Fixed issue #96.
Added a small application to fix future issues with embedded escape codes. Also fixed some encoding issues with the pt-BR files. git-svn-id: https://duplicati.googlecode.com/svn/trunk@298 59da171f-624f-0410-aa54-27559c288bec
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 10.00
|
||||
# Visual C# Express 2008
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ResXEscapeCodeFixer", "ResXEscapeCodeFixer\ResXEscapeCodeFixer.csproj", "{982E3EB3-369D-4DF4-AA73-C875D388F1BB}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{982E3EB3-369D-4DF4-AA73-C875D388F1BB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{982E3EB3-369D-4DF4-AA73-C875D388F1BB}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{982E3EB3-369D-4DF4-AA73-C875D388F1BB}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{982E3EB3-369D-4DF4-AA73-C875D388F1BB}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
@@ -0,0 +1,72 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.IO;
|
||||
|
||||
namespace ResXEscapeCodeFixer
|
||||
{
|
||||
class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
string startpath = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
|
||||
if (args.Length >= 1)
|
||||
startpath = args[0];
|
||||
|
||||
Console.WriteLine("Root folder is: {0}", startpath);
|
||||
|
||||
Queue<string> folders = new Queue<string>();
|
||||
folders.Enqueue(startpath);
|
||||
|
||||
while (folders.Count > 0)
|
||||
{
|
||||
string folder = folders.Dequeue();
|
||||
|
||||
Console.WriteLine("Processing folder: {0}", folder);
|
||||
|
||||
foreach (string s in Directory.GetDirectories(folder))
|
||||
folders.Enqueue(s);
|
||||
|
||||
foreach (string s in Directory.GetFiles(folder, "*.resx"))
|
||||
FixUpResX(s);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static void FixUpResX(string file)
|
||||
{
|
||||
bool modified = false;
|
||||
Console.WriteLine("Examining file: {0}", Path.GetFileName(file));
|
||||
System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
|
||||
doc.Load(file);
|
||||
|
||||
foreach (System.Xml.XmlNode n in doc.SelectNodes("root/data"))
|
||||
{
|
||||
//TODO: Make sure that xml:space="preserve" is present
|
||||
System.Xml.XmlNode value = n["value"];
|
||||
if (value != null)
|
||||
{
|
||||
if (value.InnerText.IndexOf('\\') > 0)
|
||||
{
|
||||
string newvalue = value.InnerText
|
||||
.Replace("\\r\\n", "\r\n")
|
||||
.Replace("\\n", "\r\n")
|
||||
.Replace("\\r", "\r")
|
||||
.Replace("\\t", "\t")
|
||||
.Replace("\\\"", "\"");
|
||||
if (newvalue != value.InnerText)
|
||||
{
|
||||
Console.WriteLine("Replacing: \r\n\t{0}\r\n\t{1}", value.InnerText, newvalue);
|
||||
value.InnerText = newvalue;
|
||||
modified = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (modified)
|
||||
doc.Save(file);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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("ResXEscapeCodeFixer")]
|
||||
[assembly: AssemblyDescription("A fixup tool for escape sequences in ResX files")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("HexaD")]
|
||||
[assembly: AssemblyProduct("ResXEscapeCodeFixer")]
|
||||
[assembly: AssemblyCopyright("Copyright © HexaD 2009 LGPL")]
|
||||
[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("c975af8a-55b0-42b2-b850-98adfac344f2")]
|
||||
|
||||
// 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")]
|
||||
@@ -0,0 +1,61 @@
|
||||
<?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.30729</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{982E3EB3-369D-4DF4-AA73-C875D388F1BB}</ProjectGuid>
|
||||
<OutputType>Exe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>ResXEscapeCodeFixer</RootNamespace>
|
||||
<AssemblyName>ResXEscapeCodeFixer</AssemblyName>
|
||||
<TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<TargetFrameworkSubset>
|
||||
</TargetFrameworkSubset>
|
||||
</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.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="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="app.config" />
|
||||
</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>
|
||||
@@ -0,0 +1,3 @@
|
||||
<?xml version="1.0"?>
|
||||
<configuration>
|
||||
<startup><supportedRuntime version="v2.0.50727"/></startup></configuration>
|
||||
Reference in New Issue
Block a user