Make structural changes to repository
Modernizes the repository
This commit is contained in:
parent
a67593b58f
commit
7f7f8970bc
412 changed files with 72437 additions and 155552 deletions
437
source/BugReport/BugReportForm.Designer.cs
generated
Normal file
437
source/BugReport/BugReportForm.Designer.cs
generated
Normal file
|
@ -0,0 +1,437 @@
|
|||
namespace LSLEditor.BugReport
|
||||
{
|
||||
partial class BugReportForm
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.components = new System.ComponentModel.Container();
|
||||
this.groupBox1 = new System.Windows.Forms.GroupBox();
|
||||
this.textBox3 = new System.Windows.Forms.TextBox();
|
||||
this.panel2 = new System.Windows.Forms.Panel();
|
||||
this.button4 = new System.Windows.Forms.Button();
|
||||
this.label6 = new System.Windows.Forms.Label();
|
||||
this.label5 = new System.Windows.Forms.Label();
|
||||
this.label4 = new System.Windows.Forms.Label();
|
||||
this.label3 = new System.Windows.Forms.Label();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.textBox1 = new System.Windows.Forms.TextBox();
|
||||
this.listView1 = new System.Windows.Forms.ListView();
|
||||
this.textBox2 = new System.Windows.Forms.TextBox();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.tabControl1 = new System.Windows.Forms.TabControl();
|
||||
this.tabPage1 = new System.Windows.Forms.TabPage();
|
||||
this.panel1 = new System.Windows.Forms.Panel();
|
||||
this.button3 = new System.Windows.Forms.Button();
|
||||
this.progressBar1 = new System.Windows.Forms.ProgressBar();
|
||||
this.button2 = new System.Windows.Forms.Button();
|
||||
this.button1 = new System.Windows.Forms.Button();
|
||||
this.tabPage2 = new System.Windows.Forms.TabPage();
|
||||
this.textBox5 = new System.Windows.Forms.TextBox();
|
||||
this.splitter2 = new System.Windows.Forms.Splitter();
|
||||
this.textBox4 = new System.Windows.Forms.TextBox();
|
||||
this.splitter1 = new System.Windows.Forms.Splitter();
|
||||
this.listView2 = new System.Windows.Forms.ListView();
|
||||
this.columnHeader1 = new System.Windows.Forms.ColumnHeader();
|
||||
this.columnHeader2 = new System.Windows.Forms.ColumnHeader();
|
||||
this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components);
|
||||
this.deleteToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.timer1 = new System.Windows.Forms.Timer(this.components);
|
||||
this.groupBox1.SuspendLayout();
|
||||
this.panel2.SuspendLayout();
|
||||
this.tabControl1.SuspendLayout();
|
||||
this.tabPage1.SuspendLayout();
|
||||
this.panel1.SuspendLayout();
|
||||
this.tabPage2.SuspendLayout();
|
||||
this.contextMenuStrip1.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// groupBox1
|
||||
//
|
||||
this.groupBox1.Controls.Add(this.textBox3);
|
||||
this.groupBox1.Controls.Add(this.panel2);
|
||||
this.groupBox1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.groupBox1.Location = new System.Drawing.Point(3, 3);
|
||||
this.groupBox1.Name = "groupBox1";
|
||||
this.groupBox1.Padding = new System.Windows.Forms.Padding(8);
|
||||
this.groupBox1.Size = new System.Drawing.Size(712, 330);
|
||||
this.groupBox1.TabIndex = 0;
|
||||
this.groupBox1.TabStop = false;
|
||||
this.groupBox1.Text = "report";
|
||||
//
|
||||
// textBox3
|
||||
//
|
||||
this.textBox3.AcceptsReturn = true;
|
||||
this.textBox3.AcceptsTab = true;
|
||||
this.textBox3.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.textBox3.Location = new System.Drawing.Point(8, 160);
|
||||
this.textBox3.Multiline = true;
|
||||
this.textBox3.Name = "textBox3";
|
||||
this.textBox3.ScrollBars = System.Windows.Forms.ScrollBars.Both;
|
||||
this.textBox3.Size = new System.Drawing.Size(696, 162);
|
||||
this.textBox3.TabIndex = 4;
|
||||
//
|
||||
// panel2
|
||||
//
|
||||
this.panel2.Controls.Add(this.button4);
|
||||
this.panel2.Controls.Add(this.label6);
|
||||
this.panel2.Controls.Add(this.label5);
|
||||
this.panel2.Controls.Add(this.label4);
|
||||
this.panel2.Controls.Add(this.label3);
|
||||
this.panel2.Controls.Add(this.label1);
|
||||
this.panel2.Controls.Add(this.textBox1);
|
||||
this.panel2.Controls.Add(this.listView1);
|
||||
this.panel2.Controls.Add(this.textBox2);
|
||||
this.panel2.Controls.Add(this.label2);
|
||||
this.panel2.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.panel2.Location = new System.Drawing.Point(8, 21);
|
||||
this.panel2.Name = "panel2";
|
||||
this.panel2.Size = new System.Drawing.Size(696, 139);
|
||||
this.panel2.TabIndex = 6;
|
||||
//
|
||||
// button4
|
||||
//
|
||||
this.button4.Location = new System.Drawing.Point(312, 112);
|
||||
this.button4.Name = "button4";
|
||||
this.button4.Size = new System.Drawing.Size(75, 24);
|
||||
this.button4.TabIndex = 9;
|
||||
this.button4.Text = "check all";
|
||||
this.button4.UseVisualStyleBackColor = true;
|
||||
this.button4.Click += new System.EventHandler(this.button4_Click);
|
||||
//
|
||||
// label6
|
||||
//
|
||||
this.label6.AutoSize = true;
|
||||
this.label6.Location = new System.Drawing.Point(0, 80);
|
||||
this.label6.Name = "label6";
|
||||
this.label6.Size = new System.Drawing.Size(191, 13);
|
||||
this.label6.TabIndex = 8;
|
||||
this.label6.Text = "and will not be made public in any way!";
|
||||
//
|
||||
// label5
|
||||
//
|
||||
this.label5.AutoSize = true;
|
||||
this.label5.Location = new System.Drawing.Point(0, 64);
|
||||
this.label5.Name = "label5";
|
||||
this.label5.Size = new System.Drawing.Size(217, 13);
|
||||
this.label5.TabIndex = 7;
|
||||
this.label5.Text = "Uploaded files will only be used for bugfixing,";
|
||||
//
|
||||
// label4
|
||||
//
|
||||
this.label4.AutoSize = true;
|
||||
this.label4.Location = new System.Drawing.Point(208, 8);
|
||||
this.label4.Name = "label4";
|
||||
this.label4.Size = new System.Drawing.Size(98, 13);
|
||||
this.label4.TabIndex = 6;
|
||||
this.label4.Text = "Files to be included";
|
||||
//
|
||||
// label3
|
||||
//
|
||||
this.label3.AutoSize = true;
|
||||
this.label3.Location = new System.Drawing.Point(0, 104);
|
||||
this.label3.Name = "label3";
|
||||
this.label3.Size = new System.Drawing.Size(130, 13);
|
||||
this.label3.TabIndex = 5;
|
||||
this.label3.Text = "Description of the problem";
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(0, 8);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(35, 13);
|
||||
this.label1.TabIndex = 2;
|
||||
this.label1.Text = "Name";
|
||||
//
|
||||
// textBox1
|
||||
//
|
||||
this.textBox1.Location = new System.Drawing.Point(40, 8);
|
||||
this.textBox1.Name = "textBox1";
|
||||
this.textBox1.Size = new System.Drawing.Size(168, 20);
|
||||
this.textBox1.TabIndex = 1;
|
||||
//
|
||||
// listView1
|
||||
//
|
||||
this.listView1.CheckBoxes = true;
|
||||
this.listView1.Location = new System.Drawing.Point(312, 8);
|
||||
this.listView1.Name = "listView1";
|
||||
this.listView1.Size = new System.Drawing.Size(248, 104);
|
||||
this.listView1.TabIndex = 3;
|
||||
this.listView1.UseCompatibleStateImageBehavior = false;
|
||||
this.listView1.View = System.Windows.Forms.View.Details;
|
||||
//
|
||||
// textBox2
|
||||
//
|
||||
this.textBox2.Location = new System.Drawing.Point(40, 40);
|
||||
this.textBox2.Name = "textBox2";
|
||||
this.textBox2.Size = new System.Drawing.Size(168, 20);
|
||||
this.textBox2.TabIndex = 2;
|
||||
//
|
||||
// label2
|
||||
//
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Location = new System.Drawing.Point(0, 40);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(32, 13);
|
||||
this.label2.TabIndex = 3;
|
||||
this.label2.Text = "Email";
|
||||
//
|
||||
// tabControl1
|
||||
//
|
||||
this.tabControl1.Controls.Add(this.tabPage1);
|
||||
this.tabControl1.Controls.Add(this.tabPage2);
|
||||
this.tabControl1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.tabControl1.Location = new System.Drawing.Point(8, 8);
|
||||
this.tabControl1.Name = "tabControl1";
|
||||
this.tabControl1.SelectedIndex = 0;
|
||||
this.tabControl1.Size = new System.Drawing.Size(726, 402);
|
||||
this.tabControl1.TabIndex = 0;
|
||||
//
|
||||
// tabPage1
|
||||
//
|
||||
this.tabPage1.Controls.Add(this.groupBox1);
|
||||
this.tabPage1.Controls.Add(this.panel1);
|
||||
this.tabPage1.Location = new System.Drawing.Point(4, 22);
|
||||
this.tabPage1.Name = "tabPage1";
|
||||
this.tabPage1.Padding = new System.Windows.Forms.Padding(3);
|
||||
this.tabPage1.Size = new System.Drawing.Size(718, 376);
|
||||
this.tabPage1.TabIndex = 0;
|
||||
this.tabPage1.Text = "New bug report";
|
||||
this.tabPage1.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// panel1
|
||||
//
|
||||
this.panel1.Controls.Add(this.button3);
|
||||
this.panel1.Controls.Add(this.progressBar1);
|
||||
this.panel1.Controls.Add(this.button2);
|
||||
this.panel1.Controls.Add(this.button1);
|
||||
this.panel1.Dock = System.Windows.Forms.DockStyle.Bottom;
|
||||
this.panel1.Location = new System.Drawing.Point(3, 333);
|
||||
this.panel1.Name = "panel1";
|
||||
this.panel1.Size = new System.Drawing.Size(712, 40);
|
||||
this.panel1.TabIndex = 0;
|
||||
//
|
||||
// button3
|
||||
//
|
||||
this.button3.Location = new System.Drawing.Point(504, 8);
|
||||
this.button3.Name = "button3";
|
||||
this.button3.Size = new System.Drawing.Size(75, 23);
|
||||
this.button3.TabIndex = 7;
|
||||
this.button3.Text = "Close";
|
||||
this.button3.UseVisualStyleBackColor = true;
|
||||
this.button3.Click += new System.EventHandler(this.button3_Click);
|
||||
//
|
||||
// progressBar1
|
||||
//
|
||||
this.progressBar1.Location = new System.Drawing.Point(8, 8);
|
||||
this.progressBar1.Name = "progressBar1";
|
||||
this.progressBar1.Size = new System.Drawing.Size(280, 23);
|
||||
this.progressBar1.TabIndex = 0;
|
||||
//
|
||||
// button2
|
||||
//
|
||||
this.button2.Enabled = false;
|
||||
this.button2.Location = new System.Drawing.Point(416, 8);
|
||||
this.button2.Name = "button2";
|
||||
this.button2.Size = new System.Drawing.Size(75, 23);
|
||||
this.button2.TabIndex = 6;
|
||||
this.button2.Text = "Cancel";
|
||||
this.button2.UseVisualStyleBackColor = true;
|
||||
this.button2.Click += new System.EventHandler(this.button2_Click);
|
||||
//
|
||||
// button1
|
||||
//
|
||||
this.button1.Location = new System.Drawing.Point(296, 8);
|
||||
this.button1.Name = "button1";
|
||||
this.button1.Size = new System.Drawing.Size(112, 23);
|
||||
this.button1.TabIndex = 5;
|
||||
this.button1.Text = "Send bug report";
|
||||
this.button1.UseVisualStyleBackColor = true;
|
||||
this.button1.Click += new System.EventHandler(this.button1_Click);
|
||||
//
|
||||
// tabPage2
|
||||
//
|
||||
this.tabPage2.Controls.Add(this.textBox5);
|
||||
this.tabPage2.Controls.Add(this.splitter2);
|
||||
this.tabPage2.Controls.Add(this.textBox4);
|
||||
this.tabPage2.Controls.Add(this.splitter1);
|
||||
this.tabPage2.Controls.Add(this.listView2);
|
||||
this.tabPage2.Location = new System.Drawing.Point(4, 22);
|
||||
this.tabPage2.Name = "tabPage2";
|
||||
this.tabPage2.Padding = new System.Windows.Forms.Padding(3);
|
||||
this.tabPage2.Size = new System.Drawing.Size(718, 376);
|
||||
this.tabPage2.TabIndex = 1;
|
||||
this.tabPage2.Text = "Bug tracker";
|
||||
this.tabPage2.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// textBox5
|
||||
//
|
||||
this.textBox5.AcceptsReturn = true;
|
||||
this.textBox5.AcceptsTab = true;
|
||||
this.textBox5.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.textBox5.Location = new System.Drawing.Point(267, 131);
|
||||
this.textBox5.Multiline = true;
|
||||
this.textBox5.Name = "textBox5";
|
||||
this.textBox5.ReadOnly = true;
|
||||
this.textBox5.ScrollBars = System.Windows.Forms.ScrollBars.Both;
|
||||
this.textBox5.Size = new System.Drawing.Size(448, 242);
|
||||
this.textBox5.TabIndex = 10;
|
||||
//
|
||||
// splitter2
|
||||
//
|
||||
this.splitter2.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.splitter2.Location = new System.Drawing.Point(267, 128);
|
||||
this.splitter2.Name = "splitter2";
|
||||
this.splitter2.Size = new System.Drawing.Size(448, 3);
|
||||
this.splitter2.TabIndex = 3;
|
||||
this.splitter2.TabStop = false;
|
||||
//
|
||||
// textBox4
|
||||
//
|
||||
this.textBox4.AcceptsReturn = true;
|
||||
this.textBox4.AcceptsTab = true;
|
||||
this.textBox4.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.textBox4.Location = new System.Drawing.Point(267, 3);
|
||||
this.textBox4.Multiline = true;
|
||||
this.textBox4.Name = "textBox4";
|
||||
this.textBox4.ReadOnly = true;
|
||||
this.textBox4.ScrollBars = System.Windows.Forms.ScrollBars.Both;
|
||||
this.textBox4.Size = new System.Drawing.Size(448, 125);
|
||||
this.textBox4.TabIndex = 9;
|
||||
//
|
||||
// splitter1
|
||||
//
|
||||
this.splitter1.Location = new System.Drawing.Point(264, 3);
|
||||
this.splitter1.Name = "splitter1";
|
||||
this.splitter1.Size = new System.Drawing.Size(3, 370);
|
||||
this.splitter1.TabIndex = 1;
|
||||
this.splitter1.TabStop = false;
|
||||
//
|
||||
// listView2
|
||||
//
|
||||
this.listView2.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
|
||||
this.columnHeader1,
|
||||
this.columnHeader2});
|
||||
this.listView2.ContextMenuStrip = this.contextMenuStrip1;
|
||||
this.listView2.Dock = System.Windows.Forms.DockStyle.Left;
|
||||
this.listView2.FullRowSelect = true;
|
||||
this.listView2.HideSelection = false;
|
||||
this.listView2.Location = new System.Drawing.Point(3, 3);
|
||||
this.listView2.Name = "listView2";
|
||||
this.listView2.Size = new System.Drawing.Size(261, 370);
|
||||
this.listView2.TabIndex = 8;
|
||||
this.listView2.UseCompatibleStateImageBehavior = false;
|
||||
this.listView2.View = System.Windows.Forms.View.Details;
|
||||
this.listView2.SelectedIndexChanged += new System.EventHandler(this.listView2_SelectedIndexChanged);
|
||||
//
|
||||
// columnHeader1
|
||||
//
|
||||
this.columnHeader1.Text = "Number";
|
||||
this.columnHeader1.Width = 85;
|
||||
//
|
||||
// columnHeader2
|
||||
//
|
||||
this.columnHeader2.Text = "Date/Time";
|
||||
this.columnHeader2.Width = 145;
|
||||
//
|
||||
// contextMenuStrip1
|
||||
//
|
||||
this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.deleteToolStripMenuItem});
|
||||
this.contextMenuStrip1.Name = "contextMenuStrip1";
|
||||
this.contextMenuStrip1.Size = new System.Drawing.Size(117, 26);
|
||||
//
|
||||
// deleteToolStripMenuItem
|
||||
//
|
||||
this.deleteToolStripMenuItem.Name = "deleteToolStripMenuItem";
|
||||
this.deleteToolStripMenuItem.Size = new System.Drawing.Size(116, 22);
|
||||
this.deleteToolStripMenuItem.Text = "Delete";
|
||||
this.deleteToolStripMenuItem.Click += new System.EventHandler(this.deleteToolStripMenuItem_Click);
|
||||
//
|
||||
// timer1
|
||||
//
|
||||
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
|
||||
//
|
||||
// BugReportForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(742, 418);
|
||||
this.Controls.Add(this.tabControl1);
|
||||
this.Name = "BugReportForm";
|
||||
this.Padding = new System.Windows.Forms.Padding(8);
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||
this.Text = "LSLEditor bug report";
|
||||
this.groupBox1.ResumeLayout(false);
|
||||
this.groupBox1.PerformLayout();
|
||||
this.panel2.ResumeLayout(false);
|
||||
this.panel2.PerformLayout();
|
||||
this.tabControl1.ResumeLayout(false);
|
||||
this.tabPage1.ResumeLayout(false);
|
||||
this.panel1.ResumeLayout(false);
|
||||
this.tabPage2.ResumeLayout(false);
|
||||
this.tabPage2.PerformLayout();
|
||||
this.contextMenuStrip1.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.GroupBox groupBox1;
|
||||
private System.Windows.Forms.ListView listView1;
|
||||
private System.Windows.Forms.Label label2;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.TextBox textBox2;
|
||||
private System.Windows.Forms.TextBox textBox1;
|
||||
private System.Windows.Forms.TextBox textBox3;
|
||||
private System.Windows.Forms.Panel panel2;
|
||||
private System.Windows.Forms.Label label4;
|
||||
private System.Windows.Forms.Label label3;
|
||||
private System.Windows.Forms.Label label5;
|
||||
private System.Windows.Forms.Label label6;
|
||||
private System.Windows.Forms.TabControl tabControl1;
|
||||
private System.Windows.Forms.TabPage tabPage1;
|
||||
private System.Windows.Forms.Panel panel1;
|
||||
private System.Windows.Forms.ProgressBar progressBar1;
|
||||
private System.Windows.Forms.Button button2;
|
||||
private System.Windows.Forms.Button button1;
|
||||
private System.Windows.Forms.TabPage tabPage2;
|
||||
private System.Windows.Forms.TextBox textBox5;
|
||||
private System.Windows.Forms.Splitter splitter2;
|
||||
private System.Windows.Forms.TextBox textBox4;
|
||||
private System.Windows.Forms.Splitter splitter1;
|
||||
private System.Windows.Forms.ListView listView2;
|
||||
private System.Windows.Forms.ColumnHeader columnHeader1;
|
||||
private System.Windows.Forms.Timer timer1;
|
||||
private System.Windows.Forms.ContextMenuStrip contextMenuStrip1;
|
||||
private System.Windows.Forms.ToolStripMenuItem deleteToolStripMenuItem;
|
||||
private System.Windows.Forms.Button button3;
|
||||
private System.Windows.Forms.Button button4;
|
||||
private System.Windows.Forms.ColumnHeader columnHeader2;
|
||||
}
|
||||
}
|
294
source/BugReport/BugReportForm.cs
Normal file
294
source/BugReport/BugReportForm.cs
Normal file
|
@ -0,0 +1,294 @@
|
|||
// <copyright file="gpl-2.0.txt">
|
||||
// ORIGINAL CODE BASE IS Copyright (C) 2006-2010 by Alphons van der Heijden.
|
||||
// The code was donated on 2010-04-28 by Alphons van der Heijden to Brandon 'Dimentox Travanti' Husbands &
|
||||
// Malcolm J. Kudra, who in turn License under the GPLv2 in agreement with Alphons van der Heijden's wishes.
|
||||
//
|
||||
// The community would like to thank Alphons for all of his hard work, blood sweat and tears. Without his work
|
||||
// the community would be stuck with crappy editors.
|
||||
//
|
||||
// The source code in this file ("Source Code") is provided by The LSLEditor Group to you under the terms of the GNU
|
||||
// General Public License, version 2.0 ("GPL"), unless you have obtained a separate licensing agreement ("Other
|
||||
// License"), formally executed by you and The LSLEditor Group.
|
||||
// Terms of the GPL can be found in the gplv2.txt document.
|
||||
//
|
||||
// GPLv2 Header
|
||||
// ************
|
||||
// LSLEditor, a External editor for the LSL Language.
|
||||
// Copyright (C) 2010 The LSLEditor Group.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
|
||||
// License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any
|
||||
// later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
|
||||
// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
// details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
|
||||
// Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
// ********************************************************************************************************************
|
||||
// The above copyright notice and this permission notice shall be included in copies or substantial portions of the
|
||||
// Software.
|
||||
// ********************************************************************************************************************
|
||||
// </copyright>
|
||||
//
|
||||
// <summary>
|
||||
// BugReportForm.cs
|
||||
//
|
||||
// </summary>
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using System.Reflection;
|
||||
|
||||
using LSLEditor.org.lsleditor.www;
|
||||
|
||||
|
||||
namespace LSLEditor.BugReport
|
||||
{
|
||||
public partial class BugReportForm : Form
|
||||
{
|
||||
private bool blnComplete;
|
||||
private UploadBugReport ubr;
|
||||
|
||||
private LSLEditorForm parent;
|
||||
|
||||
public BugReportForm(LSLEditorForm parent)
|
||||
{
|
||||
InitializeComponent();
|
||||
this.parent = parent;
|
||||
this.Icon = parent.Icon;
|
||||
this.textBox1.Text = Properties.Settings.Default.AvatarName;
|
||||
this.textBox2.Text = Properties.Settings.Default.EmailAddress;
|
||||
this.listView1.Columns.Add("ScriptName",this.listView1.Width-30);
|
||||
foreach (Form form in parent.Children)
|
||||
{
|
||||
EditForm editForm = form as EditForm;
|
||||
if (editForm == null || editForm.IsDisposed)
|
||||
continue;
|
||||
ListViewItem lvi = new ListViewItem(editForm.ScriptName);
|
||||
lvi.Checked = false;
|
||||
this.listView1.Items.Add(lvi);
|
||||
}
|
||||
ShowBugReportsList();
|
||||
}
|
||||
|
||||
private void ShowBugReportsList()
|
||||
{
|
||||
if (Properties.Settings.Default.Bugreports == null)
|
||||
return;
|
||||
this.listView2.Items.Clear();
|
||||
foreach (string Handle in Properties.Settings.Default.Bugreports)
|
||||
{
|
||||
long result;
|
||||
if (!long.TryParse(Handle, out result))
|
||||
continue;
|
||||
result *= (long)1e7;
|
||||
DateTime dateTime = new DateTime(result);
|
||||
ListViewItem lvi = new ListViewItem(Handle);
|
||||
lvi.SubItems.Add(dateTime.ToString());
|
||||
lvi.Tag = Handle;
|
||||
this.listView2.Items.Add(lvi);
|
||||
}
|
||||
}
|
||||
|
||||
//close
|
||||
private void button3_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.timer1.Stop();
|
||||
if (ubr != null)
|
||||
ubr.Stop();
|
||||
this.Close();
|
||||
}
|
||||
|
||||
// cancel
|
||||
private void button2_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.button2.Enabled = false;
|
||||
this.timer1.Stop();
|
||||
this.progressBar1.Value = 0;
|
||||
if (ubr != null)
|
||||
ubr.Stop();
|
||||
this.button1.Enabled = true;
|
||||
}
|
||||
|
||||
private void button1_Click(object sender, EventArgs e)
|
||||
{
|
||||
string strMessage = this.textBox3.Text.Trim();
|
||||
if (strMessage == "")
|
||||
{
|
||||
MessageBox.Show("The bug report is empty(?!), it is not send!", "Bug report", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
return;
|
||||
}
|
||||
ubr = new UploadBugReport();
|
||||
this.button1.Enabled = false;
|
||||
this.button2.Enabled = true;
|
||||
this.blnComplete = false;
|
||||
this.timer1.Start();
|
||||
ubr.OnComplete += new UploadBugReport.UploadCompleteHandler(ubr_OnComplete);
|
||||
List<UploadBugReport.FileToUpload> list = new List<UploadBugReport.FileToUpload>();
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
Properties.Settings.Default.AvatarName = this.textBox1.Text;
|
||||
Properties.Settings.Default.EmailAddress = this.textBox2.Text;
|
||||
|
||||
sb.AppendFormat("Version: {0} {1}\r\n",
|
||||
this.parent.Text,
|
||||
Assembly.GetExecutingAssembly().GetName().Version.ToString());
|
||||
sb.AppendFormat("Name: {0}\r\n", this.textBox1.Text);
|
||||
sb.AppendFormat("Email: {0}\r\n\r\n", this.textBox2.Text);
|
||||
sb.Append(this.textBox3.Text);
|
||||
list.Add(new UploadBugReport.FileToUpload("bugreport.txt", sb.ToString()));
|
||||
foreach (ListViewItem lvi in this.listView1.Items)
|
||||
{
|
||||
if (!lvi.Checked)
|
||||
continue;
|
||||
string strScriptName = lvi.Text;
|
||||
string strBody = null;
|
||||
foreach (Form form in parent.Children)
|
||||
{
|
||||
EditForm editForm = form as EditForm;
|
||||
if (editForm == null || editForm.IsDisposed)
|
||||
continue;
|
||||
if (editForm.ScriptName == strScriptName)
|
||||
strBody = editForm.SourceCode;
|
||||
}
|
||||
if(strBody != null)
|
||||
list.Add(new UploadBugReport.FileToUpload(strScriptName, strBody));
|
||||
}
|
||||
ubr.UploadAsync(list, this.progressBar1);
|
||||
}
|
||||
|
||||
void ubr_OnComplete(object sender, UploadBugReport.UploadCompleteEventArgs e)
|
||||
{
|
||||
if(e.TotalBytes == -1)
|
||||
MessageBox.Show("There is something wrong. Your bug report has not been sent!!", "Oops...", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
else
|
||||
MessageBox.Show("Your bug report has been sent (" + e.TotalBytes + " bytes)", "Ready", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
this.blnComplete = true;
|
||||
}
|
||||
|
||||
private void timer1_Tick(object sender, EventArgs e)
|
||||
{
|
||||
if (this.blnComplete)
|
||||
{
|
||||
this.timer1.Stop();
|
||||
|
||||
this.button1.Enabled = true;
|
||||
this.button2.Enabled = false;
|
||||
|
||||
this.progressBar1.Value = 0;
|
||||
this.textBox3.Clear();
|
||||
ShowBugReportsList();
|
||||
this.tabControl1.SelectedIndex = 1;
|
||||
}
|
||||
|
||||
if (ubr != null)
|
||||
{
|
||||
if (!ubr.blnRunning)
|
||||
{
|
||||
this.button1.Enabled = true;
|
||||
this.timer1.Stop();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void listView2_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (this.listView2.SelectedItems.Count == 0)
|
||||
return;
|
||||
ListViewItem lvi = this.listView2.SelectedItems[0];
|
||||
string Handle = lvi.Tag.ToString();
|
||||
|
||||
Service1 service1 = new Service1();
|
||||
service1.GetStatusCompleted += new GetStatusCompletedEventHandler(service1_GetStatusCompleted);
|
||||
service1.GetStatusAsync(Handle, Handle);
|
||||
}
|
||||
|
||||
void service1_GetStatusCompleted(object sender, GetStatusCompletedEventArgs e)
|
||||
{
|
||||
this.textBox5.Clear();
|
||||
string Handle = e.UserState.ToString();
|
||||
if (e.Error != null)
|
||||
{
|
||||
this.textBox4.Text = "Bug report [" + Handle + "] not available (at this time)";
|
||||
return;
|
||||
}
|
||||
|
||||
string strResult = e.Result;
|
||||
if (strResult == null)
|
||||
{
|
||||
this.textBox5.Text = "Bug report [" + Handle + "] does not exist (anymore)";
|
||||
return;
|
||||
}
|
||||
|
||||
this.textBox5.Text = strResult.Replace("\n", "\r\n");
|
||||
|
||||
Service1 service1 = new Service1();
|
||||
service1.GetBugReportCompleted += new GetBugReportCompletedEventHandler(service1_GetBugReportCompleted);
|
||||
service1.GetBugReportAsync(Handle, Handle);
|
||||
}
|
||||
|
||||
void service1_GetBugReportCompleted(object sender, GetBugReportCompletedEventArgs e)
|
||||
{
|
||||
this.textBox4.Clear();
|
||||
string Handle = e.UserState.ToString();
|
||||
|
||||
if (e.Error != null)
|
||||
{
|
||||
this.textBox4.Text = "Bug report [" + Handle + "] not available (at this time)";
|
||||
return;
|
||||
}
|
||||
|
||||
string strResult = e.Result;
|
||||
if (strResult == null)
|
||||
{
|
||||
this.textBox4.Text = "Bug report [" + Handle + "] does not extist (anymore)";
|
||||
return;
|
||||
}
|
||||
|
||||
this.textBox4.Text = strResult.Replace("\n", "\r\n");
|
||||
}
|
||||
|
||||
private void deleteToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (this.listView2.SelectedItems.Count == 0)
|
||||
return;
|
||||
|
||||
if (MessageBox.Show("Delete " + this.listView2.SelectedItems.Count + " bugreports?", "Delete Bugreports", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
|
||||
{
|
||||
for(int intI=0; intI<this.listView2.SelectedItems.Count;intI++)
|
||||
{
|
||||
ListViewItem lvi = this.listView2.SelectedItems[intI];
|
||||
string Handle = lvi.Tag.ToString();
|
||||
Properties.Settings.Default.Bugreports.Remove(Handle);
|
||||
}
|
||||
this.textBox4.Clear();
|
||||
this.textBox5.Clear();
|
||||
}
|
||||
ShowBugReportsList();
|
||||
}
|
||||
|
||||
private void button4_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (this.button4.Text.Contains("uncheck"))
|
||||
{
|
||||
foreach (ListViewItem lvi in this.listView1.Items)
|
||||
lvi.Checked = false;
|
||||
this.button4.Text = "check all";
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (ListViewItem lvi in this.listView1.Items)
|
||||
lvi.Checked = true;
|
||||
this.button4.Text = "uncheck all";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
129
source/BugReport/BugReportForm.resx
Normal file
129
source/BugReport/BugReportForm.resx
Normal file
|
@ -0,0 +1,129 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="contextMenuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>100, 17</value>
|
||||
</metadata>
|
||||
<metadata name="timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>42</value>
|
||||
</metadata>
|
||||
</root>
|
218
source/BugReport/UploadBugReport.cs
Normal file
218
source/BugReport/UploadBugReport.cs
Normal file
|
@ -0,0 +1,218 @@
|
|||
// <copyright file="gpl-2.0.txt">
|
||||
// ORIGINAL CODE BASE IS Copyright (C) 2006-2010 by Alphons van der Heijden.
|
||||
// The code was donated on 2010-04-28 by Alphons van der Heijden to Brandon 'Dimentox Travanti' Husbands &
|
||||
// Malcolm J. Kudra, who in turn License under the GPLv2 in agreement with Alphons van der Heijden's wishes.
|
||||
//
|
||||
// The community would like to thank Alphons for all of his hard work, blood sweat and tears. Without his work
|
||||
// the community would be stuck with crappy editors.
|
||||
//
|
||||
// The source code in this file ("Source Code") is provided by The LSLEditor Group to you under the terms of the GNU
|
||||
// General Public License, version 2.0 ("GPL"), unless you have obtained a separate licensing agreement ("Other
|
||||
// License"), formally executed by you and The LSLEditor Group.
|
||||
// Terms of the GPL can be found in the gplv2.txt document.
|
||||
//
|
||||
// GPLv2 Header
|
||||
// ************
|
||||
// LSLEditor, a External editor for the LSL Language.
|
||||
// Copyright (C) 2010 The LSLEditor Group.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
|
||||
// License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any
|
||||
// later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
|
||||
// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
// details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
|
||||
// Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
// ********************************************************************************************************************
|
||||
// The above copyright notice and this permission notice shall be included in copies or substantial portions of the
|
||||
// Software.
|
||||
// ********************************************************************************************************************
|
||||
// </copyright>
|
||||
//
|
||||
// <summary>
|
||||
//
|
||||
//
|
||||
// </summary>
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Drawing;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading;
|
||||
using System.Collections;
|
||||
using System.Collections.Specialized;
|
||||
using System.Collections.Generic;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace LSLEditor.BugReport
|
||||
{
|
||||
class UploadBugReport
|
||||
{
|
||||
public struct FileToUpload
|
||||
{
|
||||
public string FileName;
|
||||
public string Body;
|
||||
public string Path;
|
||||
public FileToUpload(string FileName, string Body)
|
||||
{
|
||||
this.FileName = FileName;
|
||||
this.Body = Body;
|
||||
this.Path = null;
|
||||
}
|
||||
}
|
||||
|
||||
public class UploadCompleteEventArgs : EventArgs
|
||||
{
|
||||
public int TotalBytes;
|
||||
public UploadCompleteEventArgs(int intTotal)
|
||||
{
|
||||
this.TotalBytes = intTotal;
|
||||
}
|
||||
}
|
||||
|
||||
public bool blnRunning;
|
||||
|
||||
public delegate void UploadCompleteHandler(object sender, UploadCompleteEventArgs e);
|
||||
public event UploadCompleteHandler OnComplete;
|
||||
|
||||
private Thread thread;
|
||||
private ProgressBar progressbar;
|
||||
private List<FileToUpload> list;
|
||||
|
||||
public void UploadAsync(List<FileToUpload> list, ProgressBar progressbar)
|
||||
{
|
||||
this.list = list;
|
||||
this.progressbar = progressbar;
|
||||
|
||||
this.blnRunning = true;
|
||||
|
||||
thread = new Thread(new ThreadStart(Worker));
|
||||
thread.IsBackground = true;
|
||||
thread.Name = "Worker";
|
||||
thread.Start();
|
||||
}
|
||||
|
||||
public void Stop()
|
||||
{
|
||||
this.blnRunning = false;
|
||||
if (thread != null)
|
||||
{
|
||||
thread.Join(1000);
|
||||
thread = null;
|
||||
}
|
||||
}
|
||||
|
||||
private void Worker()
|
||||
{
|
||||
int intTotal = 0;
|
||||
try
|
||||
{
|
||||
org.lsleditor.www.Service1 webservice = new org.lsleditor.www.Service1();
|
||||
|
||||
string Handle = webservice.Open();
|
||||
if (Handle == null)
|
||||
{
|
||||
MessageBox.Show("Can't get an upload handle", "Oops...");
|
||||
this.blnRunning = false;
|
||||
return;
|
||||
}
|
||||
|
||||
if (Properties.Settings.Default.Bugreports == null)
|
||||
Properties.Settings.Default.Bugreports = new StringCollection();
|
||||
Properties.Settings.Default.Bugreports.Add(Handle);
|
||||
|
||||
// Properties.Settings.Default.Save();
|
||||
|
||||
int intNumber = 0;
|
||||
foreach (FileToUpload file in this.list)
|
||||
{
|
||||
string strFileName = string.Format("{0}-{1}", intNumber, file.FileName);
|
||||
if (file.Path == null)
|
||||
{
|
||||
intTotal += Upload(Handle, strFileName, Encoding.ASCII.GetBytes(file.Body));
|
||||
}
|
||||
else
|
||||
{
|
||||
intTotal += Upload(Handle, strFileName, file.Path);
|
||||
}
|
||||
intNumber++;
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
intTotal = -1;
|
||||
}
|
||||
if (this.blnRunning)
|
||||
if (OnComplete != null)
|
||||
OnComplete(this, new UploadCompleteEventArgs(intTotal));
|
||||
this.blnRunning = false;
|
||||
}
|
||||
|
||||
private delegate void SetValueDelegate(int intValue);
|
||||
|
||||
private void SetMaximum(int intMaximum)
|
||||
{
|
||||
if (this.progressbar.InvokeRequired)
|
||||
{
|
||||
this.progressbar.Invoke(new SetValueDelegate(SetMaximum), new object[] { intMaximum });
|
||||
}
|
||||
else
|
||||
{
|
||||
this.progressbar.Maximum = intMaximum;
|
||||
}
|
||||
}
|
||||
|
||||
private void SetValue(int intValue)
|
||||
{
|
||||
if (this.progressbar.InvokeRequired)
|
||||
{
|
||||
this.progressbar.Invoke(new SetValueDelegate(SetValue), new object[] { intValue });
|
||||
}
|
||||
else
|
||||
{
|
||||
this.progressbar.Value = intValue;
|
||||
}
|
||||
}
|
||||
private int Upload(string Handle, string FileName, byte[] buffer)
|
||||
{
|
||||
org.lsleditor.www.Service1 webservice = new org.lsleditor.www.Service1();
|
||||
if (Handle == null)
|
||||
return 0;
|
||||
|
||||
SetMaximum(buffer.Length);
|
||||
int intOffset = 0;
|
||||
int intTotal = 0;
|
||||
byte[] smallbuffer = new byte[1024];
|
||||
while (this.blnRunning)
|
||||
{
|
||||
int intLength = Math.Min(smallbuffer.Length, buffer.Length - intOffset);
|
||||
if (intLength <= 0)
|
||||
break;
|
||||
Array.Copy(buffer, intOffset, smallbuffer, 0, intLength);
|
||||
intOffset += intLength;
|
||||
string strError = webservice.Write(Handle, FileName, smallbuffer, intLength);
|
||||
if (strError != null)
|
||||
{
|
||||
MessageBox.Show("Error:" + strError, "Oops...", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
break;
|
||||
}
|
||||
intTotal += intLength;
|
||||
SetValue(intTotal);
|
||||
}
|
||||
return intTotal;
|
||||
}
|
||||
|
||||
private int Upload(string Handle, string FileName, string strPath)
|
||||
{
|
||||
FileStream fs = new FileStream(strPath, FileMode.Open, FileAccess.Read);
|
||||
byte[] buffer = new byte[fs.Length];
|
||||
fs.Read(buffer, 0, (int)fs.Length);
|
||||
fs.Close();
|
||||
return Upload(Handle, FileName, buffer);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue