From d507b5b6015326a4c0dfc950e36e2db41ba57c02 Mon Sep 17 00:00:00 2001 From: tomvita <68505331+tomvita@users.noreply.github.com> Date: Wed, 7 Oct 2020 00:02:10 +0800 Subject: [PATCH] push bookmark export to switch via noexs --- PointerSearcher/Form1.Designer.cs | 35 +++++++++++++++++--------- PointerSearcher/Form1.cs | 41 +++++++++++++++++++++++++++++-- PointerSearcher/Form1.resx | 24 ++++++++++++++++++ 3 files changed, 87 insertions(+), 13 deletions(-) diff --git a/PointerSearcher/Form1.Designer.cs b/PointerSearcher/Form1.Designer.cs index a886cec..1f61c89 100644 --- a/PointerSearcher/Form1.Designer.cs +++ b/PointerSearcher/Form1.Designer.cs @@ -29,9 +29,9 @@ protected override void Dispose(bool disposing) private void InitializeComponent() { this.components = new System.ComponentModel.Container(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle10 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle11 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle12 = new System.Windows.Forms.DataGridViewCellStyle(); this.buttonRead = new System.Windows.Forms.Button(); this.textBox1 = new System.Windows.Forms.TextBox(); this.dataGridView1 = new System.Windows.Forms.DataGridView(); @@ -202,6 +202,7 @@ private void InitializeComponent() this.label28 = new System.Windows.Forms.Label(); this.label29 = new System.Windows.Forms.Label(); this.button8 = new System.Windows.Forms.Button(); + this.button9 = new System.Windows.Forms.Button(); ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit(); this.tabControl1.SuspendLayout(); this.tabPage1.SuspendLayout(); @@ -257,8 +258,8 @@ private void InitializeComponent() this.ColumnTargetAddress3}); this.dataGridView1.Location = new System.Drawing.Point(6, 6); this.dataGridView1.Name = "dataGridView1"; - dataGridViewCellStyle1.NullValue = null; - this.dataGridView1.RowsDefaultCellStyle = dataGridViewCellStyle1; + dataGridViewCellStyle10.NullValue = null; + this.dataGridView1.RowsDefaultCellStyle = dataGridViewCellStyle10; this.dataGridView1.RowTemplate.Height = 21; this.dataGridView1.Size = new System.Drawing.Size(1094, 163); this.dataGridView1.TabIndex = 2; @@ -662,6 +663,7 @@ private void InitializeComponent() // // tabPage1 // + this.tabPage1.Controls.Add(this.button9); this.tabPage1.Controls.Add(this.dataGridView4); this.tabPage1.Controls.Add(this.getbookmarkbutton); this.tabPage1.Controls.Add(this.groupBox2); @@ -862,17 +864,17 @@ private void InitializeComponent() // fromDataGridViewTextBoxColumn // this.fromDataGridViewTextBoxColumn.DataPropertyName = "From"; - dataGridViewCellStyle2.Format = "X10"; - dataGridViewCellStyle2.NullValue = null; - this.fromDataGridViewTextBoxColumn.DefaultCellStyle = dataGridViewCellStyle2; + dataGridViewCellStyle11.Format = "X10"; + dataGridViewCellStyle11.NullValue = null; + this.fromDataGridViewTextBoxColumn.DefaultCellStyle = dataGridViewCellStyle11; this.fromDataGridViewTextBoxColumn.HeaderText = "From"; this.fromDataGridViewTextBoxColumn.Name = "fromDataGridViewTextBoxColumn"; // // toDataGridViewTextBoxColumn // this.toDataGridViewTextBoxColumn.DataPropertyName = "To"; - dataGridViewCellStyle3.Format = "X10"; - this.toDataGridViewTextBoxColumn.DefaultCellStyle = dataGridViewCellStyle3; + dataGridViewCellStyle12.Format = "X10"; + this.toDataGridViewTextBoxColumn.DefaultCellStyle = dataGridViewCellStyle12; this.toDataGridViewTextBoxColumn.HeaderText = "To"; this.toDataGridViewTextBoxColumn.Name = "toDataGridViewTextBoxColumn"; // @@ -1728,6 +1730,16 @@ private void InitializeComponent() this.button8.UseVisualStyleBackColor = true; this.button8.Click += new System.EventHandler(this.button8_Click_1); // + // button9 + // + this.button9.Location = new System.Drawing.Point(769, 408); + this.button9.Name = "button9"; + this.button9.Size = new System.Drawing.Size(169, 23); + this.button9.TabIndex = 86; + this.button9.Text = "Push Export to EdiZon SE"; + this.button9.UseVisualStyleBackColor = true; + this.button9.Click += new System.EventHandler(this.button9_Click); + // // Form1 // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -1786,7 +1798,7 @@ private void InitializeComponent() this.Controls.Add(this.label7); this.Controls.Add(this.pictureBox2); this.Name = "Form1"; - this.Text = "PointerSearcher SE 0.5.3"; + this.Text = "PointerSearcher SE 0.5.4"; this.Load += new System.EventHandler(this.Form1_Load); ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit(); this.tabControl1.ResumeLayout(false); @@ -1987,6 +1999,7 @@ private void InitializeComponent() private System.Windows.Forms.Label label28; private System.Windows.Forms.Label label29; private System.Windows.Forms.Button button8; + private System.Windows.Forms.Button button9; } } diff --git a/PointerSearcher/Form1.cs b/PointerSearcher/Form1.cs index 3943035..39309cb 100644 --- a/PointerSearcher/Form1.cs +++ b/PointerSearcher/Form1.cs @@ -59,7 +59,7 @@ private async void buttonRead_Click(object sender, EventArgs e) buttonRead.Enabled = false; - IDumpDataReader reader = CreateDumpDataReader(dataGridView1.Rows[0], false); + IDumpDataReader reader = CreateDumpDataReader(dataGridView1.Rows[fileselect], false); if (reader == null) { throw new Exception("Invalid input" + Environment.NewLine + "Check highlighted cell"); @@ -295,8 +295,9 @@ private async void buttonNarrowDown_Click(object sender, EventArgs e) { SetProgressBar(0); Dictionary dumps = new Dictionary(); - for (int i = 1; i < dataGridView1.Rows.Count; i++) + for (int i = 0; i < dataGridView1.Rows.Count; i++) { + if (i == fileselect) continue; DataGridViewRow row = dataGridView1.Rows[i]; ClearRowBackColor(row); if (IsBlankRow(row)) @@ -1650,5 +1651,41 @@ private void button8_Click_1(object sender, EventArgs e) catch { textBox10.Text = "err"; }; textBox8_TextChanged_1(sender, e); } + + private void button9_Click(object sender, EventArgs e) + { + button9.BackColor = System.Drawing.Color.White; + if (textBox2.Text == "") { MessageBox.Show("bookmark filename missing"); return; }; + String filepath = textBox2.Text; + BinaryReader BM; + try + { + BM = new BinaryReader(new FileStream(filepath, FileMode.Open, FileAccess.Read)); + BM.BaseStream.Seek(0, SeekOrigin.Begin); + int readSize = (int)(BM.BaseStream.Length); + byte[] buff; + buff = BM.ReadBytes(readSize); + + if (!command_available()) return; + byte[] msg = { 0x1C }; //_putbookmark + int a = s.Send(msg); + while (s.Available < 4) ; + byte[] b = new byte[s.Available]; + s.Receive(b); + if (!showerror(b)) + { + byte[] fsize = BitConverter.GetBytes(readSize); + s.Send(fsize); + s.Send(buff); + while (s.Available < 4) ; + b = new byte[s.Available]; + s.Receive(b); + if (!showerror(b)) + { button9.BackColor = System.Drawing.Color.LightGreen; } + } else { MessageBox.Show("Remote file not accessible"); } + BM.BaseStream.Close(); + } + catch (IOException) { textBox1.Text = "Cannot Read file"; } + } } } diff --git a/PointerSearcher/Form1.resx b/PointerSearcher/Form1.resx index b5dd8de..3b82f9b 100644 --- a/PointerSearcher/Form1.resx +++ b/PointerSearcher/Form1.resx @@ -144,6 +144,12 @@ True + + True + + + 17, 17 + 17, 17 @@ -156,6 +162,21 @@ True + + True + + + True + + + True + + + True + + + True + True @@ -165,6 +186,9 @@ 116, 17 + + 116, 17 + 204, 17