proper import

git-svn-id: https://lsleditor.svn.sourceforge.net/svnroot/lsleditor@9 3f4676ac-adda-40fd-8265-58d1435b1672
This commit is contained in:
dimentox 2010-04-29 07:47:27 +00:00
parent 66730fd649
commit 3151e1e342
454 changed files with 57577 additions and 0 deletions

145
trunk/About.Designer.cs generated Normal file
View file

@ -0,0 +1,145 @@
namespace LSLEditor
{
partial class About
{
/// <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.pictureBox1 = new System.Windows.Forms.PictureBox();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.label2 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.webBrowser1 = new System.Windows.Forms.WebBrowser();
this.linkLabel1 = new System.Windows.Forms.LinkLabel();
this.button1 = new System.Windows.Forms.Button();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
this.groupBox1.SuspendLayout();
this.SuspendLayout();
//
// pictureBox1
//
this.pictureBox1.Image = global::LSLEditor.Properties.Resources.logo;
this.pictureBox1.Location = new System.Drawing.Point(16, 16);
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(184, 80);
this.pictureBox1.TabIndex = 0;
this.pictureBox1.TabStop = false;
//
// groupBox1
//
this.groupBox1.Controls.Add(this.label2);
this.groupBox1.Controls.Add(this.label1);
this.groupBox1.Controls.Add(this.webBrowser1);
this.groupBox1.Controls.Add(this.linkLabel1);
this.groupBox1.Controls.Add(this.pictureBox1);
this.groupBox1.Location = new System.Drawing.Point(16, 8);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(320, 360);
this.groupBox1.TabIndex = 1;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "LSL-Editor";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(72, 112);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(16, 13);
this.label2.TabIndex = 4;
this.label2.Text = "...";
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(16, 112);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(45, 13);
this.label1.TabIndex = 3;
this.label1.Text = "Version:";
//
// webBrowser1
//
this.webBrowser1.Location = new System.Drawing.Point(8, 128);
this.webBrowser1.MinimumSize = new System.Drawing.Size(20, 20);
this.webBrowser1.Name = "webBrowser1";
this.webBrowser1.Size = new System.Drawing.Size(304, 224);
this.webBrowser1.TabIndex = 2;
//
// linkLabel1
//
this.linkLabel1.AutoSize = true;
this.linkLabel1.Location = new System.Drawing.Point(16, 96);
this.linkLabel1.Name = "linkLabel1";
this.linkLabel1.Size = new System.Drawing.Size(220, 13);
this.linkLabel1.TabIndex = 1;
this.linkLabel1.TabStop = true;
this.linkLabel1.Text = "(C) 2006,2007,2008 Alphons van der Heijden";
this.linkLabel1.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabel1_LinkClicked);
//
// button1
//
this.button1.Location = new System.Drawing.Point(240, 376);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(75, 23);
this.button1.TabIndex = 2;
this.button1.Text = "Ok";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// About
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.White;
this.ClientSize = new System.Drawing.Size(352, 410);
this.Controls.Add(this.button1);
this.Controls.Add(this.groupBox1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "About";
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "About";
this.Load += new System.EventHandler(this.About_Load);
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.PictureBox pictureBox1;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.WebBrowser webBrowser1;
private System.Windows.Forms.LinkLabel linkLabel1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label1;
}
}

80
trunk/About.cs Normal file
View file

@ -0,0 +1,80 @@
// /**
// ********
// *
// * ORIGIONAL CODE BASE IS Copyright (C) 2006-2010 by Alphons van der Heijden
// * The code was donated on 4/28/2010 by Alphons van der Heijden
// * To Brandon'Dimentox Travanti' Husbands & Malcolm J. Kudra which in turn Liscense under the GPLv2.
// * In agreement to Alphons van der Heijden 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 all
// * copies or substantial portions of the Software.
// *
// ********
// */
using System;
using System.IO;
using System.Reflection;
using System.ComponentModel;
using System.Windows.Forms;
namespace LSLEditor
{
public partial class About : Form
{
public About(LSLEditorForm parent)
{
InitializeComponent();
this.Icon = parent.Icon;
string strVersion = Assembly.GetExecutingAssembly().GetName().Version.ToString();
this.label2.Text = strVersion;
}
private void button1_Click(object sender, EventArgs e)
{
this.Close();
}
private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
System.Diagnostics.Process.Start(Properties.Settings.Default.ContactUrl);
}
private void About_Load(object sender, EventArgs e)
{
string strExeFileName = Path.GetFileName(Assembly.GetExecutingAssembly().CodeBase);
this.webBrowser1.Navigate("res://" + strExeFileName + "/"+ Properties.Settings.Default.About);
}
}
}

120
trunk/About.resx Normal file
View file

@ -0,0 +1,120 @@
<?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>
</root>

View file

@ -0,0 +1,24 @@
using System;
using System.IO;
// BZip2.Decompress(File.OpenRead("in"), File.Create("out"));
namespace LSLEditor.BZip2Decompress
{
public sealed class Decompressor
{
public static void Decompress(Stream inStream, Stream outStream)
{
using ( outStream ) {
using ( BZip2InputStream bzis = new BZip2InputStream(inStream) ) {
int ch = bzis.ReadByte();
while (ch != -1) {
outStream.WriteByte((byte)ch);
ch = bzis.ReadByte();
}
}
}
}
}
}

View file

@ -0,0 +1,122 @@
namespace LSLEditor.BZip2Decompress
{
/// <summary>
/// Defines internal values for both compression and decompression
/// </summary>
public sealed class BZip2Constants
{
/// <summary>
/// Random numbers used to randomise repetitive blocks
/// </summary>
public readonly static int[] rNums = {
619, 720, 127, 481, 931, 816, 813, 233, 566, 247,
985, 724, 205, 454, 863, 491, 741, 242, 949, 214,
733, 859, 335, 708, 621, 574, 73, 654, 730, 472,
419, 436, 278, 496, 867, 210, 399, 680, 480, 51,
878, 465, 811, 169, 869, 675, 611, 697, 867, 561,
862, 687, 507, 283, 482, 129, 807, 591, 733, 623,
150, 238, 59, 379, 684, 877, 625, 169, 643, 105,
170, 607, 520, 932, 727, 476, 693, 425, 174, 647,
73, 122, 335, 530, 442, 853, 695, 249, 445, 515,
909, 545, 703, 919, 874, 474, 882, 500, 594, 612,
641, 801, 220, 162, 819, 984, 589, 513, 495, 799,
161, 604, 958, 533, 221, 400, 386, 867, 600, 782,
382, 596, 414, 171, 516, 375, 682, 485, 911, 276,
98, 553, 163, 354, 666, 933, 424, 341, 533, 870,
227, 730, 475, 186, 263, 647, 537, 686, 600, 224,
469, 68, 770, 919, 190, 373, 294, 822, 808, 206,
184, 943, 795, 384, 383, 461, 404, 758, 839, 887,
715, 67, 618, 276, 204, 918, 873, 777, 604, 560,
951, 160, 578, 722, 79, 804, 96, 409, 713, 940,
652, 934, 970, 447, 318, 353, 859, 672, 112, 785,
645, 863, 803, 350, 139, 93, 354, 99, 820, 908,
609, 772, 154, 274, 580, 184, 79, 626, 630, 742,
653, 282, 762, 623, 680, 81, 927, 626, 789, 125,
411, 521, 938, 300, 821, 78, 343, 175, 128, 250,
170, 774, 972, 275, 999, 639, 495, 78, 352, 126,
857, 956, 358, 619, 580, 124, 737, 594, 701, 612,
669, 112, 134, 694, 363, 992, 809, 743, 168, 974,
944, 375, 748, 52, 600, 747, 642, 182, 862, 81,
344, 805, 988, 739, 511, 655, 814, 334, 249, 515,
897, 955, 664, 981, 649, 113, 974, 459, 893, 228,
433, 837, 553, 268, 926, 240, 102, 654, 459, 51,
686, 754, 806, 760, 493, 403, 415, 394, 687, 700,
946, 670, 656, 610, 738, 392, 760, 799, 887, 653,
978, 321, 576, 617, 626, 502, 894, 679, 243, 440,
680, 879, 194, 572, 640, 724, 926, 56, 204, 700,
707, 151, 457, 449, 797, 195, 791, 558, 945, 679,
297, 59, 87, 824, 713, 663, 412, 693, 342, 606,
134, 108, 571, 364, 631, 212, 174, 643, 304, 329,
343, 97, 430, 751, 497, 314, 983, 374, 822, 928,
140, 206, 73, 263, 980, 736, 876, 478, 430, 305,
170, 514, 364, 692, 829, 82, 855, 953, 676, 246,
369, 970, 294, 750, 807, 827, 150, 790, 288, 923,
804, 378, 215, 828, 592, 281, 565, 555, 710, 82,
896, 831, 547, 261, 524, 462, 293, 465, 502, 56,
661, 821, 976, 991, 658, 869, 905, 758, 745, 193,
768, 550, 608, 933, 378, 286, 215, 979, 792, 961,
61, 688, 793, 644, 986, 403, 106, 366, 905, 644,
372, 567, 466, 434, 645, 210, 389, 550, 919, 135,
780, 773, 635, 389, 707, 100, 626, 958, 165, 504,
920, 176, 193, 713, 857, 265, 203, 50, 668, 108,
645, 990, 626, 197, 510, 357, 358, 850, 858, 364,
936, 638
};
/// <summary>
/// When multiplied by compression parameter (1-9) gives the block size for compression
/// 9 gives the best compresssion but uses the most memory.
/// </summary>
public const int baseBlockSize = 100000;
/// <summary>
/// Backend constant
/// </summary>
public const int MAX_ALPHA_SIZE = 258;
/// <summary>
/// Backend constant
/// </summary>
public const int MAX_CODE_LEN = 23;
/// <summary>
/// Backend constant
/// </summary>
public const int RUNA = 0;
/// <summary>
/// Backend constant
/// </summary>
public const int RUNB = 1;
/// <summary>
/// Backend constant
/// </summary>
public const int N_GROUPS = 6;
/// <summary>
/// Backend constant
/// </summary>
public const int G_SIZE = 50;
/// <summary>
/// Backend constant
/// </summary>
public const int N_ITERS = 4;
/// <summary>
/// Backend constant
/// </summary>
public const int MAX_SELECTORS = (2 + (900000 / G_SIZE));
/// <summary>
/// Backend constant
/// </summary>
public const int NUM_OVERSHOOT_BYTES = 20;
private BZip2Constants()
{
}
}
}

View file

@ -0,0 +1,924 @@
using System;
using System.IO;
namespace LSLEditor.BZip2Decompress
{
/// <summary>
/// An input stream that decompresses files in the BZip2 format
/// </summary>
public class BZip2InputStream : Stream
{
#region Constants
const int START_BLOCK_STATE = 1;
const int RAND_PART_A_STATE = 2;
const int RAND_PART_B_STATE = 3;
const int RAND_PART_C_STATE = 4;
const int NO_RAND_PART_A_STATE = 5;
const int NO_RAND_PART_B_STATE = 6;
const int NO_RAND_PART_C_STATE = 7;
#endregion
#region Constructors
/// <summary>
/// Construct instance for reading from stream
/// </summary>
/// <param name="stream">Data source</param>
public BZip2InputStream(Stream stream)
{
// init arrays
for (int i = 0; i < BZip2Constants.N_GROUPS; ++i)
{
limit[i] = new int[BZip2Constants.MAX_ALPHA_SIZE];
baseArray[i] = new int[BZip2Constants.MAX_ALPHA_SIZE];
perm[i] = new int[BZip2Constants.MAX_ALPHA_SIZE];
}
BsSetStream(stream);
Initialize();
InitBlock();
SetupBlock();
}
#endregion
/// <summary>
/// Get/set flag indicating ownership of underlying stream.
/// When the flag is true <see cref="Close"></see> will close the underlying stream also.
/// </summary>
public bool IsStreamOwner
{
get { return isStreamOwner; }
set { isStreamOwner = value; }
}
#region Stream Overrides
/// <summary>
/// Gets a value indicating if the stream supports reading
/// </summary>
public override bool CanRead
{
get {
return baseStream.CanRead;
}
}
/// <summary>
/// Gets a value indicating whether the current stream supports seeking.
/// </summary>
public override bool CanSeek {
get {
return baseStream.CanSeek;
}
}
/// <summary>
/// Gets a value indicating whether the current stream supports writing.
/// This property always returns false
/// </summary>
public override bool CanWrite {
get {
return false;
}
}
/// <summary>
/// Gets the length in bytes of the stream.
/// </summary>
public override long Length {
get {
return baseStream.Length;
}
}
/// <summary>
/// Gets or sets the streams position.
/// Setting the position is not supported and will throw a NotSupportException
/// </summary>
/// <exception cref="NotSupportedException">Any attempt to set the position</exception>
public override long Position {
get {
return baseStream.Position;
}
set {
throw new NotSupportedException("BZip2InputStream position cannot be set");
}
}
/// <summary>
/// Flushes the stream.
/// </summary>
public override void Flush()
{
if (baseStream != null) {
baseStream.Flush();
}
}
/// <summary>
/// Set the streams position. This operation is not supported and will throw a NotSupportedException
/// </summary>
/// <exception cref="NotSupportedException">Any access</exception>
public override long Seek(long offset, SeekOrigin origin)
{
throw new NotSupportedException("BZip2InputStream Seek not supported");
}
/// <summary>
/// Sets the length of this stream to the given value.
/// This operation is not supported and will throw a NotSupportedExceptionortedException
/// </summary>
/// <exception cref="NotSupportedException">Any access</exception>
public override void SetLength(long value)
{
throw new NotSupportedException("BZip2InputStream SetLength not supported");
}
/// <summary>
/// Writes a block of bytes to this stream using data from a buffer.
/// This operation is not supported and will throw a NotSupportedException
/// </summary>
/// <exception cref="NotSupportedException">Any access</exception>
public override void Write(byte[] buffer, int offset, int count)
{
throw new NotSupportedException("BZip2InputStream Write not supported");
}
/// <summary>
/// Writes a byte to the current position in the file stream.
/// This operation is not supported and will throw a NotSupportedException
/// </summary>
/// <param name="value">The value to write.</param>
/// <exception cref="NotSupportedException">Any access</exception>
public override void WriteByte(byte value)
{
throw new NotSupportedException("BZip2InputStream WriteByte not supported");
}
/// <summary>
/// Read a sequence of bytes and advances the read position by one byte.
/// </summary>
/// <param name="buffer">Array of bytes to store values in</param>
/// <param name="offset">Offset in array to begin storing data</param>
/// <param name="count">The maximum number of bytes to read</param>
/// <returns>The total number of bytes read into the buffer. This might be less
/// than the number of bytes requested if that number of bytes are not
/// currently available or zero if the end of the stream is reached.
/// </returns>
public override int Read(byte[] buffer, int offset, int count)
{
if ( buffer == null )
{
throw new ArgumentNullException("buffer");
}
for (int i = 0; i < count; ++i) {
int rb = ReadByte();
if (rb == -1) {
return i;
}
buffer[offset + i] = (byte)rb;
}
return count;
}
/// <summary>
/// Closes the stream, releasing any associated resources.
/// </summary>
public override void Close()
{
if ( IsStreamOwner && (baseStream != null) ) {
baseStream.Close();
}
}
/// <summary>
/// Read a byte from stream advancing position
/// </summary>
/// <returns>byte read or -1 on end of stream</returns>
public override int ReadByte()
{
if (streamEnd)
{
return -1; // ok
}
int retChar = currentChar;
switch (currentState)
{
case RAND_PART_B_STATE:
SetupRandPartB();
break;
case RAND_PART_C_STATE:
SetupRandPartC();
break;
case NO_RAND_PART_B_STATE:
SetupNoRandPartB();
break;
case NO_RAND_PART_C_STATE:
SetupNoRandPartC();
break;
case START_BLOCK_STATE:
case NO_RAND_PART_A_STATE:
case RAND_PART_A_STATE:
break;
default:
break;
}
return retChar;
}
#endregion
void MakeMaps()
{
nInUse = 0;
for (int i = 0; i < 256; ++i) {
if (inUse[i]) {
seqToUnseq[nInUse] = (byte)i;
unseqToSeq[i] = (byte)nInUse;
nInUse++;
}
}
}
void Initialize()
{
char magic1 = BsGetUChar();
char magic2 = BsGetUChar();
char magic3 = BsGetUChar();
char magic4 = BsGetUChar();
if (magic1 != 'B' || magic2 != 'Z' || magic3 != 'h' || magic4 < '1' || magic4 > '9') {
streamEnd = true;
return;
}
SetDecompressStructureSizes(magic4 - '0');
computedCombinedCRC = 0;
}
void InitBlock()
{
char magic1 = BsGetUChar();
char magic2 = BsGetUChar();
char magic3 = BsGetUChar();
char magic4 = BsGetUChar();
char magic5 = BsGetUChar();
char magic6 = BsGetUChar();
if (magic1 == 0x17 && magic2 == 0x72 && magic3 == 0x45 && magic4 == 0x38 && magic5 == 0x50 && magic6 == 0x90) {
Complete();
return;
}
if (magic1 != 0x31 || magic2 != 0x41 || magic3 != 0x59 || magic4 != 0x26 || magic5 != 0x53 || magic6 != 0x59) {
BadBlockHeader();
streamEnd = true;
return;
}
storedBlockCRC = BsGetInt32();
blockRandomised = (BsR(1) == 1);
GetAndMoveToFrontDecode();
mCrc.Reset();
currentState = START_BLOCK_STATE;
}
void EndBlock()
{
computedBlockCRC = (int)mCrc.Value;
// -- A bad CRC is considered a fatal error. --
if (storedBlockCRC != computedBlockCRC) {
CrcError();
}
// 1528150659
computedCombinedCRC = ((computedCombinedCRC << 1) & 0xFFFFFFFF) | (computedCombinedCRC >> 31);
computedCombinedCRC = computedCombinedCRC ^ (uint)computedBlockCRC;
}
void Complete()
{
storedCombinedCRC = BsGetInt32();
if (storedCombinedCRC != (int)computedCombinedCRC) {
CrcError();
}
streamEnd = true;
}
void BsSetStream(Stream stream)
{
baseStream = stream;
bsLive = 0;
bsBuff = 0;
}
void FillBuffer()
{
int thech = 0;
try {
thech = baseStream.ReadByte();
} catch (Exception) {
CompressedStreamEOF();
}
if (thech == -1) {
CompressedStreamEOF();
}
bsBuff = (bsBuff << 8) | (thech & 0xFF);
bsLive += 8;
}
int BsR(int n)
{
while (bsLive < n) {
FillBuffer();
}
int v = (bsBuff >> (bsLive - n)) & ((1 << n) - 1);
bsLive -= n;
return v;
}
char BsGetUChar()
{
return (char)BsR(8);
}
int BsGetint()
{
int u = BsR(8);
u = (u << 8) | BsR(8);
u = (u << 8) | BsR(8);
u = (u << 8) | BsR(8);
return u;
}
int BsGetIntVS(int numBits)
{
return BsR(numBits);
}
int BsGetInt32()
{
return BsGetint();
}
void RecvDecodingTables()
{
char[][] len = new char[BZip2Constants.N_GROUPS][];
for (int i = 0; i < BZip2Constants.N_GROUPS; ++i) {
len[i] = new char[BZip2Constants.MAX_ALPHA_SIZE];
}
bool[] inUse16 = new bool[16];
//--- Receive the mapping table ---
for (int i = 0; i < 16; i++) {
inUse16[i] = (BsR(1) == 1);
}
for (int i = 0; i < 16; i++) {
if (inUse16[i]) {
for (int j = 0; j < 16; j++) {
inUse[i * 16 + j] = (BsR(1) == 1);
}
} else {
for (int j = 0; j < 16; j++) {
inUse[i * 16 + j] = false;
}
}
}
MakeMaps();
int alphaSize = nInUse + 2;
//--- Now the selectors ---
int nGroups = BsR(3);
int nSelectors = BsR(15);
for (int i = 0; i < nSelectors; i++) {
int j = 0;
while (BsR(1) == 1) {
j++;
}
selectorMtf[i] = (byte)j;
}
//--- Undo the MTF values for the selectors. ---
byte[] pos = new byte[BZip2Constants.N_GROUPS];
for (int v = 0; v < nGroups; v++) {
pos[v] = (byte)v;
}
for (int i = 0; i < nSelectors; i++) {
int v = selectorMtf[i];
byte tmp = pos[v];
while (v > 0) {
pos[v] = pos[v - 1];
v--;
}
pos[0] = tmp;
selector[i] = tmp;
}
//--- Now the coding tables ---
for (int t = 0; t < nGroups; t++) {
int curr = BsR(5);
for (int i = 0; i < alphaSize; i++) {
while (BsR(1) == 1) {
if (BsR(1) == 0) {
curr++;
} else {
curr--;
}
}
len[t][i] = (char)curr;
}
}
//--- Create the Huffman decoding tables ---
for (int t = 0; t < nGroups; t++) {
int minLen = 32;
int maxLen = 0;
for (int i = 0; i < alphaSize; i++) {
maxLen = Math.Max(maxLen, len[t][i]);
minLen = Math.Min(minLen, len[t][i]);
}
HbCreateDecodeTables(limit[t], baseArray[t], perm[t], len[t], minLen, maxLen, alphaSize);
minLens[t] = minLen;
}
}
void GetAndMoveToFrontDecode()
{
byte[] yy = new byte[256];
int nextSym;
int limitLast = BZip2Constants.baseBlockSize * blockSize100k;
origPtr = BsGetIntVS(24);
RecvDecodingTables();
int EOB = nInUse+1;
int groupNo = -1;
int groupPos = 0;
/*--
Setting up the unzftab entries here is not strictly
necessary, but it does save having to do it later
in a separate pass, and so saves a block's worth of
cache misses.
--*/
for (int i = 0; i <= 255; i++) {
unzftab[i] = 0;
}
for (int i = 0; i <= 255; i++) {
yy[i] = (byte)i;
}
last = -1;
if (groupPos == 0) {
groupNo++;
groupPos = BZip2Constants.G_SIZE;
}
groupPos--;
int zt = selector[groupNo];
int zn = minLens[zt];
int zvec = BsR(zn);
int zj;
while (zvec > limit[zt][zn]) {
if (zn > 20) { // the longest code
throw new Exception("Bzip data error");
}
zn++;
while (bsLive < 1) {
FillBuffer();
}
zj = (bsBuff >> (bsLive-1)) & 1;
bsLive--;
zvec = (zvec << 1) | zj;
}
if (zvec - baseArray[zt][zn] < 0 || zvec - baseArray[zt][zn] >= BZip2Constants.MAX_ALPHA_SIZE) {
throw new Exception("Bzip data error");
}
nextSym = perm[zt][zvec - baseArray[zt][zn]];
while (true) {
if (nextSym == EOB) {
break;
}
if (nextSym == BZip2Constants.RUNA || nextSym == BZip2Constants.RUNB) {
int s = -1;
int n = 1;
do {
if (nextSym == BZip2Constants.RUNA) {
s += (0 + 1) * n;
} else if (nextSym == BZip2Constants.RUNB) {
s += (1 + 1) * n;
}
n <<= 1;
if (groupPos == 0) {
groupNo++;
groupPos = BZip2Constants.G_SIZE;
}
groupPos--;
zt = selector[groupNo];
zn = minLens[zt];
zvec = BsR(zn);
while (zvec > limit[zt][zn]) {
zn++;
while (bsLive < 1) {
FillBuffer();
}
zj = (bsBuff >> (bsLive - 1)) & 1;
bsLive--;
zvec = (zvec << 1) | zj;
}
nextSym = perm[zt][zvec - baseArray[zt][zn]];
} while (nextSym == BZip2Constants.RUNA || nextSym == BZip2Constants.RUNB);
s++;
byte ch = seqToUnseq[yy[0]];
unzftab[ch] += s;
while (s > 0) {
last++;
ll8[last] = ch;
s--;
}
if (last >= limitLast) {
BlockOverrun();
}
continue;
} else {
last++;
if (last >= limitLast) {
BlockOverrun();
}
byte tmp = yy[nextSym - 1];
unzftab[seqToUnseq[tmp]]++;
ll8[last] = seqToUnseq[tmp];
for (int j = nextSym-1; j > 0; --j) {
yy[j] = yy[j - 1];
}
yy[0] = tmp;
if (groupPos == 0) {
groupNo++;
groupPos = BZip2Constants.G_SIZE;
}
groupPos--;
zt = selector[groupNo];
zn = minLens[zt];
zvec = BsR(zn);
while (zvec > limit[zt][zn]) {
zn++;
while (bsLive < 1) {
FillBuffer();
}
zj = (bsBuff >> (bsLive-1)) & 1;
bsLive--;
zvec = (zvec << 1) | zj;
}
nextSym = perm[zt][zvec - baseArray[zt][zn]];
continue;
}
}
}
void SetupBlock()
{
int[] cftab = new int[257];
cftab[0] = 0;
Array.Copy(unzftab, 0, cftab, 1, 256);
for (int i = 1; i <= 256; i++) {
cftab[i] += cftab[i - 1];
}
for (int i = 0; i <= last; i++) {
byte ch = ll8[i];
tt[cftab[ch]] = i;
cftab[ch]++;
}
cftab = null;
tPos = tt[origPtr];
count = 0;
i2 = 0;
ch2 = 256; /*-- not a char and not EOF --*/
if (blockRandomised) {
rNToGo = 0;
rTPos = 0;
SetupRandPartA();
} else {
SetupNoRandPartA();
}
}
void SetupRandPartA()
{
if (i2 <= last) {
chPrev = ch2;
ch2 = ll8[tPos];
tPos = tt[tPos];
if (rNToGo == 0) {
rNToGo = BZip2Constants.rNums[rTPos];
rTPos++;
if (rTPos == 512) {
rTPos = 0;
}
}
rNToGo--;
ch2 ^= (int)((rNToGo == 1) ? 1 : 0);
i2++;
currentChar = ch2;
currentState = RAND_PART_B_STATE;
mCrc.Update(ch2);
} else {
EndBlock();
InitBlock();
SetupBlock();
}
}
void SetupNoRandPartA()
{
if (i2 <= last) {
chPrev = ch2;
ch2 = ll8[tPos];
tPos = tt[tPos];
i2++;
currentChar = ch2;
currentState = NO_RAND_PART_B_STATE;
mCrc.Update(ch2);
} else {
EndBlock();
InitBlock();
SetupBlock();
}
}
void SetupRandPartB()
{
if (ch2 != chPrev) {
currentState = RAND_PART_A_STATE;
count = 1;
SetupRandPartA();
} else {
count++;
if (count >= 4) {
z = ll8[tPos];
tPos = tt[tPos];
if (rNToGo == 0) {
rNToGo = BZip2Constants.rNums[rTPos];
rTPos++;
if (rTPos == 512) {
rTPos = 0;
}
}
rNToGo--;
z ^= (byte)((rNToGo == 1) ? 1 : 0);
j2 = 0;
currentState = RAND_PART_C_STATE;
SetupRandPartC();
} else {
currentState = RAND_PART_A_STATE;
SetupRandPartA();
}
}
}
void SetupRandPartC()
{
if (j2 < (int)z) {
currentChar = ch2;
mCrc.Update(ch2);
j2++;
} else {
currentState = RAND_PART_A_STATE;
i2++;
count = 0;
SetupRandPartA();
}
}
void SetupNoRandPartB()
{
if (ch2 != chPrev) {
currentState = NO_RAND_PART_A_STATE;
count = 1;
SetupNoRandPartA();
} else {
count++;
if (count >= 4) {
z = ll8[tPos];
tPos = tt[tPos];
currentState = NO_RAND_PART_C_STATE;
j2 = 0;
SetupNoRandPartC();
} else {
currentState = NO_RAND_PART_A_STATE;
SetupNoRandPartA();
}
}
}
void SetupNoRandPartC()
{
if (j2 < (int)z) {
currentChar = ch2;
mCrc.Update(ch2);
j2++;
} else {
currentState = NO_RAND_PART_A_STATE;
i2++;
count = 0;
SetupNoRandPartA();
}
}
void SetDecompressStructureSizes(int newSize100k)
{
if (!(0 <= newSize100k && newSize100k <= 9 && 0 <= blockSize100k && blockSize100k <= 9)) {
throw new Exception("Invalid block size");
}
blockSize100k = newSize100k;
if (newSize100k == 0) {
return;
}
int n = BZip2Constants.baseBlockSize * newSize100k;
ll8 = new byte[n];
tt = new int[n];
}
static void CompressedStreamEOF()
{
throw new Exception("BZip2 input stream end of compressed stream");
}
static void BlockOverrun()
{
throw new Exception("BZip2 input stream block overrun");
}
static void BadBlockHeader()
{
throw new Exception("BZip2 input stream bad block header");
}
static void CrcError()
{
throw new Exception("BZip2 input stream crc error");
}
static void HbCreateDecodeTables(int[] limit, int[] baseArray, int[] perm, char[] length, int minLen, int maxLen, int alphaSize)
{
int pp = 0;
for (int i = minLen; i <= maxLen; ++i)
{
for (int j = 0; j < alphaSize; ++j)
{
if (length[j] == i)
{
perm[pp] = j;
++pp;
}
}
}
for (int i = 0; i < BZip2Constants.MAX_CODE_LEN; i++)
{
baseArray[i] = 0;
}
for (int i = 0; i < alphaSize; i++)
{
++baseArray[length[i] + 1];
}
for (int i = 1; i < BZip2Constants.MAX_CODE_LEN; i++)
{
baseArray[i] += baseArray[i - 1];
}
for (int i = 0; i < BZip2Constants.MAX_CODE_LEN; i++)
{
limit[i] = 0;
}
int vec = 0;
for (int i = minLen; i <= maxLen; i++)
{
vec += (baseArray[i + 1] - baseArray[i]);
limit[i] = vec - 1;
vec <<= 1;
}
for (int i = minLen + 1; i <= maxLen; i++)
{
baseArray[i] = ((limit[i - 1] + 1) << 1) - baseArray[i];
}
}
#region Instance Fields
/*--
index of the last char in the block, so
the block size == last + 1.
--*/
int last;
/*--
index in zptr[] of original string after sorting.
--*/
int origPtr;
/*--
always: in the range 0 .. 9.
The current block size is 100000 * this number.
--*/
int blockSize100k;
bool blockRandomised;
int bsBuff;
int bsLive;
IChecksum mCrc = new StrangeCRC();
bool[] inUse = new bool[256];
int nInUse;
byte[] seqToUnseq = new byte[256];
byte[] unseqToSeq = new byte[256];
byte[] selector = new byte[BZip2Constants.MAX_SELECTORS];
byte[] selectorMtf = new byte[BZip2Constants.MAX_SELECTORS];
int[] tt;
byte[] ll8;
/*--
freq table collected to save a pass over the data
during decompression.
--*/
int[] unzftab = new int[256];
int[][] limit = new int[BZip2Constants.N_GROUPS][];
int[][] baseArray = new int[BZip2Constants.N_GROUPS][];
int[][] perm = new int[BZip2Constants.N_GROUPS][];
int[] minLens = new int[BZip2Constants.N_GROUPS];
Stream baseStream;
bool streamEnd;
int currentChar = -1;
int currentState = START_BLOCK_STATE;
int storedBlockCRC, storedCombinedCRC;
int computedBlockCRC;
uint computedCombinedCRC;
int count, chPrev, ch2;
int tPos;
int rNToGo;
int rTPos;
int i2, j2;
byte z;
bool isStreamOwner = true;
#endregion
}
}

View file

@ -0,0 +1,93 @@
// IChecksum.cs - Interface to compute a data checksum
// Copyright (C) 2001 Mike Krueger
//
// This file was translated from java, it was part of the GNU Classpath
// Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
//
// 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//
// Linking this library statically or dynamically with other modules is
// making a combined work based on this library. Thus, the terms and
// conditions of the GNU General Public License cover the whole
// combination.
//
// As a special exception, the copyright holders of this library give you
// permission to link this library with independent modules to produce an
// executable, regardless of the license terms of these independent
// modules, and to copy and distribute the resulting executable under
// terms of your choice, provided that you also meet, for each linked
// independent module, the terms and conditions of the license of that
// module. An independent module is a module which is not derived from
// or based on this library. If you modify this library, you may extend
// this exception to your version of the library, but you are not
// obligated to do so. If you do not wish to do so, delete this
// exception statement from your version.
namespace LSLEditor.BZip2Decompress
{
/// <summary>
/// Interface to compute a data checksum used by checked input/output streams.
/// A data checksum can be updated by one byte or with a byte array. After each
/// update the value of the current checksum can be returned by calling
/// <code>getValue</code>. The complete checksum object can also be reset
/// so it can be used again with new data.
/// </summary>
public interface IChecksum
{
/// <summary>
/// Returns the data checksum computed so far.
/// </summary>
long Value
{
get;
}
/// <summary>
/// Resets the data checksum as if no update was ever called.
/// </summary>
void Reset();
/// <summary>
/// Adds one byte to the data checksum.
/// </summary>
/// <param name = "value">
/// the data value to add. The high byte of the int is ignored.
/// </param>
void Update(int value);
/// <summary>
/// Updates the data checksum with the bytes taken from the array.
/// </summary>
/// <param name="buffer">
/// buffer an array of bytes
/// </param>
void Update(byte[] buffer);
/// <summary>
/// Adds the byte array to the data checksum.
/// </summary>
/// <param name = "buffer">
/// The buffer which contains the data
/// </param>
/// <param name = "offset">
/// The offset in the buffer where the data starts
/// </param>
/// <param name = "count">
/// the number of data bytes to add.
/// </param>
void Update(byte[] buffer, int offset, int count);
}
}

