private void MainForm_FormClosing(object sender, FormClosingEventArgs e) { try { if (_Map_File_Manager != null) { _Map_File_Manager.Close(); } } catch { } try { CrossReferenceDataGridView.SetupToIni(_Ini_File); CrossReferenceDataGridView.SetupToIni(_Ini_File); RemovedSymbolDataGridView.SetupToIni(_Ini_File); MaximumStackUsageDataGridView.SetupToIni(_Ini_File); StackUsageDataGridView.SetupToIni(_Ini_File); MutuallyRecursiveDataGridView.SetupToIni(_Ini_File); FunctionPointerDataGridView.SetupToIni(_Ini_File); LocalSymbolDataGridView.SetupToIni(_Ini_File); GlobalSymbolDataGridView.SetupToIni(_Ini_File); MemoryMapImageDataGridView.SetupToIni(_Ini_File); ImageComponentSizeDataGridView.SetupToIni(_Ini_File); _Ini_File.Save(_Ini_File_Name); } catch { } }
private void UpdateImageComponentSize() { ImageComponentSizeField[] data; ImageComponentSizeDataGridView.PopSelections(); ImageComponentSizeDataGridView.Rows.Clear(); data = _Map_File_Manager.ImageComponentSizeData; foreach (ImageComponentSizeField field in data) { ImageComponentSizeDataGridView.Rows.Add(field.Object_Name, field.Code, field.Inline_Data, field.Read_Only_Data, field.Read_Write_Data, field.Zero_Init_Data, field.Debug_Data); } ImageComponentSizeDataGridView.PushSelections(); }
private void MainForm_Load(object sender, EventArgs e) { OpenFileDialog dialog; string buffer; int width; int height; int id; Uri map_path; Uri current_path; current_path = new Uri(System.IO.Directory.GetCurrentDirectory() + "\\"); try { _Ini_File.Load(_Ini_File_Name); } catch { MessageBox.Show(this, "Unable to open/create " + _Ini_File_Name, "Fatal error", MessageBoxButtons.OK, MessageBoxIcon.Error); Close(); return; } CrossReferenceDataGridView.SetupFromIni(_Ini_File); RemovedSymbolDataGridView.SetupFromIni(_Ini_File); MaximumStackUsageDataGridView.SetupFromIni(_Ini_File); StackUsageDataGridView.SetupFromIni(_Ini_File); MutuallyRecursiveDataGridView.SetupFromIni(_Ini_File); FunctionPointerDataGridView.SetupFromIni(_Ini_File); LocalSymbolDataGridView.SetupFromIni(_Ini_File); GlobalSymbolDataGridView.SetupFromIni(_Ini_File); MemoryMapImageDataGridView.SetupFromIni(_Ini_File); ImageComponentSizeDataGridView.SetupFromIni(_Ini_File); current_path = new Uri(System.IO.Directory.GetCurrentDirectory() + "\\"); try { _Map_File_Name = Uri.UnescapeDataString(_Ini_File.GetKeyValue("Map", "FilePath")); if (String.IsNullOrEmpty(_Map_File_Name)) { if (String.IsNullOrEmpty(_Ini_File_Path)) { map_path = new Uri(Path.Combine(System.IO.Directory.GetCurrentDirectory() + "\\", ("Application.map"))); _Map_File_Name = map_path.LocalPath; } else { map_path = new Uri(Path.GetFullPath(Path.Combine(_Ini_File_Path + "\\", ("Application.map")))); _Map_File_Name = map_path.LocalPath; } } else { _Map_File_Name = new Uri(current_path, _Map_File_Name).LocalPath; } } catch { _Map_File_Name = ""; } if (!File.Exists(_Map_File_Name)) { dialog = new OpenFileDialog(); dialog.InitialDirectory = System.IO.Directory.GetCurrentDirectory(); dialog.Filter = "map files (*.map)|*.map"; if (dialog.ShowDialog(this) != DialogResult.OK) { Close(); return; } _Map_File_Name = dialog.FileName; } _Map_File_Manager = new MapFileManager(_Map_File_Name); try { System.IO.File.ReadAllLines(_Map_File_Name); } catch { MessageBox.Show(this, "Unable to open " + _Map_File_Name, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); Close(); return; } try { map_path = new Uri(current_path, _Map_File_Name); _Ini_File.SetKeyValue("Map", "FilePath", current_path.MakeRelativeUri(map_path).ToString()); } catch { } buffer = _Ini_File.GetKeyValue("Window", "Width"); try { width = int.Parse(buffer); } catch { width = 1000; } buffer = _Ini_File.GetKeyValue("Window", "Height"); try { height = int.Parse(buffer); } catch { height = 600; } this.Size = new System.Drawing.Size(width, height); buffer = _Ini_File.GetKeyValue("Tab", "Selected"); try { id = int.Parse(buffer); } catch { id = 0; } MainTabs.SelectedIndex = id; this.Text = App.Name + " " + App.Version + " - " + _Map_File_Name; }