Browse Source

http://codeconverter.sharpdevelop.net/ included in /samples (ASP.NET 3.5 application, code conversion features separated out into assembly project ICSharpCode.CodeConversion for easier reuse)

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@3092 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Christoph Wille 17 years ago
parent
commit
67e57efb2f
  1. 165
      samples/CodeConverter/Source/CCClient/CodeConversionForm.Designer.cs
  2. 78
      samples/CodeConverter/Source/CCClient/CodeConversionForm.cs
  3. 120
      samples/CodeConverter/Source/CCClient/CodeConversionForm.resx
  4. 113
      samples/CodeConverter/Source/CCClient/CodeConvertServiceClient.csproj
  5. 20
      samples/CodeConverter/Source/CCClient/Program.cs
  6. 33
      samples/CodeConverter/Source/CCClient/Properties/AssemblyInfo.cs
  7. 63
      samples/CodeConverter/Source/CCClient/Properties/Resources.Designer.cs
  8. 117
      samples/CodeConverter/Source/CCClient/Properties/Resources.resx
  9. 36
      samples/CodeConverter/Source/CCClient/Properties/Settings.Designer.cs
  10. 9
      samples/CodeConverter/Source/CCClient/Properties/Settings.settings
  11. 68
      samples/CodeConverter/Source/CCClient/Web References/ICSharpCode.OnlineConverter/ConvertService.wsdl
  12. 170
      samples/CodeConverter/Source/CCClient/Web References/ICSharpCode.OnlineConverter/Reference.cs
  13. 6
      samples/CodeConverter/Source/CCClient/Web References/ICSharpCode.OnlineConverter/Reference.map
  14. 16
      samples/CodeConverter/Source/CCClient/app.config
  15. 31
      samples/CodeConverter/Source/CCSite/About.aspx
  16. 21
      samples/CodeConverter/Source/CCSite/About.aspx.cs
  17. 31
      samples/CodeConverter/Source/CCSite/About.aspx.designer.cs
  18. 214
      samples/CodeConverter/Source/CCSite/CCSite.csproj
  19. 266
      samples/CodeConverter/Source/CCSite/Code/HtmlWriter.cs
  20. 28
      samples/CodeConverter/Source/CCSite/CodeFormatClient.aspx
  21. 21
      samples/CodeConverter/Source/CCSite/CodeFormatClient.aspx.cs
  22. 16
      samples/CodeConverter/Source/CCSite/CodeFormatClient.aspx.designer.cs
  23. 1
      samples/CodeConverter/Source/CCSite/CodeFormatService.asmx
  24. 49
      samples/CodeConverter/Source/CCSite/CodeFormatService.asmx.cs
  25. 10
      samples/CodeConverter/Source/CCSite/Convert.aspx
  26. 21
      samples/CodeConverter/Source/CCSite/Convert.aspx.cs
  27. 14
      samples/CodeConverter/Source/CCSite/Convert.aspx.designer.cs
  28. 16
      samples/CodeConverter/Source/CCSite/ConvertCSharp20ToVbNet80.aspx
  29. 19
      samples/CodeConverter/Source/CCSite/ConvertCSharp20ToVbNet80.aspx.cs
  30. 14
      samples/CodeConverter/Source/CCSite/ConvertCSharp20ToVbNet80.aspx.designer.cs
  31. 1
      samples/CodeConverter/Source/CCSite/ConvertService.asmx
  32. 86
      samples/CodeConverter/Source/CCSite/ConvertService.cs
  33. 56
      samples/CodeConverter/Source/CCSite/Default.aspx
  34. 18
      samples/CodeConverter/Source/CCSite/Default.aspx.cs
  35. 14
      samples/CodeConverter/Source/CCSite/Default.aspx.designer.cs
  36. 21
      samples/CodeConverter/Source/CCSite/DotNetClientApplication.aspx
  37. 21
      samples/CodeConverter/Source/CCSite/DotNetClientApplication.aspx.cs
  38. 16
      samples/CodeConverter/Source/CCSite/DotNetClientApplication.aspx.designer.cs
  39. 39
      samples/CodeConverter/Source/CCSite/FormatCode.aspx
  40. 47
      samples/CodeConverter/Source/CCSite/FormatCode.aspx.cs
  41. 103
      samples/CodeConverter/Source/CCSite/FormatCode.aspx.designer.cs
  42. 35
      samples/CodeConverter/Source/CCSite/Properties/AssemblyInfo.cs
  43. 32
      samples/CodeConverter/Source/CCSite/ProzacAfternoon.master
  44. 18
      samples/CodeConverter/Source/CCSite/ProzacAfternoon.master.cs
  45. 32
      samples/CodeConverter/Source/CCSite/ProzacAfternoon.master.designer.cs
  46. 42
      samples/CodeConverter/Source/CCSite/SnippetConverter.aspx
  47. 66
      samples/CodeConverter/Source/CCSite/SnippetConverter.aspx.cs
  48. 59
      samples/CodeConverter/Source/CCSite/SnippetConverter.aspx.designer.cs
  49. 88
      samples/CodeConverter/Source/CCSite/Web.Config
  50. 242
      samples/CodeConverter/Source/CCSite/default.css
  51. BIN
      samples/CodeConverter/Source/CCSite/downloads/CodeConvertServiceClient.zip
  52. BIN
      samples/CodeConverter/Source/CCSite/downloads/CodeConvertServiceClient_Source.zip
  53. BIN
      samples/CodeConverter/Source/CCSite/downloads/CodeFormatServiceClient.zip
  54. BIN
      samples/CodeConverter/Source/CCSite/downloads/CodeFormatServiceClient_Source.zip
  55. BIN
      samples/CodeConverter/Source/CCSite/images/bg.gif
  56. BIN
      samples/CodeConverter/Source/CCSite/images/cnr_bl.gif
  57. BIN
      samples/CodeConverter/Source/CCSite/images/cnr_br.gif
  58. BIN
      samples/CodeConverter/Source/CCSite/images/cnr_tl.gif
  59. BIN
      samples/CodeConverter/Source/CCSite/images/cnr_tr.gif
  60. BIN
      samples/CodeConverter/Source/CCSite/images/header.jpg
  61. BIN
      samples/CodeConverter/Source/CCSite/images/sample.jpg
  62. BIN
      samples/CodeConverter/Source/CCSite/images/topnav_bg.gif
  63. BIN
      samples/CodeConverter/Source/CCSite/images/topnav_bg_grey.gif
  64. BIN
      samples/CodeConverter/Source/CCSite/screenshots/CodeConverterClient.png
  65. BIN
      samples/CodeConverter/Source/CCSite/screenshots/FormatCode_Html.png
  66. BIN
      samples/CodeConverter/Source/CCSite/screenshots/FormatCode_Preview.png
  67. BIN
      samples/CodeConverter/Source/CCSite/screenshots/FormatCode_Source.png
  68. 38
      samples/CodeConverter/Source/CodeConverter.sln
  69. 171
      samples/CodeConverter/Source/CodeFormatServiceClient/CodeFormatForm.Designer.cs
  70. 43
      samples/CodeConverter/Source/CodeFormatServiceClient/CodeFormatForm.cs
  71. 120
      samples/CodeConverter/Source/CodeFormatServiceClient/CodeFormatForm.resx
  72. 116
      samples/CodeConverter/Source/CodeFormatServiceClient/CodeFormatServiceClient.csproj
  73. 20
      samples/CodeConverter/Source/CodeFormatServiceClient/Program.cs
  74. 33
      samples/CodeConverter/Source/CodeFormatServiceClient/Properties/AssemblyInfo.cs
  75. 63
      samples/CodeConverter/Source/CodeFormatServiceClient/Properties/Resources.Designer.cs
  76. 117
      samples/CodeConverter/Source/CodeFormatServiceClient/Properties/Resources.resx
  77. 36
      samples/CodeConverter/Source/CodeFormatServiceClient/Properties/Settings.Designer.cs
  78. 9
      samples/CodeConverter/Source/CodeFormatServiceClient/Properties/Settings.settings
  79. 212
      samples/CodeConverter/Source/CodeFormatServiceClient/Web References/ICSharpCode.CodeFormat/Reference.cs
  80. 7
      samples/CodeConverter/Source/CodeFormatServiceClient/Web References/ICSharpCode.CodeFormat/Reference.map
  81. 6
      samples/CodeConverter/Source/CodeFormatServiceClient/Web References/ICSharpCode.CodeFormat/codeformatservice.disco
  82. 110
      samples/CodeConverter/Source/CodeFormatServiceClient/Web References/ICSharpCode.CodeFormat/codeformatservice.wsdl
  83. 16
      samples/CodeConverter/Source/CodeFormatServiceClient/app.config
  84. 95
      samples/CodeConverter/Source/ICSharpCode.CodeConversion/BooHelpers.cs
  85. 24
      samples/CodeConverter/Source/ICSharpCode.CodeConversion/HelperFunctions.cs
  86. 83
      samples/CodeConverter/Source/ICSharpCode.CodeConversion/ICSharpCode.CodeConversion.csproj
  87. 13
      samples/CodeConverter/Source/ICSharpCode.CodeConversion/IConvertCode.cs
  88. 36
      samples/CodeConverter/Source/ICSharpCode.CodeConversion/Properties/AssemblyInfo.cs
  89. 60
      samples/CodeConverter/Source/ICSharpCode.CodeConversion/ReferencedContentsSingleton.cs
  90. 55
      samples/CodeConverter/Source/ICSharpCode.CodeConversion/SnippetConversion.cs

165
samples/CodeConverter/Source/CCClient/CodeConversionForm.Designer.cs generated

@ -0,0 +1,165 @@ @@ -0,0 +1,165 @@
namespace CodeConvertServiceClient
{
partial class CodeConversionForm
{
/// <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.typeOfConversion = new System.Windows.Forms.ComboBox();
this.performConversion = new System.Windows.Forms.Button();
this.inputSource = new System.Windows.Forms.TextBox();
this.outputTextBox = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.linkLabel1 = new System.Windows.Forms.LinkLabel();
this.SuspendLayout();
//
// typeOfConversion
//
this.typeOfConversion.FormattingEnabled = true;
this.typeOfConversion.Items.AddRange(new object[] {
"C# to VB.NET",
"VB.NET to C#",
"C# to Boo",
"VB.NET to Boo"});
this.typeOfConversion.Location = new System.Drawing.Point(376, 19);
this.typeOfConversion.Name = "typeOfConversion";
this.typeOfConversion.Size = new System.Drawing.Size(121, 21);
this.typeOfConversion.TabIndex = 1;
//
// performConversion
//
this.performConversion.Location = new System.Drawing.Point(204, 303);
this.performConversion.Name = "performConversion";
this.performConversion.Size = new System.Drawing.Size(166, 23);
this.performConversion.TabIndex = 4;
this.performConversion.Text = "Perform Conversion";
this.performConversion.UseVisualStyleBackColor = true;
this.performConversion.Click += new System.EventHandler(this.performConversion_Click);
//
// inputSource
//
this.inputSource.Location = new System.Drawing.Point(16, 82);
this.inputSource.Multiline = true;
this.inputSource.Name = "inputSource";
this.inputSource.ScrollBars = System.Windows.Forms.ScrollBars.Both;
this.inputSource.Size = new System.Drawing.Size(709, 211);
this.inputSource.TabIndex = 3;
//
// outputTextBox
//
this.outputTextBox.Location = new System.Drawing.Point(16, 366);
this.outputTextBox.Multiline = true;
this.outputTextBox.Name = "outputTextBox";
this.outputTextBox.ScrollBars = System.Windows.Forms.ScrollBars.Both;
this.outputTextBox.Size = new System.Drawing.Size(709, 211);
this.outputTextBox.TabIndex = 6;
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(13, 22);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(354, 13);
this.label1.TabIndex = 0;
this.label1.Text = "Step 1: Choose source language and destination language for conversion";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(13, 57);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(327, 13);
this.label2.TabIndex = 2;
this.label2.Text = "Step 2: Paste the source code (entire class[es]) you want to convert";
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(13, 340);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(76, 13);
this.label3.TabIndex = 5;
this.label3.Text = "Step 4: Output";
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(13, 303);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(185, 13);
this.label4.TabIndex = 7;
this.label4.Text = "Step 3: Perform the actual conversion";
//
// linkLabel1
//
this.linkLabel1.AutoSize = true;
this.linkLabel1.Location = new System.Drawing.Point(373, 57);
this.linkLabel1.Name = "linkLabel1";
this.linkLabel1.Size = new System.Drawing.Size(132, 13);
this.linkLabel1.TabIndex = 8;
this.linkLabel1.TabStop = true;
this.linkLabel1.Text = "Online Snippet Conversion";
this.linkLabel1.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabel1_LinkClicked);
//
// CodeConversionForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(734, 592);
this.Controls.Add(this.linkLabel1);
this.Controls.Add(this.label4);
this.Controls.Add(this.label3);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.Controls.Add(this.outputTextBox);
this.Controls.Add(this.inputSource);
this.Controls.Add(this.performConversion);
this.Controls.Add(this.typeOfConversion);
this.Name = "CodeConversionForm";
this.Text = "Code Converter";
this.Load += new System.EventHandler(this.CodeConversionForm_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.ComboBox typeOfConversion;
private System.Windows.Forms.Button performConversion;
private System.Windows.Forms.TextBox inputSource;
private System.Windows.Forms.TextBox outputTextBox;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.LinkLabel linkLabel1;
}
}

78
samples/CodeConverter/Source/CCClient/CodeConversionForm.cs

