Example #1
0
 private void CopyTo(SettingsDB target)
 {
     //直接引用,但此处不产生影响。
     target.FileIndexInPath  = this.FileIndexInPath == null ? new List <string>() : this.FileIndexInPath;
     target.FileIndexOutPath = this.FileIndexOutPath == null ? new List <string>() : this.FileIndexOutPath;
     target.MP3IndexInPath   = this.MP3IndexInPath == null ? new List <string>() : this.MP3IndexInPath;
     target.MP3IndexOutPath  = this.MP3IndexOutPath == null ? new List <string>() : this.MP3IndexOutPath;
     target.FileIndexPath    = this.FileIndexPath == null ? new List <string>() : this.FileIndexPath;
     target.MP3IndexPath     = this.MP3IndexPath == null ? new List <string>() : this.MP3IndexPath;
 }
Example #2
0
 /// <summary>
 /// 写设置
 /// </summary>
 public void WriteSettings()
 {
     FileStream fs;
     BinaryFormatter bf = new BinaryFormatter();
     SettingsDB settings = new SettingsDB();
     this.CopyTo(settings);
     try
     {
         fs = new FileStream(Application.StartupPath + @"\Settings.db", FileMode.Create);
         try
         {
             bf.Serialize(fs, settings);
         }
         catch
         { }
         fs.Close();
     }
     catch
     { }
 }
Example #3
0
        /// <summary>
        /// 写设置
        /// </summary>
        public void WriteSettings()
        {
            FileStream      fs;
            BinaryFormatter bf       = new BinaryFormatter();
            SettingsDB      settings = new SettingsDB();

            this.CopyTo(settings);
            try
            {
                fs = new FileStream(Application.StartupPath + @"\Settings.db", FileMode.Create);
                try
                {
                    bf.Serialize(fs, settings);
                }
                catch
                { }
                fs.Close();
            }
            catch
            { }
        }
Example #4
0
        /// <summary>
        /// 读设置
        /// </summary>
        public void ReadSettings()
        {
            FileStream fs;
            BinaryFormatter bf = new BinaryFormatter();

            SettingsDB settings = new SettingsDB();
            try
            {
                fs = new FileStream(Application.StartupPath + @"\Settings.db", FileMode.OpenOrCreate);
                try
                {
                    settings = (SettingsDB)bf.Deserialize(fs);
                }
                catch
                { }
                fs.Close();
            }
            catch
            { }

            settings.CopyTo(this);
        }
Example #5
0
        /// <summary>
        /// 读设置
        /// </summary>
        public void ReadSettings()
        {
            FileStream      fs;
            BinaryFormatter bf = new BinaryFormatter();

            SettingsDB settings = new SettingsDB();

            try
            {
                fs = new FileStream(Application.StartupPath + @"\Settings.db", FileMode.OpenOrCreate);
                try
                {
                    settings = (SettingsDB)bf.Deserialize(fs);
                }
                catch
                { }
                fs.Close();
            }
            catch
            { }

            settings.CopyTo(this);
        }
Example #6
0
 private void CopyTo(SettingsDB target)
 {
     //直接引用,但此处不产生影响。
     target.FileIndexInPath = this.FileIndexInPath == null ? new List<string>() : this.FileIndexInPath;
     target.FileIndexOutPath = this.FileIndexOutPath == null ? new List<string>() : this.FileIndexOutPath;
     target.MP3IndexInPath = this.MP3IndexInPath == null ? new List<string>() : this.MP3IndexInPath;
     target.MP3IndexOutPath = this.MP3IndexOutPath == null ? new List<string>() : this.MP3IndexOutPath;
     target.FileIndexPath = this.FileIndexPath == null ? new List<string>() : this.FileIndexPath;
     target.MP3IndexPath = this.MP3IndexPath == null ? new List<string>() : this.MP3IndexPath;
 }