Esempio n. 1
0
        //============================================================================
        // LastBINFile
        //============================================================================
        static public void save()
        {
            try
            {
                string filePath = AppDomain.CurrentDomain.BaseDirectory + cSettingsFileLocation;
                if (File.Exists(filePath))
                {
                    File.Delete(filePath);
                }

                XMLGlobalSettings gsXML = new XMLGlobalSettings();
                gsXML.LastBINFile       = LastBINFile;
                gsXML.LastEXEFile       = LastEXEFile;
                gsXML.LocalCodePath     = LocalCodePath;
                gsXML.PlaybackSpeed     = PlaybackSpeed;
                gsXML.MaxStackWalkDepth = MaxStackWalkDepth;

                XmlSerializer s  = new XmlSerializer(typeof(XMLGlobalSettings), new Type[] { });
                Stream        st = File.Open(filePath, FileMode.OpenOrCreate);
                s.Serialize(st, gsXML);
                st.Close();
            }
            catch (Exception e)
            {
                MessageBox.Show(e.InnerException.ToString());
            }
        }
Esempio n. 2
0
        //============================================================================
        // LastBINFile
        //============================================================================
        static public void load()
        {
            string filePath = AppDomain.CurrentDomain.BaseDirectory + cSettingsFileLocation;

            if (!File.Exists(filePath))
            {
                save();
            }

            Stream st = null;

            try
            {
                XmlSerializer s = new XmlSerializer(typeof(XMLGlobalSettings), new Type[] { });

                st = File.OpenRead(filePath);
                XMLGlobalSettings gsXML = (XMLGlobalSettings)s.Deserialize(st);
                st.Close();



                PlaybackSpeed     = gsXML.PlaybackSpeed;
                LastBINFile       = gsXML.LastBINFile;
                LastEXEFile       = gsXML.LastEXEFile;
                LocalCodePath     = gsXML.LocalCodePath;
                MaxStackWalkDepth = gsXML.MaxStackWalkDepth;
            }
            catch (Exception e)
            {
                MessageBox.Show("Error Loading " + cSettingsFileLocation + ":\n" + e.InnerException.ToString());

                if (st != null)
                {
                    st.Close();
                }

                if (File.Exists(filePath))
                {
                    File.Delete(filePath);
                }
            }
        }