@ -0,0 +1,78 @@ @@ -0,0 +1,78 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Collections.Specialized;
using CodeConvertServiceClient.ICSharpCode.OnlineConverter;
namespace CodeConvertServiceClient
{
public partial class CodeConversionForm : Form
{
StringDictionary ConversionTypes;
public CodeConversionForm()
{
InitializeComponent();
ConversionTypes = new StringDictionary();
ConversionTypes.Add("C# to VB.NET", "cs2vbnet");
ConversionTypes.Add("VB.NET to C#", "vbnet2cs");
ConversionTypes.Add("C# to Boo", "cs2boo");
ConversionTypes.Add("VB.NET to Boo", "vbnet2boo");
}
private void CodeConversionForm_Load(object sender, EventArgs e)
{
typeOfConversion.SelectedIndex = 0;
}
private void performConversion_Click(object sender, EventArgs e)
{
string buttonText = "";
try
{
ConvertService cs = new ConvertService();
string convertedCode = "", errorMessage = "";
string conversionType = ConversionTypes[typeOfConversion.Items[typeOfConversion.SelectedIndex].ToString()];
buttonText = performConversion.Text;
performConversion.Text = "waiting...";
performConversion.Enabled = false;
bool bResult = cs.PerformConversion(conversionType, inputSource.Text,
out convertedCode, out errorMessage);
if (bResult)
{
outputTextBox.Text = convertedCode.Replace("\n", "\r\n");
}
else
{
outputTextBox.Text = errorMessage.Replace("\n", "\r\n");
}
}
catch (Exception ex)
{
// Failure is reported via dialog box, but not presented in a "nice way" - after all, this is for developers
MessageBox.Show("Web Service failed: " + ex.ToString());
}
finally
{
performConversion.Text = buttonText;
performConversion.Enabled = true;
}
}
private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
System.Diagnostics.Process.Start("http://codeconverter.sharpdevelop.net/SnippetConverter.aspx");
}
}
}

120
samples/CodeConverter/Source/CCClient/CodeConversionForm.resx

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

113
samples/CodeConverter/Source/CCClient/CodeConvertServiceClient.csproj

@ -0,0 +1,113 @@ @@ -0,0 +1,113 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.50727</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{93D91711-636F-4796-8572-F043D4CF8FA5}</ProjectGuid>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>CodeConvertServiceClient</RootNamespace>
<AssemblyName>CodeConvertServiceClient</AssemblyName>
<FileUpgradeFlags>
</FileUpgradeFlags>
<OldToolsVersion>2.0</OldToolsVersion>
<UpgradeBackupLocation>
</UpgradeBackupLocation>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.EnterpriseServices" />
<Reference Include="System.Web.Services" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="CodeConversionForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="CodeConversionForm.Designer.cs">
<DependentUpon>CodeConversionForm.cs</DependentUpon>
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="CodeConversionForm.resx">
<SubType>Designer</SubType>
<DependentUpon>CodeConversionForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
<None Include="app.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<None Include="Web References\ICSharpCode.OnlineConverter\ConvertService.wsdl" />
<None Include="Web References\ICSharpCode.OnlineConverter\Reference.map">
<Generator>MSDiscoCodeGenerator</Generator>
<LastGenOutput>Reference.cs</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
<Compile Include="Web References\ICSharpCode.OnlineConverter\Reference.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Reference.map</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<WebReferences Include="Web References\" />
</ItemGroup>
<ItemGroup>
<WebReferenceUrl Include="http://codeconverter.sharpdevelop.net/ConvertService.asmx%3fWSDL">
<UrlBehavior>Dynamic</UrlBehavior>
<RelPath>Web References\ICSharpCode.OnlineConverter\</RelPath>
<UpdateFromURL>http://codeconverter.sharpdevelop.net/ConvertService.asmx%3fWSDL</UpdateFromURL>
<ServiceLocationURL>
</ServiceLocationURL>
<CachedDynamicPropName>
</CachedDynamicPropName>
<CachedAppSettingsObjectName>Settings</CachedAppSettingsObjectName>
<CachedSettingsPropName>CodeConvertServiceClient_ICSharpCode_OnlineConverter_ConvertService</CachedSettingsPropName>
</WebReferenceUrl>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

20
samples/CodeConverter/Source/CCClient/Program.cs

@ -0,0 +1,20 @@ @@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.Windows.Forms;
namespace CodeConvertServiceClient
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new CodeConversionForm());
}
}
}

33
samples/CodeConverter/Source/CCClient/Properties/AssemblyInfo.cs

@ -0,0 +1,33 @@ @@ -0,0 +1,33 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("CodeConvertServiceClient")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("AlphaSierraPapa")]
[assembly: AssemblyProduct("CodeConvertServiceClient")]
[assembly: AssemblyCopyright("Copyright © AlphaSierraPapa 2005")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("f4eafea9-cf98-4ef0-92e0-f38415517e51")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

63
samples/CodeConverter/Source/CCClient/Properties/Resources.Designer.cs generated

@ -0,0 +1,63 @@ @@ -0,0 +1,63 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:2.0.50727.1433
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace CodeConvertServiceClient.Properties {
using System;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("CodeConvertServiceClient.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
}
}

117
samples/CodeConverter/Source/CCClient/Properties/Resources.resx

@ -0,0 +1,117 @@ @@ -0,0 +1,117 @@
<?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.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="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</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="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" 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>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>

36
samples/CodeConverter/Source/CCClient/Properties/Settings.Designer.cs generated

@ -0,0 +1,36 @@ @@ -0,0 +1,36 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:2.0.50727.1433
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace CodeConvertServiceClient.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "9.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default {
get {
return defaultInstance;
}
}
[global::System.Configuration.ApplicationScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.SpecialSettingAttribute(global::System.Configuration.SpecialSetting.WebServiceUrl)]
[global::System.Configuration.DefaultSettingValueAttribute("http://codeconverter.sharpdevelop.net/ConvertService.asmx")]
public string CodeConvertServiceClient_ICSharpCode_OnlineConverter_ConvertService {
get {
return ((string)(this["CodeConvertServiceClient_ICSharpCode_OnlineConverter_ConvertService"]));
}
}
}
}

9
samples/CodeConverter/Source/CCClient/Properties/Settings.settings

@ -0,0 +1,9 @@ @@ -0,0 +1,9 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="CodeConvertServiceClient.Properties" GeneratedClassName="Settings">
<Profiles />
<Settings>
<Setting Name="CodeConvertServiceClient_ICSharpCode_OnlineConverter_ConvertService" Type="(Web Service URL)" Scope="Application">
<Value Profile="(Default)">http://codeconverter.sharpdevelop.net/ConvertService.asmx</Value>
</Setting>
</Settings>
</SettingsFile>

68
samples/CodeConverter/Source/CCClient/Web References/ICSharpCode.OnlineConverter/ConvertService.wsdl

@ -0,0 +1,68 @@ @@ -0,0 +1,68 @@
<?xml version="1.0" encoding="utf-8"?>
<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns="http://developer.sharpdevelop.net/CodeConverter.NET/" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" targetNamespace="http://developer.sharpdevelop.net/CodeConverter.NET/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
<wsdl:types>
<s:schema elementFormDefault="qualified" targetNamespace="http://developer.sharpdevelop.net/CodeConverter.NET/">
<s:element name="PerformConversion">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="TypeOfConversion" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="SourceCode" type="s:string" />
</s:sequence>
</s:complexType>
</s:element>
<s:element name="PerformConversionResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="1" maxOccurs="1" name="PerformConversionResult" type="s:boolean" />
<s:element minOccurs="0" maxOccurs="1" name="ConvertedCode" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="ErrorMessage" type="s:string" />
</s:sequence>
</s:complexType>
</s:element>
</s:schema>
</wsdl:types>
<wsdl:message name="PerformConversionSoapIn">
<wsdl:part name="parameters" element="tns:PerformConversion" />
</wsdl:message>
<wsdl:message name="PerformConversionSoapOut">
<wsdl:part name="parameters" element="tns:PerformConversionResponse" />
</wsdl:message>
<wsdl:portType name="ConvertServiceSoap">
<wsdl:operation name="PerformConversion">
<wsdl:input message="tns:PerformConversionSoapIn" />
<wsdl:output message="tns:PerformConversionSoapOut" />
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="ConvertServiceSoap" type="tns:ConvertServiceSoap">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="PerformConversion">
<soap:operation soapAction="http://developer.sharpdevelop.net/CodeConverter.NET/PerformConversion" style="document" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:binding name="ConvertServiceSoap12" type="tns:ConvertServiceSoap">
<soap12:binding transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="PerformConversion">
<soap12:operation soapAction="http://developer.sharpdevelop.net/CodeConverter.NET/PerformConversion" style="document" />
<wsdl:input>
<soap12:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap12:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="ConvertService">
<wsdl:port name="ConvertServiceSoap" binding="tns:ConvertServiceSoap">
<soap:address location="http://codeconverter.sharpdevelop.net/ConvertService.asmx" />
</wsdl:port>
<wsdl:port name="ConvertServiceSoap12" binding="tns:ConvertServiceSoap12">
<soap12:address location="http://codeconverter.sharpdevelop.net/ConvertService.asmx" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>

170
samples/CodeConverter/Source/CCClient/Web References/ICSharpCode.OnlineConverter/Reference.cs

@ -0,0 +1,170 @@ @@ -0,0 +1,170 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:2.0.50727.1433
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
//
// This source code was auto-generated by Microsoft.VSDesigner, Version 2.0.50727.1433.
//
#pragma warning disable 1591
namespace CodeConvertServiceClient.ICSharpCode.OnlineConverter {
using System.Diagnostics;
using System.Web.Services;
using System.ComponentModel;
using System.Web.Services.Protocols;
using System;
using System.Xml.Serialization;
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "2.0.50727.1433")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Web.Services.WebServiceBindingAttribute(Name="ConvertServiceSoap", Namespace="http://developer.sharpdevelop.net/CodeConverter.NET/")]
public partial class ConvertService : System.Web.Services.Protocols.SoapHttpClientProtocol {
private System.Threading.SendOrPostCallback PerformConversionOperationCompleted;
private bool useDefaultCredentialsSetExplicitly;
/// <remarks/>
public ConvertService() {
this.Url = global::CodeConvertServiceClient.Properties.Settings.Default.CodeConvertServiceClient_ICSharpCode_OnlineConverter_ConvertService;
if ((this.IsLocalFileSystemWebService(this.Url) == true)) {
this.UseDefaultCredentials = true;
this.useDefaultCredentialsSetExplicitly = false;
}
else {
this.useDefaultCredentialsSetExplicitly = true;
}
}
public new string Url {
get {
return base.Url;
}
set {
if ((((this.IsLocalFileSystemWebService(base.Url) == true)
&& (this.useDefaultCredentialsSetExplicitly == false))
&& (this.IsLocalFileSystemWebService(value) == false))) {
base.UseDefaultCredentials = false;
}
base.Url = value;
}
}
public new bool UseDefaultCredentials {
get {
return base.UseDefaultCredentials;
}
set {
base.UseDefaultCredentials = value;
this.useDefaultCredentialsSetExplicitly = true;
}
}
/// <remarks/>
public event PerformConversionCompletedEventHandler PerformConversionCompleted;
/// <remarks/>
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://developer.sharpdevelop.net/CodeConverter.NET/PerformConversion", RequestNamespace="http://developer.sharpdevelop.net/CodeConverter.NET/", ResponseNamespace="http://developer.sharpdevelop.net/CodeConverter.NET/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public bool PerformConversion(string TypeOfConversion, string SourceCode, out string ConvertedCode, out string ErrorMessage) {
object[] results = this.Invoke("PerformConversion", new object[] {
TypeOfConversion,
SourceCode});
ConvertedCode = ((string)(results[1]));
ErrorMessage = ((string)(results[2]));
return ((bool)(results[0]));
}
/// <remarks/>
public void PerformConversionAsync(string TypeOfConversion, string SourceCode) {
this.PerformConversionAsync(TypeOfConversion, SourceCode, null);
}
/// <remarks/>
public void PerformConversionAsync(string TypeOfConversion, string SourceCode, object userState) {
if ((this.PerformConversionOperationCompleted == null)) {
this.PerformConversionOperationCompleted = new System.Threading.SendOrPostCallback(this.OnPerformConversionOperationCompleted);
}
this.InvokeAsync("PerformConversion", new object[] {
TypeOfConversion,
SourceCode}, this.PerformConversionOperationCompleted, userState);
}
private void OnPerformConversionOperationCompleted(object arg) {
if ((this.PerformConversionCompleted != null)) {
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
this.PerformConversionCompleted(this, new PerformConversionCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
}
}
/// <remarks/>
public new void CancelAsync(object userState) {
base.CancelAsync(userState);
}
private bool IsLocalFileSystemWebService(string url) {
if (((url == null)
|| (url == string.Empty))) {
return false;
}
System.Uri wsUri = new System.Uri(url);
if (((wsUri.Port >= 1024)
&& (string.Compare(wsUri.Host, "localHost", System.StringComparison.OrdinalIgnoreCase) == 0))) {
return true;
}
return false;
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "2.0.50727.1433")]
public delegate void PerformConversionCompletedEventHandler(object sender, PerformConversionCompletedEventArgs e);
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "2.0.50727.1433")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class PerformConversionCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
private object[] results;
internal PerformConversionCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
base(exception, cancelled, userState) {
this.results = results;
}
/// <remarks/>
public bool Result {
get {
this.RaiseExceptionIfNecessary();
return ((bool)(this.results[0]));
}
}
/// <remarks/>
public string ConvertedCode {
get {
this.RaiseExceptionIfNecessary();
return ((string)(this.results[1]));
}
}
/// <remarks/>
public string ErrorMessage {
get {
this.RaiseExceptionIfNecessary();
return ((string)(this.results[2]));
}
}
}
}
#pragma warning restore 1591

6
samples/CodeConverter/Source/CCClient/Web References/ICSharpCode.OnlineConverter/Reference.map

@ -0,0 +1,6 @@ @@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<DiscoveryClientResultsFile xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Results>
<DiscoveryClientResult referenceType="System.Web.Services.Discovery.ContractReference" url="http://codeconverter.sharpdevelop.net/ConvertService.asmx?WSDL" filename="ConvertService.wsdl" />
</Results>
</DiscoveryClientResultsFile>

16
samples/CodeConverter/Source/CCClient/app.config

@ -0,0 +1,16 @@ @@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="CodeConvertServiceClient.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</sectionGroup>
</configSections>
<applicationSettings>
<CodeConvertServiceClient.Properties.Settings>
<setting name="CodeConvertServiceClient_ICSharpCode_OnlineConverter_ConvertService"
serializeAs="String">
<value>http://codeconverter.sharpdevelop.net/ConvertService.asmx</value>
</setting>
</CodeConvertServiceClient.Properties.Settings>
</applicationSettings>
</configuration>

31
samples/CodeConverter/Source/CCSite/About.aspx

