public Translator(frmMain main) { InitializeComponent(); this.Fmain = main; if (main.file == null) { this.Close(); return; } original = main.file; }
private int getColIndex(string name, SHNFile file) { for (int i = 0; i < file.table.Columns.Count; i++) { if (file.table.Columns[i].ColumnName == name) { return(i); } } return(-1); }
private int GetRowByIndex(int ColIndex, string RowID, SHNFile file) { for (int i = 0; i < file.table.Rows.Count; i++) { if (file.table.Rows[i][ColIndex].ToString() == RowID) { return(i); } } return(-1); }
public rowTally(frmMain main) { InitializeComponent(); this.mainRT = main; if (main.file == null) { this.Close(); return; } original = main.file; }
private void btnOpen_Click(object sender, EventArgs e) { OpenFileDialog open = new OpenFileDialog(); open.Filter = "SHN File (*.shn)|*.shn"; open.Title = "Open language file"; if (!(open.ShowDialog() == DialogResult.OK)) { return; } language = new SHNFile(open.FileName); RefreshColumns(); }
void InitFile(string Filename, bool NewFile = false) { Stopwatch stopwatch = Stopwatch.StartNew(); stopwatch.Restart(); if (NewFile == false) { if (!File.Exists(Filename)) { return; } if (Path.GetFileName(Filename) == "QuestData.shn") { MessageBox.Show("Please use iQuest as this application cannot view this file."); return; } if (!(Filename.ToLower().EndsWith(".shn"))) //other file handling { SHNFile file = new SHNFile(); file.LoadMe(Filename); OPToolEditor editor = new OPToolEditor(this, file.data, Path.GetExtension(Filename)); editor.ShowDialog(); return; } } try { TabPage page; SHNFile ifile; if (NewFile == true) { ifile = new SHNFile(); ifile.CreateDefaultLayout(); page = new TabPage(Filename); } else { page = new TabPage(Path.GetFileName(Filename)); ifile = new SHNFile(Filename); } FileTabs.TabPages.Add(page); FileTabs.SelectedTab = page; DataGridView grid = new DataGridView(); page.Tag = grid; grid.Tag = ifile; /* dataGridView Properties Set Here */ grid.DataSource = ifile.table; grid.AllowUserToDeleteRows = true; grid.AllowUserToOrderColumns = true; grid.AllowUserToResizeColumns = true; grid.DoubleBuffered(true); grid.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; grid.Location = new System.Drawing.Point(6, 19); grid.Name = "grid"; grid.Size = new System.Drawing.Size(749, 470); grid.ScrollBars = ScrollBars.Both; grid.TabIndex = 1; grid.Dock = DockStyle.Fill; grid.DataError += new DataGridViewDataErrorEventHandler(grid_DataError); grid.CellClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGrid_CellClick); page.Controls.Add(grid); page.ToolTipText = Filename; this.Text = "SHN Editor - " + FileTabs.TabCount.ToString() + " file(s) open"; stopwatch.Stop(); SQLStatus.Text = "Loaded " + file.table.Columns.Count + " column(s) and " + (file.table.Rows.Count).ToString() + " row(s) in " + stopwatch.ElapsedMilliseconds + " milliseconds."; } catch (Exception e) { SQLStatus.Text = e.Message; } }