public static SettingObj Read() { if (!System.IO.File.Exists(path)) { SettingObj tmp = new SettingObj(); tmp.Save(); return(tmp); } System.Runtime.Serialization.Json.DataContractJsonSerializer sr = new System.Runtime.Serialization.Json.DataContractJsonSerializer(typeof(SettingObj)); using (System.IO.FileStream sw = new System.IO.FileStream(path, System.IO.FileMode.Open, System.IO.FileAccess.Read)) { return((SettingObj)sr.ReadObject(sw)); } }
private void FormToSettings() { mySetting.StorageFolder = tbFolder.Text; mySetting.AllowBeep = cbBeep.Checked; mySetting.AllowStoreOnBaseFolderIfTagIsNull = cbARR.Checked; mySetting.FolderTag_News = TextBox1.Text; mySetting.FolderTag_Sports = TextBox2.Text; mySetting.FolderTag_Docum = TextBox3.Text; mySetting.FolderTag_Music = TextBox4.Text; mySetting.FolderTag_Variety = TextBox5.Text; mySetting.FolderTag_Movie = TextBox6.Text; mySetting.FolderTag_Anime = TextBox7.Text; mySetting.FolderTag_Info = TextBox8.Text; mySetting.FolderTag_Docum = TextBox9.Text; mySetting.FolderTag_Live = TextBox10.Text; mySetting.FolderTag_Edu = TextBox11.Text; mySetting.FolderTag_Other = TextBox12.Text; mySetting.EPG_ServiceAddr = textBox13.Text; mySetting.EPG_BaseFolder = textBox14.Text; mySetting.EPG_UserName = textBox15.Text; mySetting.EPG_Passwd = maskedTextBox1.Text; mySetting.Save(); }