@ -0,0 +1,31 @@ @@ -0,0 +1,31 @@
<%@ Page Language="C#" MasterPageFile="~/ProzacAfternoon.master"
AutoEventWireup="true" CodeBehind="About.aspx.cs"
Inherits="CCSite.About" Title="About" %>
<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" Runat="Server">
<div class="news_right clearfix" id="news">
<div class="news_cnr_top"><img src="images/cnr_tl.gif" alt="corner" width="8" height="8" class="cnr" style="display: none" /></div>
<p><span class="news_title">Images and Layout</span><br />
The design used for this site originates from <a href="http://www.oswd.org/">Open Source Web Design</a>,
and we decided to use the <a href="http://www.oswd.org/design/preview/id/2381">prozac afternoon</a> layout.
</p>
<p>
We changed the top photo, and went with one from <a href="http://www.photocase.de/">PhotoCase.de</a>.
The bridge metaphor is intended to symbolize a code conversion.
</p>
<div class="news_cnr_bottom"><img src="images/cnr_bl.gif" alt="corner" width="8" height="8" class="cnr" style="display: none" /></div>
</div>
<p class="page_title">Version Information</p>
<p>The online code conversion facility is currently using version
<asp:Label ID="VersionLabel" runat="server" Text="Label"></asp:Label>
of the <a href="http://laputa.sharpdevelop.net/NRefactoryTutorialVideo.aspx">NRefactory</a>
parser layer of <a href="http://www.icsharpcode.net/opensource/sd/">SharpDevelop</a>.
</p>
<p class="page_title">Who is Providing This Service?</p>
<p>This Web site is operated by the SharpDevelop team to gather as much feedback on our
code conversion feature as possible.
</p>
</asp:Content>

21
samples/CodeConverter/Source/CCSite/About.aspx.cs

@ -0,0 +1,21 @@ @@ -0,0 +1,21 @@
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
namespace CCSite
{
public partial class About : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
VersionLabel.Text = ICSharpCode.CodeConversion.HelperFunctions.GetNRefactoryVersion();
}
}
}

31
samples/CodeConverter/Source/CCSite/About.aspx.designer.cs generated

@ -0,0 +1,31 @@ @@ -0,0 +1,31 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:2.0.50727.312
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace CCSite {
/// <summary>
/// About class.
/// </summary>
/// <remarks>
/// Auto-generated class.
/// </remarks>
public partial class About {
/// <summary>
/// VersionLabel control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Label VersionLabel;
}
}

214
samples/CodeConverter/Source/CCSite/CCSite.csproj

@ -0,0 +1,214 @@ @@ -0,0 +1,214 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>9.0.21022</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{6597D0F8-916A-45EB-98D1-831064914B77}</ProjectGuid>
<ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>CCSite</RootNamespace>
<AssemblyName>CCSite</AssemblyName>
<FileUpgradeFlags>
</FileUpgradeFlags>
<OldToolsVersion>2.0</OldToolsVersion>
<UpgradeBackupLocation>
</UpgradeBackupLocation>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="ICSharpCode.TextEditor, Version=2.1.0.2520, Culture=neutral, PublicKeyToken=4d61825e8dd49f1a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\Dependencies\ICSharpCode.TextEditor.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Data" />
<Reference Include="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Drawing" />
<Reference Include="System.Web" />
<Reference Include="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Web.Extensions.Design, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Xml" />
<Reference Include="System.Configuration" />
<Reference Include="System.Web.Services" />
<Reference Include="System.EnterpriseServices" />
<Reference Include="System.Web.Mobile" />
<Reference Include="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="About.aspx.cs">
<SubType>ASPXCodeBehind</SubType>
<DependentUpon>About.aspx</DependentUpon>
</Compile>
<Compile Include="About.aspx.designer.cs">
<DependentUpon>About.aspx</DependentUpon>
</Compile>
<Compile Include="CodeFormatClient.aspx.cs">
<SubType>ASPXCodeBehind</SubType>
<DependentUpon>CodeFormatClient.aspx</DependentUpon>
</Compile>
<Compile Include="CodeFormatClient.aspx.designer.cs">
<DependentUpon>CodeFormatClient.aspx</DependentUpon>
</Compile>
<Compile Include="CodeFormatService.asmx.cs">
<DependentUpon>CodeFormatService.asmx</DependentUpon>
<SubType>Component</SubType>
</Compile>
<Compile Include="Code\HtmlWriter.cs" />
<Compile Include="Convert.aspx.cs">
<DependentUpon>Convert.aspx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="Convert.aspx.designer.cs">
<DependentUpon>Convert.aspx</DependentUpon>
</Compile>
<Compile Include="ConvertCSharp20ToVbNet80.aspx.cs">
<DependentUpon>ConvertCSharp20ToVbNet80.aspx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="ConvertCSharp20ToVbNet80.aspx.designer.cs">
<DependentUpon>ConvertCSharp20ToVbNet80.aspx</DependentUpon>
</Compile>
<Compile Include="ConvertService.cs">
<DependentUpon>ConvertService.asmx</DependentUpon>
<SubType>Component</SubType>
</Compile>
<Compile Include="DotNetClientApplication.aspx.cs">
<SubType>ASPXCodeBehind</SubType>
<DependentUpon>DotNetClientApplication.aspx</DependentUpon>
</Compile>
<Compile Include="DotNetClientApplication.aspx.designer.cs">
<DependentUpon>DotNetClientApplication.aspx</DependentUpon>
</Compile>
<Compile Include="FormatCode.aspx.cs">
<SubType>ASPXCodeBehind</SubType>
<DependentUpon>FormatCode.aspx</DependentUpon>
</Compile>
<Compile Include="FormatCode.aspx.designer.cs">
<DependentUpon>FormatCode.aspx</DependentUpon>
</Compile>
<Compile Include="SnippetConverter.aspx.cs">
<DependentUpon>SnippetConverter.aspx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="SnippetConverter.aspx.designer.cs">
<DependentUpon>SnippetConverter.aspx</DependentUpon>
</Compile>
<Compile Include="Default.aspx.cs">
<DependentUpon>Default.aspx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="Default.aspx.designer.cs">
<DependentUpon>Default.aspx</DependentUpon>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="ProzacAfternoon.master.cs">
<DependentUpon>ProzacAfternoon.master</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="ProzacAfternoon.master.designer.cs">
<DependentUpon>ProzacAfternoon.master</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<Content Include="ProzacAfternoon.master" />
<Content Include="Web.Config" />
</ItemGroup>
<ItemGroup>
<Content Include="About.aspx" />
<Content Include="screenshots\CodeConverterClient.png">
</Content>
<Content Include="Convert.aspx" />
<Content Include="ConvertCSharp20ToVbNet80.aspx" />
<Content Include="ConvertService.asmx" />
<Content Include="DotNetClientApplication.aspx" />
<Content Include="SnippetConverter.aspx" />
<Content Include="Default.aspx" />
<Content Include="default.css" />
<Content Include="images\bg.gif" />
<Content Include="images\cnr_bl.gif" />
<Content Include="images\cnr_br.gif" />
<Content Include="images\cnr_tl.gif" />
<Content Include="images\cnr_tr.gif" />
<Content Include="images\header.jpg" />
<Content Include="images\sample.jpg" />
<Content Include="images\topnav_bg.gif" />
<Content Include="images\topnav_bg_grey.gif" />
</ItemGroup>
<ItemGroup>
<Content Include="downloads\CodeConvertServiceClient.zip">
</Content>
<Content Include="downloads\CodeConvertServiceClient_Source.zip">
</Content>
<Content Include="CodeFormatService.asmx" />
<Content Include="FormatCode.aspx" />
<Content Include="screenshots\FormatCode_Preview.png" />
<Content Include="screenshots\FormatCode_Source.png" />
<Content Include="screenshots\FormatCode_Html.png" />
</ItemGroup>
<ItemGroup>
<Content Include="CodeFormatClient.aspx" />
<Content Include="downloads\CodeFormatServiceClient.zip" />
<Content Include="downloads\CodeFormatServiceClient_Source.zip" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\ICSharpCode.CodeConversion\ICSharpCode.CodeConversion.csproj">
<Project>{BF122CB4-E896-40CA-BF0A-AB44906AB87D}</Project>
<Name>ICSharpCode.CodeConversion</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v9.0\WebApplications\Microsoft.WebApplication.targets" Condition="" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
<ProjectExtensions>
<VisualStudio>
<FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
<WebProjectProperties>
<UseIIS>False</UseIIS>
<AutoAssignPort>True</AutoAssignPort>
<DevelopmentServerPort>54633</DevelopmentServerPort>
<DevelopmentServerVPath>/</DevelopmentServerVPath>
<IISUrl>
</IISUrl>
<NTLMAuthentication>False</NTLMAuthentication>
<SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile>
</WebProjectProperties>
</FlavorProperties>
</VisualStudio>
</ProjectExtensions>
</Project>

266
samples/CodeConverter/Source/CCSite/Code/HtmlWriter.cs

@ -0,0 +1,266 @@ @@ -0,0 +1,266 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <author name="Daniel Grunwald"/>
// <version>$Revision: 2522 $</version>
// </file>
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Xml;
using ICSharpCode.TextEditor;
using ICSharpCode.TextEditor.Document;
namespace ICSharpCode.HtmlSyntaxColorizer
{
public class HtmlWriter
{
public bool AlternateLineBackground;
public bool ShowLineNumbers;
public string MainStyle = "font-size: small; font-family: Consolas, \"Courier New\", Courier, Monospace;";
public string LineStyle = "margin: 0em;";
public string AlternateLineStyle = "margin: 0em; width: 100%; background-color: #f0f0f0;";
#region Stylesheet cache
/// <summary>
/// Specifies whether a CSS stylesheet should be created to reduce the size of the created code.
/// The default value is true.
/// </summary>
public bool CreateStylesheet = true;
/// <summary>
/// Specifies the prefix to use in front of generate style class names.
/// </summary>
public string StyleClassPrefix = "code";
Dictionary<string, string> stylesheetCache = new Dictionary<string, string>();
/// <summary>
/// Resets the CSS stylesheet cache. Stylesheet classes will be cached on GenerateHtml calls.
/// If you want to reuse the HtmlWriter for multiple
/// </summary>
public void ResetStylesheetCache()
{
stylesheetCache.Clear();
}
string GetClass(string style)
{
return stylesheetCache[style];
}
void CacheClass(string style, StringBuilder b)
{
if (style == null) return;
if (!stylesheetCache.ContainsKey(style))
{
string styleName = StyleClassPrefix + stylesheetCache.Count;
stylesheetCache[style] = styleName;
b.Append('.');
b.Append(styleName);
b.Append(" { ");
b.Append(style);
b.AppendLine(" }");
}
}
#endregion
public string GenerateHtml(string code, string highlighterName)
{
IDocument doc = new DocumentFactory().CreateDocument();
doc.HighlightingStrategy = HighlightingManager.Manager.FindHighlighter(highlighterName);
doc.TextContent = code;
return GenerateHtml(doc);
}
HighlightColor currentDefaultTextColor;
public string GenerateHtml(IDocument document)
{
string myMainStyle = MainStyle;
currentDefaultTextColor = document.HighlightingStrategy.GetColorFor("Default");
myMainStyle += " color: " + ColorToString(currentDefaultTextColor.Color) + ";"
+ " background-color: " + ColorToString(currentDefaultTextColor.BackgroundColor) + ";";
string LineNumberStyle;
HighlightColor lineNumbersColor = document.HighlightingStrategy.GetColorFor("LineNumbers");
if (lineNumbersColor != null)
{
LineNumberStyle = "color: " + ColorToString(lineNumbersColor.Color) + ";"
+ " background-color: " + ColorToString(lineNumbersColor.BackgroundColor) + ";";
}
else
{
LineNumberStyle = "color: #606060;";
}
StringBuilder b = new StringBuilder();
if (CreateStylesheet)
{
b.AppendLine("<style type=\"text/css\">");
if (ShowLineNumbers || AlternateLineBackground)
{
CacheClass(myMainStyle, b);
CacheClass(LineStyle, b);
}
else
{
CacheClass(myMainStyle + LineStyle, b);
}
if (AlternateLineBackground) CacheClass(AlternateLineStyle, b);
if (ShowLineNumbers) CacheClass(LineNumberStyle, b);
foreach (LineSegment ls in document.LineSegmentCollection)
{
foreach (TextWord word in ls.Words)
{
CacheClass(GetStyle(word), b);
}
}
b.AppendLine("</style>");
}
if (ShowLineNumbers || AlternateLineBackground)
{
b.Append("<div");
WriteStyle(myMainStyle, b);
b.AppendLine(">");
int longestNumberLength = 1 + (int)Math.Log10(document.TotalNumberOfLines);
int lineNumber = 1;
foreach (LineSegment lineSegment in document.LineSegmentCollection)
{
b.Append("<pre");
if (AlternateLineBackground && (lineNumber % 2) == 0)
{
WriteStyle(AlternateLineStyle, b);
}
else
{
WriteStyle(LineStyle, b);
}
b.Append(">");
if (ShowLineNumbers)
{
b.Append("<span");
WriteStyle(LineNumberStyle, b);
b.Append('>');
b.Append(lineNumber.ToString().PadLeft(longestNumberLength));
b.Append(": ");
b.Append("</span>");
}
if (lineSegment.Words.Count == 0)
{
b.Append("&nbsp;");
}
else
{
PrintWords(lineSegment, b);
}
b.AppendLine("</pre>");
lineNumber++;
}
b.AppendLine("</div>");
}
else
{
b.Append("<pre");
WriteStyle(myMainStyle + LineStyle, b);
b.AppendLine(">");
foreach (LineSegment lineSegment in document.LineSegmentCollection)
{
PrintWords(lineSegment, b);
b.AppendLine();
}
b.AppendLine("</pre>");
}
return b.ToString();
}
void PrintWords(LineSegment lineSegment, StringBuilder b)
{
string currentSpan = null;
foreach (TextWord word in lineSegment.Words)
{
if (word.Type == TextWordType.Space)
{
b.Append(' ');
}
else if (word.Type == TextWordType.Tab)
{
b.Append('\t');
}
else
{
string newSpan = GetStyle(word);
if (currentSpan != newSpan)
{
if (currentSpan != null) b.Append("</span>");
if (newSpan != null)
{
b.Append("<span");
WriteStyle(newSpan, b);
b.Append('>');
}
currentSpan = newSpan;
}
b.Append(HtmlEncode(word.Word));
}
}
if (currentSpan != null) b.Append("</span>");
}
static string HtmlEncode(string word)
{
return word.Replace("&", "&amp;").Replace("<", "&lt;").Replace(">", "&gt;");
}
void WriteStyle(string style, StringBuilder b)
{
if (CreateStylesheet)
{
b.Append(" class=\"");
b.Append(GetClass(style));
b.Append('"');
}
else
{
b.Append(" style='");
b.Append(style);
b.Append("'");
}
}
string GetStyle(TextWord word)
{
if (word.SyntaxColor == null || word.SyntaxColor.ToString() == currentDefaultTextColor.ToString())
return null;
string style = "color: " + ColorToString(word.Color) + ";";
if (word.Bold)
{
style += " font-weight: bold;";
}
if (word.Italic)
{
style += " font-style: italic;";
}
if (word.SyntaxColor.HasBackground)
{
style += " background-color: " + ColorToString(word.SyntaxColor.BackgroundColor) + ";";
}
return style;
}
static string ColorToString(System.Drawing.Color color)
{
return "#" + color.R.ToString("x2") + color.G.ToString("x2") + color.B.ToString("x2");
}
}
}

