- Main Page
- Packages
- Classes
- Files

- File List
- File Members

# D:/guillaume/guillara/3D/DXGfx/Backup/DXGfxLib/Serialization/Water2Surrogate.cs

Go to the documentation of this file.

    00001 using System;
    00002 using System.Collections.Generic;
    00003 using System.Text;
    00004 using System.Runtime.Serialization;
    00005
    00006 namespace DXGfxLib.Serialization
    00007 {
    00008     public class Water2Surrogate : ISerializationSurrogate
    00009     {
    00016         public void GetObjectData(Object obj, SerializationInfo info, StreamingContext context)
    00017         {
    00018             if (obj == null)
    00019             {
    00020                 throw new NullReferenceException("No scene object to serialize, this is wrong!");
    00021             }
    00022
    00023             Water2 water = obj as Water2;
    00024
    00025             if (water == null)
    00026             {
    00027                 throw new ArgumentException("The Object passed through obj argument is not a scene object, this is wrong!");
    00028             }
    00029
    00030             info.AddValue("FileName", water.fileName, typeof(string));
    00031         }
    00032
    00041         public Object SetObjectData(Object obj, SerializationInfo info, StreamingContext context, ISurrogateSelector selector)
    00042         {
    00043             if (obj == null)
    00044             {
    00045                 throw new NullReferenceException("No scene object to serialize, this is wrong!");
    00046             }
    00047
    00048             Water2 water = obj as Water2;
    00049
    00050             if (water == null)
    00051             {
    00052                 throw new ArgumentException("The Object passed through obj argument is not a terrain object, this is wrong!");
    00053             }
    00054
    00055             water.fileName = (string)info.GetValue("FileName", typeof(string));
    00056
    00057             return null;
    00058         }
    00059     }
    00060 }