public void Setup(ContextFile CurrentFile, ContextSetting Settings, RichTextBox Target) { CFile = CurrentFile; CSettings = Settings; TextSource = Target; Ready = true; PrinterSets = new PrinterSettings(); }
public static void SaveToFile(ContextSetting that, string Name) { { using (var fn = System.IO.File.Open(Name, FileMode.Create)) { var Serial = new XmlSerializer(typeof(ContextSetting)); Serial.Serialize(fn, that); fn.Flush(); } } }
private void MainWindow_Load(object sender, EventArgs e) { BookMarks.TargetWindow = mainWindowRichText; BookMarks.Show(); if (!DisableConfigLoad) { #if DEBUG if (File.Exists(GetUserDebugConfigFileLocation())) { CurrentSettings = ContextSetting.LoadFromFile(GetUserDebugConfigFileLocation()); File.Delete(GetUserDebugConfigFileLocation()); } else { if (File.Exists(GetUserConfigFileLocation())) { CurrentSettings = ContextSetting.LoadFromFile(GetUserConfigFileLocation()); } else { CurrentSettings = new ContextSetting(); // hard coded feauled } } #else CurrentSettings = ContextSetting.LoadFromFile(GetUserConfigFileLocation()); if (File.Exists(GetUserConfigFileLocation())) { CurrentSettings = ContextSetting.LoadFromFile(GetUserConfigFileLocation()); } else { CurrentSettings = new ContextSetting(); // hard coded feauled } #endif } ImplementCurrentSettings(); }