28
samples/CodeConverter/Source/CCSite/CodeFormatClient.aspx

@ -0,0 +1,28 @@ @@ -0,0 +1,28 @@
<%@ Page Language="C#" MasterPageFile="~/ProzacAfternoon.master"
AutoEventWireup="true" CodeBehind="CodeFormatClient.aspx.cs"
Inherits="CCSite.CodeFormatClient" Title="Windows Forms Client Demo Application for Code Formatting" %>
<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
<p class="page_title">Code Formatting Client</p>
<p>
This is a demo of how to use the Code Formatting Web Service - implemented as a Windows Forms application.
Source code is included.
</p>
<p>
<img src="/screenshots/FormatCode_Source.png" width="759" height="495" alt="Providing Input" />
</p>
<p>
<img src="/screenshots/FormatCode_Preview.png" width="759" height="495" alt="The generated HTML is rendered as a preview" />
</p>
<p>
<img src="/screenshots/FormatCode_Html.png" width="759" height="495" alt="Copy the HTML to your Web site / application" />
</p>
<p class="page_title">Downloads</p>
<ul>
<li><a href="/downloads/CodeFormatServiceClient.zip">Application</a></li>
<li><a href="/downloads/CodeFormatServiceClient_Source.zip">Source Code</a> (C#)</li>
</ul>
</asp:Content>

21
samples/CodeConverter/Source/CCSite/CodeFormatClient.aspx.cs

@ -0,0 +1,21 @@ @@ -0,0 +1,21 @@
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
namespace CCSite
{
public partial class CodeFormatClient : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
}
}

16
samples/CodeConverter/Source/CCSite/CodeFormatClient.aspx.designer.cs generated

@ -0,0 +1,16 @@ @@ -0,0 +1,16 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:2.0.50727.1433
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace CCSite {
public partial class CodeFormatClient {
}
}

1
samples/CodeConverter/Source/CCSite/CodeFormatService.asmx

@ -0,0 +1 @@ @@ -0,0 +1 @@
<%@ WebService Language="C#" CodeBehind="CodeFormatService.asmx.cs" Class="CCSite.CodeFormatService" %>

49
samples/CodeConverter/Source/CCSite/CodeFormatService.asmx.cs

@ -0,0 +1,49 @@ @@ -0,0 +1,49 @@
using System;
using System.Data;
using System.Web;
using System.Collections;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.ComponentModel;
using ICSharpCode.HtmlSyntaxColorizer;
using ICSharpCode.TextEditor.Document;
namespace CCSite
{
/// <summary>
/// Summary description for CodeFormatService
/// </summary>
[WebService(Namespace = "http://codeconverter.sharpdevelop.net/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[ToolboxItem(false)]
public class CodeFormatService : System.Web.Services.WebService
{
[WebMethod]
public string Format(string Document, string HighlighterName, bool IncludeLineNumbers)
{
HtmlWriter writer = new HtmlWriter();
writer.ShowLineNumbers = IncludeLineNumbers;
writer.AlternateLineBackground = false;
string generatedHtml = writer.GenerateHtml(Document, HighlighterName);
return "<html><body>" + generatedHtml + "</body></html>";
}
[WebMethod]
public string[] RetrieveAvailableHighlighters()
{
Hashtable ht = HighlightingManager.Manager.HighlightingDefinitions;
string[] highlighters = new string[ht.Count];
int currentElement = 0;
foreach (DictionaryEntry de in ht)
{
highlighters[currentElement++] = de.Key.ToString();
}
return highlighters;
}
}
}

10
samples/CodeConverter/Source/CCSite/Convert.aspx

@ -0,0 +1,10 @@ @@ -0,0 +1,10 @@
<%@ Page Language="C#" MasterPageFile="~/ProzacAfternoon.master" AutoEventWireup="true"
Inherits="ConvertPage"
Title="Online Code Converter for .NET 2.0"
ValidateRequest="false" Codebehind="Convert.aspx.cs" %>
<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="Server">
NO LONGER IN USE
</asp:Content>

21
samples/CodeConverter/Source/CCSite/Convert.aspx.cs

@ -0,0 +1,21 @@ @@ -0,0 +1,21 @@
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using ICSharpCode.CodeConversion;
public partial class ConvertPage : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Response.Redirect("/SnippetConverter.aspx");
Response.End();
}
}

14
samples/CodeConverter/Source/CCSite/Convert.aspx.designer.cs generated

@ -0,0 +1,14 @@ @@ -0,0 +1,14 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:2.0.50727.1433
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
public partial class ConvertPage {
}

16
samples/CodeConverter/Source/CCSite/ConvertCSharp20ToVbNet80.aspx

@ -0,0 +1,16 @@ @@ -0,0 +1,16 @@
<%@ Page Language="C#" AutoEventWireup="true"
Inherits="ConvertCSharp20ToVbNet80"
ValidateRequest="false" Codebehind="ConvertCSharp20ToVbNet80.aspx.cs" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Convert C# 2.0 Code to VB.NET 8.0</title>
</head>
<body>
NO LONGER USED
</body>
</html>

19
samples/CodeConverter/Source/CCSite/ConvertCSharp20ToVbNet80.aspx.cs

@ -0,0 +1,19 @@ @@ -0,0 +1,19 @@
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class ConvertCSharp20ToVbNet80 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
// THIS PAGE IS NO LONGER USED
Response.Redirect("Default.aspx", true);
}
}

14
samples/CodeConverter/Source/CCSite/ConvertCSharp20ToVbNet80.aspx.designer.cs generated

@ -0,0 +1,14 @@ @@ -0,0 +1,14 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:2.0.50727.1433
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
public partial class ConvertCSharp20ToVbNet80 {
}

1
samples/CodeConverter/Source/CCSite/ConvertService.asmx

@ -0,0 +1 @@ @@ -0,0 +1 @@
<%@ WebService Language="C#" CodeBehind="ConvertService.cs" Class="ConvertService" %>

86
samples/CodeConverter/Source/CCSite/ConvertService.cs

@ -0,0 +1,86 @@ @@ -0,0 +1,86 @@
using System;
using System.Web;
using System.Collections;
using System.Web.Services;
using System.Web.Services.Protocols;
using ICSharpCode.CodeConversion;
/// <summary>
/// Summary description for ConvertService
/// </summary>
[WebService(Namespace = "http://developer.sharpdevelop.net/CodeConverter.NET/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class ConvertService : System.Web.Services.WebService {
public ConvertService () {
//Uncomment the following line if using designed components
//InitializeComponent();
}
[WebMethod]
public bool PerformConversion(string TypeOfConversion, string SourceCode, out string ConvertedCode, out string ErrorMessage)
{
return ConvertSnippet(TypeOfConversion, SourceCode, out ConvertedCode, out ErrorMessage);
}
// a simple wrapper to streamline method names
[WebMethod]
public bool Convert(string TypeOfConversion, string SourceCode, out string ConvertedCode, out string ErrorMessage)
{
return ConvertSnippet(TypeOfConversion, SourceCode, out ConvertedCode, out ErrorMessage);
}
[WebMethod]
public bool ConvertSnippet(string TypeOfConversion, string SourceCode, out string ConvertedCode, out string ErrorMessage)
{
ErrorMessage = ConvertedCode = "";
string convertedSource = "", errorMessage = "";
bool bSuccessfulConversion = false;
IConvertCode currentConverter = null;
switch (TypeOfConversion)
{
case "cs2boo":
currentConverter = new ConvertCSharpToBoo();
break;
case "vbnet2boo":
currentConverter = new ConvertVbNetToBoo();
break;
case "cs2vbnet":
currentConverter = new ConvertCSharpSnippetToVbNet();
break;
case "vbnet2cs":
currentConverter = new ConvertVbNetSnippetToCSharp();
break;
default:
return false;
}
try
{
bSuccessfulConversion = currentConverter.Convert(SourceCode,
out convertedSource,
out errorMessage);
}
catch (Exception ex)
{
bSuccessfulConversion = false;
errorMessage = "Exception occured: " + ex.ToString() + "\r\n\r\nError Message:" + errorMessage;
}
if (bSuccessfulConversion)
{
ConvertedCode = convertedSource;
}
else
{
ErrorMessage = errorMessage;
}
return bSuccessfulConversion;
}
}

56
samples/CodeConverter/Source/CCSite/Default.aspx

@ -0,0 +1,56 @@ @@ -0,0 +1,56 @@
<%@ Page Language="C#" MasterPageFile="~/ProzacAfternoon.master"
AutoEventWireup="true"
Inherits="_DefaultPage"
Title="About the Code Converter" Codebehind="Default.aspx.cs" %>
<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" Runat="Server">
<p class="page_title">The Code Converter</p>
<p>
Go directly to the <a href="SnippetConverter.aspx">converter</a> (supports C#, VB.NET and Boo)
</p>
<p class="page_title">The Code Formatter</p>
<p>
Go directly to the <a href="FormatCode.aspx">Code Formatter</a> (supports ASP/XHTML, BAT, Boo, Coco, C++.NET, C#,
HTML, Java, JavaScript, Patch, PHP, TeX, VBNET, XML)
</p>
<p>
The code formatting capability is also exposed as a Web service. A <a href="CodeFormatClient.aspx">sample client application</a> is available
for download. Please note: SharpDevelop ships with \Samples\HtmlSyntaxColorizer on which this Web service is built upon.
</p>
<p class="page_title">Code Conversion as a Web Service</p>
<p>
If you want to use code conversion in your code, you can call the <a href="ConvertService.asmx">
Convert Service</a>. It is really simple to use: reference the service, and
you are good to go. Please use the method Convert (the others are deprecated), and the first
parameter has the following options: cs2vbnet, vbnet2cs, cs2boo, vbnet2boo. If conversion
fails, you can look at the ErrorMessage to see what went wrong. Otherwise, ConvertedSource
will contain the source code in the target language. The service is doing the exact
same steps as the <a href="SnippetConverter.aspx">online converter</a>.
</p>
<p>
A sample Windows Forms application demonstrating the usage of the service is available:
<a href="DotNetClientApplication.aspx">Windows Forms Web Service Client</a> (source included)
</p>
<p class="page_title">Technical Background</p>
<p>
The converter uses <a href="http://www.icsharpcode.net/opensource/sd/">SharpDevelop</a>'s
NRefactory to perform the conversion. For the conversion
to work properly, you have to paste a full class or source code file because we
don't do "magic" RegEx's or string replacement - our code converter uses a full
blown parser, and that's why the source code must be valid.</p>
<p>
Note that the conversion is not perfect (ie references to external references can
be guessed only), however, if you encounter a problem such as a wrongly converted
statement, please let us know - after all, the reason why we provide this online
converter is to more easily gather feedback. You can get in touch with us via the <a href="http://community.sharpdevelop.net/forums/19/ShowForum.aspx">
Bug Reporting Forum</a>. By providing us with a sample of what's not working
as expected, we can improve the converter
so you get better results the next time - as well as everyone else.
</p>
</asp:Content>

18
samples/CodeConverter/Source/CCSite/Default.aspx.cs

@ -0,0 +1,18 @@ @@ -0,0 +1,18 @@
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class _DefaultPage : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
}

14
samples/CodeConverter/Source/CCSite/Default.aspx.designer.cs generated

@ -0,0 +1,14 @@ @@ -0,0 +1,14 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:2.0.50727.1433
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
public partial class _DefaultPage {
}

21
samples/CodeConverter/Source/CCSite/DotNetClientApplication.aspx

@ -0,0 +1,21 @@ @@ -0,0 +1,21 @@
<%@ Page Language="C#" MasterPageFile="~/ProzacAfternoon.master" AutoEventWireup="true"
CodeBehind="DotNetClientApplication.aspx.cs" Inherits="CCSite.DotNetClientApplication"
Title="Windows Forms Web Service Client" %>
<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
<p class="page_title">Windows Forms Web Service Client</p>
<p>
This is a demo of how to use the Code Conversion Web Service - implemented as a Windows Forms application.
Source code is included.
</p>
<p>
<img src="/screenshots/CodeConverterClient.png" width="750" height="628" alt=".NET Client for Code Conversion Web Service" />
</p>
<p class="page_title">Downloads</p>
<ul>
<li><a href="/downloads/CodeConvertServiceClient.zip">Application</a></li>
<li><a href="/downloads/CodeConvertServiceClient_Source.zip">Source Code</a> (C#)</li>
</ul>
</asp:Content>

21
samples/CodeConverter/Source/CCSite/DotNetClientApplication.aspx.cs

@ -0,0 +1,21 @@ @@ -0,0 +1,21 @@
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
namespace CCSite
{
public partial class DotNetClientApplication : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
}
}

16
samples/CodeConverter/Source/CCSite/DotNetClientApplication.aspx.designer.cs generated

@ -0,0 +1,16 @@ @@ -0,0 +1,16 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:2.0.50727.1433
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace CCSite {
public partial class DotNetClientApplication {
}
}

39
samples/CodeConverter/Source/CCSite/FormatCode.aspx

@ -0,0 +1,39 @@ @@ -0,0 +1,39 @@
<%@ Page Language="C#" MasterPageFile="~/ProzacAfternoon.master"
AutoEventWireup="true" CodeBehind="FormatCode.aspx.cs" Inherits="CCSite.FormatCode"
ValidateRequest="false" Title="Format Code" %>
<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="Server">
<p class="page_title">Step 1: Choose source language</p>
<p>
<asp:DropDownList ID="languageChoice" runat="server">
</asp:DropDownList>
<br />
</p>
<p class="page_title">Step 2: Paste the source code you want to HTML format</p>
<p>
<asp:TextBox ID="inputTextBox" runat="server" Height="171px" TextMode="MultiLine"
Width="737px"></asp:TextBox>
<br /> (Note: We do not store the code you submit in any way!)
</p>
<p class="page_title">Step 3: Format source code</p>
<p>
<asp:CheckBox ID="ShowLineNumbers" runat="server" Text="Show line numbers " /><br />
<asp:CheckBox ID="UseAlternatingBackground" runat="server" Text="Use alternating line background" /><br />
<asp:Button ID="convertCode" runat="server" Text="Format source code" OnClick="formatCode_Click" /><br />
</p>
<p class="page_title">Step 4: Output</p>
<p>
<asp:Label ID="OutputLabel" runat="server" Text="Formatted source code" Width="741px"></asp:Label><br />
<asp:TextBox ID="outputTextBox" runat="server" Height="171px" TextMode="MultiLine"
Width="737px"></asp:TextBox>
</p>
<div style="width: 100%;" runat="server" ID="PreviewPane" visible="false">
<p class="page_title">Inline Code Preview</p>
<p>
<asp:Literal ID="inlineCodePreview" runat="server"></asp:Literal>
</p>
</div>
</asp:Content>

47
samples/CodeConverter/Source/CCSite/FormatCode.aspx.cs

@ -0,0 +1,47 @@ @@ -0,0 +1,47 @@
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using ICSharpCode.HtmlSyntaxColorizer;
using ICSharpCode.TextEditor.Document;
namespace CCSite
{
public partial class FormatCode : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (Page.IsPostBack) return;
Hashtable ht = HighlightingManager.Manager.HighlightingDefinitions;
foreach (DictionaryEntry de in ht)
{
string currentKey = de.Key.ToString();
languageChoice.Items.Add(currentKey);
}
languageChoice.Items.FindByValue("C#").Selected = true;
}
protected void formatCode_Click(object sender, EventArgs e)
{
HtmlWriter writer = new HtmlWriter();
writer.ShowLineNumbers = ShowLineNumbers.Checked;
writer.AlternateLineBackground = UseAlternatingBackground.Checked;
string generatedHtml = writer.GenerateHtml(inputTextBox.Text, languageChoice.SelectedValue);
string codeHtmlDocument = "<html><body>" + generatedHtml + "</body></html>";
outputTextBox.Text = codeHtmlDocument;
inlineCodePreview.Text = generatedHtml;
PreviewPane.Visible = true;
}
}
}

