Ejemplo n.º 1
0
Archivo: SerTest.cs Proyecto: nyet/nyet
        public static void Save(MySettings settings, string fileName)
        {
            Stream stream = null;
            try
            {
                /*
                IFormatter formatter = new BinaryFormatter();
                stream = new FileStream(fileName, FileMode.Create, FileAccess.Write, FileShare.None);
                formatter.Serialize(stream, VERSION);
                formatter.Serialize(stream, settings);
                */

                XmlSerializer x = new XmlSerializer(settings.GetType());
                stream = new FileStream(fileName, FileMode.Create, FileAccess.Write, FileShare.None);
                x.Serialize(stream, settings);
            }
            catch
            {
                // do nothing, just ignore any possible errors
            }
            finally
            {
                if (null != stream)
                    stream.Close();
            }
        }
Ejemplo n.º 2
0
Archivo: SerTest.cs Proyecto: nyet/nyet
        public static void Main()
        {
            MySettings ms = new MySettings();
            ms.screenDx = 1;

            Settings.Save(ms, "ms.txt");

            return;
        }