public MainWindow() { Topmost = true; InitializeComponent(); InitializeGeneralSettingsUI(); var version = Assembly.GetExecutingAssembly().GetName().Version; mainWindow.Title += $" v{version}"; AppHeaderLabel.Content += $" v{version}"; Log.Information($"Current version: {version}"); ironworksContext = IronworksContext.Instance(); ironworksSettings = IronworksSettings.Instance; Welcome(); LoadSettings(); ShowDialogueWindow(); const int period = 500; chatboxTimer = new Timer(UpdateChatbox, null, 0, period); Log.Debug($"New RefreshChatbox timer with period {period}ms"); }
private static void InitSettings() { Directory.CreateDirectory("settings"); string settingsFilePath = "./settings/settings.json"; if (File.Exists(settingsFilePath)) {// Read settings using (StreamReader reader = File.OpenText(settingsFilePath)) { var settings = reader.ReadToEnd(); var previousSettings = JsonConvert.DeserializeObject <IronworksSettings>(settings); IronworksSettings.Instance = previousSettings; Log.Debug("settings.json loaded"); } } else {// Create new one newcomer = true; var ironworksSettings = new IronworksSettings(); IronworksSettings.Instance = ironworksSettings; string settings = JsonConvert.SerializeObject(ironworksSettings, Formatting.Indented); File.WriteAllText(settingsFilePath, settings); Log.Debug("settings.json created"); } }
public DialogueWindow(MainWindow mainWindow) { Topmost = true; InitializeComponent(); ironworksContext = mainWindow.ironworksContext; ironworksSettings = mainWindow.ironworksSettings; LoadUISettings(); const int period = 500; chatboxTimer = new Timer(RefreshDialogueTextBox, null, 0, period); Log.Debug($"New RefreshChatbox timer with period {period}ms"); }