103
samples/CodeConverter/Source/CCSite/FormatCode.aspx.designer.cs generated

@ -0,0 +1,103 @@ @@ -0,0 +1,103 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:2.0.50727.312
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace CCSite {
/// <summary>
/// FormatCode class.
/// </summary>
/// <remarks>
/// Auto-generated class.
/// </remarks>
public partial class FormatCode {
/// <summary>
/// languageChoice control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.DropDownList languageChoice;
/// <summary>
/// inputTextBox control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.TextBox inputTextBox;
/// <summary>
/// ShowLineNumbers control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.CheckBox ShowLineNumbers;
/// <summary>
/// UseAlternatingBackground control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.CheckBox UseAlternatingBackground;
/// <summary>
/// convertCode control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Button convertCode;
/// <summary>
/// OutputLabel control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Label OutputLabel;
/// <summary>
/// outputTextBox control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.TextBox outputTextBox;
/// <summary>
/// PreviewPane control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlGenericControl PreviewPane;
/// <summary>
/// inlineCodePreview control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Literal inlineCodePreview;
}
}

35
samples/CodeConverter/Source/CCSite/Properties/AssemblyInfo.cs

@ -0,0 +1,35 @@ @@ -0,0 +1,35 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("CCSite")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("CCSite")]
[assembly: AssemblyCopyright("Copyright © 2007")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("3d5900ae-111a-45be-96b3-d9e4606ca793")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

32
samples/CodeConverter/Source/CCSite/ProzacAfternoon.master

@ -0,0 +1,32 @@ @@ -0,0 +1,32 @@
<%@ Master Language="C#" AutoEventWireup="true" Inherits="ProzacAfternoon" Codebehind="ProzacAfternoon.master.cs" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
<link rel="stylesheet" type="text/css" href="default.css" media="screen" />
</head>
<body>
<form id="form1" runat="server">
<div class="wrap clearfix">
<div class="header"><strong>code converter</strong> by SharpDevelop</div>
<div class="topnav" id="nav">
<ul>
<li><a href="Default.aspx">home</a></li>
<li><a href="SnippetConverter.aspx">convert</a></li>
<li><a href="http://community.sharpdevelop.net/forums/">forums</a></li>
<li><a href="http://www.icsharpcode.net/opensource/sd/download/">download</a></li>
<li><a href="http://wiki.sharpdevelop.net/">wiki</a></li>
<li><a href="About.aspx">about</a></li>
</ul>
</div>
<div class="container clearfix">
<asp:contentplaceholder id="MainContent" runat="server">
</asp:contentplaceholder>
</div>
<div class="footer" id="footer"> <a href="Default.aspx">home</a>&nbsp;&nbsp;:&nbsp;&nbsp; <a href="SnippetConverter.aspx">convert</a>&nbsp;&nbsp;:&nbsp;&nbsp; <a href="http://community.sharpdevelop.net/forums/">forums</a>&nbsp;&nbsp;:&nbsp;&nbsp; <a href="http://www.icsharpcode.net/opensource/sd/download/">download</a>&nbsp;&nbsp;:&nbsp;&nbsp; <a href="http://wiki.sharpdevelop.net/">wiki</a>&nbsp;&nbsp;:&nbsp;&nbsp; <a href="About.aspx">about</a> </div>
</div>
</form>
</body>
</html>

18
samples/CodeConverter/Source/CCSite/ProzacAfternoon.master.cs

@ -0,0 +1,18 @@ @@ -0,0 +1,18 @@
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class ProzacAfternoon : System.Web.UI.MasterPage
{
protected void Page_Load(object sender, EventArgs e)
{
}
}

32
samples/CodeConverter/Source/CCSite/ProzacAfternoon.master.designer.cs generated

@ -0,0 +1,32 @@ @@ -0,0 +1,32 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:2.0.50727.1433
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
public partial class ProzacAfternoon {
/// <summary>
/// form1 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlForm form1;
/// <summary>
/// MainContent control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.ContentPlaceHolder MainContent;
}

42
samples/CodeConverter/Source/CCSite/SnippetConverter.aspx

@ -0,0 +1,42 @@ @@ -0,0 +1,42 @@
<%@ Page Language="C#" MasterPageFile="~/ProzacAfternoon.master" AutoEventWireup="true"
Inherits="SnippetConverterPage"
Title="Snippet Converter for .NET 2.0"
ValidateRequest="false" Codebehind="SnippetConverter.aspx.cs" %>
<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="Server">
<p class="page_title">Step 1: Choose source language and destination language for conversion</p>
<p>
<asp:RadioButtonList ID="languageChoice" runat="server" RepeatColumns="2">
<asp:ListItem Selected="True" Value="cs2vbnet">C# to VB.NET</asp:ListItem>
<asp:ListItem Value="vbnet2cs">VB.NET to C#</asp:ListItem>
<asp:ListItem Value="cs2boo">C# to Boo</asp:ListItem>
<asp:ListItem Value="vbnet2boo">VB.NET to Boo</asp:ListItem>
</asp:RadioButtonList>
<br />
</p>
<p class="page_title">Step 2: Paste the source code snippet you want to convert</p>
<p>
<asp:TextBox ID="inputTextBox" runat="server" Height="171px" TextMode="MultiLine"
Width="737px"></asp:TextBox>
<br /> (Note: We do not store the code you submit in any way!)
</p>
<p class="page_title">Step 3: Perform the actual conversion</p>
<p>
<asp:Button ID="convertCode" runat="server" Text="Perform conversion" OnClick="convertCode_Click" /><br />
</p>
<p class="page_title">Step 4: Output</p>
<p>
<asp:Label ID="OutputLabel" runat="server" Text="Converted Sourcecode" Width="741px"></asp:Label><br />
<asp:TextBox ID="outputTextBox" runat="server" Height="171px" TextMode="MultiLine"
Width="737px"></asp:TextBox>
</p>
<p class="page_title">IMPORTANT: Please help us improve!</p>
<p>
If you encounter a problem such as a wrongly converted statement (<a href="default.aspx">read about conversion limitations first</a>), please let us know via the
<a href="http://community.sharpdevelop.net/forums/19/ShowForum.aspx">Bug Reporting Forum</a>.
By providing us with a sample of what's not working as expected, we can improve the converter.
</p>
</asp:Content>

66
samples/CodeConverter/Source/CCSite/SnippetConverter.aspx.cs

@ -0,0 +1,66 @@ @@ -0,0 +1,66 @@
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using ICSharpCode.CodeConversion;
public partial class SnippetConverterPage : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void convertCode_Click(object sender, EventArgs e)
{
string convertedSource = "", errorMessage = "";
bool bSuccessfulConversion = false;
IConvertCode currentConverter = null;
try
{
switch (languageChoice.SelectedValue)
{
case "cs2boo":
currentConverter = new ConvertCSharpToBoo();
break;
case "vbnet2boo":
currentConverter = new ConvertVbNetToBoo();
break;
case "cs2vbnet":
currentConverter = new ConvertCSharpSnippetToVbNet();
break;
case "vbnet2cs":
currentConverter = new ConvertVbNetSnippetToCSharp();
break;
}
bSuccessfulConversion = currentConverter.Convert(inputTextBox.Text,
out convertedSource,
out errorMessage);
}
catch (Exception ex)
{
OutputLabel.Text = "Exception occured, please report in the bug reporting forum";
outputTextBox.Text = ex.ToString();
return;
}
if (bSuccessfulConversion)
{
OutputLabel.Text = "Converted Sourcecode";
outputTextBox.Text = convertedSource;
}
else
{
OutputLabel.Text = "Conversion error, reason:";
outputTextBox.Text = errorMessage;
}
}
}

59
samples/CodeConverter/Source/CCSite/SnippetConverter.aspx.designer.cs generated

@ -0,0 +1,59 @@ @@ -0,0 +1,59 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:2.0.50727.1433
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
public partial class SnippetConverterPage {
/// <summary>
/// languageChoice control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.RadioButtonList languageChoice;
/// <summary>
/// inputTextBox control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.TextBox inputTextBox;
/// <summary>
/// convertCode control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Button convertCode;
/// <summary>
/// OutputLabel control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Label OutputLabel;
/// <summary>
/// outputTextBox control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.TextBox outputTextBox;
}

88
samples/CodeConverter/Source/CCSite/Web.Config

@ -0,0 +1,88 @@ @@ -0,0 +1,88 @@
<?xml version="1.0"?>
<!--
Note: As an alternative to hand editing this file you can use the
web admin tool to configure settings for your application. Use
the Website->Asp.Net Configuration option in Visual Studio.
A full list of settings and comments can be found in
machine.config.comments usually located in
\Windows\Microsoft.Net\Framework\v2.x\Config
-->
<configuration>
<configSections>
<sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
<sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="Everywhere"/>
<section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
<section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
<section name="roleService" type="System.Web.Configuration.ScriptingRoleServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/></sectionGroup></sectionGroup></sectionGroup></configSections><appSettings/>
<connectionStrings/>
<system.web>
<!--
Set compilation debug="true" to insert debugging
symbols into the compiled page. Because this
affects performance, set this value to true only
during development.
-->
<compilation debug="true">
<assemblies>
<add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/></assemblies></compilation>
<!--
The <authentication> section enables configuration
of the security authentication mode used by
ASP.NET to identify an incoming user.
-->
<authentication mode="Windows"/>
<!--
The <customErrors> section enables configuration
of what to do if/when an unhandled error occurs
during the execution of a request. Specifically,
it enables developers to configure html error pages
to be displayed in place of a error stack trace.
<customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
<error statusCode="403" redirect="NoAccess.htm" />
<error statusCode="404" redirect="FileNotFound.htm" />
</customErrors>
-->
<pages>
<controls>
<add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/></controls></pages>
<httpHandlers>
<remove verb="*" path="*.asmx"/>
<add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add verb="GET,HEAD" path="ScriptResource.axd" validate="false" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/></httpHandlers>
<httpModules>
<add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/></httpModules></system.web>
<system.codedom>
<compilers>
<compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CSharp.CSharpCodeProvider,System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" warningLevel="4">
<providerOption name="CompilerVersion" value="v3.5"/>
<providerOption name="WarnAsError" value="false"/></compiler></compilers></system.codedom>
<system.webServer>
<validation validateIntegratedModeConfiguration="false"/>
<modules>
<remove name="ScriptModule"/>
<add name="ScriptModule" preCondition="managedHandler" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/></modules>
<handlers>
<remove name="WebServiceHandlerFactory-Integrated"/>
<remove name="ScriptHandlerFactory"/>
<remove name="ScriptHandlerFactoryAppServices"/>
<remove name="ScriptResource"/>
<add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add name="ScriptResource" verb="GET,HEAD" path="ScriptResource.axd" preCondition="integratedMode" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/></handlers></system.webServer>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Web.Extensions" publicKeyToken="31bf3856ad364e35"/>
<bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0"/></dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Extensions.Design" publicKeyToken="31bf3856ad364e35"/>
<bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0"/></dependentAssembly></assemblyBinding></runtime></configuration>

242
samples/CodeConverter/Source/CCSite/default.css

