Example #1
0
        /// <summary>Deserializes to an instance of GameCatalog.</summary>
        /// <param name="reader">TextReader instance.</param>
        /// <returns>GameCatalog result.</returns>
        public GameCatalog Deserialize(TextReader reader)
        {
            GameCatalog o = (GameCatalog)s.Deserialize(reader);

            reader.Close();
            return(o);
        }
Example #2
0
        private string StringSerialize(GameCatalog gamecatalog)
        {
            TextWriter w   = WriterSerialize(gamecatalog);
            string     xml = w.ToString();

            w.Close();
            return(xml);
        }
Example #3
0
        private TextWriter WriterSerialize(GameCatalog gamecatalog)
        {
            TextWriter w = new StringWriter();

            this.s = new XmlSerializer(this.type);
            s.Serialize(w, gamecatalog);
            w.Flush();
            return(w);
        }
Example #4
0
        /// <summary>Serializes to an XmlDocument.</summary>
        /// <param name="GameCatalog">GameCatalog to serialize.</param>
        /// <returns>XmlDocument instance.</returns>
        public XmlDocument Serialize(GameCatalog gamecatalog)
        {
            string      xml = StringSerialize(gamecatalog);
            XmlDocument doc = new XmlDocument();

            doc.PreserveWhitespace = true;
            doc.LoadXml(xml);
            doc = Clean(doc);
            return(doc);
        }
Example #5
0
        /// <summary>Writes config data to config file.</summary>
        /// <param name="file">Config file name.</param>
        /// <param name="config">Config object.</param>
        /// <returns></returns>
        public static bool WriteFile(string file, GameCatalog config)
        {
            bool ok = false;
            GameCatalogSerializer serializer = new GameCatalogSerializer();

            try {
                string xml = serializer.Serialize(config).OuterXml;
                using (StreamWriter writer = new StreamWriter(file, false)) {
                    writer.Write(xml);
                    writer.Flush();
                    writer.Close();
                }
                ok = true;
            } catch {}
            return(ok);
        }
Example #6
0
 // File New
 private void menuItem12_Click(object sender, System.EventArgs e)
 {
     if (dirty)
     {
         DialogResult dr = MessageBox.Show(this, "Data changed, would you like to save?", "Save", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
         if (dr == DialogResult.Yes)
         {
             menuItem10_Click(sender, e);
         }
         else if (dr == DialogResult.Cancel)
         {
             return;
         }
     }
     games    = new GameCatalog();
     filename = null;
     gamelist.Items.Clear();
 }
Example #7
0
 public Form1()
 {
     InitializeComponent();
     PaintMenu();
     games = new GameCatalog();
 }
Example #8
0
 private void OpenFile(string filename)
 {
     this.filename = filename;
     games         = GameCatalogSerializer.ReadFile(filename);
     dirty         = false;
 }
Example #9
0
 public PrintForm2(Games games) : this()
 {
     this.games       = new GameCatalog();
     this.games.Games = games;
     Init();
 }
Example #10
0
 public PrintForm2(GameCatalog gcat) : this()
 {
     this.games = gcat;
     Init();
 }
Example #11
0
 public StatsForm(GameCatalog game)
 {
     InitializeComponent();
     this.game = game;
     UpdateUI();
 }