Ejemplo n.º 1
0
        private void oDTEditorToolStripMenuItem_Click(object sender, EventArgs e)
        {
            OPToolEditor editor = new OPToolEditor(this, new byte[1], ".dat");

            editor.ShowDialog();
        }
Ejemplo n.º 2
0
        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;
            }
        }