@ -0,0 +1,242 @@ @@ -0,0 +1,242 @@
/* culture shock: prozac afternoon by pogy366 - Sept. 2005 */
/******* structure and layout *******/
body {
font-family:Arial, Helvetica, sans-serif;
font-size: 9pt;
color: #000000;
background: #B4B8B7;
margin:10px 0 0 0;
padding:0 0 0 0;
background: #8E979C url(images/bg.gif);
text-align:center;
}
.wrap {
position:relative;
width:780px;
margin:0 auto;
padding:0 0 0 0;
text-align:center;
background: #ffffff url(images/header.jpg) no-repeat;
border-left:1px solid #f1b75f;
border-right:1px solid #f1b75f;
border-top:1px solid #f1b75f;
}
.header {
position:relative;
clear:none;
width:770px;
height:25px;
margin:100px 0 0 0;
padding:0 0 0 0;
background:transparent;
color:#ffffff;
text-align:right;
}
.topnav {
position:relative;
clear:both;
width:780px;
height:21px;
margin:0 0 0 0;
padding:0 0 0 0;
background:#cccccc;
font-size:8pt;
}
.container {
position:relative;
clear:both;
width:760px;
margin:10px 10px 0 10px;
padding:0 0 0 0;
background:#ffffff;
color:#000000;
text-align:left;
}
.news_right {
position:relative;
float:right;
clear:both;
width:200px;
margin:0 0 5px 10px;
padding:0 10px 0 10px;
background:#D0DEF6;
color:#465670;
font-family:Verdana, Arial, Helvetica, sans-serif;
font-size:8pt;
}
.news p {
margin:10px 10px;
}
.news_cnr_top {
background:url(images/cnr_tr.gif) no-repeat top right;
margin:0 -10px 0 -10px;
}
.news_cnr_bottom {
background:url(images/cnr_br.gif) no-repeat top right;
margin:0 -10px 0 -10px;
}
img.cnr {
width:8px;
height:8px;
border:none;
display: block !important;
}
.footer {
position:relative;
clear:both;
width:780px;
margin:20px 0 0 0;
padding:4px 0 4px 0;
background:#ffffff;
font-size:8pt;
text-align:center;
border-top:1px solid #f1b75f;
border-bottom:1px solid #f1b75f;
}
/******* top navigation *******/
#nav ul{
padding:0 0 0 0;
margin:0 0 0 0;
white-space: nowrap;
font-size:8pt;
color:#ffffff;
float:left;
width:100%;
background:#ffffff url(images/topnav_bg_grey.gif);
list-style:none;
}
#nav ul li{
display:inline;
list-style:none;
}
#nav ul li a{
margin: 0 0 0 0;
padding: .25em 2em .3em 1em;
background:#ffffff url(images/topnav_bg_grey.gif);
color: #000000;
text-decoration:none;
float: left;
border-right:1px solid #cccccc;
}
#nav ul li a:hover{
background:#8DA8D5 url(images/topnav_bg.gif);
color: #ffffff;
text-decoration:none;
border-right:1px solid #cccccc;
}
/******* links *******/
a {
color:#D3812D;
text-decoration:underline;
}
a:hover {
color:#E39243;
text-decoration:none;
}
#news a {
color:#D3812D;
text-decoration:underline;
}
#news a:hover {
color:#E39243;
text-decoration:none;
}
#footer a {
color:#f1b75f;
text-decoration:none;
}
#footer a:hover {
color:#D3812D;
text-decoration:none;
}
/******* fonts and colors *******/
.header strong {
font-family:Verdana, Arial, Helvetica, sans-serif;
color:#ffffff;
font-size:13pt;
letter-spacing:.7em;
}
.news_title {
font-family:Arial, Helvetica, sans-serif;
color:#465670;
font-size:10pt;
font-weight:bold;
}
.page_title {
font-family:Arial, Helvetica, sans-serif;
color:#4669A4;
font-size:10pt;
font-weight:bold;
padding: 0 0 0 0;
margin: 0 0 -8px 0;
}
/******* images *******/
img {
border:none;
}
.right img{
position:relative;
float:right;
padding:0 0 0 0;
margin:5px 2px 2px 5px;
}
.left img{
position:relative;
float:left;
padding:0 0 0 0;
margin:0 5px 0 2px;
}
/******* workarounds and hacks *******/
.clearfix:after {
content: ".";
display: block;
height: 0;
clear: both;
visibility: hidden;
}
.clearfix {display: inline-table;}
/* Hides from IE-mac \*/
* html .clearfix {height: 1%;}
.clearfix {display: block;}
/* End hide from IE-mac */

BIN
samples/CodeConverter/Source/CCSite/downloads/CodeConvertServiceClient.zip

Binary file not shown.

BIN
samples/CodeConverter/Source/CCSite/downloads/CodeConvertServiceClient_Source.zip

Binary file not shown.

BIN
samples/CodeConverter/Source/CCSite/downloads/CodeFormatServiceClient.zip

Binary file not shown.

BIN
samples/CodeConverter/Source/CCSite/downloads/CodeFormatServiceClient_Source.zip

Binary file not shown.

BIN
samples/CodeConverter/Source/CCSite/images/bg.gif

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 B

BIN
samples/CodeConverter/Source/CCSite/images/cnr_bl.gif

Binary file not shown.

After

Width:  |  Height:  |  Size: 100 B

BIN
samples/CodeConverter/Source/CCSite/images/cnr_br.gif

Binary file not shown.

After

Width:  |  Height:  |  Size: 100 B

BIN
samples/CodeConverter/Source/CCSite/images/cnr_tl.gif

Binary file not shown.

After

Width:  |  Height:  |  Size: 108 B

BIN
samples/CodeConverter/Source/CCSite/images/cnr_tr.gif

Binary file not shown.

After

Width:  |  Height:  |  Size: 100 B

BIN
samples/CodeConverter/Source/CCSite/images/header.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

BIN
samples/CodeConverter/Source/CCSite/images/sample.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

BIN
samples/CodeConverter/Source/CCSite/images/topnav_bg.gif

Binary file not shown.

After

Width:  |  Height:  |  Size: 166 B

BIN
samples/CodeConverter/Source/CCSite/images/topnav_bg_grey.gif

Binary file not shown.

After

Width:  |  Height:  |  Size: 108 B

BIN
samples/CodeConverter/Source/CCSite/screenshots/CodeConverterClient.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

BIN
samples/CodeConverter/Source/CCSite/screenshots/FormatCode_Html.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

BIN
samples/CodeConverter/Source/CCSite/screenshots/FormatCode_Preview.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB

BIN
samples/CodeConverter/Source/CCSite/screenshots/FormatCode_Source.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

38
samples/CodeConverter/Source/CodeConverter.sln

@ -0,0 +1,38 @@ @@ -0,0 +1,38 @@

Microsoft Visual Studio Solution File, Format Version 10.00
# Visual Studio 2008
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CCSite", "CCSite\CCSite.csproj", "{6597D0F8-916A-45EB-98D1-831064914B77}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CodeConvertServiceClient", "CCClient\CodeConvertServiceClient.csproj", "{93D91711-636F-4796-8572-F043D4CF8FA5}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CodeFormatServiceClient", "CodeFormatServiceClient\CodeFormatServiceClient.csproj", "{0CC6D33C-CE47-4441-8656-F7CA248ADD14}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.CodeConversion", "ICSharpCode.CodeConversion\ICSharpCode.CodeConversion.csproj", "{BF122CB4-E896-40CA-BF0A-AB44906AB87D}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{6597D0F8-916A-45EB-98D1-831064914B77}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6597D0F8-916A-45EB-98D1-831064914B77}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6597D0F8-916A-45EB-98D1-831064914B77}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6597D0F8-916A-45EB-98D1-831064914B77}.Release|Any CPU.Build.0 = Release|Any CPU
{93D91711-636F-4796-8572-F043D4CF8FA5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{93D91711-636F-4796-8572-F043D4CF8FA5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{93D91711-636F-4796-8572-F043D4CF8FA5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{93D91711-636F-4796-8572-F043D4CF8FA5}.Release|Any CPU.Build.0 = Release|Any CPU
{0CC6D33C-CE47-4441-8656-F7CA248ADD14}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0CC6D33C-CE47-4441-8656-F7CA248ADD14}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0CC6D33C-CE47-4441-8656-F7CA248ADD14}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0CC6D33C-CE47-4441-8656-F7CA248ADD14}.Release|Any CPU.Build.0 = Release|Any CPU
{BF122CB4-E896-40CA-BF0A-AB44906AB87D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BF122CB4-E896-40CA-BF0A-AB44906AB87D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BF122CB4-E896-40CA-BF0A-AB44906AB87D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BF122CB4-E896-40CA-BF0A-AB44906AB87D}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

171
samples/CodeConverter/Source/CodeFormatServiceClient/CodeFormatForm.Designer.cs generated

@ -0,0 +1,171 @@ @@ -0,0 +1,171 @@
namespace CodeFormatServiceClient
{
partial class CodeFormatForm
{
/// <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.tabctrlMain = new System.Windows.Forms.TabControl();
this.tabPage1 = new System.Windows.Forms.TabPage();
this.tabPageOutput = new System.Windows.Forms.TabPage();
this.tabPagePreview = new System.Windows.Forms.TabPage();
this.availableHighlighters = new System.Windows.Forms.ComboBox();
this.sourceTextDocument = new System.Windows.Forms.TextBox();
this.buttonFormatCode = new System.Windows.Forms.Button();
this.htmlOutput = new System.Windows.Forms.TextBox();
this.formatPreview = new System.Windows.Forms.WebBrowser();
this.tabctrlMain.SuspendLayout();
this.tabPage1.SuspendLayout();
this.tabPageOutput.SuspendLayout();
this.tabPagePreview.SuspendLayout();
this.SuspendLayout();
//
// tabctrlMain
//
this.tabctrlMain.Controls.Add(this.tabPage1);
this.tabctrlMain.Controls.Add(this.tabPageOutput);
this.tabctrlMain.Controls.Add(this.tabPagePreview);
this.tabctrlMain.Location = new System.Drawing.Point(12, 12);
this.tabctrlMain.Name = "tabctrlMain";
this.tabctrlMain.SelectedIndex = 0;
this.tabctrlMain.Size = new System.Drawing.Size(721, 436);
this.tabctrlMain.TabIndex = 1;
//
// tabPage1
//
this.tabPage1.Controls.Add(this.buttonFormatCode);
this.tabPage1.Controls.Add(this.sourceTextDocument);
this.tabPage1.Controls.Add(this.availableHighlighters);
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(713, 410);
this.tabPage1.TabIndex = 0;
this.tabPage1.Text = "Input";
this.tabPage1.UseVisualStyleBackColor = true;
//
// tabPageOutput
//
this.tabPageOutput.Controls.Add(this.htmlOutput);
this.tabPageOutput.Location = new System.Drawing.Point(4, 22);
this.tabPageOutput.Name = "tabPageOutput";
this.tabPageOutput.Padding = new System.Windows.Forms.Padding(3);
this.tabPageOutput.Size = new System.Drawing.Size(713, 410);
this.tabPageOutput.TabIndex = 1;
this.tabPageOutput.Text = "Output";
this.tabPageOutput.UseVisualStyleBackColor = true;
//
// tabPagePreview
//
this.tabPagePreview.Controls.Add(this.formatPreview);
this.tabPagePreview.Location = new System.Drawing.Point(4, 22);
this.tabPagePreview.Name = "tabPagePreview";
this.tabPagePreview.Padding = new System.Windows.Forms.Padding(3);
this.tabPagePreview.Size = new System.Drawing.Size(713, 410);
this.tabPagePreview.TabIndex = 2;
this.tabPagePreview.Text = "Preview";
this.tabPagePreview.UseVisualStyleBackColor = true;
//
// availableHighlighters
//
this.availableHighlighters.FormattingEnabled = true;
this.availableHighlighters.Location = new System.Drawing.Point(6, 6);
this.availableHighlighters.Name = "availableHighlighters";
this.availableHighlighters.Size = new System.Drawing.Size(121, 21);
this.availableHighlighters.TabIndex = 1;
//
// sourceTextDocument
//
this.sourceTextDocument.AcceptsReturn = true;
this.sourceTextDocument.AcceptsTab = true;
this.sourceTextDocument.Location = new System.Drawing.Point(6, 33);
this.sourceTextDocument.Multiline = true;
this.sourceTextDocument.Name = "sourceTextDocument";
this.sourceTextDocument.Size = new System.Drawing.Size(701, 371);
this.sourceTextDocument.TabIndex = 2;
//
// buttonFormatCode
//
this.buttonFormatCode.Location = new System.Drawing.Point(142, 4);
this.buttonFormatCode.Name = "buttonFormatCode";
this.buttonFormatCode.Size = new System.Drawing.Size(120, 23);
this.buttonFormatCode.TabIndex = 3;
this.buttonFormatCode.Text = "Format Code";
this.buttonFormatCode.UseVisualStyleBackColor = true;
this.buttonFormatCode.Click += new System.EventHandler(this.buttonFormatCode_Click);
//
// htmlOutput
//
this.htmlOutput.AcceptsReturn = true;
this.htmlOutput.AcceptsTab = true;
this.htmlOutput.Location = new System.Drawing.Point(6, 6);
this.htmlOutput.Multiline = true;
this.htmlOutput.Name = "htmlOutput";
this.htmlOutput.Size = new System.Drawing.Size(701, 398);
this.htmlOutput.TabIndex = 3;
//
// formatPreview
//
this.formatPreview.Dock = System.Windows.Forms.DockStyle.Fill;
this.formatPreview.Location = new System.Drawing.Point(3, 3);
this.formatPreview.MinimumSize = new System.Drawing.Size(20, 20);
this.formatPreview.Name = "formatPreview";
this.formatPreview.Size = new System.Drawing.Size(707, 404);
this.formatPreview.TabIndex = 0;
//
// CodeFormatForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(743, 459);
this.Controls.Add(this.tabctrlMain);
this.Name = "CodeFormatForm";
this.Text = "Format Code";
this.Load += new System.EventHandler(this.CodeFormatForm_Load);
this.tabctrlMain.ResumeLayout(false);
this.tabPage1.ResumeLayout(false);
this.tabPage1.PerformLayout();
this.tabPageOutput.ResumeLayout(false);
this.tabPageOutput.PerformLayout();
this.tabPagePreview.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.TabControl tabctrlMain;
private System.Windows.Forms.TabPage tabPage1;
private System.Windows.Forms.TabPage tabPageOutput;
private System.Windows.Forms.Button buttonFormatCode;
private System.Windows.Forms.TextBox sourceTextDocument;
private System.Windows.Forms.ComboBox availableHighlighters;
private System.Windows.Forms.TextBox htmlOutput;
private System.Windows.Forms.TabPage tabPagePreview;
private System.Windows.Forms.WebBrowser formatPreview;
}
}