View file

@ -0,0 +1,18 @@
using System;
using System.Security.Cryptography;
using System.IO;
namespace LSLEditor.BZip2Decompress
{
class MD5Verify
{
public static string ComputeHash(string strFile)
{
MD5CryptoServiceProvider csp = new MD5CryptoServiceProvider();
FileStream stream = File.OpenRead(strFile);
byte[] hash = csp.ComputeHash(stream);
stream.Close();
return BitConverter.ToString(hash).Replace("-", "").ToLower();
}
}
}

View file

@ -0,0 +1,207 @@
// StrangeCRC.cs - computes a crc used in the bziplib
//
// Copyright (C) 2001 Mike Krueger
//
// This file was translated from java, it was part of the GNU Classpath
// Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
//
// 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//
// Linking this library statically or dynamically with other modules is
// making a combined work based on this library. Thus, the terms and
// conditions of the GNU General Public License cover the whole
// combination.
//
// As a special exception, the copyright holders of this library give you
// permission to link this library with independent modules to produce an
// executable, regardless of the license terms of these independent
// modules, and to copy and distribute the resulting executable under
// terms of your choice, provided that you also meet, for each linked
// independent module, the terms and conditions of the license of that
// module. An independent module is a module which is not derived from
// or based on this library. If you modify this library, you may extend
// this exception to your version of the library, but you are not
// obligated to do so. If you do not wish to do so, delete this
// exception statement from your version.
using System;
namespace LSLEditor.BZip2Decompress
{
/// <summary>
/// Bzip2 checksum algorithm
/// </summary>
public class StrangeCRC : IChecksum
{
readonly static uint[] crc32Table = {
0x00000000, 0x04c11db7, 0x09823b6e, 0x0d4326d9,
0x130476dc, 0x17c56b6b, 0x1a864db2, 0x1e475005,
0x2608edb8, 0x22c9f00f, 0x2f8ad6d6, 0x2b4bcb61,
0x350c9b64, 0x31cd86d3, 0x3c8ea00a, 0x384fbdbd,
0x4c11db70, 0x48d0c6c7, 0x4593e01e, 0x4152fda9,
0x5f15adac, 0x5bd4b01b, 0x569796c2, 0x52568b75,
0x6a1936c8, 0x6ed82b7f, 0x639b0da6, 0x675a1011,
0x791d4014, 0x7ddc5da3, 0x709f7b7a, 0x745e66cd,
0x9823b6e0, 0x9ce2ab57, 0x91a18d8e, 0x95609039,
0x8b27c03c, 0x8fe6dd8b, 0x82a5fb52, 0x8664e6e5,
0xbe2b5b58, 0xbaea46ef, 0xb7a96036, 0xb3687d81,
0xad2f2d84, 0xa9ee3033, 0xa4ad16ea, 0xa06c0b5d,
0xd4326d90, 0xd0f37027, 0xddb056fe, 0xd9714b49,
0xc7361b4c, 0xc3f706fb, 0xceb42022, 0xca753d95,
0xf23a8028, 0xf6fb9d9f, 0xfbb8bb46, 0xff79a6f1,
0xe13ef6f4, 0xe5ffeb43, 0xe8bccd9a, 0xec7dd02d,
0x34867077, 0x30476dc0, 0x3d044b19, 0x39c556ae,
0x278206ab, 0x23431b1c, 0x2e003dc5, 0x2ac12072,
0x128e9dcf, 0x164f8078, 0x1b0ca6a1, 0x1fcdbb16,
0x018aeb13, 0x054bf6a4, 0x0808d07d, 0x0cc9cdca,
0x7897ab07, 0x7c56b6b0, 0x71159069, 0x75d48dde,
0x6b93dddb, 0x6f52c06c, 0x6211e6b5, 0x66d0fb02,
0x5e9f46bf, 0x5a5e5b08, 0x571d7dd1, 0x53dc6066,
0x4d9b3063, 0x495a2dd4, 0x44190b0d, 0x40d816ba,
0xaca5c697, 0xa864db20, 0xa527fdf9, 0xa1e6e04e,
0xbfa1b04b, 0xbb60adfc, 0xb6238b25, 0xb2e29692,
0x8aad2b2f, 0x8e6c3698, 0x832f1041, 0x87ee0df6,
0x99a95df3, 0x9d684044, 0x902b669d, 0x94ea7b2a,
0xe0b41de7, 0xe4750050, 0xe9362689, 0xedf73b3e,
0xf3b06b3b, 0xf771768c, 0xfa325055, 0xfef34de2,
0xc6bcf05f, 0xc27dede8, 0xcf3ecb31, 0xcbffd686,
0xd5b88683, 0xd1799b34, 0xdc3abded, 0xd8fba05a,
0x690ce0ee, 0x6dcdfd59, 0x608edb80, 0x644fc637,
0x7a089632, 0x7ec98b85, 0x738aad5c, 0x774bb0eb,
0x4f040d56, 0x4bc510e1, 0x46863638, 0x42472b8f,
0x5c007b8a, 0x58c1663d, 0x558240e4, 0x51435d53,
0x251d3b9e, 0x21dc2629, 0x2c9f00f0, 0x285e1d47,
0x36194d42, 0x32d850f5, 0x3f9b762c, 0x3b5a6b9b,
0x0315d626, 0x07d4cb91, 0x0a97ed48, 0x0e56f0ff,
0x1011a0fa, 0x14d0bd4d, 0x19939b94, 0x1d528623,
0xf12f560e, 0xf5ee4bb9, 0xf8ad6d60, 0xfc6c70d7,
0xe22b20d2, 0xe6ea3d65, 0xeba91bbc, 0xef68060b,
0xd727bbb6, 0xd3e6a601, 0xdea580d8, 0xda649d6f,
0xc423cd6a, 0xc0e2d0dd, 0xcda1f604, 0xc960ebb3,
0xbd3e8d7e, 0xb9ff90c9, 0xb4bcb610, 0xb07daba7,
0xae3afba2, 0xaafbe615, 0xa7b8c0cc, 0xa379dd7b,
0x9b3660c6, 0x9ff77d71, 0x92b45ba8, 0x9675461f,
0x8832161a, 0x8cf30bad, 0x81b02d74, 0x857130c3,
0x5d8a9099, 0x594b8d2e, 0x5408abf7, 0x50c9b640,
0x4e8ee645, 0x4a4ffbf2, 0x470cdd2b, 0x43cdc09c,
0x7b827d21, 0x7f436096, 0x7200464f, 0x76c15bf8,
0x68860bfd, 0x6c47164a, 0x61043093, 0x65c52d24,
0x119b4be9, 0x155a565e, 0x18197087, 0x1cd86d30,
0x029f3d35, 0x065e2082, 0x0b1d065b, 0x0fdc1bec,
0x3793a651, 0x3352bbe6, 0x3e119d3f, 0x3ad08088,
0x2497d08d, 0x2056cd3a, 0x2d15ebe3, 0x29d4f654,
0xc5a92679, 0xc1683bce, 0xcc2b1d17, 0xc8ea00a0,
0xd6ad50a5, 0xd26c4d12, 0xdf2f6bcb, 0xdbee767c,
0xe3a1cbc1, 0xe760d676, 0xea23f0af, 0xeee2ed18,
0xf0a5bd1d, 0xf464a0aa, 0xf9278673, 0xfde69bc4,
0x89b8fd09, 0x8d79e0be, 0x803ac667, 0x84fbdbd0,
0x9abc8bd5, 0x9e7d9662, 0x933eb0bb, 0x97ffad0c,
0xafb010b1, 0xab710d06, 0xa6322bdf, 0xa2f33668,
0xbcb4666d, 0xb8757bda, 0xb5365d03, 0xb1f740b4
};
int globalCrc;
/// <summary>
/// Initialise a default instance of <see cref="StrangeCRC"></see>
/// </summary>
public StrangeCRC()
{
Reset();
}
/// <summary>
/// Reset the state of Crc.
/// </summary>
public void Reset()
{
globalCrc = -1;
}
/// <summary>
/// Get the current Crc value.
/// </summary>
public long Value {
get {
return ~globalCrc;
}
}
/// <summary>
/// Update the Crc value.
/// </summary>
/// <param name="value">data update is based on</param>
public void Update(int value)
{
int temp = (globalCrc >> 24) ^ value;
if (temp < 0) {
temp = 256 + temp;
}
globalCrc = unchecked((int)((globalCrc << 8) ^ crc32Table[temp]));
}
/// <summary>
/// Update Crc based on a block of data
/// </summary>
public void Update(byte[] buffer)
{
if (buffer == null) {
throw new ArgumentNullException("buffer");
}
Update(buffer, 0, buffer.Length);
}
/// <summary>
/// Update Crc based on a portion of a block of data
/// </summary>
/// <param name="buffer">block of data</param>
/// <param name="offset">index of first byte to use</param>
/// <param name="count">number of bytes to use</param>
public void Update(byte[] buffer, int offset, int count)
{
if (buffer == null) {
throw new ArgumentNullException("buffer");
}
if ( offset < 0 )
{
#if COMPACT_FRAMEWORK_V10
throw new ArgumentOutOfRangeException("offset");
#else
throw new ArgumentOutOfRangeException("offset", "cannot be less than zero");
#endif
}
if ( count < 0 )
{
#if COMPACT_FRAMEWORK_V10
throw new ArgumentOutOfRangeException("count");
#else
throw new ArgumentOutOfRangeException("count", "cannot be less than zero");
#endif
}
if ( offset + count > buffer.Length )
{
throw new ArgumentOutOfRangeException("count");
}
for (int i = 0; i < count; ++i) {
Update(buffer[offset++]);
}
}
}
}

81
trunk/Browser.Designer.cs generated Normal file
View file

@ -0,0 +1,81 @@
namespace LSLEditor
{
partial class Browser
{
/// <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.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components);
this.closeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.tabControl1 = new System.Windows.Forms.TabControlExtended(this.components);
this.contextMenuStrip1.SuspendLayout();
this.SuspendLayout();
//
// contextMenuStrip1
//
this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.closeToolStripMenuItem});
this.contextMenuStrip1.Name = "contextMenuStrip1";
this.contextMenuStrip1.Size = new System.Drawing.Size(112, 26);
//
// closeToolStripMenuItem
//
this.closeToolStripMenuItem.Name = "closeToolStripMenuItem";
this.closeToolStripMenuItem.Size = new System.Drawing.Size(111, 22);
this.closeToolStripMenuItem.Text = "Close";
this.closeToolStripMenuItem.Click += new System.EventHandler(this.closeToolStripMenuItem_Click);
//
// tabControl1
//
this.tabControl1.Dock = System.Windows.Forms.DockStyle.Fill;
this.tabControl1.Location = new System.Drawing.Point(0, 0);
this.tabControl1.Name = "tabControl1";
this.tabControl1.SelectedIndex = 0;
this.tabControl1.Size = new System.Drawing.Size(592, 366);
this.tabControl1.TabIndex = 1;
this.tabControl1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.tabControl1_MouseDown);
//
// Browser
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(592, 366);
this.Controls.Add(this.tabControl1);
this.Name = "Browser";
this.Text = "Browser";
this.contextMenuStrip1.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.TabControlExtended tabControl1;
private System.Windows.Forms.ContextMenuStrip contextMenuStrip1;
private System.Windows.Forms.ToolStripMenuItem closeToolStripMenuItem;
}
}

179
trunk/Browser.cs Normal file
View file

@ -0,0 +1,179 @@
// /**
// ********
// *
// * ORIGIONAL CODE BASE IS Copyright (C) 2006-2010 by Alphons van der Heijden
// * The code was donated on 4/28/2010 by Alphons van der Heijden
// * To Brandon'Dimentox Travanti' Husbands & Malcolm J. Kudra which in turn Liscense under the GPLv2.
// * In agreement to Alphons van der Heijden 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 all
// * copies or substantial portions of the Software.
// *
// ********
// */
using System;
using System.ComponentModel;
using System.Drawing;
using System.Drawing.Imaging;
using System.Windows.Forms;
namespace LSLEditor
{
public partial class Browser : Form
{
private LSLEditorForm lslEditorForm;
public Browser(LSLEditorForm lslEditorForm)
{
InitializeComponent();
this.Icon = lslEditorForm.Icon;
this.lslEditorForm = lslEditorForm;
// enables close buttons on tabs
this.tabControl1.SetDrawMode();
}
private void axWebBrowser1_StatusTextChanged(object sender, EventArgs e)
{
WebBrowser axWebBrowser1 = sender as WebBrowser;
ToolStripStatusLabel status = axWebBrowser1.Tag as ToolStripStatusLabel;
if (status == null)
return;
status.Text = axWebBrowser1.StatusText;
}
private void axWebBrowser1_Navigating(object sender, WebBrowserNavigatingEventArgs e)
{
string strUrl = e.Url.ToString();
if (strUrl.EndsWith(".lsl"))
{
e.Cancel = true;
if (MessageBox.Show("Import LSL script?", "Import script", MessageBoxButtons.OKCancel) == DialogResult.Cancel)
return;
WebBrowser axWebBrowser1 = sender as WebBrowser;
axWebBrowser1.Stop();
this.lslEditorForm.OpenFile(strUrl,Guid.NewGuid());
}
}
public void ShowWebBrowser(string strTabName, string strUrl)
{
WebBrowser axWebBrowser1 = null;
try
{
if (!Properties.Settings.Default.HelpNewTab)
{
TabPage tabPage = this.tabControl1.TabPages[0];
tabPage.Text = strTabName + " ";
axWebBrowser1 = tabPage.Controls[0] as WebBrowser;
}
}
catch
{
}
if (axWebBrowser1 == null)
{
TabPage tabPage = new TabPage(strTabName + " ");
tabPage.BackColor = Color.White;
axWebBrowser1 = new WebBrowser();
ToolStripStatusLabel toolStripStatusLabel1 = new ToolStripStatusLabel();
StatusStrip statusStrip1 = new StatusStrip();
statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { toolStripStatusLabel1});
statusStrip1.Location = new System.Drawing.Point(0, 318);
statusStrip1.Name = "statusStrip1";
statusStrip1.Size = new System.Drawing.Size(584, 22);
statusStrip1.TabIndex = 0;
statusStrip1.Text = "statusStrip1";
toolStripStatusLabel1.Name = "toolStripStatusLabel1";
toolStripStatusLabel1.Size = new System.Drawing.Size(109, 17);
toolStripStatusLabel1.Text = "toolStripStatusLabel1";
tabPage.Controls.Add(axWebBrowser1);
tabPage.Controls.Add(statusStrip1);
this.tabControl1.TabPages.Add(tabPage);
this.tabControl1.SelectedIndex = this.tabControl1.TabCount - 1;
// reference
axWebBrowser1.Tag = toolStripStatusLabel1;
axWebBrowser1.Dock = DockStyle.Fill;
axWebBrowser1.StatusTextChanged += new EventHandler(axWebBrowser1_StatusTextChanged);
axWebBrowser1.Navigating += new WebBrowserNavigatingEventHandler(axWebBrowser1_Navigating);
}
axWebBrowser1.Navigate(strUrl);
}
private void closeToolStripMenuItem_Click(object sender, EventArgs e)
{
int intTabToClose = (int)this.contextMenuStrip1.Tag;
if (intTabToClose >= this.tabControl1.TabCount)
return;
this.tabControl1.TabPages.RemoveAt(intTabToClose);
}
private void tabControl1_MouseDown(object sender, MouseEventArgs e)
{
TabControl tabControl = sender as TabControl;
if (tabControl == null)
return;
if (e.Button == MouseButtons.Right)
{
for (int intI = 0; intI < tabControl.TabCount; intI++)
{
Rectangle rt = tabControl.GetTabRect(intI);
if (e.X > rt.Left && e.X < rt.Right
&& e.Y > rt.Top && e.Y < rt.Bottom)
{
this.contextMenuStrip1.Tag = intI;
this.contextMenuStrip1.Show(this.tabControl1, new Point(e.X, e.Y));
}
}
}
}
}
}

123
trunk/Browser.resx Normal file
View file

@ -0,0 +1,123 @@
<?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>127, 17</value>
</metadata>
</root>

437
trunk/BugReport/BugReportForm.Designer.cs generated Normal file
View 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;
}
}

View file

@ -0,0 +1,298 @@
// /**
// ********
// *
// * ORIGIONAL CODE BASE IS Copyright (C) 2006-2010 by Alphons van der Heijden
// * The code was donated on 4/28/2010 by Alphons van der Heijden
// * To Brandon'Dimentox Travanti' Husbands & Malcolm J. Kudra which in turn Liscense under the GPLv2.
// * In agreement to Alphons van der Heijden 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 all
// * copies or substantial portions of the Software.
// *
// ********
// */
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";
}
}
}
}

View 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>

View file

@ -0,0 +1,222 @@
// /**
// ********
// *
// * ORIGIONAL CODE BASE IS Copyright (C) 2006-2010 by Alphons van der Heijden
// * The code was donated on 4/28/2010 by Alphons van der Heijden
// * To Brandon'Dimentox Travanti' Husbands & Malcolm J. Kudra which in turn Liscense under the GPLv2.
// * In agreement to Alphons van der Heijden 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 all
// * copies or substantial portions of the Software.
// *
// ********
// */
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);
}
}
}

View file

@ -0,0 +1,97 @@
// /**
// ********
// *
// * ORIGIONAL CODE BASE IS Copyright (C) 2006-2010 by Alphons van der Heijden
// * The code was donated on 4/28/2010 by Alphons van der Heijden
// * To Brandon'Dimentox Travanti' Husbands & Malcolm J. Kudra which in turn Liscense under the GPLv2.
// * In agreement to Alphons van der Heijden 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 all
// * copies or substantial portions of the Software.
// *
// ********
// */
using System; // bitconvertor
using System.IO;
using System.IO.Compression;
using System.Security.Cryptography;
namespace LSLEditor.Decompressor
{
public class MD5Verify
{
public static string ComputeHash(string strFile)
{
MD5CryptoServiceProvider csp = new MD5CryptoServiceProvider();
FileStream stream = File.OpenRead(strFile);
byte[] hash = csp.ComputeHash(stream);
stream.Close();
return BitConverter.ToString(hash).Replace("-", "").ToLower();
}
}
public sealed class Gzip
{
public static void Decompress(Stream inStream, Stream outStream)
{
using (outStream)
{
using (GZipStream zipStream = new GZipStream(inStream, CompressionMode.Decompress))
{
int ch = zipStream.ReadByte();
while (ch != -1)
{
outStream.WriteByte((byte)ch);
ch = zipStream.ReadByte();
}
}
}
}
}
public sealed class Zip
{
public static void Decompress(Stream inStream, Stream outStream)
{
ZipEntry zipEntry = ZipEntry.Read(inStream);
inStream.Close();
using (outStream)
{
zipEntry.Extract(outStream);
}
}
}
}

View file

@ -0,0 +1,371 @@
// /**
// ********
// *
// * ORIGIONAL CODE BASE IS Copyright (C) 2006-2010 by Alphons van der Heijden
// * The code was donated on 4/28/2010 by Alphons van der Heijden
// * To Brandon'Dimentox Travanti' Husbands & Malcolm J. Kudra which in turn Liscense under the GPLv2.
// * In agreement to Alphons van der Heijden 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 all
// * copies or substantial portions of the Software.
// *
// ********
// */
using System;
namespace LSLEditor.Decompressor
{
public class ZipEntry
{
private const int ZipEntrySignature = 0x04034b50;
private const int ZipEntryDataDescriptorSignature = 0x08074b50;
private DateTime _LastModified;
private string _FileName;
private Int16 _VersionNeeded;
private Int16 _BitField;
private Int16 _CompressionMethod;
private Int32 _CompressedSize;
private Int32 _UncompressedSize;
private Int32 _LastModDateTime;
private Int32 _Crc32;
private byte[] _Extra;
private byte[] __filedata;
private byte[] _FileData
{
get
{
if (__filedata == null)
{
}
return __filedata;
}
}
private System.IO.MemoryStream _UnderlyingMemoryStream;
private System.IO.Compression.DeflateStream _CompressedStream;
private System.IO.Compression.DeflateStream CompressedStream
{
get
{
if (_CompressedStream == null)
{
_UnderlyingMemoryStream = new System.IO.MemoryStream();
bool LeaveUnderlyingStreamOpen = true;
_CompressedStream = new System.IO.Compression.DeflateStream(_UnderlyingMemoryStream,
System.IO.Compression.CompressionMode.Compress,
LeaveUnderlyingStreamOpen);
}
return _CompressedStream;
}
}
private static bool ReadHeader(System.IO.Stream s, ZipEntry ze)
{
int signature = Shared.ReadSignature(s);
// return null if this is not a local file header signature
if (SignatureIsNotValid(signature))
{
s.Seek(-4, System.IO.SeekOrigin.Current);
return false;
}
byte[] block = new byte[26];
int n = s.Read(block, 0, block.Length);
if (n != block.Length) return false;
int i = 0;
ze._VersionNeeded = (short)(block[i++] + block[i++] * 256);
ze._BitField = (short)(block[i++] + block[i++] * 256);
ze._CompressionMethod = (short)(block[i++] + block[i++] * 256);
ze._LastModDateTime = block[i++] + block[i++] * 256 + block[i++] * 256 * 256 + block[i++] * 256 * 256 * 256;
// the PKZIP spec says that if bit 3 is set (0x0008), then the CRC, Compressed size, and uncompressed size
// come directly after the file data. The only way to find it is to scan the zip archive for the signature of
// the Data Descriptor, and presume that that signature does not appear in the (compressed) data of the compressed file.
if ((ze._BitField & 0x0008) != 0x0008)
{
ze._Crc32 = block[i++] + block[i++] * 256 + block[i++] * 256 * 256 + block[i++] * 256 * 256 * 256;
ze._CompressedSize = block[i++] + block[i++] * 256 + block[i++] * 256 * 256 + block[i++] * 256 * 256 * 256;
ze._UncompressedSize = block[i++] + block[i++] * 256 + block[i++] * 256 * 256 + block[i++] * 256 * 256 * 256;
}
else
{
// the CRC, compressed size, and uncompressed size are stored later in the stream.
// here, we advance the pointer.
i += 12;
}
Int16 filenameLength = (short)(block[i++] + block[i++] * 256);
Int16 extraFieldLength = (short)(block[i++] + block[i++] * 256);
block = new byte[filenameLength];
n = s.Read(block, 0, block.Length);
ze._FileName = Shared.StringFromBuffer(block, 0, block.Length);
ze._Extra = new byte[extraFieldLength];
n = s.Read(ze._Extra, 0, ze._Extra.Length);
// transform the time data into something usable
ze._LastModified = Shared.PackedToDateTime(ze._LastModDateTime);
// actually get the compressed size and CRC if necessary
if ((ze._BitField & 0x0008) == 0x0008)
{
long posn = s.Position;
long SizeOfDataRead = Shared.FindSignature(s, ZipEntryDataDescriptorSignature);
if (SizeOfDataRead == -1) return false;
// read 3x 4-byte fields (CRC, Compressed Size, Uncompressed Size)
block = new byte[12];
n = s.Read(block, 0, block.Length);
if (n != 12) return false;
i = 0;
ze._Crc32 = block[i++] + block[i++] * 256 + block[i++] * 256 * 256 + block[i++] * 256 * 256 * 256;
ze._CompressedSize = block[i++] + block[i++] * 256 + block[i++] * 256 * 256 + block[i++] * 256 * 256 * 256;
ze._UncompressedSize = block[i++] + block[i++] * 256 + block[i++] * 256 * 256 + block[i++] * 256 * 256 * 256;
if (SizeOfDataRead != ze._CompressedSize)
throw new Exception("Data format error (bit 3 is set)");
// seek back to previous position, to read file data
s.Seek(posn, System.IO.SeekOrigin.Begin);
}
return true;
}
private static bool SignatureIsNotValid(int signature)
{
return (signature != ZipEntrySignature);
}
public static ZipEntry Read(System.IO.Stream s)
{
ZipEntry entry = new ZipEntry();
if (!ReadHeader(s, entry)) return null;
entry.__filedata = new byte[entry._CompressedSize];
int n = s.Read(entry._FileData, 0, entry._FileData.Length);
if (n != entry._FileData.Length)
{
throw new Exception("badly formatted zip file.");
}
// finally, seek past the (already read) Data descriptor if necessary
if ((entry._BitField & 0x0008) == 0x0008)
{
s.Seek(16, System.IO.SeekOrigin.Current);
}
return entry;
}
public void Extract(System.IO.Stream s)
{
using (System.IO.MemoryStream memstream = new System.IO.MemoryStream(_FileData))
{
System.IO.Stream input = null;
try
{
if (this._CompressedSize == this._UncompressedSize)
{
input = memstream;
}
else
{
input = new System.IO.Compression.DeflateStream(memstream, System.IO.Compression.CompressionMode.Decompress);
}
System.IO.Stream output = null;
try
{
output = s;
byte[] bytes = new byte[4096];
int n;
n = 1; // anything non-zero
while (n != 0)
{
n = input.Read(bytes, 0, bytes.Length);
if (n > 0)
{
output.Write(bytes, 0, n);
}
}
}
finally
{
// we only close the output stream if we opened it.
if (output != null)
{
output.Close();
output.Dispose();
}
}
}
finally
{
// we only close the output stream if we opened it.
// we cannot use using() here because in some cases we do not want to Dispose the stream!
if ((input != null) && (input != memstream))
{
input.Close();
input.Dispose();
}
}
}
}
}
class Shared
{
protected internal static string StringFromBuffer(byte[] buf, int start, int maxlength)
{
int i;
char[] c = new char[maxlength];
for (i = 0; (i < maxlength) && (i < buf.Length) && (buf[i] != 0); i++)
{
c[i] = (char)buf[i]; // System.BitConverter.ToChar(buf, start+i*2);
}
string s = new System.String(c, 0, i);
return s;
}
protected internal static int ReadSignature(System.IO.Stream s)
{
int n = 0;
byte[] sig = new byte[4];
n = s.Read(sig, 0, sig.Length);
if (n != sig.Length) throw new Exception("Could not read signature - no data!");
int signature = (((sig[3] * 256 + sig[2]) * 256) + sig[1]) * 256 + sig[0];
return signature;
}
protected internal static long FindSignature(System.IO.Stream s, int SignatureToFind)
{
long startingPosition = s.Position;
int BATCH_SIZE = 1024;
byte[] targetBytes = new byte[4];
targetBytes[0] = (byte)(SignatureToFind >> 24);
targetBytes[1] = (byte)((SignatureToFind & 0x00FF0000) >> 16);
targetBytes[2] = (byte)((SignatureToFind & 0x0000FF00) >> 8);
targetBytes[3] = (byte)(SignatureToFind & 0x000000FF);
byte[] batch = new byte[BATCH_SIZE];
int n = 0;
bool success = false;
do
{
n = s.Read(batch, 0, batch.Length);
if (n != 0)
{
for (int i = 0; i < n; i++)
{
if (batch[i] == targetBytes[3])
{
s.Seek(i - n, System.IO.SeekOrigin.Current);
int sig = ReadSignature(s);
success = (sig == SignatureToFind);
if (!success) s.Seek(-3, System.IO.SeekOrigin.Current);
break; // out of for loop
}
}
}
else break;
if (success) break;
} while (true);
if (!success)
{
s.Seek(startingPosition, System.IO.SeekOrigin.Begin);
return -1; // or throw?
}
// subtract 4 for the signature.
long bytesRead = (s.Position - startingPosition) - 4;
// number of bytes read, should be the same as compressed size of file
return bytesRead;
}
protected internal static DateTime PackedToDateTime(Int32 packedDateTime)
{
Int16 packedTime = (Int16)(packedDateTime & 0x0000ffff);
Int16 packedDate = (Int16)((packedDateTime & 0xffff0000) >> 16);
int year = 1980 + ((packedDate & 0xFE00) >> 9);
int month = (packedDate & 0x01E0) >> 5;
int day = packedDate & 0x001F;
int hour = (packedTime & 0xF800) >> 11;
int minute = (packedTime & 0x07E0) >> 5;
int second = packedTime & 0x001F;
DateTime d = System.DateTime.Now;
try { d = new System.DateTime(year, month, day, hour, minute, second, 0); }
catch
{
Console.Write("\nInvalid date/time?:\nyear: {0} ", year);
Console.Write("month: {0} ", month);
Console.WriteLine("day: {0} ", day);
Console.WriteLine("HH:MM:SS= {0}:{1}:{2}", hour, minute, second);
}
return d;
}
protected internal static Int32 DateTimeToPacked(DateTime time)
{
UInt16 packedDate = (UInt16)((time.Day & 0x0000001F) | ((time.Month << 5) & 0x000001E0) | (((time.Year - 1980) << 9) & 0x0000FE00));
UInt16 packedTime = (UInt16)((time.Second & 0x0000001F) | ((time.Minute << 5) & 0x000007E0) | ((time.Hour << 11) & 0x0000F800));
return (Int32)(((UInt32)(packedDate << 16)) | packedTime);
}
}
}

113
trunk/EditForm.Designer.cs generated Normal file
View file

@ -0,0 +1,113 @@
namespace LSLEditor
{
partial class EditForm
{
/// <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.tabControl1 = new System.Windows.Forms.TabControl();
this.tabPage1 = new System.Windows.Forms.TabPage();
this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components);
this.disableCompilesyntaxCheckToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.numberedTextBoxUC1 = new NumberedTextBox.NumberedTextBoxUC();
this.tabControl1.SuspendLayout();
this.tabPage1.SuspendLayout();
this.contextMenuStrip1.SuspendLayout();
this.SuspendLayout();
//
// tabControl1
//
this.tabControl1.ContextMenuStrip = this.contextMenuStrip1;
this.tabControl1.Controls.Add(this.tabPage1);
this.tabControl1.Dock = System.Windows.Forms.DockStyle.Fill;
this.tabControl1.Location = new System.Drawing.Point(0, 0);
this.tabControl1.Name = "tabControl1";
this.tabControl1.SelectedIndex = 0;
this.tabControl1.Size = new System.Drawing.Size(551, 323);
this.tabControl1.TabIndex = 1;
this.tabControl1.SelectedIndexChanged += new System.EventHandler(this.tabControl1_SelectedIndexChanged);
//
// tabPage1
//
this.tabPage1.Controls.Add(this.numberedTextBoxUC1);
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(543, 297);
this.tabPage1.TabIndex = 0;
this.tabPage1.Text = "Script";
this.tabPage1.UseVisualStyleBackColor = true;
//
// contextMenuStrip1
//
this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.disableCompilesyntaxCheckToolStripMenuItem});
this.contextMenuStrip1.Name = "contextMenuStrip1";
this.contextMenuStrip1.Size = new System.Drawing.Size(225, 26);
//
// disableCompilesyntaxCheckToolStripMenuItem
//
this.disableCompilesyntaxCheckToolStripMenuItem.Name = "disableCompilesyntaxCheckToolStripMenuItem";
this.disableCompilesyntaxCheckToolStripMenuItem.Size = new System.Drawing.Size(224, 22);
this.disableCompilesyntaxCheckToolStripMenuItem.Text = "Disable compile/syntax check";
this.disableCompilesyntaxCheckToolStripMenuItem.Click += new System.EventHandler(this.disableCompilesyntaxCheckToolStripMenuItem_Click);
//
// numberedTextBoxUC1
//
this.numberedTextBoxUC1.Dock = System.Windows.Forms.DockStyle.Fill;
this.numberedTextBoxUC1.Location = new System.Drawing.Point(3, 3);
this.numberedTextBoxUC1.Name = "numberedTextBoxUC1";
this.numberedTextBoxUC1.Size = new System.Drawing.Size(537, 291);
this.numberedTextBoxUC1.TabIndex = 4;
//
// EditForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(551, 323);
this.Controls.Add(this.tabControl1);
this.Name = "EditForm";
this.Text = "EditForm";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.EditForm_FormClosing);
this.tabControl1.ResumeLayout(false);
this.tabPage1.ResumeLayout(false);
this.contextMenuStrip1.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.TabControl tabControl1;
private System.Windows.Forms.TabPage tabPage1;
private NumberedTextBox.NumberedTextBoxUC numberedTextBoxUC1;
private System.Windows.Forms.ContextMenuStrip contextMenuStrip1;
private System.Windows.Forms.ToolStripMenuItem disableCompilesyntaxCheckToolStripMenuItem;
}
}

449
trunk/EditForm.cs Normal file
View file

