Exemplo n.º 1
0
        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();
            }
        }
Exemplo n.º 2
0
 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();
 }
Exemplo n.º 3
0
 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();
 }
Exemplo n.º 4
0
        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();
            }
        }