43
samples/CodeConverter/Source/CodeFormatServiceClient/CodeFormatForm.cs

@ -0,0 +1,43 @@ @@ -0,0 +1,43 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using CodeFormatServiceClient.ICSharpCode.CodeFormat;
namespace CodeFormatServiceClient
{
public partial class CodeFormatForm : Form
{
CodeFormatService cfs = null;
public CodeFormatForm()
{
InitializeComponent();
}
private void CodeFormatForm_Load(object sender, EventArgs e)
{
// yes, a stupid idea to do this synchronous - sample only
cfs = new CodeFormatService();
string[] serviceHighlighters = cfs.RetrieveAvailableHighlighters();
for (int i = 0; i < serviceHighlighters.Length; i++)
availableHighlighters.Items.Add(serviceHighlighters[i]);
availableHighlighters.SelectedIndex = availableHighlighters.FindStringExact("C#");
}
private void buttonFormatCode_Click(object sender, EventArgs e)
{
string htmlSource = cfs.Format(sourceTextDocument.Text,
availableHighlighters.Items[availableHighlighters.SelectedIndex].ToString(), false);
htmlOutput.Text = htmlSource;
formatPreview.DocumentText = htmlSource;
tabctrlMain.SelectedTab = tabPagePreview;
}
}
}

120
samples/CodeConverter/Source/CodeFormatServiceClient/CodeFormatForm.resx

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

116
samples/CodeConverter/Source/CodeFormatServiceClient/CodeFormatServiceClient.csproj

@ -0,0 +1,116 @@ @@ -0,0 +1,116 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.50727</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{0CC6D33C-CE47-4441-8656-F7CA248ADD14}</ProjectGuid>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>CodeFormatServiceClient</RootNamespace>
<AssemblyName>CodeFormatServiceClient</AssemblyName>
<FileUpgradeFlags>
</FileUpgradeFlags>
<OldToolsVersion>2.0</OldToolsVersion>
<UpgradeBackupLocation>
</UpgradeBackupLocation>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.EnterpriseServices" />
<Reference Include="System.Web.Services" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="CodeFormatForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="CodeFormatForm.Designer.cs">
<DependentUpon>CodeFormatForm.cs</DependentUpon>
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="CodeFormatForm.resx">
<SubType>Designer</SubType>
<DependentUpon>CodeFormatForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<None Include="Web References\ICSharpCode.CodeFormat\codeformatservice.wsdl" />
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
<Compile Include="Web References\ICSharpCode.CodeFormat\Reference.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Reference.map</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<WebReferences Include="Web References\" />
</ItemGroup>
<ItemGroup>
<WebReferenceUrl Include="http://codeconverter.sharpdevelop.net/codeformatservice.asmx">
<UrlBehavior>Dynamic</UrlBehavior>
<RelPath>Web References\ICSharpCode.CodeFormat\</RelPath>
<UpdateFromURL>http://codeconverter.sharpdevelop.net/codeformatservice.asmx</UpdateFromURL>
<ServiceLocationURL>
</ServiceLocationURL>
<CachedDynamicPropName>
</CachedDynamicPropName>
<CachedAppSettingsObjectName>Settings</CachedAppSettingsObjectName>
<CachedSettingsPropName>CodeFormatServiceClient_ICSharpCode_CodeFormat_CodeFormatService</CachedSettingsPropName>
</WebReferenceUrl>
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
<None Include="Web References\ICSharpCode.CodeFormat\codeformatservice.disco" />
<None Include="Web References\ICSharpCode.CodeFormat\Reference.map">
<Generator>MSDiscoCodeGenerator</Generator>
<LastGenOutput>Reference.cs</LastGenOutput>
</None>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

20
samples/CodeConverter/Source/CodeFormatServiceClient/Program.cs

@ -0,0 +1,20 @@ @@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.Windows.Forms;
namespace CodeFormatServiceClient
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new CodeFormatForm());
}
}
}

33
samples/CodeConverter/Source/CodeFormatServiceClient/Properties/AssemblyInfo.cs

@ -0,0 +1,33 @@ @@ -0,0 +1,33 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("CodeFormatServiceClient")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("CodeFormatServiceClient")]
[assembly: AssemblyCopyright("Copyright © 2007")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("02005d8d-0f3a-4fca-8043-1261227a02b1")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

63
samples/CodeConverter/Source/CodeFormatServiceClient/Properties/Resources.Designer.cs generated

@ -0,0 +1,63 @@ @@ -0,0 +1,63 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:2.0.50727.1433
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace CodeFormatServiceClient.Properties {
using System;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("CodeFormatServiceClient.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
}
}

117
samples/CodeConverter/Source/CodeFormatServiceClient/Properties/Resources.resx

@ -0,0 +1,117 @@ @@ -0,0 +1,117 @@
<?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.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="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</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="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" 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>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>

36
samples/CodeConverter/Source/CodeFormatServiceClient/Properties/Settings.Designer.cs generated

@ -0,0 +1,36 @@ @@ -0,0 +1,36 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:2.0.50727.1433
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace CodeFormatServiceClient.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "9.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default {
get {
return defaultInstance;
}
}
[global::System.Configuration.ApplicationScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.SpecialSettingAttribute(global::System.Configuration.SpecialSetting.WebServiceUrl)]
[global::System.Configuration.DefaultSettingValueAttribute("http://codeconverter.sharpdevelop.net/codeformatservice.asmx")]
public string CodeFormatServiceClient_ICSharpCode_CodeFormat_CodeFormatService {
get {
return ((string)(this["CodeFormatServiceClient_ICSharpCode_CodeFormat_CodeFormatService"]));
}
}
}
}

9
samples/CodeConverter/Source/CodeFormatServiceClient/Properties/Settings.settings

@ -0,0 +1,9 @@ @@ -0,0 +1,9 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="CodeFormatServiceClient.Properties" GeneratedClassName="Settings">
<Profiles />
<Settings>
<Setting Name="CodeFormatServiceClient_ICSharpCode_CodeFormat_CodeFormatService" Type="(Web Service URL)" Scope="Application">
<Value Profile="(Default)">http://codeconverter.sharpdevelop.net/codeformatservice.asmx</Value>
</Setting>
</Settings>
</SettingsFile>

212
samples/CodeConverter/Source/CodeFormatServiceClient/Web References/ICSharpCode.CodeFormat/Reference.cs

@ -0,0 +1,212 @@ @@ -0,0 +1,212 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:2.0.50727.1433
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
//
// This source code was auto-generated by Microsoft.VSDesigner, Version 2.0.50727.1433.
//
#pragma warning disable 1591
namespace CodeFormatServiceClient.ICSharpCode.CodeFormat {
using System.Diagnostics;
using System.Web.Services;
using System.ComponentModel;
using System.Web.Services.Protocols;
using System;
using System.Xml.Serialization;
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "2.0.50727.1433")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Web.Services.WebServiceBindingAttribute(Name="CodeFormatServiceSoap", Namespace="http://codeconverter.sharpdevelop.net/")]
public partial class CodeFormatService : System.Web.Services.Protocols.SoapHttpClientProtocol {
private System.Threading.SendOrPostCallback FormatOperationCompleted;
private System.Threading.SendOrPostCallback RetrieveAvailableHighlightersOperationCompleted;
private bool useDefaultCredentialsSetExplicitly;
/// <remarks/>
public CodeFormatService() {
this.Url = global::CodeFormatServiceClient.Properties.Settings.Default.CodeFormatServiceClient_ICSharpCode_CodeFormat_CodeFormatService;
if ((this.IsLocalFileSystemWebService(this.Url) == true)) {
this.UseDefaultCredentials = true;
this.useDefaultCredentialsSetExplicitly = false;
}
else {
this.useDefaultCredentialsSetExplicitly = true;
}
}
public new string Url {
get {
return base.Url;
}
set {
if ((((this.IsLocalFileSystemWebService(base.Url) == true)
&& (this.useDefaultCredentialsSetExplicitly == false))
&& (this.IsLocalFileSystemWebService(value) == false))) {
base.UseDefaultCredentials = false;
}
base.Url = value;
}
}
public new bool UseDefaultCredentials {
get {
return base.UseDefaultCredentials;
}
set {
base.UseDefaultCredentials = value;
this.useDefaultCredentialsSetExplicitly = true;
}
}
/// <remarks/>
public event FormatCompletedEventHandler FormatCompleted;
/// <remarks/>
public event RetrieveAvailableHighlightersCompletedEventHandler RetrieveAvailableHighlightersCompleted;
/// <remarks/>
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://codeconverter.sharpdevelop.net/Format", RequestNamespace="http://codeconverter.sharpdevelop.net/", ResponseNamespace="http://codeconverter.sharpdevelop.net/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public string Format(string Document, string HighlighterName, bool IncludeLineNumbers) {
object[] results = this.Invoke("Format", new object[] {
Document,
HighlighterName,
IncludeLineNumbers});
return ((string)(results[0]));
}
/// <remarks/>
public void FormatAsync(string Document, string HighlighterName, bool IncludeLineNumbers) {
this.FormatAsync(Document, HighlighterName, IncludeLineNumbers, null);
}
/// <remarks/>
public void FormatAsync(string Document, string HighlighterName, bool IncludeLineNumbers, object userState) {
if ((this.FormatOperationCompleted == null)) {
this.FormatOperationCompleted = new System.Threading.SendOrPostCallback(this.OnFormatOperationCompleted);
}
this.InvokeAsync("Format", new object[] {
Document,
HighlighterName,
IncludeLineNumbers}, this.FormatOperationCompleted, userState);
}
private void OnFormatOperationCompleted(object arg) {
if ((this.FormatCompleted != null)) {
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
this.FormatCompleted(this, new FormatCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
}
}
/// <remarks/>
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://codeconverter.sharpdevelop.net/RetrieveAvailableHighlighters", RequestNamespace="http://codeconverter.sharpdevelop.net/", ResponseNamespace="http://codeconverter.sharpdevelop.net/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public string[] RetrieveAvailableHighlighters() {
object[] results = this.Invoke("RetrieveAvailableHighlighters", new object[0]);
return ((string[])(results[0]));
}
/// <remarks/>
public void RetrieveAvailableHighlightersAsync() {
this.RetrieveAvailableHighlightersAsync(null);
}
/// <remarks/>
public void RetrieveAvailableHighlightersAsync(object userState) {
if ((this.RetrieveAvailableHighlightersOperationCompleted == null)) {
this.RetrieveAvailableHighlightersOperationCompleted = new System.Threading.SendOrPostCallback(this.OnRetrieveAvailableHighlightersOperationCompleted);
}
this.InvokeAsync("RetrieveAvailableHighlighters", new object[0], this.RetrieveAvailableHighlightersOperationCompleted, userState);
}
private void OnRetrieveAvailableHighlightersOperationCompleted(object arg) {
if ((this.RetrieveAvailableHighlightersCompleted != null)) {
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
this.RetrieveAvailableHighlightersCompleted(this, new RetrieveAvailableHighlightersCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
}
}
/// <remarks/>
public new void CancelAsync(object userState) {
base.CancelAsync(userState);
}
private bool IsLocalFileSystemWebService(string url) {
if (((url == null)
|| (url == string.Empty))) {
return false;
}
System.Uri wsUri = new System.Uri(url);
if (((wsUri.Port >= 1024)
&& (string.Compare(wsUri.Host, "localHost", System.StringComparison.OrdinalIgnoreCase) == 0))) {
return true;
}
return false;
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "2.0.50727.1433")]
public delegate void FormatCompletedEventHandler(object sender, FormatCompletedEventArgs e);
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "2.0.50727.1433")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class FormatCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
private object[] results;
internal FormatCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
base(exception, cancelled, userState) {
this.results = results;
}
/// <remarks/>
public string Result {
get {
this.RaiseExceptionIfNecessary();
return ((string)(this.results[0]));
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "2.0.50727.1433")]
public delegate void RetrieveAvailableHighlightersCompletedEventHandler(object sender, RetrieveAvailableHighlightersCompletedEventArgs e);
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "2.0.50727.1433")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class RetrieveAvailableHighlightersCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
private object[] results;
internal RetrieveAvailableHighlightersCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
base(exception, cancelled, userState) {
this.results = results;
}
/// <remarks/>
public string[] Result {
get {
this.RaiseExceptionIfNecessary();
return ((string[])(this.results[0]));
}
}
}
}
#pragma warning restore 1591

7
samples/CodeConverter/Source/CodeFormatServiceClient/Web References/ICSharpCode.CodeFormat/Reference.map

@ -0,0 +1,7 @@ @@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<DiscoveryClientResultsFile xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Results>
<DiscoveryClientResult referenceType="System.Web.Services.Discovery.ContractReference" url="http://codeconverter.sharpdevelop.net/codeformatservice.asmx?wsdl" filename="codeformatservice.wsdl" />
<DiscoveryClientResult referenceType="System.Web.Services.Discovery.DiscoveryDocumentReference" url="http://codeconverter.sharpdevelop.net/codeformatservice.asmx?disco" filename="codeformatservice.disco" />
</Results>
</DiscoveryClientResultsFile>

6
samples/CodeConverter/Source/CodeFormatServiceClient/Web References/ICSharpCode.CodeFormat/codeformatservice.disco

@ -0,0 +1,6 @@ @@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<discovery xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.xmlsoap.org/disco/">
<contractRef ref="http://codeconverter.sharpdevelop.net/codeformatservice.asmx?wsdl" docRef="http://codeconverter.sharpdevelop.net/codeformatservice.asmx" xmlns="http://schemas.xmlsoap.org/disco/scl/" />
<soap address="http://codeconverter.sharpdevelop.net/codeformatservice.asmx" xmlns:q1="http://codeconverter.sharpdevelop.net/" binding="q1:CodeFormatServiceSoap" xmlns="http://schemas.xmlsoap.org/disco/soap/" />
<soap address="http://codeconverter.sharpdevelop.net/codeformatservice.asmx" xmlns:q2="http://codeconverter.sharpdevelop.net/" binding="q2:CodeFormatServiceSoap12" xmlns="http://schemas.xmlsoap.org/disco/soap/" />
</discovery>

110
samples/CodeConverter/Source/CodeFormatServiceClient/Web References/ICSharpCode.CodeFormat/codeformatservice.wsdl

