From: Oleg T. <he...@us...> - 2005-10-22 21:18:16
|
Update of /cvsroot/mvp-xml/EXSLT/v1/src/MethodRenamer In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15352/v1/src/MethodRenamer Modified Files: MethodRenamer.cs MethodRenamer.csproj Log Message: Index: MethodRenamer.csproj =================================================================== RCS file: /cvsroot/mvp-xml/EXSLT/v1/src/MethodRenamer/MethodRenamer.csproj,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- MethodRenamer.csproj 15 Oct 2005 21:18:47 -0000 1.2 +++ MethodRenamer.csproj 22 Oct 2005 21:18:08 -0000 1.3 @@ -1,90 +1,99 @@ -<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <PropertyGroup> - <ProjectType>Local</ProjectType> - <ProductVersion>8.0.50215</ProductVersion> - <SchemaVersion>2.0</SchemaVersion> - <ProjectGuid>{A22418E5-DCE6-4D12-A016-151EA614A787}</ProjectGuid> - <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> - <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> - <ApplicationIcon> - </ApplicationIcon> - <AssemblyKeyContainerName> - </AssemblyKeyContainerName> - <AssemblyName>MethodRenamer</AssemblyName> - <AssemblyOriginatorKeyFile> - </AssemblyOriginatorKeyFile> - <DefaultClientScript>JScript</DefaultClientScript> - <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout> - <DefaultTargetSchema>IE50</DefaultTargetSchema> - <DelaySign>false</DelaySign> - <OutputType>Exe</OutputType> - <RootNamespace>GotDotNet.Exslt.MethodRenamer</RootNamespace> - <RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent> - <StartupObject>Mvp.Xml.Exslt.MethodRenamer.MethodRenamer</StartupObject> - <FileUpgradeFlags> - </FileUpgradeFlags> - <UpgradeBackupLocation> - </UpgradeBackupLocation> - </PropertyGroup> - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> - <OutputPath>.\</OutputPath> - <AllowUnsafeBlocks>false</AllowUnsafeBlocks> - <BaseAddress>285212672</BaseAddress> - <CheckForOverflowUnderflow>false</CheckForOverflowUnderflow> - <ConfigurationOverrideFile> - </ConfigurationOverrideFile> - <DefineConstants>DEBUG;TRACE</DefineConstants> - <DocumentationFile> - </DocumentationFile> - <DebugSymbols>true</DebugSymbols> - <FileAlignment>4096</FileAlignment> - <NoStdLib>false</NoStdLib> - <NoWarn> - </NoWarn> - <Optimize>false</Optimize> - <RegisterForComInterop>false</RegisterForComInterop> - <RemoveIntegerChecks>false</RemoveIntegerChecks> - <TreatWarningsAsErrors>false</TreatWarningsAsErrors> - <WarningLevel>4</WarningLevel> - </PropertyGroup> - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> - <OutputPath>.\</OutputPath> - <AllowUnsafeBlocks>false</AllowUnsafeBlocks> - <BaseAddress>285212672</BaseAddress> - <CheckForOverflowUnderflow>false</CheckForOverflowUnderflow> - <ConfigurationOverrideFile> - </ConfigurationOverrideFile> - <DefineConstants>TRACE</DefineConstants> - <DocumentationFile> - </DocumentationFile> - <DebugSymbols>false</DebugSymbols> - <FileAlignment>4096</FileAlignment> - <NoStdLib>false</NoStdLib> - <NoWarn> - </NoWarn> - <Optimize>true</Optimize> - <RegisterForComInterop>false</RegisterForComInterop> - <RemoveIntegerChecks>false</RemoveIntegerChecks> - <TreatWarningsAsErrors>false</TreatWarningsAsErrors> - <WarningLevel>4</WarningLevel> - </PropertyGroup> - <ItemGroup> - <Reference Include="System"> - <Name>System</Name> - </Reference> - <Reference Include="System.configuration" /> - </ItemGroup> - <ItemGroup> - <None Include="App.config" /> - <Compile Include="MethodRenamer.cs"> - <SubType>Code</SubType> - </Compile> - </ItemGroup> - <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> - <PropertyGroup> - <PreBuildEvent> - </PreBuildEvent> - <PostBuildEvent> - </PostBuildEvent> - </PropertyGroup> -</Project> \ No newline at end of file +<VisualStudioProject> + <CSHARP + ProjectType = "Local" + ProductVersion = "7.10.3077" + SchemaVersion = "2.0" + ProjectGuid = "{A22418E5-DCE6-4D12-A016-151EA614A787}" + > + <Build> + <Settings + ApplicationIcon = "" + AssemblyKeyContainerName = "" + AssemblyName = "MethodRenamer" + AssemblyOriginatorKeyFile = "" + DefaultClientScript = "JScript" + DefaultHTMLPageLayout = "Grid" + DefaultTargetSchema = "IE50" + DelaySign = "false" + OutputType = "Exe" + PreBuildEvent = "" + PostBuildEvent = "" + RootNamespace = "GotDotNet.Exslt.MethodRenamer" + RunPostBuildEvent = "OnBuildSuccess" + StartupObject = "Mvp.Xml.Exslt.MethodRenamer.MethodRenamer" + > + <Config + Name = "Debug" + AllowUnsafeBlocks = "false" + BaseAddress = "285212672" + CheckForOverflowUnderflow = "false" + ConfigurationOverrideFile = "" + DefineConstants = "DEBUG;TRACE" + DocumentationFile = "" + DebugSymbols = "true" + FileAlignment = "4096" + IncrementalBuild = "true" + NoStdLib = "false" + NoWarn = "" + Optimize = "false" + OutputPath = ".\" + RegisterForComInterop = "false" + RemoveIntegerChecks = "false" + TreatWarningsAsErrors = "false" + WarningLevel = "4" + /> + <Config + Name = "Release" + AllowUnsafeBlocks = "false" + BaseAddress = "285212672" + CheckForOverflowUnderflow = "false" + ConfigurationOverrideFile = "" + DefineConstants = "TRACE" + DocumentationFile = "" + DebugSymbols = "false" + FileAlignment = "4096" + IncrementalBuild = "false" + NoStdLib = "false" + NoWarn = "" + Optimize = "true" + OutputPath = ".\" + RegisterForComInterop = "false" + RemoveIntegerChecks = "false" + TreatWarningsAsErrors = "false" + WarningLevel = "4" + /> + </Settings> + <References> + <Reference + Name = "System" + AssemblyName = "System" + HintPath = "C:\WINNT\Microsoft.NET\Framework\v1.0.3705\System.dll" + /> + <Reference + Name = "System.Data" + AssemblyName = "System.Data" + HintPath = "C:\WINNT\Microsoft.NET\Framework\v1.0.3705\System.Data.dll" + /> + <Reference + Name = "System.XML" + AssemblyName = "System.Xml" + HintPath = "C:\WINNT\Microsoft.NET\Framework\v1.0.3705\System.XML.dll" + /> + </References> + </Build> + <Files> + <Include> + <File + RelPath = "App.config" + BuildAction = "None" + /> + <File + RelPath = "MethodRenamer.cs" + SubType = "Code" + BuildAction = "Compile" + /> + </Include> + </Files> + </CSHARP> +</VisualStudioProject> + Index: MethodRenamer.cs =================================================================== RCS file: /cvsroot/mvp-xml/EXSLT/v1/src/MethodRenamer/MethodRenamer.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- MethodRenamer.cs 15 Oct 2005 21:18:47 -0000 1.2 +++ MethodRenamer.cs 22 Oct 2005 21:18:08 -0000 1.3 @@ -5,51 +5,44 @@ using System.Text; using System.Configuration; -namespace Mvp.Xml.Exslt.MethodRenamer -{ - /// <summary> - /// An utility to rename methods in MSIL code. - /// </summary> - public class MethodRenamer - { - [STAThread] - static void Main(string[] args) - { - IDictionary dictionary = (IDictionary)ConfigurationManager.GetSection("names"); - //Reads input IL code - StreamReader reader = new StreamReader(args[0]); - //Writes output IL code - StreamWriter writer = new StreamWriter(args[1]); - string line; - //Go read line by line - while ((line = reader.ReadLine()) != null) - { - //Method definition? - if (line.Trim().StartsWith(".method")) - { - writer.WriteLine(line); - line = reader.ReadLine(); - if (line.IndexOf("(") != -1) - { - string methodName = line.Trim().Substring(0, line.Trim().IndexOf("(")); - if (dictionary.Contains(methodName)) - { - writer.WriteLine(line.Replace(methodName + "(", - "'" + (string)dictionary[methodName] + "'(")); - Console.WriteLine("Found '" + methodName + "' method, renamed to '" + - dictionary[methodName] + "'"); +namespace Mvp.Xml.Exslt.MethodRenamer { + /// <summary> + /// An utility to rename methods in MSIL code. + /// </summary> + public class MethodRenamer { + [STAThread] + static void Main(string[] args) { + IDictionary dictionary = (IDictionary)ConfigurationSettings.GetConfig("names"); + //Reads input IL code + StreamReader reader = new StreamReader(args[0]); + //Writes output IL code + StreamWriter writer = new StreamWriter(args[1]); + string line; + //Go read line by line + while ((line = reader.ReadLine())!=null) { + //Method definition? + if (line.Trim().StartsWith(".method")) { + writer.WriteLine(line); + line = reader.ReadLine(); + if (line.IndexOf("(")!=-1) { + string methodName = line.Trim().Substring(0, line.Trim().IndexOf("(")); + if (dictionary.Contains(methodName)) { + writer.WriteLine(line.Replace(methodName+"(", + "'"+(string)dictionary[methodName]+"'(")); + Console.WriteLine("Found '" + methodName + "' method, renamed to '" + + dictionary[methodName] + "'"); + } + else + writer.WriteLine(line); + } + else + writer.WriteLine(line); + } + else + writer.WriteLine(line); } - else - writer.WriteLine(line); - } - else - writer.WriteLine(line); + reader.Close(); + writer.Close(); } - else - writer.WriteLine(line); - } - reader.Close(); - writer.Close(); } - } -} \ No newline at end of file +} |