12 changed files with 1126 additions and 1 deletions
@ -0,0 +1,163 @@
@@ -0,0 +1,163 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
namespace ICSharpCode.NRefactory.Demo |
||||
{ |
||||
partial class VBDemo |
||||
{ |
||||
/// <summary>
|
||||
/// Designer variable used to keep track of non-visual components.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null; |
||||
|
||||
/// <summary>
|
||||
/// Disposes resources used by the control.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing) |
||||
{ |
||||
if (disposing) { |
||||
if (components != null) { |
||||
components.Dispose(); |
||||
} |
||||
} |
||||
base.Dispose(disposing); |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// This method is required for Windows Forms designer support.
|
||||
/// Do not change the method contents inside the source code editor. The Forms designer might
|
||||
/// not be able to load this method if it was changed manually.
|
||||
/// </summary>
|
||||
private void InitializeComponent() |
||||
{ |
||||
this.splitContainer1 = new System.Windows.Forms.SplitContainer(); |
||||
this.codeView = new System.Windows.Forms.TextBox(); |
||||
this.editNodeButton = new System.Windows.Forms.Button(); |
||||
this.clearSpecialsButton = new System.Windows.Forms.Button(); |
||||
this.syntaxTree = new ICSharpCode.NRefactory.Demo.VBDomView(); |
||||
this.generateCodeButton = new System.Windows.Forms.Button(); |
||||
this.parseButton = new System.Windows.Forms.Button(); |
||||
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); |
||||
this.splitContainer1.Panel1.SuspendLayout(); |
||||
this.splitContainer1.Panel2.SuspendLayout(); |
||||
this.splitContainer1.SuspendLayout(); |
||||
this.SuspendLayout(); |
||||
//
|
||||
// splitContainer1
|
||||
//
|
||||
this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill; |
||||
this.splitContainer1.Location = new System.Drawing.Point(0, 0); |
||||
this.splitContainer1.Name = "splitContainer1"; |
||||
this.splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal; |
||||
//
|
||||
// splitContainer1.Panel1
|
||||
//
|
||||
this.splitContainer1.Panel1.Controls.Add(this.codeView); |
||||
//
|
||||
// splitContainer1.Panel2
|
||||
//
|
||||
this.splitContainer1.Panel2.Controls.Add(this.editNodeButton); |
||||
this.splitContainer1.Panel2.Controls.Add(this.clearSpecialsButton); |
||||
this.splitContainer1.Panel2.Controls.Add(this.syntaxTree); |
||||
this.splitContainer1.Panel2.Controls.Add(this.generateCodeButton); |
||||
this.splitContainer1.Panel2.Controls.Add(this.parseButton); |
||||
this.splitContainer1.Size = new System.Drawing.Size(462, 391); |
||||
this.splitContainer1.SplitterDistance = 173; |
||||
this.splitContainer1.TabIndex = 1; |
||||
//
|
||||
// codeView
|
||||
//
|
||||
this.codeView.AcceptsReturn = true; |
||||
this.codeView.AcceptsTab = true; |
||||
this.codeView.Dock = System.Windows.Forms.DockStyle.Fill; |
||||
this.codeView.Font = new System.Drawing.Font("Courier New", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); |
||||
this.codeView.HideSelection = false; |
||||
this.codeView.Location = new System.Drawing.Point(0, 0); |
||||
this.codeView.Multiline = true; |
||||
this.codeView.Name = "codeView"; |
||||
this.codeView.ScrollBars = System.Windows.Forms.ScrollBars.Both; |
||||
this.codeView.Size = new System.Drawing.Size(462, 173); |
||||
this.codeView.TabIndex = 0; |
||||
this.codeView.Text = "Imports System\r\nClass Test\r\n Public Sub Main(ByVal args As String())\r\n " + |
||||
" Console.WriteLine(\"Hello, World\")\r\n End Sub\r\nEnd Class"; |
||||
this.codeView.WordWrap = false; |
||||
//
|
||||
// editNodeButton
|
||||
//
|
||||
this.editNodeButton.Anchor = System.Windows.Forms.AnchorStyles.Top; |
||||
this.editNodeButton.Location = new System.Drawing.Point(331, 2); |
||||
this.editNodeButton.Name = "editNodeButton"; |
||||
this.editNodeButton.Size = new System.Drawing.Size(100, 23); |
||||
this.editNodeButton.TabIndex = 4; |
||||
this.editNodeButton.Text = "Edit node"; |
||||
this.editNodeButton.UseVisualStyleBackColor = true; |
||||
this.editNodeButton.Click += new System.EventHandler(this.EditNodeButtonClick); |
||||
//
|
||||
// clearSpecialsButton
|
||||
//
|
||||
this.clearSpecialsButton.Anchor = System.Windows.Forms.AnchorStyles.Top; |
||||
this.clearSpecialsButton.Location = new System.Drawing.Point(225, 2); |
||||
this.clearSpecialsButton.Name = "clearSpecialsButton"; |
||||
this.clearSpecialsButton.Size = new System.Drawing.Size(100, 23); |
||||
this.clearSpecialsButton.TabIndex = 3; |
||||
this.clearSpecialsButton.Text = "Clear 0 specials"; |
||||
this.clearSpecialsButton.UseVisualStyleBackColor = true; |
||||
this.clearSpecialsButton.Click += new System.EventHandler(this.ClearSpecialsButtonClick); |
||||
//
|
||||
// syntaxTree
|
||||
//
|
||||
this.syntaxTree.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) |
||||
| System.Windows.Forms.AnchorStyles.Left) |
||||
| System.Windows.Forms.AnchorStyles.Right))); |
||||
this.syntaxTree.Location = new System.Drawing.Point(3, 32); |
||||
this.syntaxTree.Name = "syntaxTree"; |
||||
this.syntaxTree.Size = new System.Drawing.Size(459, 182); |
||||
this.syntaxTree.TabIndex = 2; |
||||
this.syntaxTree.Unit = null; |
||||
//
|
||||
// generateCodeButton
|
||||
//
|
||||
this.generateCodeButton.Anchor = System.Windows.Forms.AnchorStyles.Top; |
||||
this.generateCodeButton.Location = new System.Drawing.Point(119, 2); |
||||
this.generateCodeButton.Name = "generateCodeButton"; |
||||
this.generateCodeButton.Size = new System.Drawing.Size(100, 23); |
||||
this.generateCodeButton.TabIndex = 1; |
||||
this.generateCodeButton.Text = "Generate"; |
||||
this.generateCodeButton.UseVisualStyleBackColor = true; |
||||
this.generateCodeButton.Click += new System.EventHandler(this.GenerateCodeButtonClick); |
||||
//
|
||||
// parseButton
|
||||
//
|
||||
this.parseButton.Anchor = System.Windows.Forms.AnchorStyles.Top; |
||||
this.parseButton.Location = new System.Drawing.Point(13, 2); |
||||
this.parseButton.Name = "parseButton"; |
||||
this.parseButton.Size = new System.Drawing.Size(100, 23); |
||||
this.parseButton.TabIndex = 0; |
||||
this.parseButton.Text = "Parse"; |
||||
this.parseButton.UseVisualStyleBackColor = true; |
||||
this.parseButton.Click += new System.EventHandler(this.ParseButtonClick); |
||||
//
|
||||
// VBDemo
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); |
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; |
||||
this.Controls.Add(this.splitContainer1); |
||||
this.Name = "VBDemo"; |
||||
this.Size = new System.Drawing.Size(462, 391); |
||||
this.splitContainer1.Panel1.ResumeLayout(false); |
||||
this.splitContainer1.Panel1.PerformLayout(); |
||||
this.splitContainer1.Panel2.ResumeLayout(false); |
||||
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit(); |
||||
this.splitContainer1.ResumeLayout(false); |
||||
this.ResumeLayout(false); |
||||
} |
||||
private System.Windows.Forms.Button clearSpecialsButton; |
||||
private System.Windows.Forms.Button editNodeButton; |
||||
private ICSharpCode.NRefactory.Demo.VBDomView syntaxTree; |
||||
private System.Windows.Forms.TextBox codeView; |
||||
private System.Windows.Forms.Button generateCodeButton; |
||||
private System.Windows.Forms.Button parseButton; |
||||
private System.Windows.Forms.SplitContainer splitContainer1; |
||||
} |
||||
} |
||||
@ -0,0 +1,78 @@
@@ -0,0 +1,78 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using System.Collections.Generic; |
||||
using System.ComponentModel; |
||||
using System.Drawing; |
||||
using System.IO; |
||||
using System.Linq; |
||||
using System.Windows.Forms; |
||||
using ICSharpCode.NRefactory.VB; |
||||
using ICSharpCode.NRefactory.VB.Parser; |
||||
using ICSharpCode.NRefactory.VB.PrettyPrinter; |
||||
|
||||
namespace ICSharpCode.NRefactory.Demo |
||||
{ |
||||
/// <summary>
|
||||
/// Description of VBDemo.
|
||||
/// </summary>
|
||||
public partial class VBDemo : UserControl |
||||
{ |
||||
public VBDemo() |
||||
{ |
||||
//
|
||||
// The InitializeComponent() call is required for Windows Forms designer support.
|
||||
//
|
||||
InitializeComponent(); |
||||
ParseButtonClick(null, null); |
||||
} |
||||
|
||||
IList<ISpecial> savedSpecials; |
||||
|
||||
void ParseButtonClick(object sender, EventArgs e) |
||||
{ |
||||
using (VBParser parser = new VBParser(new VBLexer(new StringReader(codeView.Text)))) { |
||||
parser.Parse(); |
||||
// this allows retrieving comments, preprocessor directives, etc. (stuff that isn't part of the syntax)
|
||||
SetSpecials(parser.Lexer.SpecialTracker.RetrieveSpecials()); |
||||
// this retrieves the root node of the result DOM
|
||||
if (parser.Errors.Count > 0) { |
||||
MessageBox.Show(parser.Errors.ErrorOutput); |
||||
} |
||||
syntaxTree.Unit = parser.CompilationUnit; |
||||
} |
||||
} |
||||
|
||||
void GenerateCodeButtonClick(object sender, EventArgs e) |
||||
{ |
||||
if (syntaxTree.Unit != null) { |
||||
VBNetOutputVisitor visitor = new VBNetOutputVisitor(); |
||||
// re-insert the comments we saved from the parser into the output
|
||||
using (SpecialNodesInserter.Install(savedSpecials, visitor)) { |
||||
syntaxTree.Unit.AcceptVisitor(visitor, null); |
||||
} |
||||
codeView.Text = visitor.Text.Replace("\t", " "); |
||||
} |
||||
} |
||||
|
||||
void ClearSpecialsButtonClick(object sender, EventArgs e) |
||||
{ |
||||
SetSpecials(new ISpecial[0]); |
||||
} |
||||
|
||||
void EditNodeButtonClick(object sender, EventArgs e) |
||||
{ |
||||
syntaxTree.EditSelectedNode(); |
||||
} |
||||
|
||||
void SetSpecials(IList<ISpecial> specials) |
||||
{ |
||||
savedSpecials = specials; |
||||
if (specials.Count == 1) |
||||
clearSpecialsButton.Text = "Clear 1 special"; |
||||
else |
||||
clearSpecialsButton.Text = "Clear " + specials.Count + " specials"; |
||||
} |
||||
} |
||||
} |
||||
@ -0,0 +1,120 @@
@@ -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=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> |
||||
</resheader> |
||||
<resheader name="writer"> |
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> |
||||
</resheader> |
||||
</root> |
||||
@ -0,0 +1,83 @@
@@ -0,0 +1,83 @@
|
||||
// SharpDevelop samples
|
||||
// Copyright (c) 2006, AlphaSierraPapa
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification, are
|
||||
// permitted provided that the following conditions are met:
|
||||
//
|
||||
// - Redistributions of source code must retain the above copyright notice, this list
|
||||
// of conditions and the following disclaimer.
|
||||
//
|
||||
// - Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
// of conditions and the following disclaimer in the documentation and/or other materials
|
||||
// provided with the distribution.
|
||||
//
|
||||
// - Neither the name of the SharpDevelop team nor the names of its contributors may be used to
|
||||
// endorse or promote products derived from this software without specific prior written
|
||||
// permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS &AS IS& AND ANY EXPRESS
|
||||
// OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
||||
// IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
namespace ICSharpCode.NRefactory.Demo |
||||
{ |
||||
partial class VBDomView : System.Windows.Forms.UserControl |
||||
{ |
||||
/// <summary>
|
||||
/// Designer variable used to keep track of non-visual components.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null; |
||||
|
||||
/// <summary>
|
||||
/// Disposes resources used by the control.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing) |
||||
{ |
||||
if (disposing) { |
||||
if (components != null) { |
||||
components.Dispose(); |
||||
} |
||||
} |
||||
base.Dispose(disposing); |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// This method is required for Windows Forms designer support.
|
||||
/// Do not change the method contents inside the source code editor. The Forms designer might
|
||||
/// not be able to load this method if it was changed manually.
|
||||
/// </summary>
|
||||
private void InitializeComponent() |
||||
{ |
||||
this.tree = new System.Windows.Forms.TreeView(); |
||||
this.SuspendLayout(); |
||||
//
|
||||
// tree
|
||||
//
|
||||
this.tree.Dock = System.Windows.Forms.DockStyle.Fill; |
||||
this.tree.HideSelection = false; |
||||
this.tree.Location = new System.Drawing.Point(0, 0); |
||||
this.tree.Name = "tree"; |
||||
this.tree.ShowRootLines = false; |
||||
this.tree.Size = new System.Drawing.Size(186, 182); |
||||
this.tree.TabIndex = 0; |
||||
this.tree.KeyDown += new System.Windows.Forms.KeyEventHandler(this.TreeKeyDown); |
||||
//
|
||||
// AstView
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); |
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; |
||||
this.Controls.Add(this.tree); |
||||
this.Name = "AstView"; |
||||
this.Size = new System.Drawing.Size(186, 182); |
||||
this.ResumeLayout(false); |
||||
} |
||||
private System.Windows.Forms.TreeView tree; |
||||
} |
||||
} |
||||
@ -0,0 +1,249 @@
@@ -0,0 +1,249 @@
|
||||
// SharpDevelop samples
|
||||
// Copyright (c) 2006, AlphaSierraPapa
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification, are
|
||||
// permitted provided that the following conditions are met:
|
||||
//
|
||||
// - Redistributions of source code must retain the above copyright notice, this list
|
||||
// of conditions and the following disclaimer.
|
||||
//
|
||||
// - Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
// of conditions and the following disclaimer in the documentation and/or other materials
|
||||
// provided with the distribution.
|
||||
//
|
||||
// - Neither the name of the SharpDevelop team nor the names of its contributors may be used to
|
||||
// endorse or promote products derived from this software without specific prior written
|
||||
// permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS &AS IS& AND ANY EXPRESS
|
||||
// OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
||||
// IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
using System; |
||||
using System.Collections; |
||||
using System.Windows.Forms; |
||||
using System.Reflection; |
||||
|
||||
using ICSharpCode.NRefactory.VB.Dom; |
||||
using ICSharpCode.NRefactory.VB; |
||||
|
||||
namespace ICSharpCode.NRefactory.Demo |
||||
{ |
||||
public partial class VBDomView |
||||
{ |
||||
CompilationUnit unit; |
||||
|
||||
public CompilationUnit Unit { |
||||
get { |
||||
return unit; |
||||
} |
||||
set { |
||||
if (value != null) { |
||||
unit = value; |
||||
UpdateTree(); |
||||
} |
||||
} |
||||
} |
||||
|
||||
void UpdateTree() |
||||
{ |
||||
tree.Nodes.Clear(); |
||||
tree.Nodes.Add(new CollectionNode("CompilationUnit", unit.Children)); |
||||
tree.SelectedNode = tree.Nodes[0]; |
||||
} |
||||
|
||||
public VBDomView() |
||||
{ |
||||
InitializeComponent(); |
||||
} |
||||
|
||||
public void DeleteSelectedNode() |
||||
{ |
||||
if (tree.SelectedNode is ElementNode) { |
||||
INode element = (tree.SelectedNode as ElementNode).element; |
||||
if (tree.SelectedNode.Parent is CollectionNode) { |
||||
if (MessageBox.Show("Remove selected node from parent collection?", "Remove node", MessageBoxButtons.YesNo, MessageBoxIcon.Question) |
||||
== DialogResult.Yes) |
||||
{ |
||||
IList col = (tree.SelectedNode.Parent as CollectionNode).collection; |
||||
col.Remove(element); |
||||
(tree.SelectedNode.Parent as CollectionNode).Update(); |
||||
} |
||||
} else if (tree.SelectedNode.Parent is ElementNode) { |
||||
if (MessageBox.Show("Set selected property to null?", "Remove node", MessageBoxButtons.YesNo, MessageBoxIcon.Question) |
||||
== DialogResult.Yes) |
||||
{ |
||||
// get parent element
|
||||
element = (tree.SelectedNode.Parent as ElementNode).element; |
||||
string propertyName = (string)tree.SelectedNode.Tag; |
||||
element.GetType().GetProperty(propertyName).SetValue(element, null, null); |
||||
(tree.SelectedNode.Parent as ElementNode).Update(); |
||||
} |
||||
} |
||||
} else if (tree.SelectedNode is CollectionNode) { |
||||
if (MessageBox.Show("Remove all elements from selected collection?", "Clear collection", MessageBoxButtons.YesNo, MessageBoxIcon.Question) |
||||
== DialogResult.Yes) |
||||
{ |
||||
IList col = (tree.SelectedNode as CollectionNode).collection; |
||||
col.Clear(); |
||||
(tree.SelectedNode as CollectionNode).Update(); |
||||
} |
||||
} |
||||
} |
||||
|
||||
public void EditSelectedNode() |
||||
{ |
||||
TreeNode node = tree.SelectedNode; |
||||
while (!(node is ElementNode)) { |
||||
if (node == null) { |
||||
return; |
||||
} |
||||
node = node.Parent; |
||||
} |
||||
INode element = ((ElementNode)node).element; |
||||
using (VBEditDialog dlg = new VBEditDialog(element)) { |
||||
dlg.ShowDialog(); |
||||
} |
||||
((ElementNode)node).Update(); |
||||
} |
||||
|
||||
public void ApplyTransformation(IDomVisitor visitor) |
||||
{ |
||||
if (tree.SelectedNode == tree.Nodes[0]) { |
||||
unit.AcceptVisitor(visitor, null); |
||||
UpdateTree(); |
||||
} else { |
||||
string name = visitor.GetType().Name; |
||||
ElementNode elementNode = tree.SelectedNode as ElementNode; |
||||
CollectionNode collectionNode = tree.SelectedNode as CollectionNode; |
||||
if (elementNode != null) { |
||||
if (MessageBox.Show(("Apply " + name + " to selected element '" + elementNode.Text + "'?"), |
||||
"Apply transformation", MessageBoxButtons.YesNo, MessageBoxIcon.Question) |
||||
== DialogResult.Yes) |
||||
{ |
||||
elementNode.element.AcceptVisitor(visitor, null); |
||||
elementNode.Update(); |
||||
} |
||||
} else if (collectionNode != null) { |
||||
if (MessageBox.Show(("Apply " + name + " to all elements in selected collection '" + collectionNode.Text + "'?"), |
||||
"Apply transformation", MessageBoxButtons.YesNo, MessageBoxIcon.Question) |
||||
== DialogResult.Yes) |
||||
{ |
||||
foreach (TreeNode subNode in collectionNode.Nodes) { |
||||
if (subNode is ElementNode) { |
||||
(subNode as ElementNode).element.AcceptVisitor(visitor, null); |
||||
} |
||||
} |
||||
collectionNode.Update(); |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
static TreeNode CreateNode(object child) |
||||
{ |
||||
if (child == null) { |
||||
return new TreeNode("*null reference*"); |
||||
} else if (child is INode) { |
||||
return new ElementNode(child as INode); |
||||
} else { |
||||
return new TreeNode(child.ToString()); |
||||
} |
||||
} |
||||
|
||||
class CollectionNode : TreeNode |
||||
{ |
||||
internal IList collection; |
||||
string baseName; |
||||
|
||||
public CollectionNode(string text, IList children) : base(text) |
||||
{ |
||||
this.baseName = text; |
||||
this.collection = children; |
||||
Update(); |
||||
} |
||||
|
||||
public void Update() |
||||
{ |
||||
if (collection.Count == 0) { |
||||
Text = baseName + " (empty collection)"; |
||||
} else if (collection.Count == 1) { |
||||
Text = baseName + " (collection with 1 element)"; |
||||
} else { |
||||
Text = baseName + " (collection with " + collection.Count + " elements)"; |
||||
} |
||||
Nodes.Clear(); |
||||
foreach (object child in collection) { |
||||
Nodes.Add(CreateNode(child)); |
||||
} |
||||
Expand(); |
||||
} |
||||
} |
||||
|
||||
class ElementNode : TreeNode |
||||
{ |
||||
internal INode element; |
||||
|
||||
public ElementNode(INode node) |
||||
{ |
||||
this.element = node; |
||||
Update(); |
||||
} |
||||
|
||||
public void Update() |
||||
{ |
||||
Nodes.Clear(); |
||||
Type type = element.GetType(); |
||||
Text = type.Name; |
||||
if (Tag != null) { // HACK: after editing property element
|
||||
Text = Tag.ToString() + " = " + Text; |
||||
} |
||||
if (!(element is INullable && (element as INullable).IsNull)) { |
||||
AddProperties(type, element); |
||||
if (element.Children.Count > 0) { |
||||
Nodes.Add(new CollectionNode("Children", element.Children)); |
||||
} |
||||
} |
||||
} |
||||
|
||||
void AddProperties(Type type, INode node) |
||||
{ |
||||
if (type == typeof(AbstractNode)) |
||||
return; |
||||
foreach (PropertyInfo pi in type.GetProperties(BindingFlags.Instance | BindingFlags.Public)) { |
||||
if (pi.DeclaringType != type) // don't add derived properties
|
||||
continue; |
||||
if (pi.Name == "IsNull") |
||||
continue; |
||||
object value = pi.GetValue(node, null); |
||||
if (value is IList) { |
||||
Nodes.Add(new CollectionNode(pi.Name, (IList)value)); |
||||
} else if (value is string) { |
||||
Text += " " + pi.Name + "='" + value + "'"; |
||||
} else { |
||||
TreeNode treeNode = CreateNode(value); |
||||
treeNode.Text = pi.Name + " = " + treeNode.Text; |
||||
treeNode.Tag = pi.Name; |
||||
Nodes.Add(treeNode); |
||||
} |
||||
} |
||||
AddProperties(type.BaseType, node); |
||||
} |
||||
} |
||||
|
||||
void TreeKeyDown(object sender, KeyEventArgs e) |
||||
{ |
||||
if (e.KeyData == Keys.Delete) { |
||||
DeleteSelectedNode(); |
||||
} else if (e.KeyData == Keys.Space || e.KeyData == Keys.Enter) { |
||||
EditSelectedNode(); |
||||
} |
||||
} |
||||
} |
||||
} |
||||
@ -0,0 +1,120 @@
@@ -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> |
||||
@ -0,0 +1,112 @@
@@ -0,0 +1,112 @@
|
||||
// SharpDevelop samples
|
||||
// Copyright (c) 2006, AlphaSierraPapa
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification, are
|
||||
// permitted provided that the following conditions are met:
|
||||
//
|
||||
// - Redistributions of source code must retain the above copyright notice, this list
|
||||
// of conditions and the following disclaimer.
|
||||
//
|
||||
// - Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
// of conditions and the following disclaimer in the documentation and/or other materials
|
||||
// provided with the distribution.
|
||||
//
|
||||
// - Neither the name of the SharpDevelop team nor the names of its contributors may be used to
|
||||
// endorse or promote products derived from this software without specific prior written
|
||||
// permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS &AS IS& AND ANY EXPRESS
|
||||
// OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
||||
// IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
namespace ICSharpCode.NRefactory.Demo |
||||
{ |
||||
partial class VBEditDialog : System.Windows.Forms.Form |
||||
{ |
||||
/// <summary>
|
||||
/// Designer variable used to keep track of non-visual components.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null; |
||||
|
||||
/// <summary>
|
||||
/// Disposes resources used by the form.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing) |
||||
{ |
||||
if (disposing) { |
||||
if (components != null) { |
||||
components.Dispose(); |
||||
} |
||||
} |
||||
base.Dispose(disposing); |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// This method is required for Windows Forms designer support.
|
||||
/// Do not change the method contents inside the source code editor. The Forms designer might
|
||||
/// not be able to load this method if it was changed manually.
|
||||
/// </summary>
|
||||
private void InitializeComponent() |
||||
{ |
||||
this.propertyGrid = new System.Windows.Forms.PropertyGrid(); |
||||
this.panel1 = new System.Windows.Forms.Panel(); |
||||
this.okButton = new System.Windows.Forms.Button(); |
||||
this.panel1.SuspendLayout(); |
||||
this.SuspendLayout(); |
||||
//
|
||||
// propertyGrid
|
||||
//
|
||||
this.propertyGrid.Dock = System.Windows.Forms.DockStyle.Fill; |
||||
this.propertyGrid.HelpVisible = false; |
||||
this.propertyGrid.Location = new System.Drawing.Point(0, 0); |
||||
this.propertyGrid.Name = "propertyGrid"; |
||||
this.propertyGrid.PropertySort = System.Windows.Forms.PropertySort.Alphabetical; |
||||
this.propertyGrid.Size = new System.Drawing.Size(477, 436); |
||||
this.propertyGrid.TabIndex = 0; |
||||
this.propertyGrid.ToolbarVisible = false; |
||||
//
|
||||
// panel1
|
||||
//
|
||||
this.panel1.Controls.Add(this.okButton); |
||||
this.panel1.Dock = System.Windows.Forms.DockStyle.Bottom; |
||||
this.panel1.Location = new System.Drawing.Point(0, 436); |
||||
this.panel1.Name = "panel1"; |
||||
this.panel1.Size = new System.Drawing.Size(477, 38); |
||||
this.panel1.TabIndex = 1; |
||||
//
|
||||
// okButton
|
||||
//
|
||||
this.okButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); |
||||
this.okButton.DialogResult = System.Windows.Forms.DialogResult.OK; |
||||
this.okButton.Location = new System.Drawing.Point(390, 6); |
||||
this.okButton.Name = "okButton"; |
||||
this.okButton.Size = new System.Drawing.Size(75, 23); |
||||
this.okButton.TabIndex = 0; |
||||
this.okButton.Text = "OK"; |
||||
this.okButton.UseVisualStyleBackColor = true; |
||||
//
|
||||
// EditDialog
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); |
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; |
||||
this.CancelButton = this.okButton; |
||||
this.ClientSize = new System.Drawing.Size(477, 474); |
||||
this.Controls.Add(this.propertyGrid); |
||||
this.Controls.Add(this.panel1); |
||||
this.Name = "EditDialog"; |
||||
this.Text = "EditDialog"; |
||||
this.panel1.ResumeLayout(false); |
||||
this.ResumeLayout(false); |
||||
} |
||||
private System.Windows.Forms.PropertyGrid propertyGrid; |
||||
private System.Windows.Forms.Button okButton; |
||||
private System.Windows.Forms.Panel panel1; |
||||
} |
||||
} |
||||
@ -0,0 +1,42 @@
@@ -0,0 +1,42 @@
|
||||
// SharpDevelop samples
|
||||
// Copyright (c) 2006, AlphaSierraPapa
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification, are
|
||||
// permitted provided that the following conditions are met:
|
||||
//
|
||||
// - Redistributions of source code must retain the above copyright notice, this list
|
||||
// of conditions and the following disclaimer.
|
||||
//
|
||||
// - Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
// of conditions and the following disclaimer in the documentation and/or other materials
|
||||
// provided with the distribution.
|
||||
//
|
||||
// - Neither the name of the SharpDevelop team nor the names of its contributors may be used to
|
||||
// endorse or promote products derived from this software without specific prior written
|
||||
// permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS &AS IS& AND ANY EXPRESS
|
||||
// OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
||||
// IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
using System; |
||||
using System.Drawing; |
||||
using System.Windows.Forms; |
||||
|
||||
namespace ICSharpCode.NRefactory.Demo |
||||
{ |
||||
public partial class VBEditDialog |
||||
{ |
||||
public VBEditDialog(object element) |
||||
{ |
||||
InitializeComponent(); |
||||
propertyGrid.SelectedObject = element; |
||||
} |
||||
} |
||||
} |
||||
@ -0,0 +1,120 @@
@@ -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> |
||||
Loading…
Reference in new issue