@ -0,0 +1,449 @@
// /**
// ********
// *
// * ORIGIONAL CODE BASE IS Copyright (C) 2006-2010 by Alphons van der Heijden
// * The code was donated on 4/28/2010 by Alphons van der Heijden
// * To Brandon'Dimentox Travanti' Husbands & Malcolm J. Kudra which in turn Liscense under the GPLv2.
// * In agreement to Alphons van der Heijden 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 all
// * copies or substantial portions of the Software.
// *
// ********
// */
using System;
using System.IO;
using System.Xml;
using System.Drawing;
using System.Windows.Forms;
using LSLEditor.Helpers;
namespace LSLEditor
{
public partial class EditForm : Form
{
public RuntimeConsole runtime;
private string m_FullPathName;
private Guid m_Guid;
public LSLEditorForm parent;
private const int WM_NCACTIVATE = 0x0086;
protected override void WndProc(ref Message m)
{
if (m.Msg == WM_NCACTIVATE)
{
if (m.LParam != IntPtr.Zero)
{
m.WParam = new IntPtr(1);
}
else
{
this.numberedTextBoxUC1.TextBox.MakeAllInvis();
}
}
try { base.WndProc(ref m); } catch {}
}
public SyntaxRichTextBox TextBox
{
get
{
return this.numberedTextBoxUC1.TextBox;
}
}
public XmlDocument ConfLSL
{
get
{
return this.parent.ConfLSL;
}
}
public XmlDocument ConfCSharp
{
get
{
return this.parent.ConfCSharp;
}
}
public Guid guid
{
get
{
return m_Guid;
}
set
{
this.m_Guid = value;
}
}
public bool IsScript
{
get
{
return this.TextBox.ToolTipping;
}
set
{
if(value)
this.tabPage1.Text = "Script";
else
this.tabPage1.Text = "Text";
this.TextBox.ToolTipping = value;
}
}
public EditForm(LSLEditorForm lslEditorForm)
{
InitializeComponent();
this.guid = new Guid();
this.components = new System.ComponentModel.Container();
this.Icon = lslEditorForm.Icon;
this.parent = lslEditorForm;
this.numberedTextBoxUC1.TextBox.Init(this.parent, this.parent.ConfLSL);
this.numberedTextBoxUC1.TextBox.OnDirtyChanged += new IsDirtyHandler(TextBox_OnDirtyChanged);
this.Move += new EventHandler(EditForm_Position);
this.Resize += new EventHandler(EditForm_Position);
this.Layout += new LayoutEventHandler(EditForm_Layout);
SetFont();
}
public void SetFont()
{
this.numberedTextBoxUC1.Font = Properties.Settings.Default.FontEditor;
}
void EditForm_Layout(object sender, LayoutEventArgs e)
{
if (this.WindowState == FormWindowState.Minimized)
this.numberedTextBoxUC1.TextBox.MakeAllInvis();
}
void EditForm_Position(object sender, EventArgs e)
{
this.numberedTextBoxUC1.TextBox.SetPosition(this.MdiParent.RectangleToScreen(this.MdiParent.ClientRectangle));
}
void TextBox_OnDirtyChanged(object sender, EventArgs e)
{
this.Text = this.ScriptName;
if (this.numberedTextBoxUC1.TextBox.Dirty)
this.Text = this.Text.Trim()+"* ";
else
this.Text = this.Text.Trim()+" ";
TabPage tabPage = this.Tag as TabPage;
if (tabPage != null)
tabPage.Text = this.Text;
this.parent.OnDirtyChanged(this.numberedTextBoxUC1.TextBox.Dirty);
}
private void exitToolStripMenuItem_Click(object sender, EventArgs e)
{
this.Close();
}
public string FullPathName
{
get
{
return this.m_FullPathName;
}
set
{
this.m_FullPathName = value;
string strDirectory = Path.GetDirectoryName(this.m_FullPathName);
if (Directory.Exists(strDirectory))
{
Properties.Settings.Default.WorkingDirectory = strDirectory;
}
else
{
if(!Directory.Exists(Properties.Settings.Default.WorkingDirectory))
Properties.Settings.Default.WorkingDirectory = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
this.m_FullPathName = Path.Combine(Properties.Settings.Default.WorkingDirectory, this.m_FullPathName);
}
this.Text = this.ScriptName;
TabPage tabPage = this.Tag as TabPage;
if (tabPage != null)
tabPage.Text = this.Text + " ";
}
}
public string ScriptName
{
get
{
return Path.GetFileName(this.m_FullPathName);
}
}
public string ProjectName
{
get
{
return parent.SolutionExplorer.GetProjectName(this.guid);
}
}
public string SourceCode
{
get
{
return this.numberedTextBoxUC1.TextBox.Text;
}
set
{
this.numberedTextBoxUC1.TextBox.Text = value;
}
}
private int PercentageIndentTab()
{
int intSpaces = 0;
int intTabs = 0;
StringReader sr = new StringReader(this.TextBox.Text);
while (true)
{
string strLine = sr.ReadLine();
if (strLine == null)
break;
if (strLine.Length == 0)
continue;
if (strLine[0] == ' ')
intSpaces++;
else if (strLine[0] == '\t')
intTabs++;
}
if (intTabs == 0 && intSpaces==0)
return 50;
return (int)Math.Round((100.0 * intTabs) / (intTabs + intSpaces));
}
public void LoadFile(string strPath)
{
if(strPath.StartsWith("http://"))
this.FullPathName = Path.GetFileName(strPath);
else
this.FullPathName = strPath;
this.numberedTextBoxUC1.TextBox.LoadFile(strPath);
if (!this.IsScript)
return;
if (Properties.Settings.Default.IndentAutoCorrect)
{
this.TextBox.FormatDocument();
this.TextBox.ClearUndoStack();
}
else
{
if (Properties.Settings.Default.IndentWarning)
{
if ((PercentageIndentTab() > 50 && Properties.Settings.Default.SL4SpacesIndent) ||
(PercentageIndentTab() < 50 && !Properties.Settings.Default.SL4SpacesIndent))
{
if (MessageBox.Show("Indent scheme differs from settings\nDo you want to correct it?\nIt can also be corrected by pressing Ctrl-D or turn on Autocorrection (tools menu)", "Indent Warning!!", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) == DialogResult.OK)
{
this.TextBox.FormatDocument();
//this.TextBox.ClearUndoStack();
}
}
}
}
}
public void SaveCurrentFile(string strPath)
{
this.FullPathName = strPath;
this.numberedTextBoxUC1.TextBox.SaveCurrentFile(strPath);
}
public void SaveCurrentFile()
{
this.numberedTextBoxUC1.TextBox.SaveCurrentFile(this.FullPathName);
}
public bool Dirty
{
get
{
return this.numberedTextBoxUC1.TextBox.Dirty;
}
set
{
this.numberedTextBoxUC1.TextBox.Dirty = value;
}
}
public TabControl tabControl
{
get
{
return this.tabControl1;
}
}
public void SetFocus()
{
this.numberedTextBoxUC1.TextBox.Focus();
}
public void StopCompiler()
{
this.numberedTextBoxUC1.TextBox.MakeAllInvis();
if (runtime != null)
{
this.components.Remove(runtime);
if (!runtime.IsDisposed)
runtime.Dispose();
runtime = null;
}
for (int intI = this.tabControl1.TabPages.Count - 1; intI > 0; intI--)
{
this.tabControl1.TabPages.RemoveAt(intI);
}
}
public SecondLifeHost.SecondLifeHostChatHandler ChatHandler;
public SecondLifeHost.SecondLifeHostMessageLinkedHandler MessageLinkedHandler;
public bool StartCompiler()
{
if (this.disableCompilesyntaxCheckToolStripMenuItem.Checked)
return false;
if (!this.IsScript)
return false;
StopCompiler();
if (this.parent == null)
return false;
runtime = new RuntimeConsole(this.parent);
// for disposing
this.components.Add(runtime);
if (!runtime.Compile(this))
{
this.tabControl1.SelectedIndex = 0;
return false;
}
TabPage tabPage = new TabPage("Debug");
tabPage.Controls.Add(runtime);
this.tabControl1.TabPages.Add(tabPage);
this.tabControl1.SelectedIndex = 1;
return true;
}
public bool SyntaxCheck()
{
if (this.disableCompilesyntaxCheckToolStripMenuItem.Checked)
return false;
if (!this.IsScript)
return false;
LSL2CSharp translator = new LSL2CSharp(ConfLSL);
string strCSharp = translator.Parse(SourceCode);
if (System.Diagnostics.Debugger.IsAttached)
{
for (int intI = this.tabControl1.TabPages.Count - 1; intI > 0; intI--)
{
this.tabControl1.TabPages.RemoveAt(intI);
}
// TODO
TabPage tabPage = new TabPage("C#");
NumberedTextBox.NumberedTextBoxUC numberedTextBoxUC1 = new NumberedTextBox.NumberedTextBoxUC();
numberedTextBoxUC1.TextBox.Init(null, this.ConfCSharp);
numberedTextBoxUC1.TextBox.Text = strCSharp;
numberedTextBoxUC1.TextBox.ReadOnly = true;
numberedTextBoxUC1.Dock = DockStyle.Fill;
tabPage.Controls.Add(numberedTextBoxUC1);
this.tabControl.TabPages.Add(tabPage);
}
return (null != CompilerHelper.CompileCSharp(this, strCSharp));
}
public int Find(string strSearch, int intStart, int intEnd, RichTextBoxFinds options)
{
intStart = this.numberedTextBoxUC1.TextBox.Find(strSearch, intStart, intEnd, options);
this.numberedTextBoxUC1.TextBox.Focus();
return intStart;
}
private void tabControl1_SelectedIndexChanged(object sender, EventArgs e)
{
this.numberedTextBoxUC1.TextBox.MakeAllInvis();
}
private void EditForm_FormClosing(object sender, FormClosingEventArgs e)
{
this.parent.CancelClosing = false;
if (this.Dirty)
{
DialogResult dialogResult = MessageBox.Show(this, @"Save """ + this.ScriptName + @"""?", "File has changed", MessageBoxButtons.YesNoCancel);
if (dialogResult == DialogResult.Yes)
e.Cancel = this.parent.SaveFile(this,false);
else
e.Cancel = (dialogResult == DialogResult.Cancel);
}
this.parent.CancelClosing = e.Cancel;
}
private void disableCompilesyntaxCheckToolStripMenuItem_Click(object sender, EventArgs e)
{
this.disableCompilesyntaxCheckToolStripMenuItem.Checked = !this.disableCompilesyntaxCheckToolStripMenuItem.Checked;
}
}
}

126
trunk/EditForm.resx Normal file
View file

@ -0,0 +1,126 @@
<?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>17, 17</value>
</metadata>
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>37</value>
</metadata>
</root>

36
trunk/Editor/GListBox.Designer.cs generated Normal file
View file

@ -0,0 +1,36 @@
namespace LSLEditor
{
partial class GListBox
{
/// <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 Component 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()
{
components = new System.ComponentModel.Container();
}
#endregion
}
}

152
trunk/Editor/GListBox.cs Normal file
View file

@ -0,0 +1,152 @@
// /**
// ********
// *
// * ORIGIONAL CODE BASE IS Copyright (C) 2006-2010 by Alphons van der Heijden
// * The code was donated on 4/28/2010 by Alphons van der Heijden
// * To Brandon'Dimentox Travanti' Husbands & Malcolm J. Kudra which in turn Liscense under the GPLv2.
// * In agreement to Alphons van der Heijden 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 all
// * copies or substantial portions of the Software.
// *
// ********
// */
using System;
using System.Drawing;
using System.Windows.Forms;
using System.ComponentModel;
namespace LSLEditor
{
public partial class GListBox : ListBox
{
public ImageList ImageList;
public GListBox(IContainer container)
{
container.Add(this);
InitializeComponent();
// Set owner draw mode
this.DrawMode = DrawMode.OwnerDrawFixed;
this.ImageList = new ImageList();
}
public GListBox()
{
InitializeComponent();
// Set owner draw mode
this.DrawMode = DrawMode.OwnerDrawFixed;
this.ImageList = new ImageList();
}
protected override void OnDrawItem(DrawItemEventArgs e)
{
try
{
GListBoxItem item;
Rectangle bounds = new Rectangle(e.Bounds.X + e.Bounds.Height, e.Bounds.Y, e.Bounds.Width - e.Bounds.Height - 1, e.Bounds.Height);
item = (GListBoxItem)Items[e.Index];
if (item.ImageIndex != -1)
{
e.Graphics.FillRectangle(new SolidBrush(this.BackColor), bounds);
if ((e.State & DrawItemState.Selected) == DrawItemState.Selected)
e.Graphics.FillRectangle(SystemBrushes.Highlight, bounds);
e.Graphics.DrawImage(ImageList.Images[item.ImageIndex], bounds.Left - bounds.Height, bounds.Top, bounds.Height, bounds.Height);
e.Graphics.DrawString(item.Text, e.Font, new SolidBrush(e.ForeColor),
bounds.Left, bounds.Top);
}
else
{
e.Graphics.DrawString(item.Text, e.Font, new SolidBrush(e.ForeColor),
bounds.Left, bounds.Top);
}
}
catch
{
e.DrawBackground();
e.DrawFocusRectangle();
if (e.Index != -1)
{
try
{
e.Graphics.DrawString(Items[e.Index].ToString(), e.Font,
new SolidBrush(e.ForeColor), e.Bounds.Left, e.Bounds.Top);
}
catch
{
}
}
else
{
e.Graphics.DrawString(Text, e.Font, new SolidBrush(e.ForeColor),
e.Bounds.Left, e.Bounds.Top);
}
}
base.OnDrawItem(e);
}
}//End of GListBox class
// GListBoxItem class
public class GListBoxItem
{
private string _myText;
private int _myImageIndex;
// properties
public string Text
{
get { return _myText; }
set { _myText = value; }
}
public int ImageIndex
{
get { return _myImageIndex; }
set { _myImageIndex = value; }
}
//constructor
public GListBoxItem(string text, int index)
{
_myText = text;
_myImageIndex = index;
}
public GListBoxItem(string text) : this(text, -1) { }
public GListBoxItem() : this("") { }
public override string ToString()
{
return _myText;
}
}//End of GListBoxItem class
}

64
trunk/Editor/GListBoxWindow.Designer.cs generated Normal file
View file

@ -0,0 +1,64 @@
namespace LSLEditor
{
partial class GListBoxWindow
{
/// <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.gListBox1 = new LSLEditor.GListBox(this.components);
this.SuspendLayout();
//
// gListBox1
//
this.gListBox1.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed;
this.gListBox1.FormattingEnabled = true;
this.gListBox1.Location = new System.Drawing.Point(0, 0);
this.gListBox1.Name = "gListBox1";
this.gListBox1.Size = new System.Drawing.Size(192, 134);
this.gListBox1.TabIndex = 0;
this.gListBox1.Resize += new System.EventHandler(this.gListBox1_Resize);
//
// GListBoxWindow
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(212, 156);
this.Controls.Add(this.gListBox1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.Name = "GListBoxWindow";
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
this.Text = "GListBoxWindow";
this.ResumeLayout(false);
}
#endregion
private GListBox gListBox1;
}
}

View file

@ -0,0 +1,177 @@
// /**
// ********
// *
// * ORIGIONAL CODE BASE IS Copyright (C) 2006-2010 by Alphons van der Heijden
// * The code was donated on 4/28/2010 by Alphons van der Heijden
// * To Brandon'Dimentox Travanti' Husbands & Malcolm J. Kudra which in turn Liscense under the GPLv2.
// * In agreement to Alphons van der Heijden 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 all
// * copies or substantial portions of the Software.
// *
// ********
// */
using System;
using System.Drawing;
using System.ComponentModel;
using System.Windows.Forms;
namespace LSLEditor
{
public partial class GListBoxWindow : Form
{
public GListBox GListBox
{
get
{
return this.gListBox1;
}
}
public GListBoxItem Selected
{
get
{
return (GListBoxItem)this.gListBox1.Items[this.gListBox1.SelectedIndex];
}
}
public GListBoxWindow(Form parent)
{
InitializeComponent();
this.Owner = parent;
this.GListBox.Cursor = Cursors.Arrow;
this.GListBox.Sorted = true;
this.FontChanged += new EventHandler(GListBoxWindow_FontChanged);
}
void GListBoxWindow_FontChanged(object sender, EventArgs e)
{
this.GListBox.ItemHeight = 2 + (int)LSLEditor.Helpers.Measure.MeasureDisplayString(this.GListBox, "M", this.Font).Height;
}
public void KeyDownHandler(KeyEventArgs e)
{
if (!this.Visible)
return;
if (e.KeyCode == Keys.Enter)
{
// cancel richttext enter if listbox shows
e.Handled = true;
}
if (e.KeyCode == Keys.Down)
{
this.gListBox1.SelectedIndex = Math.Min(this.gListBox1.Items.Count - 1, this.gListBox1.SelectedIndex + 1);
e.Handled = true;
}
if (e.KeyCode == Keys.Up)
{
this.gListBox1.SelectedIndex = Math.Max(0, this.gListBox1.SelectedIndex - 1);
e.Handled = true;
}
if (e.KeyCode == Keys.PageUp)
{
this.gListBox1.SelectedIndex = Math.Max(0,this.gListBox1.SelectedIndex - 10);
e.Handled = true;
}
if (e.KeyCode == Keys.PageDown)
{
this.gListBox1.SelectedIndex = Math.Min(this.gListBox1.Items.Count - 1, this.gListBox1.SelectedIndex + 10);
e.Handled = true;
}
}
public void SetPosition(Rectangle rect,RichTextBox RichTextBox)
{
//Rectangle rect = Screen.PrimaryScreen.WorkingArea;
Point p = RichTextBox.GetPositionFromCharIndex(RichTextBox.SelectionStart);
p = new Point(p.X - 20, p.Y + this.gListBox1.ItemHeight); // ItemHeight = exact line height
Rectangle client = RichTextBox.ClientRectangle;
if (p.X < (client.Left-20) || p.Y < client.Top || p.X > client.Width || p.Y > client.Height)
{
this.Visible = false;
return;
}
Point screen = RichTextBox.PointToScreen(p);
//if ((screen.Y + this.Height) > rect.Height)
// screen = RichTextBox.PointToScreen(new Point(p.X - 20 + this.XOffset, p.Y - this.Height));
if (screen.Y > rect.Bottom)
{
this.Visible = false;
return;
//screen.Y = rect.Bottom;
}
if (screen.X > rect.Right)
{
this.Visible = false;
return;
//screen.X = rect.Right;
}
if (screen.X < rect.Left)
{
this.Visible = false;
return;
//screen.X = rect.Left;
}
if ((screen.Y) < rect.Top)
{
this.Visible = false;
return;
//screen.Y = rect.Top;
}
this.Location = screen;
}
private void gListBox1_Resize(object sender, EventArgs e)
{
this.Size = this.gListBox1.Size;
}
}
}

View file

@ -0,0 +1,120 @@
<?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>
</root>

410
trunk/Editor/KeyWords.cs Normal file
View file

@ -0,0 +1,410 @@
// /**
// ********
// *
// * ORIGIONAL CODE BASE IS Copyright (C) 2006-2010 by Alphons van der Heijden
// * The code was donated on 4/28/2010 by Alphons van der Heijden
// * To Brandon'Dimentox Travanti' Husbands & Malcolm J. Kudra which in turn Liscense under the GPLv2.
// * In agreement to Alphons van der Heijden 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 all
// * copies or substantial portions of the Software.
// *
// ********
// */
using System;
using System.IO;
using System.Drawing;
using System.Xml;
using System.Text;
using System.Collections;
using System.Collections.Generic;
using System.Text.RegularExpressions;
namespace LSLEditor
{
public enum KeyWordTypeEnum : int
{
Unknown = 0,
Functions = 1,
Events = 2,
Constants = 3,
Class = 4,
Vars = 5,
Properties = 6
}
public struct KeyWordInfo
{
public KeyWordTypeEnum type;
public string name;
public Color color;
public KeyWordInfo(KeyWordTypeEnum type, string name, Color color)
{
this.type = type;
this.name = name;
this.color = color;
}
}
class KeyWords
{
private ArrayList m_RegexColorList;
private Regex m_regexSplitter;
private Hashtable m_KeyWordColorList;
private XmlDocument xml;
private void MakeSplitter(string strRegexSplitter)
{
m_regexSplitter = new Regex(
@"\s*(" + strRegexSplitter + @"|\w+|.)",
RegexOptions.IgnorePatternWhitespace
| RegexOptions.Compiled
);
}
private struct RegexColor
{
public Regex regex;
public Color color;
public RegexColor(string strRegex, Color color)
{
this.regex = new Regex(strRegex,
RegexOptions.IgnorePatternWhitespace
| RegexOptions.Compiled
);
this.color = color;
}
}
public KeyWords(string ColorScheme, XmlDocument xml)
{
this.m_RegexColorList = new ArrayList();
this.m_KeyWordColorList = new Hashtable();
this.xml = xml;
string strRegexSplitter = "";
foreach (XmlNode words in xml.SelectNodes("//Words"))
{
Color color = Color.FromArgb(int.Parse(words.Attributes[ColorScheme].InnerText.Replace("#", ""), System.Globalization.NumberStyles.HexNumber));
KeyWordTypeEnum type = KeyWordTypeEnum.Unknown;
if (words.Attributes["icon"] != null)
{
switch (words.Attributes["icon"].InnerText)
{
case "Functions":
type = KeyWordTypeEnum.Functions;
break;
case "Events":
type = KeyWordTypeEnum.Events;
break;
case "Constants":
type = KeyWordTypeEnum.Constants;
break;
case "Class":
type = KeyWordTypeEnum.Class;
break;
case "Vars":
type = KeyWordTypeEnum.Vars;
break;
case "Enum":
if (!Properties.Settings.Default.CodeCompletionAnimation)
continue;
type = KeyWordTypeEnum.Properties;
break;
default:
type = KeyWordTypeEnum.Unknown;
break;
}
}
foreach (XmlNode word in words.SelectNodes(".//Word"))
{
if (word.Attributes["name"].InnerText == "regex")
{
string strRegex = word.InnerText;
AddRegex(strRegex, color);
if (strRegexSplitter != "")
strRegexSplitter += "|";
strRegexSplitter += strRegex;
}
else
{
AddKeyword(type, word.Attributes["name"].InnerText, color);
}
}
}
MakeSplitter(strRegexSplitter);
}
private void AddRegex(string strRegex, Color color)
{
m_RegexColorList.Add(new RegexColor(strRegex, color));
}
private void AddKeyword(KeyWordTypeEnum type, string name, Color color)
{
m_KeyWordColorList.Add(name, new KeyWordInfo(type, name, color));
}
public Color GetColorFromRegex(string strKeyWord)
{
// specials
Color color = Color.Black;
foreach (RegexColor regexColor in m_RegexColorList)
{
Match mm = regexColor.regex.Match(strKeyWord);
if (mm.Success)
{
// must be exact match
if (mm.Index != 0)
continue;
color = regexColor.color;
break;
}
}
return color;
}
public KeyWordInfo GetKeyWordInfo(string strWord)
{
return (KeyWordInfo)this.m_KeyWordColorList[strWord];
}
public bool ContainsKeyWord(string strWord)
{
return m_KeyWordColorList.ContainsKey(strWord);
}
public Color GetColorFromKeyWordList(string strKeyWord)
{
if (ContainsKeyWord(strKeyWord))
return GetKeyWordInfo(strKeyWord).color;
else
return Color.Black;
}
public MatchCollection Matches(string strLine)
{
return m_regexSplitter.Matches(strLine);
}
public List<KeyWordInfo> KeyWordSearch(string strKeyWord, bool IsRegularExpression)
{
List<KeyWordInfo> list = new List<KeyWordInfo>();
string strLowerCaseKeyWord = strKeyWord.ToLower();
int intLen = strLowerCaseKeyWord.Length;
foreach (string strKey in m_KeyWordColorList.Keys)
{
if (IsRegularExpression)
{
if(new Regex("^"+strKeyWord+"$").Match(strKey).Success)
list.Add(GetKeyWordInfo(strKey));
}
else
{
if (strKey.Length < intLen)
continue;
if (strKey.Substring(0, intLen).ToLower() == strLowerCaseKeyWord)
list.Add(GetKeyWordInfo(strKey));
}
}
return list;
}
public string GetDescription(string strKeyWord)
{
if(ContainsKeyWord(strKeyWord))
{
XmlNode xmlNode = xml.SelectSingleNode("//Word[@name='"+strKeyWord+"']");
if(xmlNode!=null)
{
if (xmlNode.ChildNodes.Count == 0)
return "";
string strText = xmlNode.InnerXml;
if (strText == "")
return strKeyWord;
else
{
int intArgument = strText.IndexOf("<Argument");
if (intArgument > 0)
strText = strText.Substring(0, intArgument);
StringBuilder sb = new StringBuilder();
StringReader sr = new StringReader(strText);
while (true)
{
string strLine = sr.ReadLine();
if (strLine == null)
break;
sb.AppendLine(strLine.Trim());
}
return sb.ToString();
}
}
}
return "";
}
private string MakeArgumentBold(string strText, int intArgument)
{
Regex regex = new Regex(
@"(?<prefix>[^(]* \( )
(?:
(?<argument> [^,\)]*) (?"
+ @"<seperator>[\,\)])+
)*
(?<postfix>.*)
",
RegexOptions.IgnorePatternWhitespace);
Match match = regex.Match(strText);
StringBuilder sb = new StringBuilder();
sb.Append(match.Groups["prefix"].Value);
for (int intI = 0; intI < match.Groups["argument"].Captures.Count; intI++)
{
if (intI == intArgument)
{
sb.Append(@"<b><font color=""red"">");
sb.Append(match.Groups["argument"].Captures[intI].Value);
sb.Append("</font></b>");
}
else
{
sb.Append(match.Groups["argument"].Captures[intI].Value);
}
sb.Append(match.Groups["seperator"].Captures[intI].Value);
}
sb.Append(match.Groups["postfix"].Value);
sb.Append('\n');
return sb.ToString();
}
private string GetFirstLineOfKeyWord(string strWord, out XmlNode xmlNode)
{
xmlNode = null;
if (!ContainsKeyWord(strWord))
return "";
xmlNode = xml.SelectSingleNode("//Word[@name='" + strWord + "']");
if (xmlNode == null)
return "";
if (xmlNode.ChildNodes.Count == 0)
return "";
string strText = xmlNode.ChildNodes[0].InnerText;
if (strText == "")
return "";
strText = strText.TrimStart();
int intI = strText.IndexOf("\r");
if (intI > 0)
strText = strText.Substring(0, intI);
return strText;
}
public int GetNumberOfArguments(string strWord)
{
XmlNode xmlNode;
string strFirstLine = GetFirstLineOfKeyWord(strWord, out xmlNode);
if (strFirstLine == "")
return -1;
Regex regex = new Regex(
@"(?<prefix>[^(]* \( )
(?:
(?<argument> [^,\)]*) (?"
+ @"<seperator>[\,\)])+
)*
(?<postfix>.*)
",
RegexOptions.IgnorePatternWhitespace);
Match match = regex.Match(strFirstLine);
// nr not 1, return nr
int intNr = match.Groups["argument"].Captures.Count;
if(intNr != 1)
return intNr;
// nr = 1 can be void, returns also 0
if(match.Groups["argument"].Captures[0].Value == "void")
return 0;
// not void, return 1
return 1;
}
public string GetFunctionAndHiglightArgument(string strWord, int intArgument, out string strWild)
{
XmlNode xmlNode;
string strFirstLine = GetFirstLineOfKeyWord(strWord,out xmlNode);
strWild = "";
if (strFirstLine == "")
return "";
string strRichText = MakeArgumentBold(strFirstLine, intArgument);
if (xmlNode == null)
return strRichText;
XmlNodeList nodeList = xmlNode.SelectNodes("./Argument");
if (intArgument < nodeList.Count)
{
XmlNode xmlNodeArgument = nodeList[intArgument];
if(xmlNodeArgument.Attributes["wild"]!=null)
strWild = xmlNodeArgument.Attributes["wild"].Value;
string strName = xmlNodeArgument.Attributes["name"].Value;
string strDescription = "\n" + @"<b><font color=""red"">" + strName + ":</font></b>";
strRichText += strDescription + " " + xmlNodeArgument.InnerText + "\n";
}
return strRichText;
}
public string GetEvent(string strEventName)
{
string strReturn = strEventName + "(";
XmlNode xmlNode;
string strFirstLine = GetFirstLineOfKeyWord(strEventName, out xmlNode);
if (strFirstLine == "")
return strReturn;
return strFirstLine.Replace(";", "").Replace("void", "");
}
}
}

View file

@ -0,0 +1,43 @@
// /**
// ********
// *
// * ORIGIONAL CODE BASE IS Copyright (C) 2006-2010 by Alphons van der Heijden
// * The code was donated on 4/28/2010 by Alphons van der Heijden
// * To Brandon'Dimentox Travanti' Husbands & Malcolm J. Kudra which in turn Liscense under the GPLv2.
// * In agreement to Alphons van der Heijden 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 all
// * copies or substantial portions of the Software.
// *
// ********
// */

37
trunk/Editor/Numbered.Designer.cs generated Normal file
View file

@ -0,0 +1,37 @@
namespace LSLEditor.Editor
{
partial class Numbered
{
/// <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 Component 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()
{
components = new System.ComponentModel.Container();
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
}
#endregion
}
}

142
trunk/Editor/Numbered.cs Normal file
View file

@ -0,0 +1,142 @@
// /**
// ********
// *
// * ORIGIONAL CODE BASE IS Copyright (C) 2006-2010 by Alphons van der Heijden
// * The code was donated on 4/28/2010 by Alphons van der Heijden
// * To Brandon'Dimentox Travanti' Husbands & Malcolm J. Kudra which in turn Liscense under the GPLv2.
// * In agreement to Alphons van der Heijden 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 all
// * copies or substantial portions of the Software.
// *
// ********
// */
using System;
using System.Drawing;
using System.Windows.Forms;
namespace LSLEditor.Editor
{
public partial class Numbered : UserControl
{
public RichTextBox richTextBox1;
private Brush brush;
public float LineHeight;
public Numbered()
{
InitializeComponent();
this.SetStyle(
ControlStyles.DoubleBuffer |
ControlStyles.UserPaint |
ControlStyles.AllPaintingInWmPaint,
true);
this.UpdateStyles();
brush = new SolidBrush(this.ForeColor);
LineHeight = 0.0F;
}
private void updateNumberLabel(PaintEventArgs e)
{
if (this.brush == null)
return;
if (this.ClientSize.Width <= 0 || this.ClientSize.Height <= 0)
return;
int delta = 0;
int firstLine = 0;
int lastLine = 10;
Font font = this.Font;
if (this.richTextBox1 == null)
{
LineHeight = 16.0F;
}
else
{
//we get index of first visible char and number of first visible line
Point pos = new Point(0, 0);
int firstIndex = this.richTextBox1.GetCharIndexFromPosition(pos);
firstLine = this.richTextBox1.GetLineFromCharIndex(firstIndex);
font = this.richTextBox1.Font;
if (LineHeight < 0.01)
{
if (this.richTextBox1.Lines.Length > 1)
{
Point pos1 = this.richTextBox1.GetPositionFromCharIndex(this.richTextBox1.GetFirstCharIndexFromLine(1));
LineHeight = pos1.Y;
}
}
lastLine = Math.Min(this.richTextBox1.Lines.Length, 2 + firstLine + (int)(this.richTextBox1.ClientRectangle.Height / LineHeight));
int intCharIndex = this.richTextBox1.GetCharIndexFromPosition(Point.Empty);
delta = 1 + this.richTextBox1.GetPositionFromCharIndex(intCharIndex).Y % font.Height;
}
// here we go
lastLine = Math.Max(lastLine, 1);
Graphics g = e.Graphics;
g.Clear(this.BackColor);
if(this.richTextBox1==null)
g.SetClip(new Rectangle(0, 0, this.Width, this.Height));
else
g.SetClip(new Rectangle(0, 0, this.Width, this.richTextBox1.ClientRectangle.Height));
for (int i = firstLine; i < lastLine; i++)
g.DrawString(string.Format("{0:0###}", i + 1), font, brush,
new PointF(0F, delta + (i - firstLine) * LineHeight) );
//g.DrawLine(new Pen(brush), backBuffer.Width - 1, 0, backBuffer.Width - 1, backBuffer.Height);
}
protected override void OnPaint(PaintEventArgs e)
{
updateNumberLabel(e);
}
protected override void OnPaintBackground(PaintEventArgs e)
{
//base.OnPaintBackground(e);
}
}
}

View file

@ -0,0 +1,83 @@
// /**
// ********
// *
// * ORIGIONAL CODE BASE IS Copyright (C) 2006-2010 by Alphons van der Heijden
// * The code was donated on 4/28/2010 by Alphons van der Heijden
// * To Brandon'Dimentox Travanti' Husbands & Malcolm J. Kudra which in turn Liscense under the GPLv2.
// * In agreement to Alphons van der Heijden 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 all
// * copies or substantial portions of the Software.
// *
// ********
// */
using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
namespace NumberedTextBox
{
public partial class NumberedTextBoxUC : UserControl
{
public NumberedTextBoxUC()
{
InitializeComponent();
this.numbered1.richTextBox1 = this.syntaxRichTextBox1;
this.syntaxRichTextBox1.OnPaintNumbers += new EventHandler(syntaxRichTextBox1_OnPaintNumbers);
this.FontChanged += new EventHandler(NumberedTextBoxUC_FontChanged);
}
void NumberedTextBoxUC_FontChanged(object sender, EventArgs e)
{
this.numbered1.LineHeight = 0.0F; // reset!!
RectangleF rect = LSLEditor.Helpers.Measure.MeasureDisplayString(this.syntaxRichTextBox1, "M", this.Font);
this.splitContainer1.SplitterDistance = (int)(4 * rect.Width + 5.0);
}
void syntaxRichTextBox1_OnPaintNumbers(object sender, EventArgs e)
{
this.numbered1.Invalidate();
}
public LSLEditor.SyntaxRichTextBox TextBox
{
get
{
return this.syntaxRichTextBox1;
}
}
}
}

106
trunk/Editor/NumberedTextBoxUC.designer.cs generated Normal file
View file

@ -0,0 +1,106 @@
namespace NumberedTextBox
{
partial class NumberedTextBoxUC
{
/// <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 Component 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.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.numbered1 = new LSLEditor.Editor.Numbered();
this.syntaxRichTextBox1 = new LSLEditor.SyntaxRichTextBox();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout();
this.splitContainer1.SuspendLayout();
this.SuspendLayout();
//
// splitContainer1
//
this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
this.splitContainer1.FixedPanel = System.Windows.Forms.FixedPanel.Panel1;
this.splitContainer1.IsSplitterFixed = true;
this.splitContainer1.Location = new System.Drawing.Point(0, 0);
this.splitContainer1.Name = "splitContainer1";
//
// splitContainer1.Panel1
//
this.splitContainer1.Panel1.BackColor = System.Drawing.SystemColors.ActiveBorder;
this.splitContainer1.Panel1.Controls.Add(this.numbered1);
//
// splitContainer1.Panel2
//
this.splitContainer1.Panel2.Controls.Add(this.syntaxRichTextBox1);
this.splitContainer1.Size = new System.Drawing.Size(403, 267);
this.splitContainer1.SplitterDistance = 41;
this.splitContainer1.SplitterWidth = 1;
this.splitContainer1.TabIndex = 2;
this.splitContainer1.Text = "splitContainer1";
//
// numbered1
//
this.numbered1.BackColor = System.Drawing.SystemColors.ButtonFace;
this.numbered1.Dock = System.Windows.Forms.DockStyle.Fill;
this.numbered1.Location = new System.Drawing.Point(0, 0);
this.numbered1.Name = "numbered1";
this.numbered1.Size = new System.Drawing.Size(41, 267);
this.numbered1.TabIndex = 0;
//
// syntaxRichTextBox1
//
this.syntaxRichTextBox1.AcceptsTab = true;
this.syntaxRichTextBox1.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.syntaxRichTextBox1.DetectUrls = false;
this.syntaxRichTextBox1.Dirty = true;
this.syntaxRichTextBox1.Dock = System.Windows.Forms.DockStyle.Fill;
this.syntaxRichTextBox1.Location = new System.Drawing.Point(0, 0);
this.syntaxRichTextBox1.Name = "syntaxRichTextBox1";
this.syntaxRichTextBox1.ScrollBars = System.Windows.Forms.RichTextBoxScrollBars.ForcedBoth;
this.syntaxRichTextBox1.Size = new System.Drawing.Size(361, 267);
this.syntaxRichTextBox1.TabIndex = 0;
this.syntaxRichTextBox1.Text = "";
this.syntaxRichTextBox1.ToolTipping = false;
this.syntaxRichTextBox1.WordWrap = false;
//
// NumberedTextBoxUC
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.splitContainer1);
this.Name = "NumberedTextBoxUC";
this.Size = new System.Drawing.Size(403, 267);
this.splitContainer1.Panel1.ResumeLayout(false);
this.splitContainer1.Panel2.ResumeLayout(false);
this.splitContainer1.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.SplitContainer splitContainer1;
private LSLEditor.Editor.Numbered numbered1;
private LSLEditor.SyntaxRichTextBox syntaxRichTextBox1;
}
}

View file

@ -0,0 +1,120 @@
<?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>
</root>

42
trunk/Editor/RichLabel.Designer.cs generated Normal file
View file

@ -0,0 +1,42 @@
namespace LSLEditor
{
partial class RichLabel
{
/// <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 Component 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.SuspendLayout();
//
// RichLabel
//
this.Name = "RichLabel";
this.ResumeLayout(false);
}
#endregion
}
}

272
trunk/Editor/RichLabel.cs Normal file
View file

@ -0,0 +1,272 @@
// /**
// ********
// *
// * ORIGIONAL CODE BASE IS Copyright (C) 2006-2010 by Alphons van der Heijden
// * The code was donated on 4/28/2010 by Alphons van der Heijden
// * To Brandon'Dimentox Travanti' Husbands & Malcolm J. Kudra which in turn Liscense under the GPLv2.
// * In agreement to Alphons van der Heijden 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 all
// * copies or substantial portions of the Software.
// *
// ********
// */
using System;
using System.Drawing;
using System.Globalization;
using System.Windows.Forms;
using System.ComponentModel;
using System.Collections.Generic;
using System.Text.RegularExpressions;
namespace LSLEditor
{
public partial class RichLabel : UserControl
{
private Regex m_regex;
public override string Text
{
get
{
return base.Text;
}
set
{
base.Text = value;
this.Invalidate();
}
}
public RichLabel()
{
InitializeComponent();
this.SetStyle(
ControlStyles.DoubleBuffer |
ControlStyles.UserPaint |
ControlStyles.AllPaintingInWmPaint,
true);
this.UpdateStyles();
this.Text = "richLabel1";
this.BackColor = Color.LightGoldenrodYellow;
this.m_regex = new Regex(@"
(?:
<(?:
(?<startTag>[^>/\s]*)
(?<attributes> [\s]+ (?<attName>[^=]*) = ""(?<attValue>[^""]*)"")*
)>
|
<[/]* (?<endTag>[^>\s/]*) [/]*>
|
(?<text>[^<]*)
)
",
RegexOptions.IgnorePatternWhitespace
| RegexOptions.Compiled);
//this.m_regex = new Regex(@"(?<text>\w*)");
}
private void SafePaint(PaintEventArgs e)
{
try
{
Graphics g = e.Graphics;
e.Graphics.Clear(this.BackColor);
Stack<String> fontFace = new Stack<String>();
Stack<Single> fontSize = new Stack<Single>();
Stack<Color> fontColor = new Stack<Color>();
Stack<FontStyle> fontStyle = new Stack<FontStyle>();
fontFace.Push(this.Font.Name);
fontSize.Push(this.Font.Size);
fontStyle.Push(this.Font.Style);
fontColor.Push(this.ForeColor);
float fltLineHeight = 0;
float fltLineHeightMax = 0;
float fltWidth = 0;
float fltHeight = 0;
PointF point = new PointF(this.Margin.Left, this.Margin.Top);
string strLines = this.Text.Replace("\r", "").Replace("\n", "<br>");
foreach (Match m in this.m_regex.Matches(strLines))
{
string strText = m.Groups["text"].Value.Replace("&lt;", "<").Replace("&gt;", ">");
switch (m.Groups["startTag"].Value)
{
case "font":
for (int intI = 0; intI < m.Groups["attName"].Captures.Count; intI++)
{
string strValue = m.Groups["attValue"].Captures[intI].Value;
switch (m.Groups["attName"].Captures[intI].Value)
{
case "color":
if (strValue.StartsWith("#"))
{
int intColor = 255;
int.TryParse(strValue.Substring(1), NumberStyles.HexNumber, null, out intColor);
fontColor.Push(Color.FromArgb(255, Color.FromArgb(intColor)));
}
else
{
fontColor.Push(Color.FromName(strValue));
}
break;
case "face":
fontFace.Push(strValue);
break;
case "size":
float fltSize = 10.0F;
float.TryParse(strValue, out fltSize);
fontSize.Push(fltSize);
break;
default:
break;
}
}
break;
case "b":
fontStyle.Push(fontStyle.Peek() | FontStyle.Bold);
break;
case "u":
fontStyle.Push(fontStyle.Peek() | FontStyle.Underline);
break;
case "i":
fontStyle.Push(fontStyle.Peek() | FontStyle.Italic);
break;
case "s":
fontStyle.Push(fontStyle.Peek() | FontStyle.Strikeout);
break;
case "br":
point = new PointF(this.Margin.Left, point.Y + fltLineHeightMax);
fltLineHeightMax = fltLineHeight;
break;
default:
break;
}
switch (m.Groups["endTag"].Value)
{
case "font":
if (fontColor.Count > 1)
fontColor.Pop();
if (fontSize.Count > 1)
fontSize.Pop();
if (fontFace.Count > 1)
fontFace.Pop();
break;
case "b":
case "u":
case "i":
case "s":
if (fontStyle.Count > 1)
fontStyle.Pop();
break;
case "br":
point = new PointF(this.Margin.Left, point.Y + fltLineHeightMax);
fltLineHeightMax = fltLineHeight;
break;
default:
break;
}
if (strText.Length == 0)
continue;
Font fontTmp = new Font(fontFace.Peek(), fontSize.Peek(), fontStyle.Peek());
Size rect = MeasureTextIncludingSpaces(g, strText, fontTmp); // TextRenderer.MeasureText(strText, fontTmp);
PointF pointToDraw = new PointF(point.X, point.Y);
point = new PointF(point.X + rect.Width, point.Y);
fltWidth = Math.Max(fltWidth, point.X);
fltHeight = Math.Max(fltHeight, point.Y + rect.Height);
fltLineHeight = rect.Height;
fltLineHeightMax = Math.Max(fltLineHeightMax, fltLineHeight);
Brush brush = new SolidBrush(fontColor.Peek());
g.DrawString(strText, fontTmp, brush, pointToDraw);
brush.Dispose();
fontTmp.Dispose();
}
int intWidth = (int)fltWidth + (Margin.Right <<1);
int intHeight = (int)fltHeight + Margin.Bottom;
this.Size = new Size(intWidth, intHeight);
//System.Drawing.Drawing2D.GraphicsPath path = Editor.RoundCorners.RoundedRectangle(new Rectangle(this.Location, this.Size), 10);
//g.DrawPath(new Pen(Color.Black,2F), path);
//this.Region = Editor.RoundCorners.RoundedRegion(this.Size, 4);
}
catch
{
}
}
public static SizeF MeasureTextVisible(Graphics graphics, string text, Font font)
{
StringFormat format = new StringFormat();
RectangleF rect = new RectangleF(0, 0, 4096, 1000);
CharacterRange[] ranges = { new CharacterRange(0, text.Length) };
format.SetMeasurableCharacterRanges(ranges);
Region[] regions = graphics.MeasureCharacterRanges(text, font, rect, format);
rect = regions[0].GetBounds(graphics);
return new SizeF(rect.Width, rect.Height);
}
public static Size MeasureTextIncludingSpaces(Graphics graphics, string text, Font font)
{
SizeF sizePostfix = MeasureTextVisible(graphics, "|", font);
SizeF size = MeasureTextVisible(graphics, text + "|", font);
return new Size((int)(size.Width - sizePostfix.Width + 1), (int)(size.Height + 1));
}
protected override void OnPaint(PaintEventArgs e)
{
SafePaint(e);
}
protected override void OnPaintBackground(PaintEventArgs e)
{
// base.OnPaintBackground(e);
}
}
}

120
trunk/Editor/RichLabel.resx Normal file
View file

@ -0,0 +1,120 @@
<?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>
</root>

View file

@ -0,0 +1,189 @@
using System;
//Author: Arman Ghazanchyan
//Created date: 01/27/2007
//Last updated: 01/28/2007
using System.Drawing;
using System.Drawing.Drawing2D;
namespace LSLEditor.Editor
{
class RoundCorners
{
///<summary>
/// Rounds a rectangle corners' and returns the graphics path.
/// </summary>
/// <param name="rec">A rectangle whose corners should be rounded.</param>
/// <param name="r">The radius of the rounded corners. This value should be
/// bigger then 0 and less or equal to the (a half of the smallest value
/// of the rectangles width and height).</param>
/// <param name="exclude_TopLeft">A value that specifies if the top-left
/// corner of the rectangle should be rounded. If the value is True
/// then the corner is not rounded otherwise it is.</param>
/// <param name="exclude_TopRight">A value that specifies if the top-right
/// corner of the rectangle should be rounded. If the value is True
/// then the corner is not rounded otherwise it is.</param>
/// <param name="exclude_BottomRight">A value that specifies if the bottom-right
/// corner of the rectangle should be rounded. If the value is True
/// then the corner is not rounded otherwise it is.</param>
/// <param name="exclude_BottomLeft">A value that specifies if the bottom-left
/// corner of the rectangle should be rounded. If the value is True
/// then the corner is not rounded otherwise it is.</param>
public static GraphicsPath RoundedRectangle(Rectangle rec, int r)
{
return RoundedRectangle(rec,r,false,false,false,false);
}
public static GraphicsPath RoundedRectangle(Rectangle rec, int r,
bool exclude_TopLeft,
bool exclude_TopRight,
bool exclude_BottomRight,
bool exclude_BottomLeft)
{
GraphicsPath path = new GraphicsPath();
int s = r * 2;
//If 's' is less than or equal to zero,
//then return a simple rectangle.
if (s <= 0)
{
path.StartFigure();
path.AddLine(rec.Right, rec.Y, rec.Right, rec.Y);
path.AddLine(rec.Right, rec.Bottom, rec.Right, rec.Bottom);
path.AddLine(rec.X, rec.Bottom, rec.X, rec.Bottom);
path.AddLine(rec.X, rec.Y, rec.X, rec.Y);
path.CloseAllFigures();
return path;
}
//If 's' is bigger than the smallest value of the size,
//then assign the value to 's'.
if (rec.Height <= rec.Width)
{
if (s > rec.Height)
s = rec.Height;
}
else
{
if (s > rec.Width)
s = rec.Width;
}
path.StartFigure();
//Set top-right corner.
if (!exclude_TopRight)
path.AddArc(rec.Right - s, rec.Y, s, s, 270, 90);
else
path.AddLine(rec.Right, rec.Y, rec.Right, rec.Y);
//Set bottom-right corner.
if (!exclude_BottomRight)
path.AddArc(rec.Right - s, rec.Bottom - s, s, s, 0, 90);
else
path.AddLine(rec.Right, rec.Bottom, rec.Right, rec.Bottom);
//Set bottom-left corner.
if (!exclude_BottomLeft)
path.AddArc(rec.X, rec.Bottom - s, s, s, 90, 90);
else
path.AddLine(rec.X, rec.Bottom, rec.X, rec.Bottom);
//Set top-left corner.
if (!exclude_TopLeft)
path.AddArc(rec.X, rec.Y, s, s, 180, 90);
else
path.AddLine(rec.X, rec.Y, rec.X, rec.Y);
path.CloseAllFigures();
return path;
}
/// <summary>
/// Rounds the corners of the newly created rectangle-shape region and returns the region.
/// </summary>
/// <param name="rSize">The size of the region.</param>
/// <param name="r">The radius of the rounded corners. This value should be
/// bigger then 0 and less or equal to the (a half of the smallest value
/// of the regions width and height).</param>
/// <param name="exclude_TopLeft">A value that specifies if the top-left
/// corner of the region should be rounded. If the value is True
/// then the corner is not rounded otherwise it is.</param>
/// <param name="exclude_TopRight">A value that specifies if the top-right
/// corner of the region should be rounded. If the value is True
/// then the corner is not rounded otherwise it is.</param>
/// <param name="exclude_BottomRight">A value that specifies if the bottom-right
/// corner of the region should be rounded. If the value is True
/// then the corner is not rounded otherwise it is.</param>
/// <param name="exclude_BottomLeft">A value that specifies if the bottom-left
/// corner of the region should be rounded. If the value is True
/// then the corner is not rounded otherwise it is.</param>
public static Region RoundedRegion(Size rSize, int r)
{
return RoundedRegion(rSize, r, false, false, false, false);
}
public static Region RoundedRegion(Size rSize, int r,
bool exclude_TopLeft,
bool exclude_TopRight,
bool exclude_BottomRight,
bool exclude_BottomLeft)
{
int s = r * 2;
GraphicsPath path = new GraphicsPath();
//If 's' is less than or equal to zero,
//then return a simple rectangle.
if (s <= 0)
{
path.StartFigure();
path.AddLine(rSize.Width, 0, rSize.Width, 0);
path.AddLine(rSize.Width, rSize.Height, rSize.Width, rSize.Height);
path.AddLine(0, rSize.Height, 0, rSize.Height);
path.AddLine(0, 0, 0, 0);
path.CloseAllFigures();
return new Region(path);
}
//If 's' is bigger than the smallest value of the size,
//then assign the value to 's'.
if (rSize.Height < rSize.Width)
{
if (s > rSize.Height)
s = rSize.Height;
}
else
{
if (s > rSize.Width)
s = rSize.Width;
}
path.StartFigure();
//Set top-right corner.
if (!exclude_TopRight)
path.AddArc(rSize.Width - s, 0, s - 1, s - 1, 270, 90);
else
path.AddLine(rSize.Width, 0, rSize.Width, 0);
//Set bottom-right corner.
if (!exclude_BottomRight)
{
path.AddLine(rSize.Width, r, rSize.Width, rSize.Height - r);
path.AddArc(rSize.Width - s, rSize.Height - s, s - 1, s - 1, 0, 90);
}
else
path.AddLine(rSize.Width, rSize.Height, rSize.Width, rSize.Height);
//Set bottom-left corner.
if (!exclude_BottomLeft)
{
path.AddLine(rSize.Width - r, rSize.Height, r, rSize.Height);
path.AddArc(0, rSize.Height - s, s - 1, s - 1, 90, 90);
}
else
path.AddLine(0, rSize.Height, 0, rSize.Height);
//Set top-left corner.
if (!exclude_TopLeft)
path.AddArc(0, 0, s - 1, s - 1, 180, 90);
else
path.AddLine(0, 0, 0, 0);
path.CloseAllFigures();
return new Region(path);
}
}
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,42 @@
<?xml version="1.0" encoding="utf-8" ?>
<root>
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<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" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</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>1.0.0.0</value>
</resheader>
<resheader name="Reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="Writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View file

@ -0,0 +1,162 @@
// /**
// ********
// *
// * ORIGIONAL CODE BASE IS Copyright (C) 2006-2010 by Alphons van der Heijden
// * The code was donated on 4/28/2010 by Alphons van der Heijden
// * To Brandon'Dimentox Travanti' Husbands & Malcolm J. Kudra which in turn Liscense under the GPLv2.
// * In agreement to Alphons van der Heijden 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 all
// * copies or substantial portions of the Software.
// *
// ********
// */
using System;
using System.Drawing;
using System.ComponentModel;
using System.Windows.Forms;
using System.Drawing.Drawing2D;
namespace LSLEditor
{
public partial class TooltipWindow : Form
{
public string Wild;
public int XOffset = 0;
public override string Text
{
get
{
return base.Text;
}
set
{
base.Text = value;
this.richLabel1.Text = value;
}
}
public TooltipWindow(Form parent)
{
InitializeComponent();
this.Wild = "";
this.Owner = parent;
this.richLabel1.BorderStyle = BorderStyle.FixedSingle;
//this.richLabel1.BackColor = Color.LightGoldenrodYellow;
this.BackColor = Color.LightGoldenrodYellow;
//this.richLabel1.BorderStyle = BorderStyle.None;
this.richLabel1.Tag = "";
this.richLabel1.Text = "";
}
public void SetPosition(Rectangle rect, SyntaxRichTextBox syntaxRichTextBox)
{
//Rectangle rect = Screen.PrimaryScreen.WorkingArea;
Point p = syntaxRichTextBox.GetPositionFromCharIndex(syntaxRichTextBox.SelectionStart);
p = new Point(p.X - 20 + this.XOffset + 2 , p.Y + 2 + syntaxRichTextBox.LineHeight);
Rectangle client = Screen.PrimaryScreen.WorkingArea; // syntaxRichTextBox.ClientRectangle;
if (p.X < client.Left || p.Y < client.Top || p.X > client.Width || p.Y > client.Height)
{
this.Visible = false;
return;
}
Point screen = syntaxRichTextBox.PointToScreen(p);
//if ((screen.Y + this.Height) > rect.Height)
// screen = RichTextBox.PointToScreen(new Point(p.X - 20 + this.XOffset, p.Y - this.Height));
if (screen.Y > rect.Bottom)
{
this.Visible = false;
return;
//screen.Y = rect.Bottom;
}
if (screen.X > rect.Right)
{
this.Visible = false;
return;
//screen.X = rect.Right;
}
if (screen.X < rect.Left)
{
this.Visible = false;
return;
//screen.X = rect.Left;
}
if ((screen.Y) < rect.Top)
{
this.Visible = false;
return;
//screen.Y = rect.Top;
}
this.Location = screen;
}
public void SetPosition(SyntaxRichTextBox syntaxRichTextBox, Point p)
{
Rectangle rect = Screen.PrimaryScreen.WorkingArea;
Point screen = syntaxRichTextBox.PointToScreen(new Point(p.X - 20 , p.Y + syntaxRichTextBox.LineHeight));
if ((screen.Y + this.Height) > rect.Height)
screen = syntaxRichTextBox.PointToScreen(new Point(p.X - 20, p.Y - this.Height));
if ((screen.X + this.Width) > rect.Width)
screen.X = rect.Width - this.Width;
if (screen.X < rect.Left)
screen.X = rect.Left;
if (screen.Y < rect.Top)
screen.Y = rect.Top;
this.Location = screen;
}
private void richLabel1_Resize(object sender, EventArgs e)
{
this.Size = this.richLabel1.Size;
}
}
}

62
trunk/Editor/TooltipWindow.designer.cs generated Normal file
View file

@ -0,0 +1,62 @@
namespace LSLEditor
{
partial class TooltipWindow
{
/// <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.richLabel1 = new LSLEditor.RichLabel();
this.SuspendLayout();
//
// richLabel1
//
this.richLabel1.BackColor = System.Drawing.Color.LightGoldenrodYellow;
this.richLabel1.Location = new System.Drawing.Point(0, 0);
this.richLabel1.Name = "richLabel1";
this.richLabel1.Size = new System.Drawing.Size(52, 20);
this.richLabel1.TabIndex = 0;
this.richLabel1.Resize += new System.EventHandler(this.richLabel1_Resize);
//
// TooltipWindow
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(105, 42);
this.Controls.Add(this.richLabel1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.Name = "TooltipWindow";
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
this.Text = "GListBoxWindow";
this.ResumeLayout(false);
}
#endregion
private RichLabel richLabel1;
}
}

View file

@ -0,0 +1,120 @@
<?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>
</root>

212
trunk/FindWindow.Designer.cs generated Normal file
View file

@ -0,0 +1,212 @@
namespace LSLEditor
{
partial class FindWindow
{
/// <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.groupBox1 = new System.Windows.Forms.GroupBox();
this.comboBoxFind = new System.Windows.Forms.ComboBox();
this.FindNext = new System.Windows.Forms.Button();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.comboBoxReplace = new System.Windows.Forms.ComboBox();
this.groupBox3 = new System.Windows.Forms.GroupBox();
this.checkBoxWholeWord = new System.Windows.Forms.CheckBox();
this.checkBoxReverse = new System.Windows.Forms.CheckBox();
this.checkBoxMatchCase = new System.Windows.Forms.CheckBox();
this.Replace = new System.Windows.Forms.Button();
this.ReplaceAll = new System.Windows.Forms.Button();
this.label1 = new System.Windows.Forms.Label();
this.groupBox1.SuspendLayout();
this.groupBox2.SuspendLayout();
this.groupBox3.SuspendLayout();
this.SuspendLayout();
//
// groupBox1
//
this.groupBox1.Controls.Add(this.comboBoxFind);
this.groupBox1.Location = new System.Drawing.Point(8, 8);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(240, 48);
this.groupBox1.TabIndex = 1;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "Find what:";
//
// comboBoxFind
//
this.comboBoxFind.FormattingEnabled = true;
this.comboBoxFind.Location = new System.Drawing.Point(16, 16);
this.comboBoxFind.Name = "comboBoxFind";
this.comboBoxFind.Size = new System.Drawing.Size(208, 21);
this.comboBoxFind.TabIndex = 1;
this.comboBoxFind.KeyDown += new System.Windows.Forms.KeyEventHandler(this.comboBoxFind_KeyDown);
//
// FindNext
//
this.FindNext.Location = new System.Drawing.Point(80, 184);
this.FindNext.Name = "FindNext";
this.FindNext.Size = new System.Drawing.Size(75, 23);
this.FindNext.TabIndex = 6;
this.FindNext.Text = "Find Next";
this.FindNext.UseVisualStyleBackColor = true;
this.FindNext.Click += new System.EventHandler(this.FindNext_Click);
//
// groupBox2
//
this.groupBox2.Controls.Add(this.comboBoxReplace);
this.groupBox2.Location = new System.Drawing.Point(8, 56);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(240, 48);
this.groupBox2.TabIndex = 2;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "Replace with:";
//
// comboBoxReplace
//
this.comboBoxReplace.FormattingEnabled = true;
this.comboBoxReplace.Location = new System.Drawing.Point(16, 16);
this.comboBoxReplace.Name = "comboBoxReplace";
this.comboBoxReplace.Size = new System.Drawing.Size(208, 21);
this.comboBoxReplace.TabIndex = 2;
//
// groupBox3
//
this.groupBox3.Controls.Add(this.checkBoxWholeWord);
this.groupBox3.Controls.Add(this.checkBoxReverse);
this.groupBox3.Controls.Add(this.checkBoxMatchCase);
this.groupBox3.Location = new System.Drawing.Point(8, 112);
this.groupBox3.Name = "groupBox3";
this.groupBox3.Size = new System.Drawing.Size(240, 64);
this.groupBox3.TabIndex = 3;
this.groupBox3.TabStop = false;
this.groupBox3.Text = "Find options";
//
// checkBoxWholeWord
//
this.checkBoxWholeWord.AutoSize = true;
this.checkBoxWholeWord.Location = new System.Drawing.Point(112, 24);
this.checkBoxWholeWord.Name = "checkBoxWholeWord";
this.checkBoxWholeWord.Size = new System.Drawing.Size(83, 17);
this.checkBoxWholeWord.TabIndex = 4;
this.checkBoxWholeWord.Text = "Whole word";
this.checkBoxWholeWord.UseVisualStyleBackColor = true;
//
// checkBoxReverse
//
this.checkBoxReverse.AutoSize = true;
this.checkBoxReverse.Location = new System.Drawing.Point(16, 40);
this.checkBoxReverse.Name = "checkBoxReverse";
this.checkBoxReverse.Size = new System.Drawing.Size(66, 17);
this.checkBoxReverse.TabIndex = 5;
this.checkBoxReverse.Text = "Reverse";
this.checkBoxReverse.UseVisualStyleBackColor = true;
//
// checkBoxMatchCase
//
this.checkBoxMatchCase.AutoSize = true;
this.checkBoxMatchCase.Location = new System.Drawing.Point(16, 24);
this.checkBoxMatchCase.Name = "checkBoxMatchCase";
this.checkBoxMatchCase.Size = new System.Drawing.Size(82, 17);
this.checkBoxMatchCase.TabIndex = 3;
this.checkBoxMatchCase.Text = "Match case";
this.checkBoxMatchCase.UseVisualStyleBackColor = true;
//
// Replace
//
this.Replace.Location = new System.Drawing.Point(168, 184);
this.Replace.Name = "Replace";
this.Replace.Size = new System.Drawing.Size(75, 23);
this.Replace.TabIndex = 7;
this.Replace.Text = "Replace";
this.Replace.UseVisualStyleBackColor = true;
this.Replace.Click += new System.EventHandler(this.Replace_Click);
//
// ReplaceAll
//
this.ReplaceAll.Location = new System.Drawing.Point(168, 208);
this.ReplaceAll.Name = "ReplaceAll";
this.ReplaceAll.Size = new System.Drawing.Size(75, 23);
this.ReplaceAll.TabIndex = 8;
this.ReplaceAll.Text = "Replace All";
this.ReplaceAll.UseVisualStyleBackColor = true;
this.ReplaceAll.Click += new System.EventHandler(this.ReplaceAll_Click);
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(24, 216);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(0, 13);
this.label1.TabIndex = 6;
//
// FindWindow
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(256, 238);
this.Controls.Add(this.label1);
this.Controls.Add(this.ReplaceAll);
this.Controls.Add(this.Replace);
this.Controls.Add(this.groupBox3);
this.Controls.Add(this.groupBox2);
this.Controls.Add(this.FindNext);
this.Controls.Add(this.groupBox1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
this.KeyPreview = true;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "FindWindow";
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = " Find";
this.TopMost = true;
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FindWindow_FormClosing);
this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.FindWindow_KeyDown);
this.groupBox1.ResumeLayout(false);
this.groupBox2.ResumeLayout(false);
this.groupBox3.ResumeLayout(false);
this.groupBox3.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.ComboBox comboBoxFind;
private System.Windows.Forms.Button FindNext;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.ComboBox comboBoxReplace;
private System.Windows.Forms.GroupBox groupBox3;
private System.Windows.Forms.CheckBox checkBoxMatchCase;
private System.Windows.Forms.Button Replace;
private System.Windows.Forms.Button ReplaceAll;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.CheckBox checkBoxWholeWord;
private System.Windows.Forms.CheckBox checkBoxReverse;
}
}

315
trunk/FindWindow.cs Normal file
View file

@ -0,0 +1,315 @@
// /**
// ********
// *
// * ORIGIONAL CODE BASE IS Copyright (C) 2006-2010 by Alphons van der Heijden
// * The code was donated on 4/28/2010 by Alphons van der Heijden
// * To Brandon'Dimentox Travanti' Husbands & Malcolm J. Kudra which in turn Liscense under the GPLv2.
// * In agreement to Alphons van der Heijden 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 all
// * copies or substantial portions of the Software.
// *
// ********
// */
using System;
using System.Text; // StringBuilder
using System.Text.RegularExpressions;
using System.Windows.Forms;
namespace LSLEditor
{
public partial class FindWindow : Form
{
private LSLEditorForm lslEditForm;
private int intStart;
private int intEnd;
private bool m_ReplaceAlso;
public FindWindow(LSLEditorForm lslEditForm)
{
InitializeComponent();
this.lslEditForm = lslEditForm;
this.intStart = 0;
this.intEnd = 0;
}
public bool ReplaceAlso
{
get
{
return m_ReplaceAlso;
}
set
{
m_ReplaceAlso = value;
this.groupBox2.Enabled = m_ReplaceAlso;
this.Replace.Enabled = m_ReplaceAlso;
this.ReplaceAll.Enabled = m_ReplaceAlso;
if (m_ReplaceAlso)
this.Text = "Find and Replace";
else
this.Text = "Find";
}
}
public string KeyWord
{
set
{
this.label1.Text = ""; // clear out message
if (value != "")
{
this.comboBoxFind.Text = value;
}
else
{
if (this.comboBoxFind.Items.Count > 0)
this.comboBoxFind.SelectedIndex = this.comboBoxFind.Items.Count - 1;
}
}
}
private bool UpdateComboBox(ComboBox comboBox)
{
string strText = comboBox.Text;
bool Found = false;
foreach (string strC in comboBox.Items)
{
if (strC == strText)
{
Found = true;
break;
}
}
if (!Found)
comboBox.Items.Add(strText);
return Found;
}
public void Find()
{
this.label1.Text = "";
EditForm editForm = this.lslEditForm.ActiveMdiForm as EditForm;
if (editForm == null)
return;
if (!UpdateComboBox(this.comboBoxFind))
{
editForm.TextBox.SelectionLength = 0;
editForm.TextBox.SelectionStart = 0;
}
RichTextBoxFinds options = RichTextBoxFinds.None;
if (this.checkBoxMatchCase.Checked) options |= RichTextBoxFinds.MatchCase;
if (this.checkBoxReverse.Checked) options |= RichTextBoxFinds.Reverse;
if (this.checkBoxWholeWord.Checked) options |= RichTextBoxFinds.WholeWord;
if (this.checkBoxReverse.Checked)
{
intStart = 0; // start cant change ;-)
intEnd = editForm.TextBox.SelectionStart;
}
else
{
intStart = editForm.TextBox.SelectionStart + editForm.TextBox.SelectionLength;
if (intStart == editForm.TextBox.Text.Length)
intStart = 0;
intEnd = editForm.TextBox.Text.Length - 1; // length can change!!
}
string strFind = this.comboBoxFind.Text;
int intIndex = editForm.Find(strFind, intStart, intEnd, options);
if (intIndex < 0)
{
this.label1.Text = "Not found...";
return;
}
}
private void FindNext_Click(object sender, EventArgs e)
{
Find();
this.Focus();
}
private void comboBoxFind_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Return)
{
if (this.Replace.Enabled)
{
this.comboBoxReplace.Focus();
e.SuppressKeyPress = true;
}
else
{
Find();
e.SuppressKeyPress = true;
}
}
}
private void Replace_Click(object sender, EventArgs e)
{
EditForm editForm = this.lslEditForm.ActiveMdiForm as EditForm;
if (editForm == null)
return;
UpdateComboBox(this.comboBoxReplace);
if (editForm.TextBox.SelectionLength > 0)
{
string strReplacement = this.comboBoxReplace.Text;
editForm.TextBox.ReplaceSelectedText(strReplacement);
}
Find();
this.Focus();
}
// WildCardToRegex not used!!
private string WildCardToRegex(string strWildCard)
{
StringBuilder sb = new StringBuilder(strWildCard.Length + 8);
for (int intI = 0; intI < strWildCard.Length; intI++)
{
char chrC = strWildCard[intI];
switch (chrC)
{
case '*':
sb.Append(".*");
break;
case '?':
sb.Append(".");
break;
case '\\':
intI++;
if (intI < strWildCard.Length)
sb.Append(Regex.Escape(strWildCard[intI].ToString()));
break;
default:
sb.Append(Regex.Escape(chrC.ToString()));
break;
}
}
return sb.ToString();
}
private void ReplaceAll_Click(object sender, EventArgs e)
{
EditForm editForm = this.lslEditForm.ActiveMdiForm as EditForm;
if (editForm == null)
return;
UpdateComboBox(this.comboBoxReplace);
string strPattern;
string strFind = Regex.Escape(this.comboBoxFind.Text);
string strReplacement = this.comboBoxReplace.Text;
string strSourceCode = editForm.SourceCode;
RegexOptions regexOptions = RegexOptions.Compiled;
if (!this.checkBoxMatchCase.Checked)
regexOptions |= RegexOptions.IgnoreCase;
if (this.checkBoxWholeWord.Checked)
strPattern = @"\b" + strFind + @"\b";
else
strPattern = strFind;
Regex regex = new Regex(strPattern, regexOptions);
int intCount = 0;
foreach(Match m in regex.Matches(strSourceCode))
{
if (m.Value.Length > 0)
intCount++;
}
if (intCount == 0)
{
MessageBox.Show("No matches found");
}
else
{
if (MessageBox.Show("There are " + intCount + " occurences, replace them all?", "Find and Replace", MessageBoxButtons.YesNoCancel) == DialogResult.Yes)
editForm.SourceCode = regex.Replace(strSourceCode, strReplacement);
}
this.Focus();
}
private void FindWindow_FormClosing(object sender, FormClosingEventArgs e)
{
lslEditForm.TopMost = true; // 15 nove 2007
this.Visible = false;
e.Cancel = true;
lslEditForm.TopMost = false;// 15 nove 2007
}
private void FindWindow_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyData == Keys.Escape)
{
this.Visible = false;
e.SuppressKeyPress = true;
e.Handled = true;
}
if (e.KeyCode == Keys.Return)
{
Find();
e.SuppressKeyPress = true;
this.Focus();
}
if (e.KeyCode == Keys.F3)
{
Find();
e.SuppressKeyPress = true;
this.Focus();
}
}
public void FindFocus()
{
this.comboBoxFind.Focus();
}
}
}

120
trunk/FindWindow.resx Normal file
View file

@ -0,0 +1,120 @@
<?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>
</root>

1109
trunk/Form1.cs Normal file

File diff suppressed because it is too large Load diff

348
trunk/Form1.resx Normal file
View file

@ -0,0 +1,348 @@
<?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="mainMenu1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="openFileDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>126, 17</value>
</metadata>
<metadata name="saveFileDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>256, 17</value>
</metadata>
<metadata name="statusStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 54</value>
</metadata>
<metadata name="contextMenu1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>384, 17</value>
</metadata>
<metadata name="pageSetupDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>506, 17</value>
</metadata>
<metadata name="printDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>648, 17</value>
</metadata>
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>42</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
AAABAAcAEBAQAAAAAAAoAQAAdgAAABAQAAAAAAAAaAUAAJ4BAAAYGAAAAAAAAMgGAAAGBwAAICAQAAAA
AADoAgAAzg0AACAgAAAAAAAAqAgAALYQAAAwMBAAAAAAAGgGAABeGQAAMDAAAAAAAACoDgAAxh8AACgA
AAAQAAAAIAAAAAEABAAAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAACAgAAAAACAAACA
gACAAIAAgICAAMDAwAAA/wAA/wAAAP//AAAAAP8AAP//AAAAAAD///8AERERERERERERERERERERERER
ERERERERERERERERERERAAAAAAABEXF//////wEREX+IiIiPgBF3F/f////wEREX+I//+PARdxf/d3d3
+AEREX//////AXdxeqqqq7wBEREXd3d3d3ERERERERERERERERERERERERERERERERH//wAA//8AAP//
AAD//xERwAd4iEAHiIjAA4iIIAMREeADd/8gAf//8AH//xABERH4ARf//////////////xERKAAAABAA
AAAgAAAAAQAIAAAAAABAAQAAAAAAAAAAAAAAAAAAAAAAALJOHQDfjScAeEQoAN+QLgCGUzkAtHU7ANSU
SQDnoEkA6KNOALF8WQBmZmYAtIprAICJiQC+oYwAlJSQAIuWlwCPlpcAmZydAKOlpAC2r6UAlKKsALay
rAC7tq4AuLaxAM3FugDJzMwAz9DNANDQ0ADO09MAy93hANbh5ADW5OgA1+frAOLp6wDn7O0A2OrvANnq
7wDo8vUA6/T3APP29wAAAAAA////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAoKCgoKCgoKCgoKCgoKCgoKCgoKCgo
KCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgKCgoKCgoKCgoKKCgoKCgAAAAAAAAAAAAAAAooKBco
CSMjIyMjIyMjIwAKKCgoKAkgHBkZGRkZGSUNAgooFhEoCR0QKSkpKSchJAUKKCgoKAkjFBspKSkpHiYL
CigTDigJHyMMDAwMDA8iGgUKKCgoKAkjIyMjIyMjIyMFChgVEigJAwEBAQEBCAcGBQQoKCgoKAAAAAAA
AAAAAAAoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgo//94iv//
AAD//zMV4AdrbsADAqNAA6OjwAFvkyABAADgAQAAIABnfvAApaQQAKSk+AGYjv//NgD//zEG//9RlCgA
AAAYAAAAMAAAAAEACAAAAAAAoAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwb+/APr5+QDQy8oA0szKAKGQ
iQCikIgA18jBAHdEKgB3Ri4AjlY5AKp0WQB1UkAAoXFZAHRSQQBxU0QAhmdYAK+MegCykYEAopKKALqy
rgDPy8kAe0gtAJFZOwCxeVkAtH5fAJ1uVQCeb1YAdFNBAIZmVQCGZ1YAu5mGALycigC6m4oAwKaXAJOA
dQCmlIoA3dLMALyzrgDAubUAp25MALJ6WQDBl30Awpl/ALOPegC7nIoAupuJAMCnmADCqZoAqJeNANzS
zADCurUArFITAL9oLgCUhHkArJuPAMrGwwChVxsAwp+DAMG3rwDEu7QA3GkAANaofgDTwK8AwLGkAMa4
qwDebwAA3W8AANxtAADGuKoA0snAANDIwADpiiUA95w3AO+YPADgtogA37WIAN61iADftokA37eKANXL
wADXzcEA0ci8AOWsWwDotGUA6LVlAOu5aADpuGwA67tvAOq7cQDluHMA3bV2ALa2tQChpaQA2NzbANfb
2gDg//8AkpubAJOZmQCgpaUAnaKiAKGvsACvuLkA3u7wANzs7gDd5eYA3vr/AOL7/wCdqqwAtbu8ALDA
wwDg6uwA2+XnAO7z9ADd8fYAv9HVAMLT1wC/0NQA2uzwANPk6ADk8PMA5e7wANzk5gDP09QA7fHyAN32
/QDP4ucAz+HmANvt8gDa7PEA2OrvAN/q7QDl8PMA3ff/AN73/wDd9v4A3PX9ANrw9wDc8PYAwNHWANvs
8QDa6/AA4/P4AODq7QDl7/IA5O7xAN31/QDg9/8A3PL6ANjq8ADb7PIA4fH3AN7m6QDY4OMA2/P9ANry
/ADb8/4A2vL9ANfv+gDa8/8A7vL0AO3x8wD4+PkA////AP39/QDp6ekAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAB4eHh4eHh4eHh4eHh0Q
NgAAAAAAAAAAAAsgIS4uLi4uLi4uLi0fCg8AAAAAAEAFEj9gfZKSkpKSkpKSkpJqaRc2AAAAAEcEByuI
goCMdoGBgYGBgYGNhTAMAAAAAAAAAClolXCRkI+Pj4+Pj4N5l14WAAAAAEATBRFRiWVte6ChoaGhoXx6
eIoaIwAAAEYzFSUqa25dAQKjo6Ojo6Nxb5MiDgAAAAAAAAAZZ35hXKWkpKSkpKSimI5fCDYAAEExBgUR
UZRsYmNjY2NjY2NkZoRyGyMAAFA8JwMyKoZ/i3Nzc3Nzc3N1dHeHLxw2AAAAAAAAGJafnJycnJycnJyb
nZ6amQk2AEU3JAUFLFNWVVRUVFRUVFVZV1hbWjk2AFI7JhQ4ADU9REJDQ0NDQ0NKSEkNKDQ2AAAAAAAA
AAA6Pk9NTU1NTU1MTE5LS0sAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAA////Kv///w7///8o////KP///yjwAB8o8AAPToAAB12AAAdD8AAHIIAA
Az2AAAM9+AABPYAAAT2AAABV/AAAXYAAAF2CAABd/wABVf///1X///9V////Vf///1X///9dKAAAACAA
AABAAAAAAQAEAAAAAACAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAICAAAAAAIAAAICAAIAA
gACAgIAAwMDAAAD/AAD/AAAA//8AAAAA/wAA//8AAAAAAP///wARERERERERERERERERERERERERERER
ERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERER
ERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERAAAAAAAAAAAAAAER
EREREXiIiIiIiIiIiIiAERERABF3////////////8BEREX9xF/////////////cBEREXcReP////////
///4AREREREXf/iIiIiIiIiP/wEREQABEX/4f4//////j/9wERF/9xF4+H+I//////j/gBERF3cRd/iH
9//////4//ARERERERf/h/f/////+P/3ARFwAAEXj4d3d3d3d3eP+AERf//3F3+IiIiIiIiIiP8wERd3
dxF/////////////cBEREREReP///////////4ARcAAAEXi7u7u7u7u7u7uyAX///3EXqqqqqqqqq6us
ygEXd3dxF6qqqqqqqqqqqqoBERERERF3d3d3d3d3d3d3ERERERERERERERERERERERERERERERERERER
ERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERER
EREREREREREREf//////////////////////////////////////////8AAAf/AAAD8wAAA/GAAAH5gA
AB/4AAAfHAAADwwAAA+MAAAP/gAABwYAAAcCAAADgwAAA/8AAAMDAAABAYAAAYGAAAH/wAAD////////
////////////////////////KAAAACAAAABAAAAAAQAIAAAAAACABAAAAAAAAAAAAAAAAAAAAAAAAJ44
AACmQAAAsUsAANNtAADZcgAAmDcGAH4wCQB/MQoAlDoMAHAvDwCDNg8AcDEQAJ5CEwDBZRMAoEQVANN0
FQCWQRYAl0IXAI9CHAChTCEAznQiANF4JgDzoScAXzsoAGpBKwCdUy4AnlMuAJ5VLwCiWDMAplw3AN+N
OwCjXjwArG5PALF0VQBeXl4As3tfALCIYwBmZmYAhHNoAG5ycgBwd3cAc3h3AHV5eAB2enkAeXt6AHl8
egB6fHoAe317AH1+ewB+f3wAvJiEALmghgCKiooAkJCMAI6RkAD/zJkApaShAKWloQCmpaEAxLKlAKqq
qgChsLEAysG5AMC+uwDCwLwAury9AMXFwgDGxsMAvsLEANnQxQDNy8cA087JANbQyQDP0M0A4NfNAOnc
0ADs4NEAv9DUANLa2wDO4OQA0uToAOjo6ADg6OoA6urqANnp7QDY6u8A2ervANvr8ADv8/QA6fP2APj4
+AD7+/sA/f39AAAAAAA0b/8A////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AABdXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1d
XV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1d
XV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1d
XV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dJSUlJSUlJSUl
JSUlJSUlJSUlJSUlXV1dXV1dXV1dXR8SCgcGBgYGBgYGBgYGBgYGBgYGByUmXV1dXV1dXV1dCDtGRkZG
RkZGRkZGRkZGRkZGRkY+BSVdXV1dXUI2XV0gM1VVVVVVVVVVVVVVVVVVVVVVVVUTJV1dXV1dQEA/XV0M
VVVVVVVVVVVVVVVVVVVVVVVVVTILJV1dXV1dXV1dXQ5JVV9fX19fX19fX19fX19fX19VTgUlXV1dXV1d
XV1dICRVVE1NTU1NTU1NTU1NTU1NX1ZVEyVdXV1dNS4qXV1dDFVVPShfPFFfX19fX19fX01YX1UyCyVd
XV1FRT8/XV0OSVU9KF84PF9fX19fX19fUk1fVU4FJV1dXV1dXV1dXSAkVU89KFsiU1pfX19fX19cTV9X
VRMlXV1dXV1dXV1dXQxVVT0oXzRTU19fX19fX19NX1lVMgslXV05MC0qJ11dDklVPSgoKCgoKCgoKCgo
KChNX1VOBSVdXUtLSENEP10gJFVQPT09PT09PT09PT09PT1NVVUTFyVdXV1dXV1dXV0MVVVVVVVVVVVV
VVVVVVVVVVVVVTIJJV1dXV1dXV1dXQ5JVVVVVVVVVVVVVVVVVVVVVVVVTgUlXToxLywrKV1dIw0WFhYW
FhYWFhYWFhYWFhYWFhYWARglTExKR0NBP11dAAQEBAQEBAQEBAQEBAQ3DzcPXg8DASVdXV1dXV1dXV0d
AhQVHh4eHh4eHh4eHh4eHh4eHgMFXV1dXV1dXV1dXV0hHBsaGRkZGRkZGRkZGRkZGRkQEV1dXV1dXV1d
XV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1d
XV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1d
XV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1d
XV1dXV1d//////////////////////////////////////gAAD/wAAAf8AAAHzAAAB8YAAAP+AAAD/gA
AA8cAAAHDAAAB/wAAAf+AAADBgAAAwIAAAH/AAAB/wAAAQMAAAABgAAA/4AAAf/AAAP/////////////
//////////////////8oAAAAMAAAAGAAAAABAAQAAAAAAAAGAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AACAAAAAgIAAAAAAgAAAgIAAgACAAICAgADAwMAAAP8AAP8AAAD//wAAAAD/AAD//wAAAAAA////ABER
ERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERER
ERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERER
ERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERER
ERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERER
ERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERAAAAAAAAAAAAAA
AAAAAAABERERERERERd3d3d3d3d3d3d3d3d3d3cgERERERERERd///////////////////ggERERERAB
ERc///////////////////8wEREREX/wERF4//////////////////9yARERERd3ERF3////////////
//////+CARERERERERFz///////////////////zAREREREREREXj//////////////////3IBERERER
EREXf/iIiIiIiIiIiIiIj//4IBERERAAAREXP/+If/h/////////j///MBEREX//8BEReP+IeP9/////
////iP//cgERERd3dxERd//4d/94////////+P//ggERERERERERc//4h4+H////////+P//8wERERER
ERERF4/4h3/3////////+I//9yARERERERERF3//h3j4f///////+I//+CARERAAAAERFz//iHd3d3d3
d3d3d4j//zAREX////AREXj/iIiIiIiIiIiIiIj//3IBERd3d3cREXf//////////////////4IBERER
EREREXP///////////////////MBEREREREREReP//////////////////cgERERERERERd/////////
//////////ggERAAAAABERd6qqqqqqqqqqqqqqqqqqowEX/////wERF6qqqqqqqqqqqqq7q7rMMyARd3
d3d3ERF6qqqqqqqqqqqqqrqrp8cyAREREREREREXu7u7u7u7u7u7u7u7u7uyARERERERERERd3d3d3d3
d3d3d3d3d3d3ERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERER
ERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERER
ERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERER
ERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERER
EREREREREREREf///////wAA////////AAD///////8AAP///////wAA////////AAD///////8AAP//
/////wAA////////AAD///////8AAP///////wAA////////AAD///////8AAP4AAAAB/wAA/gAAAAD/
AAD+AAAAAP8AAJ4AAAAA/wAADwAAAAB/AACPAAAAAH8AAP8AAAAAfwAA/4AAAAA/AAD/gAAAAD8AAIeA
AAAAPwAAA8AAAAAfAACDwAAAAB8AAP/AAAAAHwAA/+AAAAAPAAD/4AAAAA8AAIHgAAAADwAAAPAAAAAH
AACA8AAAAAcAAP/wAAAABwAA//gAAAADAAD/+AAAAAMAAIB4AAAAAwAAADwAAAABAACAPAAAAAEAAP/+
AAAAAQAA//8AAAADAAD///////8AAP///////wAA////////AAD///////8AAP///////wAA////////
AAD///////8AAP///////wAA////////AAD///////8AACgAAAAwAAAAYAAAAAEACAAAAAAAgAoAAAAA
AAAAAAAAAAAAAAAAAACQMAAAmTMAAKE7AACtRwAAu1UAAMNdAADMZgAA020AAN13AAD2kAAAoz0BAIYv
BACbNwQAzGkGAKNEDQBwMRAAnkITAHQ1FAAVFRUAaTIVAKBEFQDTdBUA4oMVAJhDGACgSh4Ao0sfAKFM
IQCaSyMAp08jAJ1NJQClUCUAXzsoAFw9LABhQS8AvHYxANB9MQDeijcAODg4AG5LOADaiTkAvHM9AOGQ
PwB5U0AA3I5AAKxqSQBNTU0AnWhNALN/YwBmZmYAtYRqAO+sagD1s2oAcXFxAHB3dwC4jncAdXp6APa7
fwD6v38Ae4SEALyYhAB7aoYAh5KSAJOcnACXpaUAmaioAJqmqQCqqqoAra2rAJ+srACvr6wAq66uALSy
rgC3tbAAvLixAL24sQDBu7MAw720AMrCtwDLwrcApra4ANXJuwDXyrwArLy9ANnLvQDczr4A4NDAAOTT
wQDq18QA69jEAPLcxwD13sgAtMXJAM/QzQDGzc4AuszRALvN0gC/0NQAwtPWAMbV2QDJ19sA0trbANvb
2wDJ2t4Ay9zgANfc4ADa3eEA3uHjAPjw4wDf4uQA2OLlAPjy5QDk5uYA3uLnAOXm5wDS5OgA3OXoAOzr
6ADr6+kA7uzpAPn06QDq6uoA8u/rAPr16wDW6OwA9vLsAOPr7QD59O0A2OrvANnq7wDo7u8A2+vwAOvt
8ADt7/AA3ezxAODu8gDv8fIA7vDzAPLz8wD19PMA5fH0APf29AD69/UA6fP2APz69gDt9fcA9/f3APX3
+ADy+PkA+fz8AAAAAAA0b/8A////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWV
lZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWV
lZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWV
lZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWV
lZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWV
lZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWV
lZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWV
lZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWV
lZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWV
lZWVlZWVlZWVlZWVlZUwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMJWVlZWVlZWVlZWVlZWV
lQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQERMJWVlZWVlZWVlZWVlZWVlQEvNjY2NjY2NjY2
NjY2NjY2NjY2NjY2NjY2NjY2NiwBITCVlZWVlZWVlZWVlZWVlQExf39/f39/f39/f39/f39/f39/f39/
f39/f39/f2QBEzCVlZWVlZWVlTAwlZWVlRcQf39/f39/f39/f39/f39/f39/f39/f39/f39/f38aGDCV
lZWVlZWVa1RJMJWVlZUBXH9/f39/f39/f39/f39/f39/f39/f39/f39/f387ASAwlZWVlZWVlXZscJWV
lZUAMX9/f39/f39/f39/f39/f39/f39/f39/f39/f39kAQ8wlZWVlZWVlZWVlZWVlZUXEH9/f39/f39/
f39/f39/f39/f39/f39/f39/f39/GgswlZWVlZWVlZWVlZWVlZWVAVx/f5eXl5eXl5eXl5eXl5eXl5eX
l5eXl5eXhX9/OwEfMJWVlZWVlZWVlZWVlZWVADF/f3I/T15eXl5eXl5eXl5eXl5eXl5eXl+XkH9/ZAEP
MJWVlZWVlTAwMDCVlZWVFxB/f38/QDVzc3Nzc3Nzc3Nzc3Nzc3NzbV6Bl39/fxoLMJWVlZWVblhRTEcw
lZWVlQFcf39hPzVGl5cSl5eXl5eXl5eXl5eXl2Bjl4Z/fzsBHzCVlZWVlXx0b2lwlZWVlQAxf397Pz41
eJclZZeXl5eXl5eXl5eXl21el5N/f2QBDzCVlZWVlZWVlZWVlZWVlRcQf39/Uj81RpdCNJeXl5eXl5eX
l5eXl5JefZeAf38aGTCVlZWVlZWVlZWVlZWVlZUBXH9/Zj81N5eRLZeXl5eXl5eXl5eXl5dgYpeLf387
AR8wlZWVlZWVlZWVlZWVlZUBMX9/fz89NUaXQkKXl5eXl5eXl5eXl5dBXpeUf39kAQ8wlZWVlTAwMDAw
MJWVlZUdEH9/f1I/NTU1NTU1NTU1NTU1NTU1NTU6W12Xgn9/GhkwlZWVd1lWU05KRTCVlZWVAVx/f2c/
Pz8/Pz8/Pz8/Pz8/Pz8/Pz8/P0SXjn9/OwEfMJWVlX55dXFqaHCVlZWVATF/f39/f39/f39/f39/f39/
f39/f39/f39/f39/ZAEPMJWVlZWVlZWVlZWVlZWVHRB/f39/f39/f39/f39/f39/f39/f39/f39/f39/
fxoZMJWVlZWVlZWVlZWVlZWVlQFcf39/f39/f39/f39/f39/f39/f39/f39/f39/fzsBHzCVlZWVlZWV
lZWVlZWVlQExf39/f39/f39/f39/f39/f39/f39/f39/f39/f2QBDzCVlTAwMDAwMDAwlZWVlR0CCQkJ
CQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkDHjCVelpXVVBNS0hDMJWVlZUBBwgICAgICAgICAgICAgI
CAgICAg5OQgzORaWliIEASYwlY+NjIqJh4SDiJWVlZUUDg0GBgYGBgYGBgYGBgYGBgYGBgYyOBUpOCku
ljwFASowlZWVlZWVlZWVlZWVlZWVAQojKyQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCcoATCVlZWVlZWV
lZWVlZWVlZWVlRwBAQwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwBG5WVlZWVlZWVlZWVlZWVlZWVlZWV
lZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWV
lZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWV
lZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWV
lZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWV
lZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWV
lZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWV
lZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWV
lZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWV////////AAD///////8AAP//
/////wAA////////AAD///////8AAP///////wAA////////AAD///////8AAP///////wAA////////
AAD///////8AAP8AAAAA/wAA/gAAAAD/AAD+AAAAAH8AAP4AAAAAfwAAngAAAAB/AAAPAAAAAD8AAI8A
AAAAPwAA/wAAAAA/AAD/gAAAAB8AAP+AAAAAHwAAh4AAAAAfAAADwAAAAA8AAIPAAAAADwAA/8AAAAAP
AAD/4AAAAAcAAP/gAAAABwAAgeAAAAAHAAAA8AAAAAMAAIDwAAAAAwAA//AAAAADAAD/+AAAAAEAAP/4
AAAAAQAAgHgAAAABAAAAPAAAAAAAAIA8AAAAAAAA//4AAAABAAD//wAAAAMAAP///////wAA////////
AAD///////8AAP///////wAA////////AAD///////8AAP///////wAA////////AAD///////8AAP//
/////wAA
</value>
</data>
</root>

104
trunk/GotoWindow.Designer.cs generated Normal file
View file

@ -0,0 +1,104 @@
namespace LSLEditor
{
partial class GotoWindow
{
/// <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.label1 = new System.Windows.Forms.Label();
this.textBox1 = new System.Windows.Forms.TextBox();
this.button1 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(16, 8);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(42, 13);
this.label1.TabIndex = 0;
this.label1.Text = "Line nr:";
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(16, 32);
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(224, 20);
this.textBox1.TabIndex = 1;
this.textBox1.KeyDown += new System.Windows.Forms.KeyEventHandler(this.textBox1_KeyDown);
//
// button1
//
this.button1.Location = new System.Drawing.Point(168, 56);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(75, 23);
this.button1.TabIndex = 2;
this.button1.Text = "Cancel";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// button2
//
this.button2.Location = new System.Drawing.Point(80, 56);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(75, 23);
this.button2.TabIndex = 3;
this.button2.Text = "Ok";
this.button2.UseVisualStyleBackColor = true;
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// GotoForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(254, 90);
this.Controls.Add(this.button2);
this.Controls.Add(this.button1);
this.Controls.Add(this.textBox1);
this.Controls.Add(this.label1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "GotoForm";
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Go To Line";
this.TopMost = true;
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button button2;
}
}

98
trunk/GotoWindow.cs Normal file
View file

@ -0,0 +1,98 @@
// /**
// ********
// *
// * ORIGIONAL CODE BASE IS Copyright (C) 2006-2010 by Alphons van der Heijden
// * The code was donated on 4/28/2010 by Alphons van der Heijden
// * To Brandon'Dimentox Travanti' Husbands & Malcolm J. Kudra which in turn Liscense under the GPLv2.
// * In agreement to Alphons van der Heijden 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 all
// * copies or substantial portions of the Software.
// *
// ********
// */
using System;
using System.Windows.Forms;
namespace LSLEditor
{
public partial class GotoWindow : Form
{
private LSLEditorForm lslEditForm;
public GotoWindow(LSLEditorForm lslEditForm)
{
InitializeComponent();
this.Icon = lslEditForm.Icon;
this.lslEditForm = lslEditForm;
EditForm editForm = this.lslEditForm.ActiveMdiForm as EditForm;
this.label1.Text = "Line number (1-"+editForm.TextBox.Lines.Length+")";
}
private void button1_Click(object sender, EventArgs e)
{
this.Close();
}
private void Goto()
{
EditForm editForm = this.lslEditForm.ActiveMdiForm as EditForm;
if (editForm == null)
return;
try
{
int intLine = Convert.ToInt32(this.textBox1.Text);
editForm.TextBox.Goto(intLine);
this.Close();
}
catch
{
}
}
private void button2_Click(object sender, EventArgs e)
{
Goto();
}
private void textBox1_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Return)
{
Goto();
e.SuppressKeyPress = true;
}
}
}
}

120
trunk/GotoWindow.resx Normal file
View file

@ -0,0 +1,120 @@
<?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>
</root>

View file

@ -0,0 +1,373 @@
// /**
// ********
// *
// * ORIGIONAL CODE BASE IS Copyright (C) 2006-2010 by Alphons van der Heijden
// * The code was donated on 4/28/2010 by Alphons van der Heijden
// * To Brandon'Dimentox Travanti' Husbands & Malcolm J. Kudra which in turn Liscense under the GPLv2.
// * In agreement to Alphons van der Heijden 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 all
// * copies or substantial portions of the Software.
// *
// ********
// */
using System;
using System.IO;
using System.Text;
using System.Collections.Generic;
namespace LSLEditor
{
class AutoFormatter
{
public static string GetTab()
{
if (Properties.Settings.Default.SL4SpacesIndent)
return " ";
else
return "\t";
}
private static int CountParenthesis(string strLine)
{
int intParenthesis=0;
bool blnWithinString = false;
for (int intI = 0; intI < strLine.Length; intI++)
{
if (strLine[intI] == '"')
blnWithinString = !blnWithinString;
if (blnWithinString)
{
if (strLine[intI] == '\\')
intI++;
continue;
}
if (strLine[intI] == '/')
{
if(intI<(strLine.Length-1))
if (strLine[intI + 1] == '/')
break;
}
if (strLine[intI] == '{')
intParenthesis++;
if (strLine[intI] == '}')
intParenthesis--;
}
return intParenthesis;
}
private static int GetTabCountFromWhiteSpace(string strWhiteSpace)
{
int intSpaces = 0;
for (int intI = 0; intI < strWhiteSpace.Length; intI++)
{
if(strWhiteSpace[intI]==' ')
intSpaces++;
if (strWhiteSpace[intI] == '\t')
intSpaces = (int)(6 * (intSpaces / 6)) + 6 - (intSpaces % 6);
}
if (Properties.Settings.Default.SL4SpacesIndent)
return intSpaces / 4;
else
return intSpaces / 6;
}
public static string GetWhiteSpaceFromLine(string strLine)
{
StringBuilder sb = new StringBuilder();
for (int intI = 0; intI < strLine.Length; intI++)
{
if (strLine[intI] > ' ')
break;
sb.Append(strLine[intI]);
}
return sb.ToString();
}
private static int GetTabCountFromLine(string strLine, out int intOnce)
{
StringBuilder sb = new StringBuilder();
int intCountParenthesis = CountParenthesis(strLine);
if(intCountParenthesis<0)
intCountParenthesis = 0;
for (int intI = 0; intI < strLine.Length; intI++)
{
if (strLine[intI] > ' ')
break;
sb.Append(strLine[intI]);
}
intOnce = 0;
strLine = TrimCommentTrim(strLine);
int intLength = strLine.Length;
if (intLength > 0)
{
char chrLastChar = strLine[intLength - 1];
if (strLine[0] == '{' || chrLastChar == ';' || chrLastChar == '{' || chrLastChar == '}')
intOnce = 0;
else
intOnce = 1;
// this only valid for typing
if (intCountParenthesis == 0 && chrLastChar == '{')
intCountParenthesis++;
}
return GetTabCountFromWhiteSpace(sb.ToString()) + intCountParenthesis + intOnce;
}
public static string RemoveComment(string strLine)
{
bool blnWithinString = false;
for (int intI = 0; intI < (strLine.Length - 1); intI++)
{
char chrC = strLine[intI];
if (chrC == '"')
blnWithinString = !blnWithinString;
if (blnWithinString)
{
if (chrC == '\\')
intI++;
continue;
}
if (chrC != '/')
continue;
if (strLine[intI + 1] == '/')
{
strLine = strLine.Substring(0, intI);
break;
}
}
return strLine;
}
public static string RemoveCommentsFromLines(string strLines)
{
StringBuilder sb = new StringBuilder();
StringReader sr = new StringReader(strLines);
while (true)
{
string strLine = sr.ReadLine();
if (strLine == null)
break;
sb.AppendLine(RemoveComment(strLine));
}
return sb.ToString();
}
private static string TrimCommentTrim(string strLine)
{
return RemoveComment(strLine).Trim();
}
public static string GetNewWhiteSpace(string[] lines, int intIndex)
{
int intTab = 0;
int intOnce = 0;
string strLine = "";
StringBuilder sb = new StringBuilder();
while (intIndex>=0 && intIndex<lines.Length)
{
strLine = lines[intIndex];
if (TrimCommentTrim(strLine).Length > 0)
{
intTab = GetTabCountFromLine(strLine, out intOnce);
break;
}
intIndex--;
}
if (TrimCommentTrim(strLine) != "{")
{
intIndex--;
while (intIndex >= 0 && intIndex < lines.Length)
{
strLine = lines[intIndex];
if (TrimCommentTrim(strLine).Length > 0)
{
GetTabCountFromLine(strLine, out intOnce);
break;
}
intIndex--;
}
}
for (int intI = 0; intI < (intTab - intOnce); intI++)
sb.Append(AutoFormatter.GetTab());
return sb.ToString();
}
public static string ApplyFormatting(int intTab, string strInput)
{
StringBuilder sb = new StringBuilder();
StringReader sr = new StringReader(strInput);
Stack<int> stack = new Stack<int>();
stack.Push(intTab);
int intTemp = 0;
while (true)
{
string strLine = sr.ReadLine();
if (strLine == null)
break;
// trim whitespace, this is a clean line
strLine = strLine.Trim();
// empty lines do not contain tabs
if (strLine.Length == 0)
{
sb.Append('\n');
continue;
}
// print current line, on current indent level
int intCorrection = 0;
if (strLine[0] == '{' || strLine[0] == '}')
intCorrection--;
for (int intI = 0; intI < (intTab + intTemp + intCorrection); intI++)
sb.Append(GetTab());
sb.Append(strLine);
sb.Append('\n');
// calculate next indent level
strLine = TrimCommentTrim(strLine);
int intParenthesis = CountParenthesis(strLine);
if (intParenthesis > 0)
{
for (int intP = 0; intP < intParenthesis; intP++)
{
stack.Push(intTab);
if (strLine != "{")
intTab++;
}
intTab += intTemp;
intTemp = 0;
}
else if (intParenthesis < 0)
{
if (stack.Count > 0)
intTab = stack.Pop();
intTemp = 0;
}
else
{
if (strLine.Length > 0)
{
char chrFirstChar = strLine[0];
char chrLastChar = strLine[strLine.Length - 1];
intTemp++;
if (chrFirstChar == '|' || chrLastChar == '|')
intTemp = 1;
if (chrFirstChar == '+' || chrLastChar == '+')
intTemp = 1;
if (chrFirstChar == '-' || chrLastChar == '-')
intTemp = 1;
if (chrLastChar == ',' || chrLastChar == ',')
intTemp = 1;
if (chrLastChar == ';' || chrLastChar == '}')
intTemp = 0;
}
}
}
if (!strInput.EndsWith("\n"))
return sb.ToString().TrimEnd(new char[] { '\n' });
else
return sb.ToString();
}
public static string MultiLineTab(bool blnAdd, string strText)
{
string strPrefix = GetTab();
StringBuilder sb = new StringBuilder();
StringReader sr = new StringReader(strText);
while (true)
{
string strLine = sr.ReadLine();
if (strLine == null)
break;
if (blnAdd)
{
sb.Append(strPrefix);
}
else
{
if (strLine.StartsWith(strPrefix))
strLine = strLine.Substring(strPrefix.Length);
}
sb.Append(strLine);
sb.Append('\n');
}
return sb.ToString();
}
public static string MultiLineComment(bool blnAdd, int intTab, string strText)
{
string strPrefix = "//";
StringBuilder sb = new StringBuilder();
StringReader sr = new StringReader(strText);
while (true)
{
string strLine = sr.ReadLine();
if (strLine == null)
break;
if (blnAdd)
{
sb.Append(strPrefix);
}
else
{
strLine = strLine.Trim();
if (strLine.StartsWith(strPrefix))
strLine = strLine.Substring(strPrefix.Length);
}
sb.Append(strLine);
sb.Append('\n');
}
return ApplyFormatting(intTab,sb.ToString());
}
}
}

View file

@ -0,0 +1,105 @@
// /**
// ********
// *
// * ORIGIONAL CODE BASE IS Copyright (C) 2006-2010 by Alphons van der Heijden
// * The code was donated on 4/28/2010 by Alphons van der Heijden
// * To Brandon'Dimentox Travanti' Husbands & Malcolm J. Kudra which in turn Liscense under the GPLv2.
// * In agreement to Alphons van der Heijden 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 all
// * copies or substantial portions of the Software.
// *
// ********
// */
using System.Drawing;
using System.Collections.Generic;
using System.Text.RegularExpressions;
namespace LSLEditor.Helpers
{
class CodeCompletion
{
Regex regex;
public CodeCompletion()
{
this.regex = new Regex(
@"
\b(?<type>integer|float|string|vector|rotation|state|key|list)\s
(?>
\s* (?<name>[\w]*) \s*
(?>\= \s*
(?:
(?>
[^(),;]+
| \( (?<nr>)
| \) (?<-nr>)
)*
(?(nr)(?!))
)
\s*)? [,;)]
)*
"
,
RegexOptions.IgnorePatternWhitespace
| RegexOptions.Compiled);
}
public void CodeCompletionUserVar(string strKeyWord, string strTextIn, int intStart, List<KeyWordInfo> list)
{
if (intStart == 0)
return;
string strText = strTextIn.Substring(0, intStart);
string strLowerCaseKeyWord = strKeyWord.ToLower();
foreach (Match m in regex.Matches(strText))
{
if (m.Groups.Count == 4)
{
string strType = m.Groups[1].ToString();
foreach (Capture cap in m.Groups[2].Captures)
{
string strName = cap.ToString();
if (strName.ToLower().StartsWith(strLowerCaseKeyWord))
{
KeyWordInfo ki = new KeyWordInfo(KeyWordTypeEnum.Vars, strName, Color.Red);
if (!list.Contains(ki))
list.Add(ki);
}
if (strType == "list" || strType == "vector" || strType == "rotation")
break;
}
}
}
}
}
}

View file

@ -0,0 +1,145 @@
// /**
// ********
// *
// * ORIGIONAL CODE BASE IS Copyright (C) 2006-2010 by Alphons van der Heijden
// * The code was donated on 4/28/2010 by Alphons van der Heijden
// * To Brandon'Dimentox Travanti' Husbands & Malcolm J. Kudra which in turn Liscense under the GPLv2.
// * In agreement to Alphons van der Heijden 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 all
// * copies or substantial portions of the Software.
// *
// ********
// */
using System;
using System.IO;
using System.Reflection;
using System.Windows.Forms;
using System.CodeDom.Compiler;
using Microsoft.CSharp;
namespace LSLEditor.Helpers
{
class CompilerHelper
{
private static int FindDefaultLineNumber(string strCode)
{
StringReader sr = new StringReader(strCode);
int intI = 0;
while (true)
{
string strLine = sr.ReadLine();
if (strLine == null)
break;
if (strLine.StartsWith("class State_default"))
return intI;
intI++;
}
return intI;
}
public static Assembly CompileCSharp(EditForm editForm, string CSharpCode)
{
// Code compiler and provider
CodeDomProvider cc = new CSharpCodeProvider();
// Compiler parameters
CompilerParameters cp = new CompilerParameters();
// Sept 15, 2007 -> 3, 30 oct 2007 -> 4
if(!Properties.Settings.Default.SkipWarnings)
cp.WarningLevel = 4;
// Add common assemblies
cp.ReferencedAssemblies.Add("System.dll");
cp.ReferencedAssemblies.Add("System.Windows.Forms.dll");
// LSLEditor.exe contains all base SecondLife class stuff
cp.ReferencedAssemblies.Add(Assembly.GetExecutingAssembly().Location);
// Compiling to memory
cp.GenerateInMemory = true;
// Does this work?
cp.IncludeDebugInformation = true;
// Wrap strCSharpCode into my namespace
string strRunTime = "namespace LSLEditor\n{\n";
strRunTime += CSharpCode;
strRunTime += "\n}\n";
int intDefaultLineNumber = FindDefaultLineNumber(strRunTime);
// Here we go
CompilerResults cr = cc.CompileAssemblyFromSource(cp, strRunTime);
// get the listview to store some errors
ListView ListViewErrors = editForm.parent.SyntaxErrors.ListView;
// Console.WriteLine(cr.Errors.HasWarnings.ToString());
// Check for compilation errors...
if (ListViewErrors != null && (cr.Errors.HasErrors || cr.Errors.HasWarnings))
{
int intNr = 1;
foreach (CompilerError err in cr.Errors)
{
int intLine = err.Line;
if (intLine < intDefaultLineNumber)
intLine -= 4;
else
intLine -= 5;
string strError = OopsFormatter.ApplyFormatting(err.ErrorText);
int intImageIndex = 0;
if (err.IsWarning)
intImageIndex = 1;
ListViewItem lvi = new ListViewItem(new string[] {
"", // 0
intNr.ToString(), // 1
strError, // 2
editForm.ScriptName, // 3
intLine.ToString(), // 4
err.Column.ToString(), // 5
editForm.ProjectName , // 6
editForm.FullPathName, // 7
editForm.guid.ToString(),// 8
editForm.IsScript.ToString()// 9
} , intImageIndex);
ListViewErrors.Items.Add(lvi);
intNr++;
}
return null;
}
return cr.CompiledAssembly;
}
}
}

View file

@ -0,0 +1,115 @@
// /**
// ********
// *
// * ORIGIONAL CODE BASE IS Copyright (C) 2006-2010 by Alphons van der Heijden
// * The code was donated on 4/28/2010 by Alphons van der Heijden
// * To Brandon'Dimentox Travanti' Husbands & Malcolm J. Kudra which in turn Liscense under the GPLv2.
// * In agreement to Alphons van der Heijden 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 all
// * copies or substantial portions of the Software.
// *
// ********
// */
using System;
using System.Text;
using Microsoft.Win32;
namespace LSLEditor.Helpers
{
class FileAssociator
{
// Associate file extension with progID, description, icon and application
public static bool Associate(string strExtension, string strFileNameType, string strDescription, string strApplication,int intIconNr)
{
try
{
Registry.ClassesRoot.CreateSubKey(strExtension).SetValue("", strFileNameType);
if (strFileNameType != null && strFileNameType.Length > 0)
{
using (RegistryKey key = Registry.ClassesRoot.CreateSubKey(strFileNameType))
{
if (strDescription != null)
key.SetValue("", strDescription);
if (strApplication != null)
{
key.CreateSubKey("DefaultIcon").SetValue("", strApplication + "," + intIconNr);
key.CreateSubKey(@"Shell\Open\Command").SetValue("", "\"" + strApplication + "\" \"%1\"");
}
}
}
return true;
}
catch
{
return false;
}
}
public static bool DeAssociate(string strExtension, string strFileNameType)
{
try
{
Registry.ClassesRoot.DeleteSubKey(strExtension);
Registry.ClassesRoot.DeleteSubKeyTree(strFileNameType);
return true;
}
catch
{
return false;
}
}
// Return true if extension already associated in registry
public static bool IsAssociated(string strExtension)
{
try
{
return (Registry.ClassesRoot.OpenSubKey(strExtension, false) != null);
}
catch
{
return false;
}
}
private void Test()
{
if (!IsAssociated(".lsl"))
Associate(".lsl", "LSLEditorScript", "SecondLife lsl File for LSLEditor", System.Reflection.Assembly.GetExecutingAssembly().Location, 0);
DeAssociate(".lsl", "LSLEditorScript");
}
}
}

View file

@ -0,0 +1,71 @@
// /**
// ********
// *
// * ORIGIONAL CODE BASE IS Copyright (C) 2006-2010 by Alphons van der Heijden
// * The code was donated on 4/28/2010 by Alphons van der Heijden
// * To Brandon'Dimentox Travanti' Husbands & Malcolm J. Kudra which in turn Liscense under the GPLv2.
// * In agreement to Alphons van der Heijden 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 all
// * copies or substantial portions of the Software.
// *
// ********
// */
using System;
using System.Reflection;
using System.IO;
namespace LSLEditor.Helpers
{
class GetTemplate
{
public static string Source()
{
try
{
string strTemplate = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), Properties.Settings.Default.ExampleTemplate);
if (File.Exists(strTemplate))
{
StreamReader sr = new StreamReader(strTemplate);
string strCode = sr.ReadToEnd();
sr.Close();
return strCode;
}
}
catch
{
}
return Properties.Settings.Default.Example;
}
}
}

View file

@ -0,0 +1,190 @@
// /**
// ********
// *
// * ORIGIONAL CODE BASE IS Copyright (C) 2006-2010 by Alphons van der Heijden
// * The code was donated on 4/28/2010 by Alphons van der Heijden
// * To Brandon'Dimentox Travanti' Husbands & Malcolm J. Kudra which in turn Liscense under the GPLv2.
// * In agreement to Alphons van der Heijden 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 all
// * copies or substantial portions of the Software.
// *
// ********
// */
using System;
using System.Collections;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
namespace LSLEditor
{
/// <summary>
/// Summary description for GroupboxTextbox.
/// </summary>
public class GroupboxEvent : System.Windows.Forms.GroupBox
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.Container components = null;
public GroupboxEvent(Point pt,string strName,string strArgs,System.EventHandler eventHandler)
{
// This call is required by the Windows.Forms Form Designer.
InitializeComponent();
this.Location = pt;
string[] args = strArgs.Trim().Split(new char[] {','});
int intX=5;
int intY=5;
if(args.Length>0)
intY += 5;
for(int intArgumentNumber=0;intArgumentNumber<args.Length;intArgumentNumber++)
{
string[] argument = args[intArgumentNumber].Trim().Split(new char[] {' '});
if(argument.Length==2)
{
string strArgumentName = argument[1];
string strArgumentType = argument[0];
string strArgumentValue = "";
switch(strArgumentType)
{
case "System.double":
case "LSLEditor.SecondLife+Float":
strArgumentValue = "1.0";
break;
case "LSLEditor.integer":
case "LSLEditor.SecondLife+integer":
case "System.Int32":
strArgumentValue = "1";
break;
case "LSLEditor.SecondLife+String":
case "System.String":
strArgumentValue = "hello";
break;
case "LSLEditor.SecondLife+key":
strArgumentValue = Guid.NewGuid().ToString();
break;
case "LSLEditor.SecondLife+rotation":
strArgumentValue = "<0,0,0,1>";
break;
case "LSLEditor.SecondLife+vector":
strArgumentValue = "<0,0,0>";
break;
case "LSLEditor.SecondLife+list":
strArgumentValue = "";
break;
default:
MessageBox.Show("GroupboxEvent->["+strArgumentType+"]["+strArgumentName+"]");
strArgumentValue = "unknown";
break;
}
GroupBox groupbox = new GroupBox();
groupbox.Name = strName+"_"+intArgumentNumber;
groupbox.Text = strArgumentName;
groupbox.Location = new Point(5,intY);
groupbox.Width = this.Width - 10;
Control control = null;
if (strName == "listen" && intArgumentNumber==0)
{
ComboBox comboBox = new ComboBox();
comboBox.Text = "";
control = comboBox;
}
else
{
TextBox textBox = new TextBox();
textBox.Text = strArgumentValue;
control = textBox;
}
control.Name = "textBox_" + strName + "_" + intArgumentNumber;
control.Location = new Point(5, 15);
groupbox.Controls.Add(control);
groupbox.Height = 20 + control.Height;
this.Controls.Add(groupbox);
intY += groupbox.Height;
}
else
{
if(strArgs!="")
MessageBox.Show("Argument must be 'type name' ["+strArgs+"]");
}
}
intY += 5;
Button button = new Button();
button.Text = strName;
button.Width = 130;
button.Location = new Point(intX,intY);
button.Click += eventHandler;
this.Controls.Add(button);
this.Height = intY + button.Height + 5;
}
/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Component 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()
{
//
// GroupboxTextbox
//
this.Name = "GroupboxTextbox";
this.Size = new System.Drawing.Size(152, 96);
}
#endregion
}
}

View file

@ -0,0 +1,130 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 1.3
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">1.3</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1">this is my long string</data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
[base64 mime encoded serialized .NET Framework object]
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
[base64 mime encoded string representing a byte array form of the .NET Framework object]
</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 forserialized 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.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:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<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" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</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>1.3</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="$this.TrayLargeIcon" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</data>
<data name="$this.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</data>
<data name="$this.SnapToGrid" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</data>
<data name="$this.DrawGrid" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</data>
<data name="$this.TrayHeight" type="System.Int32, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>80</value>
</data>
<data name="$this.Language" type="System.Globalization.CultureInfo, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>(Default)</value>
</data>
<data name="$this.Localizable" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</data>
<data name="$this.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>Private</value>
</data>
<data name="$this.Name">
<value>GroupboxTextbox</value>
</data>
<data name="$this.GridSize" type="System.Drawing.Size, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>8, 8</value>
</data>
</root>

View file

@ -0,0 +1,204 @@
// /**
// ********
// *
// * ORIGIONAL CODE BASE IS Copyright (C) 2006-2010 by Alphons van der Heijden
// * The code was donated on 4/28/2010 by Alphons van der Heijden
// * To Brandon'Dimentox Travanti' Husbands & Malcolm J. Kudra which in turn Liscense under the GPLv2.
// * In agreement to Alphons van der Heijden 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 all
// * copies or substantial portions of the Software.
// *
// ********
// */
using System;
using System.Net;
using System.Text;
namespace LSLEditor
{
class HTTPRequest
{
private class UserState
{
public SecondLife secondlife;
public SecondLife.key httpkey;
public UserState(SecondLife.key httpkey, SecondLife secondlife)
{
this.secondlife = secondlife;
this.httpkey = httpkey;
}
}
public static void Request(WebProxy proxy, SecondLife secondlife, string strUrl, SecondLife.list parameters, string postData, SecondLife.key key)
{
string strMethod = "GET";
string strContentType = "text/plain;charset=utf-8";
for (int intI = 0; intI < parameters.Count; intI += 2)
{
int intKey;
if (!int.TryParse(parameters[intI].ToString(), out intKey))
continue;
switch (intKey)
{
case 0:
// get, post, put, delete
strMethod = parameters[intI + 1].ToString().ToUpper();
break;
case 1:
strContentType = parameters[intI + 1].ToString();
break;
case 2:
// HTTP_BODY_MAXLENGTH
break;
case 3:
// HTTP_VERIFY_CERT
break;
default:
break;
}
}
WebClient wc = new WebClient();
wc.Headers.Add("Content-Type", strContentType);
wc.Headers.Add("Accept", "text/*");
wc.Headers.Add("Accept-Charset", "utf-8;q=1.0, *;q=0.5");
wc.Headers.Add("Accept-Encoding", "deflate, gzip");
wc.Headers.Add("User-Agent", "Second Life LSL/1.19.0(12345) (http://secondlife.com)");
System.Drawing.Point point = Properties.Settings.Default.RegionCorner;
SecondLife.vector RegionCorner = new SecondLife.vector(point.X, point.Y, 0);
SecondLife.vector pos = secondlife.GetLocalPos();
wc.Headers.Add("X-SecondLife-Shard", Properties.Settings.Default.XSecondLifeShard);
wc.Headers.Add("X-SecondLife-Object-Name", secondlife.host.GetObjectName());
wc.Headers.Add("X-SecondLife-Object-Key", secondlife.host.GetKey().ToString());
wc.Headers.Add("X-SecondLife-Region", string.Format("{0} ({1}, {2})", Properties.Settings.Default.RegionName, (int)RegionCorner.x, (int)RegionCorner.y));
wc.Headers.Add("X-SecondLife-Local-Position", string.Format("({0}, {1}, {2})", pos.x, pos.y, pos.z));
wc.Headers.Add("X-SecondLife-Local-Rotation", "(0.000000, 0.000000, 0.000000, 1.000000)");
wc.Headers.Add("X-SecondLife-Local-Velocity", "(0.000000, 0.000000, 0.000000)");
wc.Headers.Add("X-SecondLife-Owner-Name", Properties.Settings.Default.AvatarName);
wc.Headers.Add("X-SecondLife-Owner-Key", Properties.Settings.Default.AvatarKey);
wc.Headers.Add("X-Forwarded-For", "127.0.0.1");
if (proxy != null)
wc.Proxy = proxy;
Uri uri = new Uri(strUrl);
// Basic Authentication scheme, added 28 mrt 2008
if (uri.UserInfo != "")
{
string[] UserInfo = uri.UserInfo.Split(':');
if (UserInfo.Length == 2)
{
CredentialCache mycache = new CredentialCache();
mycache.Add(uri, "Basic",
new NetworkCredential(UserInfo[0], UserInfo[1]));
wc.Credentials = mycache;
}
}
UserState userState = new UserState(key, secondlife);
if (strMethod == "POST" || strMethod == "PUT")
{
wc.UploadDataCompleted += new UploadDataCompletedEventHandler(wc_UploadDataCompleted);
wc.UploadDataAsync(uri, strMethod, Encoding.UTF8.GetBytes(postData), userState);
}
else
{
wc.DownloadDataCompleted += new DownloadDataCompletedEventHandler(wc_DownloadDataCompleted);
wc.DownloadDataAsync(uri, userState);
}
}
private static void wc_DownloadDataCompleted(object sender, DownloadDataCompletedEventArgs e)
{
int intStatusCode = 200;
UserState userState = (UserState)e.UserState;
string strResult = "";
if (e.Error != null)
{
WebException webException = e.Error as WebException;
HttpWebResponse webResponse = webException.Response as HttpWebResponse;
if (webResponse == null)
{
intStatusCode = 0;
strResult = webException.Message;
}
else
{
intStatusCode = (int)webResponse.StatusCode;
System.IO.StreamReader sr = new System.IO.StreamReader(webResponse.GetResponseStream());
strResult = sr.ReadToEnd();
}
}
else
{
if (e.Result != null)
strResult = Encoding.ASCII.GetString(e.Result);
}
userState.secondlife.host.ExecuteSecondLife("http_response", userState.httpkey, (SecondLife.integer)intStatusCode, new SecondLife.list(), (SecondLife.String)strResult);
}
private static void wc_UploadDataCompleted(object sender, UploadDataCompletedEventArgs e)
{
int intStatusCode = 200;
UserState userState = (UserState)e.UserState;
string strResult = "";
if (e.Error != null)
{
WebException webException = e.Error as WebException;
HttpWebResponse webResponse = webException.Response as HttpWebResponse;
intStatusCode = (int)webResponse.StatusCode;
System.IO.StreamReader sr = new System.IO.StreamReader(webResponse.GetResponseStream());
strResult = sr.ReadToEnd();
}
else
{
if (e.Result != null)
strResult = Encoding.ASCII.GetString(e.Result);
}
userState.secondlife.host.ExecuteSecondLife("http_response", userState.httpkey, (SecondLife.integer)intStatusCode, new SecondLife.list(), (SecondLife.String)strResult);
}
}
}

642
trunk/Helpers/LSL2CSharp.cs Normal file
View file

@ -0,0 +1,642 @@
// /**
// ********
// *
// * ORIGIONAL CODE BASE IS Copyright (C) 2006-2010 by Alphons van der Heijden
// * The code was donated on 4/28/2010 by Alphons van der Heijden
// * To Brandon'Dimentox Travanti' Husbands & Malcolm J. Kudra which in turn Liscense under the GPLv2.
// * In agreement to Alphons van der Heijden 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 all
// * copies or substantial portions of the Software.
// *
// ********
// */
using System;
using System.Xml;
using System.Text;
using System.Collections;
using System.Collections.Generic;
using System.Text.RegularExpressions;
namespace LSLEditor
{
class LSL2CSharp
{
public List<string> States;
private XmlDocument xml;
public LSL2CSharp(XmlDocument xml)
{
this.xml = xml;
this.States = new List<string>();
}
private string CorrectGlobalEvaluator(Match m)
{
string strPrefix = m.Groups["prefix"].Value;
string strPublic = m.Groups["public"].Value;
string strPostfix = m.Groups["postfix"].Value;
if (strPublic.EndsWith(";"))
return strPrefix + "public static " + strPublic + strPostfix;
// has to be static,
// because the vars must keep their values between state changes
// 22 june 2007, added
Regex regex = new Regex(@"\w*", RegexOptions.IgnorePatternWhitespace );
int intCount=0;
for (Match pm = regex.Match(strPublic); pm.Success; pm = pm.NextMatch())
{
if (pm.Value.Length > 0)
intCount++;
if (intCount > 1)
break;
}
if(intCount==1)
return strPrefix + "public void " + strPublic + strPostfix;
else
return strPrefix + "public " + strPublic + strPostfix;
}
private string CorrectGlobal(string strC)
{
Regex regex = new Regex(
@"(?<prefix>\s*)
(?:
(?<public>[^{};]*;)
|
(?<public>[^{;(]*)
(?<postfix>
\( [^{]* \) \s*
\{
(?>
[^{}]+
| \{ (?<number>)
| \} (?<-number>)
)*
(?(number)(?!))
\}
)
)",
RegexOptions.IgnorePatternWhitespace);
return regex.Replace(strC, new MatchEvaluator(CorrectGlobalEvaluator));
}
private string RemoveComments(string strC)
{
if (Properties.Settings.Default.CommentCStyle)
{
int intI = strC.IndexOf("/*");
while (intI > 0)
{
int intJ = strC.IndexOf("*" + "/", intI);
if (intJ < 0)
break;
strC = strC.Remove(intI, intJ - intI + 2);
intI = strC.IndexOf("/*");
}
}
return AutoFormatter.RemoveCommentsFromLines(strC);
}
private string CorrectStates(string strC,string strGlobalClass)
{
Regex regex;
// Default state
regex = new Regex(@"^\s*(default)(\W)",
RegexOptions.Multiline
| RegexOptions.IgnorePatternWhitespace
| RegexOptions.Compiled);
strC = regex.Replace(strC, @"class State_$1 : " + strGlobalClass + "$2");
// Other states
regex = new Regex(
@"^state\s+([^\s]*)(\s*\{)",
RegexOptions.Multiline
| RegexOptions.IgnorePatternWhitespace
| RegexOptions.Compiled
);
Match m = regex.Match(strC);
while (m.Success)
{
string strStateName = m.Groups[1].ToString();
this.States.Add(strStateName);
m = m.NextMatch();
}
strC = regex.Replace(strC, "class State_$1 : " + strGlobalClass + "$2");
string strGlobal = "";
if (Properties.Settings.Default.StatesInGlobalFunctions)
{
// do nothing!
}
else
{
int intDefault = strC.IndexOf("class State_default");
if (intDefault >= 0)
{
strGlobal = strC.Substring(0, intDefault);
strC = strC.Substring(intDefault);
}
}
// State change, excluding global functions
regex = new Regex(
@"(\s+)state\s+(\w*)(\s*;)",
RegexOptions.IgnorePatternWhitespace
| RegexOptions.Compiled
);
return strGlobal + regex.Replace(strC, @"$1state(""$2"")$3");
}
private string PreCorrectReservedWords(string strC)
{
#region All PreCorrect reserved C# words
Regex regex = new Regex(@"(\b)(public
| class
| override
| namespace
| void
| SecondLife
| GlobalClass
| static
| goto
| String
| Float
)(\b)",
RegexOptions.IgnorePatternWhitespace
| RegexOptions.Compiled
);
#endregion
return regex.Replace(strC, "$1_$2$3");
}
private string CorrectReservedWords(string strC)
{
#region All reserved C# words
Regex regex = new Regex(@"(\b)(new
| abstract
| as
| base
| bool
| break
| byte
| case
| catch
| char
| checked
| const
| continue
| decimal
| delegate
| double
| enum
| event
| explicit
| extern
| false
| finally
| fixed
| foreach
| implicit
| in
| int
| interface
| internal
| is
| lock
| long
| new
| null
| object
| operator
| out
| params
| private
| protected
| readonly
| ref
| sbyte
| sealed
| short
| sizeof
| stackalloc
| struct
| switch
| this
| throw
| true
| try
| typeof
| uint
| ulong
| unchecked
| unsafe
| ushort
| using
| virtual
)(\b)",
RegexOptions.IgnorePatternWhitespace
| RegexOptions.Compiled
);
#endregion
return regex.Replace(strC, "$1_$2$3");
}
private string CorrectEvent(string strC, string strName)
{
Regex regex = new Regex(
@"([^\w_])" + strName + @"(\s*)\(",
RegexOptions.IgnorePatternWhitespace
| RegexOptions.Compiled
);
return regex.Replace(strC, "$1public override void " + strName + "$2(");
}
private string CorrectEvents(string strC)
{
XmlNode words = xml.SelectSingleNode("//Words[@name='Appendix B. Events']");
foreach (XmlNode xmlNode in words.SelectNodes(".//Word"))
{
string strName = xmlNode.Attributes["name"].InnerText;
strC = CorrectEvent(strC, strName);
}
return strC;
}
// old vector parser
// <([^<>,;]*),([^<>,;]*),([^<>,;]*)>
private string CorrectVector(string strC)
{
Regex regex = new Regex(@"
<
(?<vector_x>
(?>
[^=(),>]+
| \( (?<nr>)
| \) (?<-nr>)
| ,
)*
(?(nr)(?!))
)
,
(?<vector_y>
(?>
[^=(),>]+
| \( (?<nr>)
| \) (?<-nr>)
| ,
)*
(?(nr)(?!))
)
,
(?<vector_z>
(?>
[^=()>]+
| \( (?<nr>)
| \) (?<-nr>)
| ,
)*
(?(nr)(?!))
)
>
",
RegexOptions.IgnorePatternWhitespace
| RegexOptions.Compiled
);
return regex.Replace(strC, "new vector(${vector_x},${vector_y},${vector_z})");
}
// old rotation
// <([^<>,;]*),([^<>,;]*),([^<>,;]*),([^<>,;]*)>
private string CorrectRotation(string strC)
{
Regex regex = new Regex(@"
<
(?<rotation_x>
(?>
[^=(),>]+
| \( (?<nr>)
| \) (?<-nr>)
| ,
)*
(?(nr)(?!))
)
,
(?<rotation_y>
(?>
[^=(),>]+
| \( (?<nr>)
| \) (?<-nr>)
| ,
)*
(?(nr)(?!))
)
,
(?<rotation_z>
(?>
[^=(),>]+
| \( (?<nr>)
| \) (?<-nr>)
| ,
)*
(?(nr)(?!))
)
,
(?<rotation_s>
(?>
[^=()>]+
| \( (?<nr>)
| \) (?<-nr>)
| ,
)*
(?(nr)(?!))
)
>
",
RegexOptions.IgnorePatternWhitespace
| RegexOptions.Compiled
);
return regex.Replace(strC, "new rotation(${rotation_x},${rotation_y},${rotation_z},${rotation_s})");
}
private string CorrectQuaternion(string strC)
{
Regex regex = new Regex(
@"(\b)quaternion(\b)",
RegexOptions.Compiled
| RegexOptions.IgnorePatternWhitespace
);
return regex.Replace(strC, "$1rotation$2");
}
private string CorrectListsEvaluator(Match m)
{
string strValue = m.Value;
return "new list(new object[] {" + CorrectLists(strValue.Substring(1, strValue.Length - 2)) + "})";
}
private string CorrectLists(string strC)
{
Regex regex = new Regex(
@"
\[
(?>
[^\[\]]+
| \[ (?<number>)
| \] (?<-number>)
)*
(?(number)(?!))
\]
",
RegexOptions.IgnorePatternWhitespace
| RegexOptions.Compiled);
return regex.Replace(strC, new MatchEvaluator(CorrectListsEvaluator));
}
// changed 16 aug 2007
private string CorrectJump(string strC)
{
// jump -> goto
Regex regex = new Regex(
@"(\b)jump(\s+)([^;]*;)",
RegexOptions.Compiled
| RegexOptions.IgnorePatternWhitespace
);
strC = regex.Replace(strC, "$1goto$2_$3");
// @label; -> label:;
regex = new Regex(
@"@\s*([a-z0-9_]+)\s*;",
RegexOptions.Compiled
| RegexOptions.IgnoreCase
| RegexOptions.IgnorePatternWhitespace
);
return regex.Replace(strC, "_$1:;");
}
private string RemoveQuotedStrings(string strC, out List<string> h)
{
h = new List<string>();
StringBuilder sb = new StringBuilder();
StringBuilder QuotedString = null;
for (int intI = 0; intI < strC.Length; intI++)
{
char chrC = strC[intI];
if (chrC == '"')
{
if (QuotedString != null)
{
// end of a quoted string
sb.Append('"');
sb.Append(h.Count.ToString());
sb.Append('"');
h.Add(QuotedString.ToString());
QuotedString = null;
continue;
}
else
{
if (chrC == '"')
{
// start of a new quoted string
QuotedString = new StringBuilder();
continue;
}
// it was just a newline char, and not in a string
}
}
if (QuotedString == null)
sb.Append(chrC);
else
{
if (chrC == '\n')
{
QuotedString.Append('\\');
chrC = 'n';
}
if (chrC != '\\')
{
QuotedString.Append(chrC);
}
else // it is a backslash
{
intI++;
chrC = strC[intI];
if (chrC == 't') // tabs are 4 spaces in SL world!!
{
QuotedString.Append(" ");
}
else // nope, it is no tab, just output it all
{
QuotedString.Append('\\');
QuotedString.Append(chrC);
}
}
}
}
return sb.ToString();
}
private string InsertQuotedStrings(string strC, List<string> h)
{
StringBuilder sb = new StringBuilder();
StringBuilder QuotedString = null;
for (int intI = 0; intI < strC.Length; intI++)
{
char chrC = strC[intI];
if (chrC == '"')
{
if (QuotedString == null)
{
QuotedString = new StringBuilder();
}
else
{
sb.Append('"');
int intNumber;
// State("default") is not a number, result of 'CorrectStates'
if (int.TryParse(QuotedString.ToString(), out intNumber))
sb.Append(h[intNumber]);
else
sb.Append(QuotedString.ToString());
sb.Append('"');
QuotedString = null;
}
continue;
}
if (QuotedString == null)
sb.Append(chrC);
else
QuotedString.Append(chrC);
}
return sb.ToString();
}
private string MakeGlobalAndLocal(string strC)
{
Regex regexDefault = new Regex(@"^\s*(default)\W",
RegexOptions.IgnorePatternWhitespace
| RegexOptions.Multiline
| RegexOptions.Compiled);
Match matchDefault = regexDefault.Match(strC);
string strGlobal;
int intDefaultIndex;
if (matchDefault.Groups.Count == 2)
{
States.Add("default");
intDefaultIndex = matchDefault.Groups[1].Index;
strGlobal = CorrectGlobal(strC.Substring(0, intDefaultIndex));
}
else
{
intDefaultIndex = 0;
strGlobal = "";
}
return "class GlobalClass : SecondLife\n{\n" + strGlobal + "}\n" + strC.Substring(intDefaultIndex);
}
private string Capitalize(string strC, string strName)
{
Regex regex = new Regex(@"(\W)"+strName+@"(\W)",
RegexOptions.IgnorePatternWhitespace
| RegexOptions.Multiline
| RegexOptions.Compiled);
string strCap = strName[0].ToString().ToUpper() + strName.Substring(1);
return regex.Replace(strC, "$1"+strCap+"$2");
}
private string RemoveSingleQuotes(string strC)
{
if (Properties.Settings.Default.SingleQuote)
return strC.Replace("'", "");
else
return strC;
}
/// <summary>
/// This Class translates LSL script into CSharp code
/// </summary>
/// <param name="strLSLCode">LSL scripting code</param>
/// <returns>CSHarp code</returns>
public string Parse(string strLSLCode)
{
List<string> quotedStrings;
string strGlobalClass = "GlobalClass";
string strC = strLSLCode;
strC = RemoveComments(strC);
strC = RemoveQuotedStrings(strC, out quotedStrings);
strC = RemoveSingleQuotes(strC);
strC = PreCorrectReservedWords(strC); // Experimental
strC = MakeGlobalAndLocal(strC);
strC = CorrectJump(strC);
strC = CorrectEvents(strC);
strC = Capitalize(strC, "float");
strC = Capitalize(strC, "string"); // llList2string is also translated
strC = CorrectStates(strC, strGlobalClass);
strC = CorrectReservedWords(strC); // Experimental
strC = CorrectRotation(strC);
strC = CorrectQuaternion(strC);
strC = CorrectVector(strC);
strC = CorrectLists(strC);
strC = InsertQuotedStrings(strC, quotedStrings);
return strC;
}
}
}

70
trunk/Helpers/Measure.cs Normal file
View file

@ -0,0 +1,70 @@
// /**
// ********
// *
// * ORIGIONAL CODE BASE IS Copyright (C) 2006-2010 by Alphons van der Heijden
// * The code was donated on 4/28/2010 by Alphons van der Heijden
// * To Brandon'Dimentox Travanti' Husbands & Malcolm J. Kudra which in turn Liscense under the GPLv2.
// * In agreement to Alphons van der Heijden 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 all
// * copies or substantial portions of the Software.
// *
// ********
// */
using System;
using System.Drawing;
namespace LSLEditor.Helpers
{
class Measure
{
public static RectangleF MeasureDisplayString(System.Windows.Forms.Control control, string text, Font font)
{
Graphics graphics = control.CreateGraphics();
RectangleF rect = MeasureDisplayString(graphics, text, font);
graphics.Dispose();
return rect;
}
public static RectangleF MeasureDisplayString(Graphics graphics, string text, Font font)
{
StringFormat format = new StringFormat();
RectangleF rect = new RectangleF(0, 0, 4096, 4096);
CharacterRange[] ranges = { new CharacterRange(0, text.Length) };
Region[] regions = new Region[1];
format.SetMeasurableCharacterRanges(ranges);
regions = graphics.MeasureCharacterRanges(text, font, rect, format);
return regions[0].GetBounds(graphics);
}
}
}

View file

@ -0,0 +1,66 @@
// /**
// ********
// *
// * ORIGIONAL CODE BASE IS Copyright (C) 2006-2010 by Alphons van der Heijden
// * The code was donated on 4/28/2010 by Alphons van der Heijden
// * To Brandon'Dimentox Travanti' Husbands & Malcolm J. Kudra which in turn Liscense under the GPLv2.
// * In agreement to Alphons van der Heijden 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 all
// * copies or substantial portions of the Software.
// *
// ********
// */
using System;
using System.IO;
using System.Text;
namespace LSLEditor
{
class OopsFormatter
{
public static string ApplyFormatting(string strInput)
{
strInput = strInput.Replace("SecondLifeHost.", "");
strInput = strInput.Replace("GlobalClass.", "");
strInput = strInput.Replace("State_", "");
strInput = strInput.Replace("LSLEditor.", "");
strInput = strInput.Replace("SecondLife.", "");
strInput = strInput.Replace("String", "string");
strInput = strInput.Replace("Float", "float");
strInput = strInput.Replace(Properties.Settings.Default.OopsRemove, "");
return strInput;
}
}
}

View file

@ -0,0 +1,703 @@
// /**
// ********
// *
// * ORIGIONAL CODE BASE IS Copyright (C) 2006-2010 by Alphons van der Heijden
// * The code was donated on 4/28/2010 by Alphons van der Heijden
// * To Brandon'Dimentox Travanti' Husbands & Malcolm J. Kudra which in turn Liscense under the GPLv2.
// * In agreement to Alphons van der Heijden 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 all
// * copies or substantial portions of the Software.
// *
// ********
// */
using System;
using System.Text;
using System.Collections;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Printing;
using System.Globalization;
using System.Windows.Forms;
namespace LSLEditor.Helpers
{
/// <summary>
/// Data Grid View Printer. Print functions for a datagridview, since MS
/// didn't see fit to do it.
/// </summary>
class PrinterHelper
{
//---------------------------------------------------------------------
// global variables
//---------------------------------------------------------------------
#region global variables
// the data grid view we're printing
EditForm editForm = null;
int intCharFrom;
int intCharTo;
int intCharPrint;
// print document
PrintDocument printDoc = null;
// print status items
int fromPage = 0;
int toPage = -1;
// page formatting options
int pageHeight = 0;
int pageWidth = 0;
int printWidth = 0;
int CurrentPage = 0;
PrintRange printRange;
// calculated values
private float footerHeight = 0;
private float pagenumberHeight = 0;
#endregion
//---------------------------------------------------------------------
// properties - settable by user
//---------------------------------------------------------------------
#region properties
// Title
#region title properties
/// <summary>
/// Title for this report. Default is empty.
/// </summary>
private String title;
public String Title
{
get { return title; }
set { title = value; printDoc.DocumentName = title; }
}
/// <summary>
/// Font for the title. Default is Tahoma, 18pt.
/// </summary>
private Font titlefont;
public Font TitleFont
{
get { return titlefont; }
set { titlefont = value; }
}
/// <summary>
/// Foreground color for the title. Default is Black
/// </summary>
private Color titlecolor;
public Color TitleColor
{
get { return titlecolor; }
set { titlecolor = value; }
}
/// <summary>
/// Allow the user to override the title string alignment. Default value is
/// Alignment - Near;
/// </summary>
private StringAlignment titlealignment;
public StringAlignment TitleAlignment
{
get { return titlealignment; }
set { titlealignment = value; }
}
/// <summary>
/// Allow the user to override the title string format flags. Default values
/// are: FormatFlags - NoWrap, LineLimit, NoClip
/// </summary>
private StringFormatFlags titleformatflags;
public StringFormatFlags TitleFormatFlags
{
get { return titleformatflags; }
set { titleformatflags = value; }
}
#endregion
// SubTitle
#region subtitle properties
/// <summary>
/// SubTitle for this report. Default is empty.
/// </summary>
private String subtitle;
public String SubTitle
{
get { return subtitle; }
set { subtitle = value; }
}
/// <summary>
/// Font for the subtitle. Default is Tahoma, 12pt.
/// </summary>
private Font subtitlefont;
public Font SubTitleFont
{
get { return subtitlefont; }
set { subtitlefont = value; }
}
/// <summary>
/// Foreground color for the subtitle. Default is Black
/// </summary>
private Color subtitlecolor;
public Color SubTitleColor
{
get { return subtitlecolor; }
set { subtitlecolor = value; }
}
/// <summary>
/// Allow the user to override the subtitle string alignment. Default value is
/// Alignment - Near;
/// </summary>
private StringAlignment subtitlealignment;
public StringAlignment SubTitleAlignment
{
get { return subtitlealignment; }
set { subtitlealignment = value; }
}
/// <summary>
/// Allow the user to override the subtitle string format flags. Default values
/// are: FormatFlags - NoWrap, LineLimit, NoClip
/// </summary>
private StringFormatFlags subtitleformatflags;
public StringFormatFlags SubTitleFormatFlags
{
get { return subtitleformatflags; }
set { subtitleformatflags = value; }
}
#endregion
// Footer
#region footer properties
/// <summary>
/// footer for this report. Default is empty.
/// </summary>
private String footer;
public String Footer
{
get { return footer; }
set { footer = value; }
}
/// <summary>
/// Font for the footer. Default is Tahoma, 10pt.
/// </summary>
private Font footerfont;
public Font FooterFont
{
get { return footerfont; }
set { footerfont = value; }
}
/// <summary>
/// Foreground color for the footer. Default is Black
/// </summary>
private Color footercolor;
public Color FooterColor
{
get { return footercolor; }
set { footercolor = value; }
}
/// <summary>
/// Allow the user to override the footer string alignment. Default value is
/// Alignment - Center;
/// </summary>
private StringAlignment footeralignment;
public StringAlignment FooterAlignment
{
get { return footeralignment; }
set { footeralignment = value; }
}
/// <summary>
/// Allow the user to override the footer string format flags. Default values
/// are: FormatFlags - NoWrap, LineLimit, NoClip
/// </summary>
private StringFormatFlags footerformatflags;
public StringFormatFlags FooterFormatFlags
{
get { return footerformatflags; }
set { footerformatflags = value; }
}
private float footerspacing;
public float FooterSpacing
{
get { return footerspacing; }
set { footerspacing = value; }
}
#endregion
// Page Numbering
#region page number properties
/// <summary>
/// Include page number in the printout. Default is true.
/// </summary>
private bool pageno = true;
public bool PageNumbers
{
get { return pageno; }
set { pageno = value; }
}
/// <summary>
/// Font for the page number, Default is Tahoma, 8pt.
/// </summary>
private Font pagenofont;
public Font PageNumberFont
{
get { return pagenofont; }
set { pagenofont = value; }
}
/// <summary>
/// Text color (foreground) for the page number. Default is Black
/// </summary>
private Color pagenocolor;
public Color PageNumberColor
{
get { return pagenocolor; }
set { pagenocolor = value; }
}
/// <summary>
/// Allow the user to override the page number string alignment. Default value is
/// Alignment - Near;
/// </summary>
private StringAlignment pagenumberalignment;
public StringAlignment PaageNumberAlignment
{
get { return pagenumberalignment; }
set { pagenumberalignment = value; }
}
/// <summary>
/// Allow the user to override the pagenumber string format flags. Default values
/// are: FormatFlags - NoWrap, LineLimit, NoClip
/// </summary>
private StringFormatFlags pagenumberformatflags;
public StringFormatFlags PageNumberFormatFlags
{
get { return pagenumberformatflags; }
set { pagenumberformatflags = value; }
}
/// <summary>
/// Allow the user to select whether to have the page number at the top or bottom
/// of the page. Default is false: page numbers on the bottom of the page
/// </summary>
private bool pagenumberontop = false;
public bool PageNumberInHeader
{
get { return pagenumberontop; }
set { pagenumberontop = value; }
}
/// <summary>
/// Should the page number be printed on a separate line, or printed on the
/// same line as the header / footer? Default is false;
/// </summary>
private bool pagenumberonseparateline = false;
public bool PaageNumberOnSeparateLine
{
get { return pagenumberonseparateline; }
set { pagenumberonseparateline = value; }
}
#endregion
// Page Level Properties
#region page level properties
/// <summary>
/// Page margins override. Default is (60, 60, 60, 60)
/// </summary>
private Margins printmargins;
public Margins PrintMargins
{
get { return printmargins; }
set { printmargins = value; }
}
#endregion
#endregion
/// <summary>
/// Constructor for PrinterHelper
/// </summary>
public PrinterHelper(PageSetupDialog pageSetupDialog)
{
// create print document
printDoc = new PrintDocument();
printDoc.PrintPage += new PrintPageEventHandler(printDoc_PrintPage);
if (pageSetupDialog.PrinterSettings != null)
printDoc.PrinterSettings = pageSetupDialog.PrinterSettings;
if (pageSetupDialog.PageSettings != null)
printDoc.DefaultPageSettings = pageSetupDialog.PageSettings;
else
printDoc.DefaultPageSettings.Margins = new Margins(60, 80, 40, 40);
printmargins = printDoc.DefaultPageSettings.Margins;
// set default fonts
pagenofont = new Font("Tahoma", 8, FontStyle.Regular, GraphicsUnit.Point);
pagenocolor = Color.Black;
titlefont = new Font("Tahoma", 8, FontStyle.Bold, GraphicsUnit.Point);
titlecolor = Color.Black;
subtitlefont = new Font("Tahoma", 8, FontStyle.Regular, GraphicsUnit.Point);
subtitlecolor = Color.Black;
footerfont = new Font("Tahoma", 8, FontStyle.Regular, GraphicsUnit.Point);
footercolor = Color.Black;
// set default string formats
titlealignment = StringAlignment.Near;
titleformatflags = StringFormatFlags.NoWrap | StringFormatFlags.LineLimit | StringFormatFlags.NoClip;
subtitlealignment = StringAlignment.Near;
subtitleformatflags = StringFormatFlags.NoWrap | StringFormatFlags.LineLimit | StringFormatFlags.NoClip;
footeralignment = StringAlignment.Near;
footerformatflags = StringFormatFlags.NoWrap | StringFormatFlags.LineLimit | StringFormatFlags.NoClip;
pagenumberalignment = StringAlignment.Center;
pagenumberformatflags = StringFormatFlags.NoWrap | StringFormatFlags.LineLimit | StringFormatFlags.NoClip;
}
/// <summary>
/// Start the printing process, print to a printer.
/// </summary>
/// <param name="editForm">The EditForm to print</param>
/// NOTE: Any changes to this method also need to be done in PrintPreviewEditForm
public void PrintEditForm(EditForm editForm)
{
// save the datagridview we're printing
this.editForm = editForm;
this.intCharFrom = 0;
this.intCharPrint = 0;
this.intCharTo = editForm.TextBox.Text.Length;
// create new print dialog
PrintDialog pd = new PrintDialog();
pd.Document = printDoc;
//printDoc.DefaultPageSettings.Margins = printmargins;
pd.AllowSelection = true;
pd.AllowSomePages = false;
pd.AllowCurrentPage = false;
pd.AllowPrintToFile = false;
// show print dialog
if (DialogResult.OK == pd.ShowDialog())
{
SetupPrint(pd);
printDoc.Print();
}
}
/// <summary>
/// Start the printing process, print to a print preview dialog
/// </summary>
/// <param name="editForm">The EditForm to print</param>
/// NOTE: Any changes to this method also need to be done in PrintDataGridView
public void PrintPreviewEditForm(EditForm editForm)
{
// save the datagridview we're printing
this.editForm = editForm;
this.intCharFrom = 0;
this.intCharTo = editForm.TextBox.Text.Length;
// create new print dialog and set options
PrintDialog pd = new PrintDialog();
pd.Document = printDoc;
//printDoc.DefaultPageSettings.Margins = printmargins;
pd.AllowSelection = true;
pd.AllowSomePages = false;
pd.AllowCurrentPage = false;
pd.AllowPrintToFile = false;
// show print dialog
if (DialogResult.OK == pd.ShowDialog())
{
SetupPrint(pd);
PrintPreviewDialog ppdialog = new PrintPreviewDialog();
ppdialog.Document = printDoc;
ppdialog.ShowDialog();
}
}
/// <summary>
/// Set up the print job. Save information from print dialog
/// and print document for easy access. Also sets up the rows
/// and columns that will be printed.
/// </summary>
/// <param name="pd">The print dialog the user just filled out</param>
void SetupPrint(PrintDialog pd)
{
//-----------------------------------------------------------------
// save data from print dialog and document
//-----------------------------------------------------------------
// check to see if we're doing landscape printing
if (printDoc.DefaultPageSettings.Landscape)
{
// landscape: switch width and height
pageHeight = printDoc.DefaultPageSettings.PaperSize.Width;
pageWidth = printDoc.DefaultPageSettings.PaperSize.Height;
}
else
{
// portrait: keep width and height as expected
pageHeight = printDoc.DefaultPageSettings.PaperSize.Height;
pageWidth = printDoc.DefaultPageSettings.PaperSize.Width;
}
// save printer margins and calc print width
printmargins = printDoc.DefaultPageSettings.Margins;
printWidth = pageWidth - printmargins.Left - printmargins.Right;
// save print range
printRange = pd.PrinterSettings.PrintRange;
// pages to print handles "some pages" option
if (PrintRange.SomePages == printRange)
{
// set limits to only print some pages
fromPage = pd.PrinterSettings.FromPage;
toPage = pd.PrinterSettings.ToPage;
}
else
{
// set extremes so that we'll print all pages
fromPage = 0;
toPage = 2147483647;
}
//-----------------------------------------------------------------
// set up the pages to print
//-----------------------------------------------------------------
// pages (handles "selection" and "current page" options
if (PrintRange.Selection == printRange)
{
intCharPrint = this.editForm.TextBox.SelectionStart;
intCharFrom = intCharPrint;
intCharTo = intCharFrom + this.editForm.TextBox.SelectionLength;
}
else if (PrintRange.CurrentPage == printRange)
{
}
// this is the default for print all
else
{
intCharPrint = 0;
intCharFrom = intCharPrint;
intCharTo = this.editForm.TextBox.Text.Length;
}
}
/// <summary>
/// Centralize the string format settings. Does the work of checking for user
/// overrides, and if they're not present, setting the cell alignment to match
/// (somewhat) the source control's string alignment.
/// </summary>
/// <param name="alignment">String alignment</param>
/// <param name="flags">String format flags</param>
/// <param name="controlstyle">DataGridView style to apply (if available)</param>
/// <param name="overrideformat">True if user overrode alignment or flags</param>
/// <returns></returns>
private static StringFormat managestringformat(StringAlignment alignment, StringFormatFlags flags)
{
// start with the provided
StringFormat format = new StringFormat();
format.Trimming = StringTrimming.Word;
format.Alignment = alignment;
format.FormatFlags = flags;
return format;
}
/// <summary>
/// PrintPage event handler. This routine prints one page. It will
/// skip non-printable pages if the user selected the "some pages" option
/// on the print dialog.
/// </summary>
/// <param name="sender">default object from windows</param>
/// <param name="e">Event info from Windows about the printing</param>
private void printDoc_PrintPage(object sender, PrintPageEventArgs e)
{
// adjust printing region, make space for headers and footers
Rectangle rect = new Rectangle(
e.MarginBounds.Left,
e.MarginBounds.Top + e.MarginBounds.Top,
e.MarginBounds.Width,
e.MarginBounds.Height - e.MarginBounds.Top - e.MarginBounds.Top);
PrintPageEventArgs ee = new PrintPageEventArgs(e.Graphics, rect, e.PageBounds, e.PageSettings);
// Print the content of RichTextBox. Store the last character printed.
intCharFrom = editForm.TextBox.Print(intCharFrom, intCharTo, ee);
// increment page number & check page range
CurrentPage++;
//-----------------------------------------------------------------
// print headers
//-----------------------------------------------------------------
// reset printpos as it may have changed during the 'skip pages' routine just above.
float printpos = printmargins.Top;
// print page number if user selected it
if (pagenumberontop)
{
// if we have a page number to print
if (pageno)
{
// ... then print it
printsection(e.Graphics, ref printpos, "Page " + CurrentPage.ToString(CultureInfo.CurrentCulture),
pagenofont, pagenocolor, pagenumberalignment, pagenumberformatflags);
// if the page number is not on a separate line, don't "use up" it's vertical space
if (!pagenumberonseparateline)
printpos -= pagenumberHeight;
}
}
// print title if provided
if (!String.IsNullOrEmpty(title))
printsection(e.Graphics, ref printpos, title, titlefont,
titlecolor, titlealignment, titleformatflags);
// print subtitle if provided
if (!String.IsNullOrEmpty(subtitle))
printsection(e.Graphics, ref printpos, subtitle, subtitlefont,
subtitlecolor, subtitlealignment, subtitleformatflags);
//-----------------------------------------------------------------
// print footer
//-----------------------------------------------------------------
printfooter(e.Graphics, ref printpos);
// Check for more pages
if (intCharFrom < intCharTo)
e.HasMorePages = true;
else
{
intCharFrom = intCharPrint; // reset
CurrentPage = 0;
e.HasMorePages = false;
}
}
/// <summary>
/// Print a header or footer section. Used for page numbers and titles
/// </summary>
/// <param name="g">Graphic context to print in</param>
/// <param name="pos">Track vertical space used; 'y' location</param>
/// <param name="text">String to print</param>
/// <param name="font">Font to use for printing</param>
/// <param name="color">Color to print in</param>
/// <param name="alignment">Alignment - print to left, center or right</param>
/// <param name="flags">String format flags</param>
/// <param name="useroverride">True if the user overrode the alignment or flags</param>
private void printsection(Graphics g, ref float pos, string text,
Font font, Color color, StringAlignment alignment, StringFormatFlags flags)
{
// string formatting setup
StringFormat printformat = managestringformat(alignment, flags);
// measure string
SizeF printsize = g.MeasureString(text, font, printWidth, printformat);
// build area to print within
RectangleF printarea = new RectangleF((float)printmargins.Left, pos, (float)printWidth,
printsize.Height);
// do the actual print
g.DrawString(text, font, new SolidBrush(color), printarea, printformat);
// track "used" vertical space
pos += printsize.Height;
}
/// <summary>
/// Print the footer. This handles the footer spacing, and printing the page number
/// at the bottom of the page (if the page number is not in the header).
/// </summary>
/// <param name="g">Graphic context to print in</param>
/// <param name="pos">Track vertical space used; 'y' location</param>
private void printfooter(Graphics g, ref float pos)
{
// print last footer. Note: need to force printpos to the bottom of the page
// as we may have run out of data anywhere on the page
pos = pageHeight - footerHeight - printmargins.Top - printmargins.Bottom;
// add spacing
pos += footerspacing;
// print the footer
printsection(g, ref pos, footer, footerfont,
footercolor, footeralignment, footerformatflags);
// print the page number if it's on the bottom.
if (!pagenumberontop)
{
if (pageno)
{
pagenumberHeight = g.MeasureString("M", pagenofont).Height;
// if the pageno is not on a separate line, push the print location up by its height.
if (!pagenumberonseparateline)
pos = pos - pagenumberHeight;
// print the page number
printsection(g, ref pos, "Page " + CurrentPage.ToString(CultureInfo.CurrentCulture),
pagenofont, pagenocolor, pagenumberalignment, pagenumberformatflags);
}
}
}
}
}

273
trunk/Helpers/SendMyKeys.cs Normal file
View file

@ -0,0 +1,273 @@
// /**
// ********
// *
// * ORIGIONAL CODE BASE IS Copyright (C) 2006-2010 by Alphons van der Heijden
// * The code was donated on 4/28/2010 by Alphons van der Heijden
// * To Brandon'Dimentox Travanti' Husbands & Malcolm J. Kudra which in turn Liscense under the GPLv2.
// * In agreement to Alphons van der Heijden 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 all
// * copies or substantial portions of the Software.
// *
// ********
// */
using System;
using System.Text;
using System.Threading;
using System.Diagnostics;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Windows.Forms;
namespace NativeHelper
{
public class NativeWIN32
{
public const ushort KEYEVENTF_KEYUP = 0x0002;
public struct KEYBDINPUT
{
public ushort wVk;
public ushort wScan;
public uint dwFlags;
public long time;
public uint dwExtraInfo;
}
[StructLayout(LayoutKind.Explicit, Size = 28)]
public struct INPUT
{
[FieldOffset(0)]
public uint type;
[FieldOffset(4)]
public KEYBDINPUT ki;
}
[DllImport("user32.dll")]
public static extern uint SendInput(uint nInputs, ref INPUT pInputs, int cbSize);
[DllImport("user32.dll")]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool SetForegroundWindow(IntPtr hWnd);
}
public class SendMyKeys
{
public static void PasteTextToApp(string strText,string strAppName, string strTitle)
{
foreach (Process p in Process.GetProcessesByName(strAppName))
{
if(strTitle!=null)
if (p.MainWindowTitle.IndexOf(strTitle) < 0)
continue;
NativeWIN32.SetForegroundWindow(p.MainWindowHandle);
Thread.Sleep(5000);
SendMyKeys.SendString(strText);
return;
}
}
public static void ClipBoardToApp(string strAppName, string strTitle)
{
foreach (Process p in Process.GetProcessesByName(strAppName))
{
if (strTitle != null)
if (p.MainWindowTitle.IndexOf(strTitle) < 0)
continue;
NativeWIN32.SetForegroundWindow(p.MainWindowHandle);
Thread.Sleep(1000);
SendMyKeys.SendChar((ushort)Keys.V,false,true);
return;
}
}
public static void SendChar(ushort wVk, bool ShiftKey, bool ControlKey)
{
uint uintReturn;
NativeWIN32.INPUT structInput = new NativeWIN32.INPUT();
structInput.type = (uint)1;
structInput.ki.wScan = 0;
structInput.ki.time = 0;
structInput.ki.dwFlags = 0;
structInput.ki.dwExtraInfo = 0;
if (ControlKey)
{
structInput.ki.wVk = (ushort)Keys.ControlKey;
uintReturn = NativeWIN32.SendInput((uint)1, ref structInput, Marshal.SizeOf(structInput));
}
if (ShiftKey)
{
structInput.ki.wVk = (ushort)Keys.ShiftKey;
uintReturn = NativeWIN32.SendInput((uint)1, ref structInput, Marshal.SizeOf(structInput));
}
structInput.ki.wVk = wVk;
uintReturn = NativeWIN32.SendInput((uint)1, ref structInput, Marshal.SizeOf(structInput));
structInput.ki.dwFlags = NativeWIN32.KEYEVENTF_KEYUP;
structInput.ki.wVk = wVk;
uintReturn = NativeWIN32.SendInput((uint)1, ref structInput, Marshal.SizeOf(structInput));
if (ShiftKey)
{
structInput.ki.dwFlags = NativeWIN32.KEYEVENTF_KEYUP;
structInput.ki.wVk = (ushort)Keys.ShiftKey;
uintReturn = NativeWIN32.SendInput((uint)1, ref structInput, Marshal.SizeOf(structInput));
}
if (ControlKey)
{
structInput.ki.dwFlags = NativeWIN32.KEYEVENTF_KEYUP;
structInput.ki.wVk = (ushort)Keys.ControlKey;
uintReturn = NativeWIN32.SendInput((uint)1, ref structInput, Marshal.SizeOf(structInput));
}
}
public static void SendString(string s)
{
ushort wVk;
bool ShiftKey;
foreach (Char c in s.ToCharArray())
{
if (Char.IsUpper(c))
ShiftKey = true;
else
ShiftKey = false;
wVk = (ushort)Char.ToUpper(c);
string special = ")!@#$%^&*(";
int intDigit = special.IndexOf(c);
if (intDigit >= 0)
{
ShiftKey = true;
wVk = (ushort)('0' + intDigit);
}
else
{
switch (c)
{
case ':':
ShiftKey = true;
wVk = (ushort)Keys.Oem1;
break;
case ';':
wVk = (ushort)Keys.Oem1;
break;
case '-':
wVk = (ushort)Keys.OemMinus;
break;
case '_':
ShiftKey = true;
wVk = (ushort)Keys.OemMinus;
break;
case '+':
ShiftKey = true;
wVk = (ushort)Keys.Oemplus;
break;
case '=':
wVk = (ushort)Keys.Oemplus;
break;
case '/':
wVk = (ushort)Keys.Oem2;
break;
case '?':
ShiftKey = true;
wVk = (ushort)Keys.OemQuestion;
break;
case '.':
wVk = (ushort)Keys.OemPeriod;
break;
case '>':
ShiftKey = true;
wVk = (ushort)Keys.OemPeriod;
break;
case ',':
wVk = (ushort)Keys.Oemcomma;
break;
case '<':
ShiftKey = true;
wVk = (ushort)Keys.Oemcomma;
break;
case '`':
wVk = (ushort)Keys.Oemtilde;
break;
case '~':
ShiftKey = true;
wVk = (ushort)Keys.Oemtilde;
break;
case '|':
ShiftKey = true;
wVk = (ushort)Keys.Oem5;
break;
case '\\':
wVk = (ushort)Keys.Oem5;
break;
case '[':
wVk = (ushort)Keys.OemOpenBrackets;
break;
case '{':
ShiftKey = true;
wVk = (ushort)Keys.OemOpenBrackets;
break;
case ']':
wVk = (ushort)Keys.Oem6;
break;
case '}':
ShiftKey = true;
wVk = (ushort)Keys.Oem6;
break;
case '\'':
wVk = (ushort)Keys.Oem7;
break;
case '"':
ShiftKey = true;
wVk = (ushort)Keys.Oem7;
break;
default:
break;
}
}
SendChar(wVk, ShiftKey, false);
}
}
}
}

71
trunk/Helpers/Settings.cs Normal file
View file

@ -0,0 +1,71 @@
// /**
// ********
// *
// * ORIGIONAL CODE BASE IS Copyright (C) 2006-2010 by Alphons van der Heijden
// * The code was donated on 4/28/2010 by Alphons van der Heijden
// * To Brandon'Dimentox Travanti' Husbands & Malcolm J. Kudra which in turn Liscense under the GPLv2.
// * In agreement to Alphons van der Heijden 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 all
// * copies or substantial portions of the Software.
// *
// ********
// */
namespace LSLEditor.Properties {
// This class allows you to handle specific events on the settings class:
// The SettingChanging event is raised before a setting's value is changed.
// The PropertyChanged event is raised after a setting's value is changed.
// The SettingsLoaded event is raised after the setting values are loaded.
// The SettingsSaving event is raised before the setting values are saved.
internal sealed partial class Settings {
public Settings() {
// // To add event handlers for saving and changing settings, uncomment the lines below:
//
// this.SettingChanging += this.SettingChangingEventHandler;
//
// this.SettingsSaving += this.SettingsSavingEventHandler;
//
}
private void SettingChangingEventHandler(object sender, System.Configuration.SettingChangingEventArgs e) {
// Add code to handle the SettingChangingEvent event here.
}
private void SettingsSavingEventHandler(object sender, System.ComponentModel.CancelEventArgs e) {
// Add code to handle the SettingsSaving event here.
}
}
}

355
trunk/Helpers/SmtpClient.cs Normal file
View file

@ -0,0 +1,355 @@
// /**
// ********
// *
// * ORIGIONAL CODE BASE IS Copyright (C) 2006-2010 by Alphons van der Heijden
// * The code was donated on 4/28/2010 by Alphons van der Heijden
// * To Brandon'Dimentox Travanti' Husbands & Malcolm J. Kudra which in turn Liscense under the GPLv2.
// * In agreement to Alphons van der Heijden 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 all
// * copies or substantial portions of the Software.
// *
// ********
// */
using System;
using System.IO;
using System.Net;
using System.Text;
using System.Net.Sockets;
using System.Collections;
namespace LSLEditor
{
public class MailAttachment
{
public string Filename;
public MailAttachment(string strAttachmentFile)
{
this.Filename = strAttachmentFile;
}
}
public class MailMessage
{
public string Body;
public string From;
public string To;
public string Cc;
public string Bcc;
public string Subject;
public Hashtable Headers;
public ArrayList Attachments;
public MailMessage()
{
this.Headers = new Hashtable();
this.Attachments = new ArrayList();
}
}
/// <summary>
/// provides methods to send email via smtp direct to mail server
/// http://www.ietf.org/rfc/rfc0821.txt
/// </summary>
public class SmtpClient
{
/// <summary>
/// Get / Set the name of the SMTP mail server
/// </summary>
public string SmtpServer;
private enum SMTPResponse: int
{
CONNECT_SUCCESS = 220,
GENERIC_SUCCESS = 250,
DATA_SUCCESS = 354,
QUIT_SUCCESS = 221,
AUTH_SUCCESS = 334,
AUTH_GRANTED = 235
}
public string Send(MailMessage message)
{
string strResponse;
byte[] data;
IPHostEntry IPhst;
try
{
IPhst = Dns.GetHostEntry(SmtpServer);
}
catch (Exception exception)
{
return "Email:Error on "+exception.Message;
}
IPEndPoint endPt = new IPEndPoint(IPhst.AddressList[0], 25);
Socket s= new Socket(endPt.AddressFamily, SocketType.Stream,ProtocolType.Tcp);
s.Connect(endPt);
if(!Check_Response(s, SMTPResponse.CONNECT_SUCCESS, out strResponse))
{
s.Close();
return "Email:Error on connection (" + strResponse + ")";
}
Senddata(s, string.Format("HELO {0}\r\n", Dns.GetHostName() ));
if (!Check_Response(s, SMTPResponse.GENERIC_SUCCESS, out strResponse))
{
s.Close();
return "Email:Error on HELO (" + strResponse + ")";
}
// SMTP Authentication
if (Properties.Settings.Default.SmtpUserid != "")
{
if (Properties.Settings.Default.SmtpAuth == "PLAIN")
{
Senddata(s, "AUTH PLAIN\r\n");
if (!Check_Response(s, SMTPResponse.AUTH_SUCCESS, out strResponse))
{
s.Close();
return "Email: Error on AUTH PLAIN (" + strResponse + ")";
}
data = Encoding.ASCII.GetBytes(string.Format("\0{0}\0{1}",
Properties.Settings.Default.SmtpUserid,
Properties.Settings.Default.SmtpPassword));
Senddata(s, string.Format("{0}\r\n",Convert.ToBase64String(data)));
if (!Check_Response(s, SMTPResponse.AUTH_GRANTED, out strResponse))
{
s.Close();
return "Email: AUTH PLAIN not granted (" + strResponse + ")";
}
}
if (Properties.Settings.Default.SmtpAuth == "LOGIN")
{
Senddata(s, "AUTH LOGIN\r\n");
if (!Check_Response(s, SMTPResponse.AUTH_SUCCESS, out strResponse))
{
s.Close();
return "Email: Error on AUTH LOGIN (" + strResponse + ")";
}
data = Encoding.ASCII.GetBytes(Properties.Settings.Default.SmtpUserid);
Senddata(s, string.Format("{0}\r\n", Convert.ToBase64String(data)));
if (!Check_Response(s, SMTPResponse.AUTH_SUCCESS, out strResponse))
{
s.Close();
return "Email: AUTH LOGIN userid error (" + strResponse + ")";
}
data = Encoding.ASCII.GetBytes(Properties.Settings.Default.SmtpPassword);
Senddata(s, string.Format("{0}\r\n", Convert.ToBase64String(data)));
if (!Check_Response(s, SMTPResponse.AUTH_GRANTED, out strResponse))
{
s.Close();
return "Email: AUTH LOGIN not granted (" + strResponse + ")";
}
}
if (Properties.Settings.Default.SmtpAuth == "CRAM-MD5")
{
s.Close();
return "Email: LSLEditor Not Implemented CRAM-MD5";
}
if (Properties.Settings.Default.SmtpAuth == "DIGEST-MD5")
{
s.Close();
return "Email: LSLEditor Not Implemented DIGEST-MD5";
}
if (Properties.Settings.Default.SmtpAuth == "EXTERNAL")
{
s.Close();
return "Email: LSLEditor Not Implemented EXTERNAL";
}
if (Properties.Settings.Default.SmtpAuth == "ANONYMOUS")
{
s.Close();
return "Email: LSLEditor Not Implemented ANONYMOUS";
}
}
Senddata(s, string.Format("MAIL From: {0}\r\n", message.From ));
if (!Check_Response(s, SMTPResponse.GENERIC_SUCCESS, out strResponse))
{
s.Close();
return "Email: Error on MAIL From (" + strResponse + ")";
}
string _To = message.To;
string[] Tos= _To.Split(new char[] {';'});
foreach (string To in Tos)
{
Senddata(s, string.Format("RCPT TO: {0}\r\n", To));
if (!Check_Response(s, SMTPResponse.GENERIC_SUCCESS, out strResponse))
{
s.Close();
return "Email: Error on RCPT TO (" + strResponse + ")";
}
}
if(message.Cc!=null)
{
Tos= message.Cc.Split(new char[] {';'});
foreach (string To in Tos)
{
Senddata(s, string.Format("RCPT TO: {0}\r\n", To));
if (!Check_Response(s, SMTPResponse.GENERIC_SUCCESS, out strResponse))
{
s.Close();
return "Email: Error on (CC) RCPT TO (" + strResponse + ")";
}
}
}
StringBuilder Header=new StringBuilder();
Header.Append("From: " + message.From + "\r\n");
Tos= message.To.Split(new char[] {';'});
Header.Append("To: ");
for( int i=0; i< Tos.Length; i++)
{
Header.Append( i > 0 ? "," : "" );
Header.Append(Tos[i]);
}
Header.Append("\r\n");
if(message.Cc!=null)
{
Tos= message.Cc.Split(new char[] {';'});
Header.Append("Cc: ");
for( int i=0; i< Tos.Length; i++)
{
Header.Append( i > 0 ? "," : "" );
Header.Append(Tos[i]);
}
Header.Append("\r\n");
}
Header.Append("Date: " + DateTime.Now.ToString("R" ) + "\r\n");
Header.Append("Subject: " + message.Subject+ "\r\n");
Header.Append("X-Mailer: SMTPClient v2.36 (LSL-Editor)\r\n" );
// escape . on newline
string MsgBody = message.Body.Replace("\n.","\n..");
if(!MsgBody.EndsWith("\r\n"))
MsgBody+="\r\n";
if(message.Attachments.Count>0)
{
Header.Append( "MIME-Version: 1.0\r\n" );
Header.Append( "Content-Type: multipart/mixed; boundary=unique-boundary-1\r\n" );
Header.Append("\r\n");
Header.Append( "This is a multi-part message in MIME format.\r\n" );
StringBuilder sb = new StringBuilder();
sb.Append("--unique-boundary-1\r\n");
sb.Append("Content-Type: text/plain\r\n");
sb.Append("Content-Transfer-Encoding: 7Bit\r\n");
sb.Append("\r\n");
sb.Append(MsgBody + "\r\n");
sb.Append("\r\n");
foreach(object o in message.Attachments)
{
MailAttachment a = o as MailAttachment;
byte[] binaryData;
if(a!=null)
{
FileInfo f = new FileInfo(a.Filename);
sb.Append("--unique-boundary-1\r\n");
sb.Append("Content-Type: application/octet-stream; file=" + f.Name + "\r\n");
sb.Append("Content-Transfer-Encoding: base64\r\n");
sb.Append("Content-Disposition: attachment; filename=" + f.Name + "\r\n");
sb.Append("\r\n");
FileStream fs = f.OpenRead();
binaryData = new Byte[fs.Length];
long bytesRead = fs.Read(binaryData, 0, (int)fs.Length);
fs.Close();
string base64String = System.Convert.ToBase64String(binaryData, 0,binaryData.Length);
for(int i=0; i< base64String.Length ; )
{
int nextchunk=100;
if(base64String.Length - (i + nextchunk ) <0)
nextchunk = base64String.Length -i;
sb.Append(base64String.Substring(i, nextchunk));
sb.Append("\r\n");
i+=nextchunk;
}
sb.Append("\r\n");
}
}
MsgBody=sb.ToString();
}
Senddata(s, ("DATA\r\n"));
if (!Check_Response(s, SMTPResponse.DATA_SUCCESS, out strResponse))
{
s.Close();
return "Email:Error on DATA (" + strResponse + ")";
}
Header.Append( "\r\n" );
Header.Append( MsgBody);
Header.Append("\r\n.\r\n");
Senddata(s, Header.ToString());
if (!Check_Response(s, SMTPResponse.GENERIC_SUCCESS, out strResponse))
{
s.Close();
return "Email:Error on message body (" + strResponse + ")";
}
Senddata(s, "QUIT\r\n");
if (!Check_Response(s, SMTPResponse.QUIT_SUCCESS, out strResponse))
{
s.Close();
return "Email:Error on QUIT (" + strResponse + ")";
}
s.Close();
return "Email: Succes :-)";
}
private void Senddata(Socket s, string msg)
{
byte[] _msg = Encoding.ASCII.GetBytes(msg);
s.Send(_msg , 0, _msg .Length, SocketFlags.None);
}
private bool Check_Response(Socket s, SMTPResponse response_expected, out string sResponse)
{
byte[] bytes = new byte[1024];
while (s.Available==0)
{
System.Threading.Thread.Sleep(100);
}
int intCount = s.Receive(bytes, 0, s.Available, SocketFlags.None);
sResponse = Encoding.ASCII.GetString(bytes,0,intCount);
int response = Convert.ToInt32(sResponse.Substring(0,3));
if(response != (int)response_expected)
return false;
return true;
}
}
}

View file

@ -0,0 +1,28 @@
namespace System.Windows.Forms
{
partial class TabControlExtended
{
/// <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>
#region Component 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()
{
components = new System.ComponentModel.Container();
}
#endregion
}
}

View file

@ -0,0 +1,249 @@
// /**
// ********
// *
// * ORIGIONAL CODE BASE IS Copyright (C) 2006-2010 by Alphons van der Heijden
// * The code was donated on 4/28/2010 by Alphons van der Heijden
// * To Brandon'Dimentox Travanti' Husbands & Malcolm J. Kudra which in turn Liscense under the GPLv2.
// * In agreement to Alphons van der Heijden 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 all
// * copies or substantial portions of the Software.
// *
// ********
// */
using System;
using System.Drawing;
using System.ComponentModel;
using System.Windows.Forms;
using System.Windows.Forms.VisualStyles;
namespace System.Windows.Forms
{
public partial class TabControlExtended : System.Windows.Forms.TabControl
{
private int HoverIndex;
private bool Extended;
public event EventHandler OnTabClose;
public TabControlExtended()
{
InitializeComponent();
}
public TabControlExtended(IContainer container)
{
InitializeComponent();
container.Add(this);
}
public void SetDrawMode()
{
try
{
HoverIndex = 0;
VisualStyleRenderer render = new VisualStyleRenderer(VisualStyleElement.Tab.Pane.Normal);
this.DrawMode = TabDrawMode.OwnerDrawFixed;
this.SetStyle(ControlStyles.UserPaint, true);
this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
this.SetStyle(ControlStyles.DoubleBuffer, true);
this.SetStyle(ControlStyles.ResizeRedraw, true);
this.SetStyle(ControlStyles.SupportsTransparentBackColor, true);
this.Extended = true;
}
catch
{
this.Extended = false;
this.DrawMode = TabDrawMode.Normal;
}
}
/*
protected override bool ProcessMnemonic(char charCode)
{
foreach (TabPage p in this.TabPages)
{
if (Control.IsMnemonic(charCode, p.Text))
{
this.SelectedTab = p;
this.Focus();
return true;
}
}
return false;
}
*/
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
if (!this.Extended)
return;
MyPaint(e);
}
protected override void OnSelectedIndexChanged(EventArgs e)
{
this.HoverIndex = -1;
base.OnSelectedIndexChanged(e);
}
private void MyPaint(PaintEventArgs e)
{
if (!this.Visible)
return;
Graphics g = e.Graphics;
Rectangle displayRectangle = this.DisplayRectangle;
Size borderSize = SystemInformation.Border3DSize;
displayRectangle.Inflate(borderSize.Width << 1, borderSize.Height << 1);
VisualStyleRenderer render = new VisualStyleRenderer(VisualStyleElement.Tab.Pane.Normal);
render.DrawBackground(g, displayRectangle);
for (int intI = 0; intI < this.TabCount; intI++)
if (intI != this.SelectedIndex)
DrawTab(g, intI);
if (this.SelectedIndex >= 0)
DrawTab(g, this.SelectedIndex);
}
protected override void OnMouseMove(MouseEventArgs e)
{
base.OnMouseMove(e);
if (!Extended)
return;
Point p = e.Location;
for (int intI = 0; intI < this.TabCount; intI++)
{
Rectangle rectangle = GetTabRect(intI);
if (rectangle.Contains(p))
{
HoverIndex = intI;
this.Invalidate();
}
}
}
protected override void OnMouseLeave(EventArgs e)
{
base.OnMouseLeave(e);
if (!Extended)
return;
HoverIndex = this.SelectedIndex;
this.Invalidate();
}
protected override void OnMouseUp(MouseEventArgs e)
{
base.OnMouseUp(e);
if (!Extended)
return;
Point p = e.Location;
Rectangle rectangle = this.GetTabRect(this.SelectedIndex);
if (rectangle.Contains(p))
{
Rectangle closeImage = new Rectangle(rectangle.Right - 15 - 5, 5, 15, 15);
if (closeImage.Contains(p))
{
if (OnTabClose != null)
OnTabClose(this.SelectedIndex, new EventArgs());
else
this.TabPages.RemoveAt(this.SelectedIndex);
}
}
}
private void DrawTab(Graphics g, int intIndex)
{
Font font;
Bitmap bitmap;
Rectangle recBounds = this.GetTabRect(intIndex);
RectangleF tabTextArea = (RectangleF)this.GetTabRect(intIndex);
TabPage tabPage = this.TabPages[intIndex];
Size borderSize = SystemInformation.Border3DSize;
VisualStyleRenderer render;
if (this.SelectedIndex == intIndex)
{
font = new Font(this.Font, FontStyle.Bold);
Point p = this.PointToClient(Control.MousePosition);
Rectangle closeImage = new Rectangle(recBounds.Right - 15 - 5, 5, 15, 15);
if (closeImage.Contains(p))
bitmap = new Bitmap(Type.GetType("LSLEditor.LSLEditorForm"), "Images.Close-Active.gif");
else
bitmap = new Bitmap(Type.GetType("LSLEditor.LSLEditorForm"), "Images.Close-Inactive.gif");
recBounds.X -= borderSize.Width;
recBounds.Y -= borderSize.Height;
recBounds.Width += borderSize.Width << 1;
recBounds.Height += borderSize.Height;
render = new VisualStyleRenderer(VisualStyleElement.Tab.TabItem.Pressed);
Rectangle clipper = new Rectangle(recBounds.X, recBounds.Y, recBounds.Width, recBounds.Height - 1);
render.DrawBackground(g, recBounds, clipper);
}
else
{
font = new Font(this.Font, FontStyle.Regular);
if (this.HoverIndex == intIndex)
{
render = new VisualStyleRenderer(VisualStyleElement.Tab.TopTabItem.Hot);
bitmap = new Bitmap(Type.GetType("LSLEditor.LSLEditorForm"), "Images.Close-Active.gif");
}
else
{
render = new VisualStyleRenderer(VisualStyleElement.Tab.TabItem.Normal);
bitmap = new Bitmap(Type.GetType("LSLEditor.LSLEditorForm"), "Images.Close-Disabled.gif");
}
recBounds.Height -= borderSize.Height;
render.DrawBackground(g, recBounds);
}
SolidBrush br = new SolidBrush(tabPage.ForeColor);
//Console.WriteLine("["+tabPage.Text+"]");
g.DrawString(tabPage.Text, font, br, tabTextArea.Left + 2, tabTextArea.Top + 3);
font.Dispose();
g.DrawImage(bitmap, new Point((int)tabTextArea.Right - bitmap.Width - 5, 5));
}
}
}

263
trunk/Helpers/TaskQueue.cs Normal file
View file

@ -0,0 +1,263 @@
// /**
// ********
// *
// * ORIGIONAL CODE BASE IS Copyright (C) 2006-2010 by Alphons van der Heijden
// * The code was donated on 4/28/2010 by Alphons van der Heijden
// * To Brandon'Dimentox Travanti' Husbands & Malcolm J. Kudra which in turn Liscense under the GPLv2.
// * In agreement to Alphons van der Heijden 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 all
// * copies or substantial portions of the Software.
// *
// ********
// */
using System;
using System.Reflection;
using System.Collections;
using System.Diagnostics;
using System.Threading;
// http://www.codeproject.com/csharp/messageloop.asp
namespace LSLEditor.Helpers
{
/// <summary>
/// Represents an object that performs a certain action asynchronously, by using an internal buffer queue
/// and one internal thread.
/// </summary>
public class TaskQueue : IDisposable
{
#region Member Variables
/// <summary>Reference to the thread used to empty the queue</summary>
private Thread WorkerThread;
/// <summary>Internal queue that serves as buffer for required actions</summary>
private Queue Tasks;
/// <summary>Used to signal the thread when a new object is added to the queue</summary>
private AutoResetEvent SignalNewTask;
/// <summary>Flag that notifies that the object should be disposed</summary>
private bool stop;
#endregion Member Variables
#region Constructor
/// <summary>Creates a new buffered object</summary>
public TaskQueue()
{
WorkerThread = null;
// Make sure the queue is synchronized. This is required because items are added to the queue
// from a different thread than the thread that empties the queue
Tasks = Queue.Synchronized(new Queue());
SignalNewTask = new AutoResetEvent(false);
stop = false;
}
#endregion Ctor
#region Public Methods
public void Start()
{
Stop();
stop = false;
Tasks.Clear();
WorkerThread = new Thread(new ThreadStart(Worker));
WorkerThread.IsBackground = true;
WorkerThread.Start();
}
public void Stop()
{
if(WorkerThread!=null)
{
WorkerThread.Abort();
if (!WorkerThread.Join(2000))
{
// problems
System.Windows.Forms.MessageBox.Show("TaskQueue thread not Aborted", "Oops...");
}
WorkerThread = null;
}
}
public void Invoke(object ActiveObject,string MethodName, params object[] args)
{
if (ActiveObject == null)
return;
try
{
// Add the object to the internal buffer
Tasks.Enqueue(new Task(ActiveObject, MethodName, args));
// Signal the internal thread that there is some new object in the buffer
SignalNewTask.Set();
}
catch (Exception e)
{
Trace.WriteLine(string.Format("I An exception occurred in TaskQueue.Invoke: {0}", e.Message));
// Since the exception was not actually handled and only logged - propagate it
throw;
}
}
#endregion Public Methods
#region Private Methods
/// <summary>Method executed by the internal thread to empty the queue</summary>
private void Worker()
{
Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-US", false);
Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("en-US", false);
while (!stop)
{
try
{
// Note: this code is safe (i.e. performing the .Count and .Dequeue not inside a lock)
// because there is only one thread emptying the queue.
// Even if .Count returns 0, and before Dequeue is called a new object is added to the Queue
// then still the system will behave nicely: the next if statement will return false and
// since this is run in an endless loop, in the next iteration we will have .Count > 0.
if (Tasks.Count > 0)
{
(Tasks.Dequeue() as Task).Execute();
}
// Wait until new objects are received or Dispose was called
if (Tasks.Count == 0)
{
SignalNewTask.WaitOne();
}
}
catch (ThreadAbortException)
{
Trace.WriteLine("TaskQueue.Worker: ThreadAbortException, no problem");
}
catch (Exception e)
{
Trace.WriteLine(string.Format("TaskQueue.Worker: {0}", e.Message));
// Since the exception was not actually handled and only logged - propagate it
throw;
}
}
}
#endregion Private Methods
#region IDisposable Members and Dispose Pattern
private bool disposed = false;
~TaskQueue()
{
Dispose(false);
}
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
protected virtual void Dispose(bool disposing)
{
if (!this.disposed)
{
if (disposing)
{
try
{
stop = true;
SignalNewTask.Set();
}
catch (Exception e)
{
Trace.WriteLine(string.Format("An exception occurred in MessageLoop.AddToBuffer: {0}", e.Message));
// Since the exception was not actually handled and only logged - propagate it
throw;
}
}
this.disposed = true;
}
}
#endregion IDisposable Members and Dispose Pattern
#region Task
/// <summary>The tasks being saved in the queue</summary>
private class Task
{
private object ActiveObject;
private object[] args;
public string MethodName;
public Task(object ActiveObject, string MethodName, params object[] args)
{
this.ActiveObject = ActiveObject;
this.MethodName = MethodName;
this.args = args;
}
public void Execute()
{
try
{
MethodInfo mi = ActiveObject.GetType().GetMethod(MethodName,
BindingFlags.Public |
BindingFlags.Instance |
//BindingFlags.DeclaredOnly |
BindingFlags.NonPublic
);
mi.Invoke(ActiveObject, args);
}
catch (ThreadAbortException)
{
Trace.WriteLine("TaskQueue.Task.Execute: ThreadAbortException, no problem");
}
catch (Exception exception)
{
Exception innerException = exception.InnerException;
if (innerException == null)
innerException = exception;
string strMessage = OopsFormatter.ApplyFormatting(innerException.Message);
string strStackTrace = OopsFormatter.ApplyFormatting(innerException.StackTrace);
System.Windows.Forms.MessageBox.Show(strMessage + "\r\n" + strStackTrace, "Oops...");
}
}
}
#endregion Task
}
}

View file

@ -0,0 +1,251 @@
// /**
// ********
// *
// * ORIGIONAL CODE BASE IS Copyright (C) 2006-2010 by Alphons van der Heijden
// * The code was donated on 4/28/2010 by Alphons van der Heijden
// * To Brandon'Dimentox Travanti' Husbands & Malcolm J. Kudra which in turn Liscense under the GPLv2.
// * In agreement to Alphons van der Heijden 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 all
// * copies or substantial portions of the Software.
// *
// ********
// */
using System;
using System.Collections;
using System.Net;
using System.IO;
using System.Text;
using System.Threading;
namespace LSLEditor
{
public class RequestState
{
// This class stores the state of the request.
public SecondLife secondlife;
public SecondLife.key httpkey;
public byte[] postData;
const int BUFFER_SIZE = 1024;
public StringBuilder requestData;
public byte[] bufferRead;
public WebRequest request;
public WebResponse response;
public Stream responseStream;
public RequestState()
{
bufferRead = new byte[BUFFER_SIZE];
requestData = new StringBuilder("");
request = null;
responseStream = null;
postData = null;
}
}
class WebRequestClass
{
public static ManualResetEvent allDone= new ManualResetEvent(false);
const int BUFFER_SIZE = 1024;
public WebRequestClass(WebProxy proxy, SecondLife secondlife, string strUrl, SecondLife.list parameters, string postData, SecondLife.key key)
{
try
{
// Create a new webrequest to the mentioned URL.
WebRequest myWebRequest = WebRequest.Create(strUrl);
myWebRequest.Headers.Add("Cache-Control", "max-age=259200");
//myWebRequest.Headers.Add("Connection", "keep-alive");
myWebRequest.Headers.Add("Pragma", "no-cache");
//myWebRequest.Headers.Add("Via", "1.1 sim3560.agni.lindenlab.com:3128 (squid/2.6.STABLE12)");
//myWebRequest.Headers.Add("Content-Length", "3");
//myWebRequest.Headers.Add("Content-Type", "text/plain;charset=utf-8");
//myWebRequest.Headers.Add("Accept", "text/*");
myWebRequest.Headers.Add("Accept-Charset", "utf-8;q=1.0, *;q=0.5");
myWebRequest.Headers.Add("Accept-Encoding", "deflate, gzip");
//myWebRequest.Headers.Add("Host", "www.lsleditor.org");
//myWebRequest.Headers.Add("User-Agent", "LSLEditor 2.24 (http://www.lsleditor.org)");
myWebRequest.Headers.Add("X-SecondLife-Shard", "Production");
SecondLife.vector RegionCorner = secondlife.llGetRegionCorner();
SecondLife.vector pos = secondlife.llGetPos();
myWebRequest.Headers.Add("X-SecondLife-Object-Name", secondlife.host.GetObjectName());
myWebRequest.Headers.Add("X-SecondLife-Object-Key", secondlife.host.GetKey().ToString());
myWebRequest.Headers.Add("X-SecondLife-Region", Properties.Settings.Default.RegionName + " (" + (int)RegionCorner.x + ", " + (int)RegionCorner.y + ")");
myWebRequest.Headers.Add("X-SecondLife-Local-Position", "("+pos.x+", "+pos.y+", "+pos.z+")");
myWebRequest.Headers.Add("X-SecondLife-Local-Rotation", "(0.000000, 0.000000, 0.000000, 1.000000)");
myWebRequest.Headers.Add("X-SecondLife-Local-Velocity", "(0.000000, 0.000000, 0.000000)");
myWebRequest.Headers.Add("X-SecondLife-Owner-Name", Properties.Settings.Default.AvatarName);
myWebRequest.Headers.Add("X-SecondLife-Owner-Key", Properties.Settings.Default.AvatarKey);
myWebRequest.Headers.Add("X-Forwarded-For", "127.0.0.1");
// Setting up paramters
for (int intI = 0; intI < parameters.Count; intI += 2)
{
switch (int.Parse(parameters[intI].ToString()))
{
case 0:
myWebRequest.Method = parameters[intI + 1].ToString();
break;
case 1:
myWebRequest.ContentType = parameters[intI + 1].ToString();
break;
case 2:
// HTTP_BODY_MAXLENGTH
break;
default:
break;
}
}
if (proxy != null)
myWebRequest.Proxy = proxy;
// Create a new instance of the RequestState.
RequestState myRequestState = new RequestState();
myRequestState.secondlife = secondlife;
myRequestState.httpkey = key;
myRequestState.postData = Encoding.UTF8.GetBytes(postData);
// 19 sep 2007
myWebRequest.ContentLength = myRequestState.postData.Length;
// The 'WebRequest' object is associated to the 'RequestState' object.
myRequestState.request = myWebRequest;
// Start the Asynchronous call for response.
IAsyncResult asyncResult;
if (myWebRequest.Method == "POST" || myWebRequest.Method == "PUT")
asyncResult = (IAsyncResult)myWebRequest.BeginGetRequestStream(new AsyncCallback(RespCallback), myRequestState);
else
asyncResult = (IAsyncResult)myWebRequest.BeginGetResponse(new AsyncCallback(RespCallback), myRequestState);
}
catch (WebException e)
{
secondlife.host.VerboseMessage(e.Message);
secondlife.host.VerboseMessage(e.Status.ToString());
}
catch (Exception e)
{
Console.WriteLine("Exception raised!");
Console.WriteLine("Source : " + e.Source);
Console.WriteLine("Message : " + e.Message);
secondlife.host.VerboseMessage(e.Message);
}
}
private static void RespCallback(IAsyncResult asynchronousResult)
{
RequestState myRequestState=(RequestState) asynchronousResult.AsyncState;
try
{
// Set the State of request to asynchronous.
WebRequest request = myRequestState.request;
if (request.Method == "POST" || request.Method == "PUT") // TODO check if this post works!!!!
{
// End the operation.
Stream postStream = request.EndGetRequestStream(asynchronousResult);
// Write to the request stream.
postStream.Write(myRequestState.postData, 0, myRequestState.postData.Length);
postStream.Close();
myRequestState.response = (HttpWebResponse)request.GetResponse();
}
else
{
// End the Asynchronous response.
myRequestState.response = request.EndGetResponse(asynchronousResult);
}
// Read the response into a 'Stream' object.
Stream responseStream = myRequestState.response.GetResponseStream();
myRequestState.responseStream = responseStream;
// Begin the reading of the response
IAsyncResult asynchronousResultRead = responseStream.BeginRead(myRequestState.bufferRead, 0, BUFFER_SIZE, new AsyncCallback(ReadCallBack), myRequestState);
}
catch (WebException e)
{
myRequestState.secondlife.host.VerboseMessage(e.Message);
myRequestState.secondlife.host.VerboseMessage(e.Status.ToString());
}
catch (Exception e)
{
Console.WriteLine("Exception raised!");
Console.WriteLine("Source : " + e.Source);
Console.WriteLine("Message : " + e.Message);
myRequestState.secondlife.host.VerboseMessage(e.Message);
}
}
private static void ReadCallBack(IAsyncResult asyncResult)
{
RequestState myRequestState = (RequestState)asyncResult.AsyncState;
try
{
// Result state is set to AsyncState.
Stream responseStream = myRequestState.responseStream;
int read = responseStream.EndRead( asyncResult );
// Read the contents of the HTML page and then print to the console.
if (read > 0)
{
myRequestState.requestData.Append(Encoding.ASCII.GetString(myRequestState.bufferRead, 0, read));
IAsyncResult asynchronousResult = responseStream.BeginRead( myRequestState.bufferRead, 0, BUFFER_SIZE, new AsyncCallback(ReadCallBack), myRequestState);
}
else
{
responseStream.Close();
if(myRequestState.requestData.Length>1)
{
myRequestState.secondlife.host.ExecuteSecondLife("http_response",myRequestState.httpkey, (SecondLife.integer)200, new SecondLife.list(), (SecondLife.String)myRequestState.requestData.ToString());
}
}
}
catch(WebException e)
{
myRequestState.secondlife.host.VerboseMessage(e.Message);
myRequestState.secondlife.host.VerboseMessage(e.Status.ToString());
}
catch(Exception e)
{
Console.WriteLine("Exception raised!");
Console.WriteLine("Source : {0}" , e.Source);
Console.WriteLine("Message : {0}" , e.Message);
myRequestState.secondlife.host.VerboseMessage(e.Message);
}
}
}
}

322
trunk/Helpers/XMLRPC.cs Normal file
View file

@ -0,0 +1,322 @@
// /**
// ********
// *
// * ORIGIONAL CODE BASE IS Copyright (C) 2006-2010 by Alphons van der Heijden
// * The code was donated on 4/28/2010 by Alphons van der Heijden
// * To Brandon'Dimentox Travanti' Husbands & Malcolm J. Kudra which in turn Liscense under the GPLv2.
// * In agreement to Alphons van der Heijden 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 all
// * copies or substantial portions of the Software.
// *
// ********
// */
using System;
using System.Xml;
using System.Net;
using System.Threading;
namespace LSLEditor.Helpers
{
class XmlRpcRequestEventArgs : EventArgs
{
public SecondLife.key channel;
public SecondLife.key message_id;
public SecondLife.String sData;
public SecondLife.integer iData;
public SecondLife.String sender;
}
class XMLRPC
{
private HttpListener listener;
private Thread thread;
private bool blnRunning;
private WebRequest request;
public SecondLife.key guid;
public HttpListenerContext context;
public delegate void RequestEventHandler(object sender, XmlRpcRequestEventArgs e);
public event RequestEventHandler OnReply;
public event RequestEventHandler OnRequest;
public string Prefix;
public XMLRPC()
{
this.guid = SecondLife.NULL_KEY;
}
public SecondLife.key OpenChannel(int intChannel)
{
if (!HttpListener.IsSupported)
return this.guid;
// Yes, it works
this.guid = new SecondLife.key(Guid.NewGuid());
// Create a listener.
listener = new HttpListener();
// Add the prefix.
int intPort = 50888 + intChannel;
Prefix = "http://localhost:" + intPort + "/";
listener.Prefixes.Add(Prefix);
listener.Start();
blnRunning = true;
thread = new Thread(new ThreadStart(Worker));
thread.Name = "Worker";
thread.Start();
return this.guid;
}
private XmlRpcRequestEventArgs DecodeRequest(System.IO.Stream stream)
{
XmlRpcRequestEventArgs e = new XmlRpcRequestEventArgs();
e.sender = "";
e.message_id = SecondLife.NULL_KEY;
/*
<?xml version="1.0"?>
<methodCall>
<methodName>llRemoteData</methodName>
<params>
<param>
<value>
<struct>
<member>
<name>Channel</name>
<value><string>4a250e12-c02e-94fb-6d2f-13529cbaad63</string></value>
</member>
<member>
<name>IntValue</name>
<value><int>0</int></value>
</member>
<member>
<name>StringValue</name>
<value><string>test</string></value>
</member>
</struct>
</value>
</param>
</params>
</methodCall>
*/
XmlDocument xml = new XmlDocument();
xml.Load(stream);
XmlNode methodCall = xml.SelectSingleNode("/methodCall");
if (methodCall == null)
return e;
XmlNode methodName = methodCall.SelectSingleNode("./methodName");
if (methodName == null)
return e;
if (methodName.InnerText != "llRemoteData")
return e;
foreach (XmlNode xmlMember in methodCall.SelectNodes("./params/param/value/struct/member"))
{
string strName = xmlMember.SelectSingleNode("./name").InnerText;
string strValue = xmlMember.SelectSingleNode("./value").InnerText;
switch (strName)
{
case "Channel":
e.channel = new SecondLife.key(strValue);
break;
case "StringValue":
e.sData = strValue;
break;
case "IntValue":
int iData;
int.TryParse(strValue, out iData);
e.iData = iData;
break;
default:
break;
}
}
return e;
}
private void Worker()
{
XmlRpcRequestEventArgs e;
while (blnRunning)
{
// Note: The GetContext method blocks while waiting for a request.
try
{
context = listener.GetContext();
e = DecodeRequest(context.Request.InputStream);
if (OnRequest != null)
OnRequest(this, e);
}
catch (HttpListenerException)
{
}
catch (ThreadAbortException)
{
}
catch (Exception exception)
{
System.Windows.Forms.MessageBox.Show("RPC Error:" + exception.Message, "Oops...");
}
}
}
public void RemoteDataReply(SecondLife.key channel, SecondLife.key message_id, string sData, int iData)
{
// Obtain a response object.
HttpListenerResponse response = context.Response;
// Construct a response.
string responseString = string.Format(@"<?xml version=""1.0""?>
<methodResponse>
<params>
<param>
<value>
<struct>
<member>
<name>Channel</name>
<value><string>{0}</string></value>
</member>
<member>
<name>StringValue</name>
<value><string>{1}</string></value>
</member>
<member>
<name>IntValue</name>
<value><int>{2}</int></value>
</member>
</struct>
</value>
</param>
</params>
</methodResponse>", channel.ToString(),sData,iData);
byte[] buffer = System.Text.Encoding.UTF8.GetBytes(responseString);
// Get a response stream and write the response to it.
response.ContentLength64 = buffer.Length;
response.ContentType = "text/xml";
System.IO.Stream output = response.OutputStream;
output.Write(buffer, 0, buffer.Length);
// You must close the output stream.
output.Close();
}
public void CloseChannel()
{
blnRunning = false;
if(listener!=null)
listener.Stop();
if (thread != null)
{
thread.Abort();
bool succes = thread.Join(1000);
}
thread = null;
listener = null;
}
public SecondLife.key SendRemoteData(SecondLife.key channel, string dest, int iData, string sData)
{
this.guid = new SecondLife.key(Guid.NewGuid());
// Construct a request.
string requestString = string.Format(@"<?xml version=""1.0""?>
<methodCall>
<methodName>llRemoteData</methodName>
<params>
<param>
<value>
<struct>
<member>
<name>Channel</name>
<value><string>{0}</string></value>
</member>
<member>
<name>IntValue</name>
<value><int>{1}</int></value>
</member>
<member>
<name>StringValue</name>
<value><string>{2}</string></value>
</member>
</struct>
</value>
</param>
</params>
</methodCall>", channel.ToString(), iData, sData);
request = WebRequest.Create(dest);
byte[] buffer = System.Text.Encoding.UTF8.GetBytes(requestString);
// Get a response stream and write the response to it.
request.ContentLength = buffer.Length;
request.ContentType = "text/xml";
System.IO.Stream requestStream = request.GetRequestStream();
requestStream.Write(buffer, 0, buffer.Length);
// You must close the request stream.
requestStream.Close();
thread = new Thread(new ThreadStart(WaitOnResponse));
thread.Name = "WaitOnResponse";
thread.Start();
return this.guid;
}
private void WaitOnResponse()
{
Thread.Sleep(100);
WebResponse response = request.GetResponse();
XmlRpcRequestEventArgs e = DecodeRequest(response.GetResponseStream());
// yes!!
e.message_id = this.guid;
if (OnReply != null)
OnReply(this, e);
}
}
}

BIN
trunk/Icons/ADDITEM.GIF Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 192 B

BIN
trunk/Icons/COPY.GIF Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 115 B

BIN
trunk/Icons/CUT.GIF Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 99 B

BIN
trunk/Icons/DEINDENT.GIF Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 93 B

BIN
trunk/Icons/DELETE.GIF Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 96 B

BIN
trunk/Icons/END.GIF Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 75 B

BIN
trunk/Icons/FIND.GIF Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 111 B

BIN
trunk/Icons/ININDENT.GIF Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 93 B

BIN
trunk/Icons/NEWDOC.GIF Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 102 B

BIN
trunk/Icons/NEWPROJ.GIF Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 342 B

BIN
trunk/Icons/OPEN.GIF Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 131 B

BIN
trunk/Icons/PASTE.GIF Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 144 B

BIN
trunk/Icons/PRINT.GIF Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 129 B

BIN
trunk/Icons/PROJECT.GIF Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 149 B

BIN
trunk/Icons/PROPS.GIF Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 122 B

BIN
trunk/Icons/REDO.GIF Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 87 B

BIN
trunk/Icons/SAVE.GIF Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 119 B

BIN
trunk/Icons/SAVEALL.GIF Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 125 B

BIN
trunk/Icons/SAVEAS.GIF Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 125 B

BIN
trunk/Icons/START.GIF Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 73 B

BIN
trunk/Icons/UNDO.GIF Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 85 B

BIN
trunk/Images/Class.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 150 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1,012 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 598 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1,016 B

BIN
trunk/Images/Constants.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 88 B

BIN
trunk/Images/Enum.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 110 B

BIN
trunk/Images/Events.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 B

BIN
trunk/Images/Functions.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 109 B

BIN
trunk/Images/Namespace.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 B

Some files were not shown because too many files have changed in this diff Show more