Esempio n. 1
0
        public void SaveAppSettings(string path, SDEmuSetting setting)
        {
            FileStream fileStream = null;

            try
            {
                var serializer = new BinaryFormatter();
                fileStream = new FileStream(path, FileMode.Create);
                serializer.Serialize(fileStream, setting);
            }
            catch(Exception ex)
            {
                Debug.WriteLine(string.Format("{0}\\{1}", ex.Message, ex.StackTrace));
            }
            finally
            {
                if(fileStream != null)
                    fileStream.Close();
            }
        }
Esempio n. 2
0
        public SDEmuSetting LoadAppSettings(string path)
        {
            SDEmuSetting sdEmuSetting = null;
            FileStream fileStream = null;

            try
            {
                var serializer = new BinaryFormatter();
                fileStream = new FileStream(path, FileMode.Open);
                sdEmuSetting = (SDEmuSetting) serializer.Deserialize(fileStream);
            }
            catch(Exception ex)
            {
                Debug.WriteLine(string.Format("{0}\\{1}", ex.Message, ex.StackTrace));
                sdEmuSetting = new SDEmuSetting();
            }
            finally
            {
                if(fileStream != null)
                    fileStream.Close();
            }
            return sdEmuSetting;
        }
Esempio n. 3
0
 public void LoadCurrentAppSettings()
 {
     this.SDEmuSetting = LoadAppSettings(this.CurrentAppSettingsPath);
 }