コード例 #1
0
        private void TestXml2()
        {
            GamePadInput pad = GamePadInput.GetGamePad0();

            if (pad.ButtonY.WasPressed)
            {
                doTest = 0;
            }
            if (doTest >= 0)
            {
                if (!Storage4.FileExists(BokuGame.Settings.MediaPath + @"Xml\OptionsData.Xml"))
                {
                    doTest = 0; /// This breakpoint isn't ever hit, OptionsData.xml exists here
                }
                Stream hoseStream = Storage4.OpenWrite(@"Xml\Hoser.xml");

                XmlHose hoser = new XmlHose();
                hoser.hoser = true;

                XmlSerializer serializer = new XmlSerializer(typeof(XmlHose));
                serializer.Serialize(hoseStream, hoser);

                Storage4.Close(hoseStream);
                if (!Storage4.FileExists(BokuGame.Settings.MediaPath + @"Xml\OptionsData.Xml"))
                {
                    doTest = 0; /// THis breakpoint is hit on failure, after the flush
                                /// OptionsData.xml is not longer there.
                }
                ++testsDone;
            }
        }
コード例 #2
0
        private void TestStorage()
        {
            GamePadInput pad = GamePadInput.GetGamePad0();

            if (pad.ButtonY.WasPressed)
            {
                doTest = 0;
            }
            if (doTest >= 0)
            {
                string fileName = "Test0.dat";
                if (!Storage4.FileExists(fileName))
                {
                    doTest = 0;
                }

                Stream writeStream = Storage4.OpenWrite(fileName);
                if (writeStream == null)
                {
                    doTest = 0;
                }
                byte[] writeBytes = new byte[10000];
                writeStream.Write(writeBytes, 0, writeBytes.Length);
                Storage4.Close(writeStream);

                if (!Storage4.FileExists(fileName))
                {
                    doTest = 0;
                }

                ++testsDone;
            }
        }
コード例 #3
0
        public void Serialize(string filepath)
        {
            string        pathName   = MapFolder + filepath;
            XmlSerializer serializer = new XmlSerializer(typeof(CommandMap));
            Stream        stream     = Storage4.OpenWrite(pathName);

            serializer.Serialize(stream, this);
            Storage4.Close(stream);
        }
コード例 #4
0
        public void Save()
        {
            XmlSerializer xml = new XmlSerializer(typeof(SiteOptions));

            Stream stream = Storage4.OpenWrite(MyFilename);

            xml.Serialize(stream, this);

            stream.Close();
        }
コード例 #5
0
        public void Save()
        {
            XmlSerializer xml = new XmlSerializer(typeof(SiteID));

            Stream stream = Storage4.OpenWrite(MyFilename);

            if (stream != null)
            {
                xml.Serialize(stream, this);

                stream.Close();
            }
        }
コード例 #6
0
        }   // end of HeightMap c'tor

        /// <summary>
        /// Writes the current height map to a file.
        /// </summary>
        /// <param name="filename"></param>
        public void Save(string filename)
        {
            Stream       fs = Storage4.OpenWrite(filename);
            BinaryWriter bw = new BinaryWriter(fs);

            Save(bw);

#if NETFX_CORE
            bw.Flush();
            bw.Dispose();
#else
            bw.Close();
#endif
            Storage4.Close(fs);
        }   // end of HeightMap Save()
コード例 #7
0
ファイル: Help.cs プロジェクト: Yash-Codemaster/KoduGameLab
        public static void UnloadContent()
        {
            if (instance == null)
            {
                return;
            }
#if DEBUG
            try
            {
                Stream        stream     = Storage4.OpenWrite(LocalizationResourceManager.HelpResource.Name);
                XmlSerializer serializer = new XmlSerializer(typeof(Help));
                serializer.Serialize(stream, instance);
                Storage4.Close(stream);
            }
            catch { }
#endif
        }
コード例 #8
0
        }   // end of Load()

        private static void Save()
        {
            Stream stream = null;

            try
            {
                string xmlFileName = FileName();

                XmlSerializer serializer = new XmlSerializer(typeof(XmlOptionsData));
                stream = Storage4.OpenWrite(xmlFileName);
                serializer.Serialize(stream, _instance);
            }
            catch (Exception e)
            {
                Debug.WriteLine(e.Message);
            }

            if (stream != null)
            {
                Storage4.Close(stream);
            }
        }   // end of Save()