@ -0,0 +1,110 @@ @@ -0,0 +1,110 @@
<?xml version="1.0" encoding="utf-8"?>
<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns="http://codeconverter.sharpdevelop.net/" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" targetNamespace="http://codeconverter.sharpdevelop.net/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
<wsdl:types>
<s:schema elementFormDefault="qualified" targetNamespace="http://codeconverter.sharpdevelop.net/">
<s:element name="Format">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="Document" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="HighlighterName" type="s:string" />
<s:element minOccurs="1" maxOccurs="1" name="IncludeLineNumbers" type="s:boolean" />
</s:sequence>
</s:complexType>
</s:element>
<s:element name="FormatResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="FormatResult" type="s:string" />
</s:sequence>
</s:complexType>
</s:element>
<s:element name="RetrieveAvailableHighlighters">
<s:complexType />
</s:element>
<s:element name="RetrieveAvailableHighlightersResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="RetrieveAvailableHighlightersResult" type="tns:ArrayOfString" />
</s:sequence>
</s:complexType>
</s:element>
<s:complexType name="ArrayOfString">
<s:sequence>
<s:element minOccurs="0" maxOccurs="unbounded" name="string" nillable="true" type="s:string" />
</s:sequence>
</s:complexType>
</s:schema>
</wsdl:types>
<wsdl:message name="FormatSoapIn">
<wsdl:part name="parameters" element="tns:Format" />
</wsdl:message>
<wsdl:message name="FormatSoapOut">
<wsdl:part name="parameters" element="tns:FormatResponse" />
</wsdl:message>
<wsdl:message name="RetrieveAvailableHighlightersSoapIn">
<wsdl:part name="parameters" element="tns:RetrieveAvailableHighlighters" />
</wsdl:message>
<wsdl:message name="RetrieveAvailableHighlightersSoapOut">
<wsdl:part name="parameters" element="tns:RetrieveAvailableHighlightersResponse" />
</wsdl:message>
<wsdl:portType name="CodeFormatServiceSoap">
<wsdl:operation name="Format">
<wsdl:input message="tns:FormatSoapIn" />
<wsdl:output message="tns:FormatSoapOut" />
</wsdl:operation>
<wsdl:operation name="RetrieveAvailableHighlighters">
<wsdl:input message="tns:RetrieveAvailableHighlightersSoapIn" />
<wsdl:output message="tns:RetrieveAvailableHighlightersSoapOut" />
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="CodeFormatServiceSoap" type="tns:CodeFormatServiceSoap">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="Format">
<soap:operation soapAction="http://codeconverter.sharpdevelop.net/Format" style="document" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="RetrieveAvailableHighlighters">
<soap:operation soapAction="http://codeconverter.sharpdevelop.net/RetrieveAvailableHighlighters" style="document" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:binding name="CodeFormatServiceSoap12" type="tns:CodeFormatServiceSoap">
<soap12:binding transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="Format">
<soap12:operation soapAction="http://codeconverter.sharpdevelop.net/Format" style="document" />
<wsdl:input>
<soap12:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap12:body use="literal" />
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="RetrieveAvailableHighlighters">
<soap12:operation soapAction="http://codeconverter.sharpdevelop.net/RetrieveAvailableHighlighters" style="document" />
<wsdl:input>
<soap12:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap12:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="CodeFormatService">
<wsdl:port name="CodeFormatServiceSoap" binding="tns:CodeFormatServiceSoap">
<soap:address location="http://codeconverter.sharpdevelop.net/codeformatservice.asmx" />
</wsdl:port>
<wsdl:port name="CodeFormatServiceSoap12" binding="tns:CodeFormatServiceSoap12">
<soap12:address location="http://codeconverter.sharpdevelop.net/codeformatservice.asmx" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>

16
samples/CodeConverter/Source/CodeFormatServiceClient/app.config

@ -0,0 +1,16 @@ @@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="CodeFormatServiceClient.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</sectionGroup>
</configSections>
<applicationSettings>
<CodeFormatServiceClient.Properties.Settings>
<setting name="CodeFormatServiceClient_ICSharpCode_CodeFormat_CodeFormatService"
serializeAs="String">
<value>http://codeconverter.sharpdevelop.net/codeformatservice.asmx</value>
</setting>
</CodeFormatServiceClient.Properties.Settings>
</applicationSettings>
</configuration>

95
samples/CodeConverter/Source/ICSharpCode.CodeConversion/BooHelpers.cs

@ -0,0 +1,95 @@ @@ -0,0 +1,95 @@
using System.IO;
using System.Collections.Generic;
using System.Text;
// Boo conversion
using Boo.Lang.Compiler;
using Boo.Lang.Compiler.Ast;
using NRefactoryToBooConverter;
namespace ICSharpCode.CodeConversion
{
public class BooHelpers
{
private BooHelpers() { }
public static ConverterSettings ApplySettings(string fileName, CompilerErrorCollection errors, CompilerWarningCollection warnings)
{
ConverterSettings settings = new ConverterSettings(fileName, errors, warnings);
settings.SimplifyTypeNames = true;
return settings;
}
public static string CreateBooCode(CompilerErrorCollection errors,
CompilerWarningCollection warnings,
Module module,
IList<ICSharpCode.NRefactory.ISpecial> specials)
{
using (StringWriter w = new StringWriter())
{
foreach (CompilerError error in errors)
{
w.WriteLine("ERROR: " + error.ToString());
}
if (errors.Count > 0)
w.WriteLine();
foreach (CompilerWarning warning in warnings)
{
w.WriteLine("# WARNING: " + warning.ToString());
}
if (warnings.Count > 0)
w.WriteLine();
BooPrinterVisitorWithComments printer = new BooPrinterVisitorWithComments(specials, w);
printer.OnModule(module);
printer.Finish();
return w.ToString();
}
}
public static bool ConvertToBoo(string fileName,
string ProvidedSource,
out string ConvertedSource,
out string ErrorMessage)
{
ConvertedSource = ErrorMessage = "";
CompilerErrorCollection errors = new CompilerErrorCollection();
CompilerWarningCollection warnings = new CompilerWarningCollection();
Module module;
IList<ICSharpCode.NRefactory.ISpecial> specials;
CompileUnit compileUnit = new CompileUnit();
using (StringReader r = new StringReader(ProvidedSource))
{
// modified: removed fileName guessing
module = Parser.ParseModule(compileUnit, r, BooHelpers.ApplySettings(fileName, errors, warnings), out specials);
}
if (module == null)
{
StringBuilder errorBuilder = new StringBuilder();
foreach (CompilerError error in errors)
{
errorBuilder.AppendLine(error.ToString());
}
if (warnings.Count > 0)
{
foreach (CompilerWarning warning in warnings)
{
errorBuilder.AppendLine(warning.ToString());
}
}
ErrorMessage = errorBuilder.ToString();
return false;
}
else
{
ConvertedSource = BooHelpers.CreateBooCode(errors, warnings, module, specials);
}
return true;
}
}
}

24
samples/CodeConverter/Source/ICSharpCode.CodeConversion/HelperFunctions.cs

@ -0,0 +1,24 @@ @@ -0,0 +1,24 @@
using System;
// Conversion general
using ICSharpCode.NRefactory.PrettyPrinter;
namespace ICSharpCode.CodeConversion
{
public class HelperFunctions
{
private HelperFunctions() { }
public static string GetNRefactoryVersion()
{
System.Reflection.Assembly asm = System.Reflection.Assembly.GetAssembly(typeof(VBNetOutputVisitor));
Version v = asm.GetName().Version;
string s = string.Format("{0:0}.{1:0}.{2:0}.{3:0}",
v.Major, v.Minor, v.Build, v.Revision);
return s;
}
}
}

83
samples/CodeConverter/Source/ICSharpCode.CodeConversion/ICSharpCode.CodeConversion.csproj

@ -0,0 +1,83 @@ @@ -0,0 +1,83 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>9.0.21022</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{BF122CB4-E896-40CA-BF0A-AB44906AB87D}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>ICSharpCode.CodeConversion</RootNamespace>
<AssemblyName>ICSharpCode.CodeConversion</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Boo.Lang, Version=2.0.0.0, Culture=neutral, PublicKeyToken=32c39770e9a21a67, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\Dependencies\Boo.Lang.dll</HintPath>
</Reference>
<Reference Include="Boo.Lang.Compiler, Version=2.0.0.0, Culture=neutral, PublicKeyToken=32c39770e9a21a67, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\Dependencies\Boo.Lang.Compiler.dll</HintPath>
</Reference>
<Reference Include="ICSharpCode.NRefactory, Version=3.0.0.3091, Culture=neutral, PublicKeyToken=efe927acf176eea2, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\Dependencies\ICSharpCode.NRefactory.dll</HintPath>
</Reference>
<Reference Include="ICSharpCode.SharpDevelop.Dom, Version=3.0.0.3091, Culture=neutral, PublicKeyToken=f829da5c02be14ee, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\Dependencies\ICSharpCode.SharpDevelop.Dom.dll</HintPath>
</Reference>
<Reference Include="NRefactoryToBooConverter, Version=3.0.0.3091, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\Dependencies\NRefactoryToBooConverter.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Xml.Linq">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Data.DataSetExtensions">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="BooHelpers.cs" />
<Compile Include="HelperFunctions.cs" />
<Compile Include="IConvertCode.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="ReferencedContentsSingleton.cs" />
<Compile Include="SnippetConversion.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

13
samples/CodeConverter/Source/ICSharpCode.CodeConversion/IConvertCode.cs

@ -0,0 +1,13 @@ @@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace ICSharpCode.CodeConversion
{
public interface IConvertCode
{
bool Convert(string ProvidedSource,
out string ConvertedSource,
out string ErrorMessage);
}
}

36
samples/CodeConverter/Source/ICSharpCode.CodeConversion/Properties/AssemblyInfo.cs

@ -0,0 +1,36 @@ @@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("ICSharpCode.CodeConversion")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ICSharpCode.CodeConversion")]
[assembly: AssemblyCopyright("Copyright © 2008")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("58d3f9b2-0779-4ff9-a496-18ee99410397")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

60
samples/CodeConverter/Source/ICSharpCode.CodeConversion/ReferencedContentsSingleton.cs

@ -0,0 +1,60 @@ @@ -0,0 +1,60 @@
using System;
using System.Collections.Generic;
using ICSharpCode.SharpDevelop.Dom;
using ICSharpCode.SharpDevelop.Dom.NRefactoryResolver;
using System.IO;
using System.Runtime.InteropServices;
namespace ICSharpCode.CodeConversion
{
public static class ReferencedContentsSingleton
{
public readonly static List<IProjectContent> ReferencedContents;
static readonly ProjectContentRegistry pcr = new ProjectContentRegistry();
static ReferencedContentsSingleton()
{
ReferencedContents = new List<IProjectContent> {
pcr.Mscorlib,
InternalGetRtDirPC("System"),
// InternalGet35DirPC("System.Core"),
InternalGetRtDirPC("System.Data"),
InternalGetRtDirPC("System.Drawing"),
InternalGetRtDirPC("System.Windows.Forms"),
InternalGetRtDirPC("System.Xml"),
// InternalGet35DirPC("System.Xml.Linq"),
// InternalGet35DirPC("System.Data.Linq"),
InternalGetRtDirPC("System.Web"),
// InternalGet35DirPC("System.Net"),
// InternalGet35DirPC("System.Data.DataSetExtensions"),
InternalGetRtDirPC("Microsoft.VisualBasic")
// add more references here
};
}
static IProjectContent InternalGetRtDirPC(string name)
{
IProjectContent pc = pcr.GetProjectContentForReference(name,
Path.Combine(RuntimeEnvironment.GetRuntimeDirectory(), name + ".dll"));
if (null == pc)
throw new Exception("Assembly " + name + " was not found in Runtime directory.");
return pc;
}
static IProjectContent InternalGet35DirPC(string name)
{
string threeFiveDir =
Environment.ExpandEnvironmentVariables(@"%ProgramFiles%\Reference Assemblies\Microsoft\Framework\v3.5");
IProjectContent pc = pcr.GetProjectContentForReference(name,
Path.Combine(threeFiveDir, name + ".dll"));
if (null == pc)
throw new Exception("Assembly " + name + " was not found 3.5 reference assemblies directory.");
return pc;
}
}
}

55
samples/CodeConverter/Source/ICSharpCode.CodeConversion/SnippetConversion.cs

@ -0,0 +1,55 @@ @@ -0,0 +1,55 @@
using System;
using System.Collections.Generic;
using ICSharpCode.SharpDevelop.Dom;
using ICSharpCode.SharpDevelop.Dom.NRefactoryResolver;
using System.IO;
using System.Runtime.InteropServices;
namespace ICSharpCode.CodeConversion
{
public class ConvertCSharpSnippetToVbNet : IConvertCode
{
public bool Convert(string ProvidedSource, out string ConvertedSource, out string ErrorMessage)
{
CodeSnippetConverter converter = new CodeSnippetConverter() { ReferencedContents = ReferencedContentsSingleton.ReferencedContents };
ConvertedSource = converter.CSharpToVB(ProvidedSource, out ErrorMessage);
return (ErrorMessage.Length == 0);
}
}
public class ConvertVbNetSnippetToCSharp : IConvertCode
{
public bool Convert(string ProvidedSource, out string ConvertedSource, out string ErrorMessage)
{
CodeSnippetConverter converter = new CodeSnippetConverter() { ReferencedContents = ReferencedContentsSingleton.ReferencedContents };
ConvertedSource = converter.VBToCSharp(ProvidedSource, out ErrorMessage);
return (ErrorMessage.Length == 0);
}
}
public class ConvertCSharpToBoo : IConvertCode
{
public bool Convert(string ProvidedSource, out string ConvertedSource, out string ErrorMessage)
{
bool bSuccessfulConversion = BooHelpers.ConvertToBoo("convert.cs",
ProvidedSource,
out ConvertedSource,
out ErrorMessage);
return bSuccessfulConversion;
}
}
public class ConvertVbNetToBoo : IConvertCode
{
public bool Convert(string ProvidedSource, out string ConvertedSource, out string ErrorMessage)
{
bool bSuccessfulConversion = BooHelpers.ConvertToBoo("convert.vb",
ProvidedSource,
out ConvertedSource,
out ErrorMessage);
return bSuccessfulConversion;
}
}
}
Loading…
Cancel
Save