示例#1
0
 public static void UserDataSave(UserData data)
 {
     SerializeObject(GetAppDataFile(), data);
 }
示例#2
0
        private void mnuReadNav_Click(object sender, System.EventArgs e)
        {
            try
            {
                UserData userData = AppData.UserDataLoad();

                if (userData != null)
                {
                    openFileDialog.InitialDirectory = userData.LastNavDirectory;
                }

                openFileDialog.Filter = "Fritz Navigation Files(*.nav)|*.nav";
                openFileDialog.ShowDialog(this);

                if (openFileDialog.FileName != null && openFileDialog.FileName.Trim().Length > 0)
                {
                    if (userData == null)
                    {
                        userData = new UserData();
                    }
                    userData.LastNavDirectory = Path.GetDirectoryName(openFileDialog.FileName);
                    AppData.UserDataSave(userData);

                    _reader = new NavigationReader();
                    _reader.Read(openFileDialog.FileName);
                    _navFileName = openFileDialog.FileName;

                    this.Text = "Fritz Waypoint Tool (ET) - " + _navFileName;

                    InitializeWaypoints(true);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(this, "Unable to read .nav file. " + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
示例#3
0
        //end crapshoot
        private void OpenFile()
        {
            try
            {
                UserData userData = AppData.UserDataLoad();

                if (userData != null)
                {
                    openFile.InitialDirectory = userData.LastAIScriptDirectory;
                }

                openFile.Filter = "Fritz AIScript Files(*.aiscript)|*.aiscript";
                DialogResult result = openFile.ShowDialog(this.ParentForm);

                if (result == DialogResult.OK)
                {
                    if (openFile.FileName != null && openFile.FileName.Trim().Length > 0)
                    {
                        if (userData == null)
                        {
                            userData = new UserData();
                        }

                        //userData.LastAIScriptDirectory = Path.GetDirectoryName(openFile.FileName);
                        //gonna try to automatically open last used aiscript, so save full path -crapshoot
                        userData.LastAIScriptDirectory = Path.GetFullPath(openFile.FileName);
                        AppData.UserDataSave(userData);

                        scriptEditor.LoadFile(openFile.FileName, true);
                        _fileName = openFile.FileName;
                        ValidateScript();
                        //ValidateScript();
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(this.ParentForm, "Error opening file. " + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }