private void newFile(object sender, EventArgs e) { if (!canDestroy()) { return; } using (var open = new OpenFileDialog { Title = "Open Hexagony source file", DefaultExt = "hxg", Filter = "Hexagony source (*.hxg)|*.hxg" }) { if (HCProgram.Settings.LastDirectory != null) { try { open.InitialDirectory = HCProgram.Settings.LastDirectory; } catch { } } if (open.ShowDialog() == DialogResult.Cancel) { return; } HCProgram.Settings.LastDirectory = Path.GetDirectoryName(open.FileName); _currentFilePath = null; _anyChanges = false; _file = new HCFile { HexagonySource = readHexagonyFile(open.FileName) }; rerender(); } }
private void openCore(string filePath) { if (!File.Exists(filePath)) { DlgMessage.Show("The specified file does not exist.", "Error", DlgType.Error); return; } _currentFilePath = filePath; _file = ClassifyJson.Deserialize <HCFile>(JsonValue.Parse(File.ReadAllText(_currentFilePath))); _anyChanges = false; // _lastFileTime = File.GetLastWriteTimeUtc(_currentFilePath); updateList(); rerender(); }
private void openCore(string filePath) { if (!File.Exists(filePath)) { DlgMessage.Show("The specified file does not exist.", "Error", DlgType.Error); return; } _currentFilePath = filePath; _file = ClassifyJson.Deserialize<HCFile>(JsonValue.Parse(File.ReadAllText(_currentFilePath))); _anyChanges = false; _lastFileTime = File.GetLastWriteTimeUtc(_currentFilePath); updateList(); rerender(); }
private void newFile(object sender, EventArgs e) { if (!canDestroy()) return; using (var open = new OpenFileDialog { Title = "Open Hexagony source file", DefaultExt = "hxg", Filter = "Hexagony source (*.hxg)|*.hxg" }) { if (HCProgram.Settings.LastDirectory != null) try { open.InitialDirectory = HCProgram.Settings.LastDirectory; } catch { } if (open.ShowDialog() == DialogResult.Cancel) return; HCProgram.Settings.LastDirectory = Path.GetDirectoryName(open.FileName); _currentFilePath = null; _anyChanges = false; _file = new HCFile { HexagonySource = readHexagonyFile(open.FileName) }; rerender(); } }