-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit a935b65
Showing
11 changed files
with
517 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# Auto detect text files and perform LF normalization | ||
* text=auto | ||
|
||
|
||
# Custom for Visual Studio | ||
*.cs text diff=csharp eol=crlf | ||
*.sln text merge=union eol=crlf | ||
*.csproj text merge=union eol=crlf | ||
*.vbproj text merge=union | ||
*.fsproj text merge=union | ||
*.dbproj text merge=union | ||
*.ascx text eol=crlf | ||
*.xaml text eol=crlf | ||
*.cmd text eol=crlf | ||
*.ps1 text eol=crlf | ||
*.coffee text eol=crlf | ||
*.config text eol=crlf | ||
*.css text eol=crlf | ||
*.nuspec text eol=crlf | ||
*.scss text eol=crlf | ||
*.cshtml text eol=crlf | ||
*.htm text eol=crlf | ||
*.html text eol=crlf | ||
*.js text eol=crlf | ||
*.ts text eol=crlf | ||
*.msbuild text eol=crlf | ||
*.resx text merge=union | ||
*.ruleset text | ||
*.Stylecop text | ||
*.targets text eol=crlf | ||
*.tt text | ||
*.txt text eol=crlf | ||
*.vb text eol=crlf | ||
*.vbhtml text eol=crlf | ||
*.xml text eol=crlf | ||
*.xunit text eol=crlf | ||
|
||
*.bmp binary | ||
*.gif binary | ||
*.ico binary | ||
*.jpg binary | ||
*.png binary | ||
|
||
|
||
|
||
# Standard to msysgit | ||
*.doc diff=astextplain | ||
*.DOC diff=astextplain | ||
*.docx diff=astextplain | ||
*.DOCX diff=astextplain | ||
*.dot diff=astextplain | ||
*.DOT diff=astextplain | ||
*.pdf diff=astextplain | ||
*.PDF diff=astextplain | ||
*.rtf diff=astextplain | ||
*.RTF diff=astextplain |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,153 @@ | ||
## Ignore Visual Studio temporary files, build results, and | ||
## files generated by popular Visual Studio add-ons. | ||
|
||
# User-specific files | ||
*.suo | ||
*.user | ||
*.sln.docstates | ||
|
||
# Databases | ||
*.sqlite3 | ||
|
||
# Build results | ||
|
||
[Dd]ebug/ | ||
[Rr]elease/ | ||
[Bb]in/ | ||
[Oo]bj/ | ||
[Bb]uild-[Aa]rtifacts/ | ||
|
||
# Enable "build/" folder in the NuGet Packages folder since NuGet packages use it for MSBuild targets | ||
# !packages/*/build/ | ||
|
||
# MSTest test Results | ||
[Tt]est[Rr]esult*/ | ||
[Bb]uild[Ll]og.* | ||
|
||
*_i.c | ||
*_p.c | ||
*.ilk | ||
*.meta | ||
*.obj | ||
*.pch | ||
*.pdb | ||
*.pgc | ||
*.pgd | ||
*.rsp | ||
*.sbr | ||
*.tlb | ||
*.tli | ||
*.tlh | ||
*.tmp | ||
*.tmp_proj | ||
*.log | ||
*.vspscc | ||
*.vssscc | ||
.builds | ||
*.pidb | ||
*.log | ||
*.scc | ||
|
||
# Visual C++ cache files | ||
ipch/ | ||
*.aps | ||
*.ncb | ||
*.opensdf | ||
*.sdf | ||
*.cachefile | ||
|
||
# Visual Studio profiler | ||
*.psess | ||
*.vsp | ||
*.vspx | ||
|
||
# Guidance Automation Toolkit | ||
*.gpState | ||
|
||
# ReSharper is a .NET coding add-in | ||
_ReSharper*/ | ||
*.[Rr]e[Ss]harper | ||
|
||
# TeamCity is a build add-in | ||
_TeamCity* | ||
|
||
# DotCover is a Code Coverage Tool | ||
*.dotCover | ||
|
||
# NCrunch | ||
*.ncrunch* | ||
.*crunch*.local.xml | ||
|
||
# Installshield output folder | ||
[Ee]xpress/ | ||
|
||
# DocProject is a documentation generator add-in | ||
DocProject/buildhelp/ | ||
DocProject/Help/*.HxT | ||
DocProject/Help/*.HxC | ||
DocProject/Help/*.hhc | ||
DocProject/Help/*.hhk | ||
DocProject/Help/*.hhp | ||
DocProject/Help/Html2 | ||
DocProject/Help/html | ||
|
||
# Click-Once directory | ||
publish/ | ||
|
||
# Publish Web Output | ||
*.Publish.xml | ||
*.pubxml | ||
|
||
# NuGet Packages Directory | ||
## TODO: If you have NuGet Package Restore enabled, uncomment the next line | ||
# packages/ | ||
|
||
# Windows Azure Build Output | ||
csx | ||
*.build.csdef | ||
|
||
# Windows Store app package directory | ||
AppPackages/ | ||
|
||
# Others | ||
sql/ | ||
*.Cache | ||
ClientBin/ | ||
[Ss]tyle[Cc]op.* | ||
~$* | ||
*~ | ||
*.dbmdl | ||
*.[Pp]ublish.xml | ||
*.pfx | ||
*.publishsettings | ||
|
||
# RIA/Silverlight projects | ||
Generated_Code/ | ||
|
||
# Backup & report files from converting an old project file to a newer | ||
# Visual Studio version. Backup files are not needed, because we have git ;-) | ||
_UpgradeReport_Files/ | ||
Backup*/ | ||
UpgradeLog*.XML | ||
UpgradeLog*.htm | ||
|
||
# SQL Server files | ||
App_Data/*.mdf | ||
App_Data/*.ldf | ||
|
||
# ========================= | ||
# Windows detritus | ||
# ========================= | ||
|
||
# Windows image file caches | ||
Thumbs.db | ||
ehthumbs.db | ||
|
||
# Folder config file | ||
Desktop.ini | ||
|
||
# Recycle Bin used on file shares | ||
$RECYCLE.BIN/ | ||
|
||
# Mac crap | ||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio 2012 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ResourceMigrator", "ResourceMigrator\ResourceMigrator.csproj", "{2E82D15B-B11F-42D6-BC50-D28D73991047}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{2E82D15B-B11F-42D6-BC50-D28D73991047}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{2E82D15B-B11F-42D6-BC50-D28D73991047}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{2E82D15B-B11F-42D6-BC50-D28D73991047}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{2E82D15B-B11F-42D6-BC50-D28D73991047}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
EndGlobal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<configuration> | ||
<startup> | ||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" /> | ||
</startup> | ||
</configuration> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using System.Text; | ||
|
||
namespace ResourceMigrator | ||
{ | ||
public static class Droid | ||
{ | ||
public static void WriteToTarget(FileSystemInfo sourceFile, string targetDir, Dictionary<string, string> strings) | ||
{ | ||
var resourceType = sourceFile.GetResourceType(); | ||
var builder = new StringBuilder(); | ||
|
||
builder.AppendLine("<?xml version=\"1.0\" encoding=\"utf-8\"?>"); | ||
builder.Append(@" | ||
<!-- .......................................................................... | ||
<auto-generated> | ||
This code was generated by a tool. | ||
Runtime Version:" + Helpers.GetAssemblyVersion() + @" (ResourceMigrator.exe) | ||
Changes to this file may cause incorrect behavior and will be lost if | ||
the code is regenerated. | ||
</auto-generated> | ||
........................................................................... --> | ||
"); | ||
|
||
builder.AppendLine("<resources>"); | ||
|
||
foreach (var key in strings.Keys) | ||
{ | ||
builder.Append(" "); | ||
builder.AppendLine(string.Format("<{0} name=\"{1}\">{2}</{0}>", resourceType, key, strings[key].ToEscapedString())); | ||
} | ||
|
||
builder.AppendLine("</resources>"); | ||
|
||
var outputFileName = Path.GetFileNameWithoutExtension(sourceFile.Name) + ".xml"; | ||
File.WriteAllText(Path.Combine(targetDir, outputFileName), builder.ToString()); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Globalization; | ||
using System.IO; | ||
using System.Text; | ||
using System.Xml; | ||
|
||
namespace ResourceMigrator | ||
{ | ||
public static class Extensions | ||
{ | ||
public static string ToEscapedString(this string input) | ||
{ | ||
var literal = new StringBuilder(input.Length + 2); | ||
foreach (var c in input) | ||
{ | ||
switch (c) | ||
{ | ||
case '\'': literal.Append(@"\'"); break; | ||
case '\"': literal.Append("\\\""); break; | ||
case '\\': literal.Append(@"\\"); break; | ||
case '\0': literal.Append(@"\0"); break; | ||
case '\a': literal.Append(@"\a"); break; | ||
case '\b': literal.Append(@"\b"); break; | ||
case '\f': literal.Append(@"\f"); break; | ||
case '\n': literal.Append(@"\n"); break; | ||
case '\r': literal.Append(@"\r"); break; | ||
case '\t': literal.Append(@"\t"); break; | ||
case '\v': literal.Append(@"\v"); break; | ||
default: | ||
if (Char.GetUnicodeCategory(c) != UnicodeCategory.Control) | ||
{ | ||
literal.Append(c); | ||
} | ||
else | ||
{ | ||
literal.Append(@"\u"); | ||
literal.Append(((ushort)c).ToString("x4")); | ||
} | ||
break; | ||
} | ||
} | ||
return literal.ToString(); | ||
} | ||
|
||
public static Dictionary<string, string> LoadResources(this FileSystemInfo file) | ||
{ | ||
if (file == null) throw new ArgumentNullException("file"); | ||
var result = new Dictionary<string, string>(); | ||
|
||
var doc = new XmlDocument(); | ||
doc.Load(file.FullName); | ||
|
||
var nodes = doc.SelectNodes("//data"); | ||
|
||
if (nodes != null) | ||
foreach (XmlNode node in nodes) | ||
{ | ||
if (node.Attributes == null) continue; | ||
var name = node.Attributes["name"].Value; | ||
var value = node.ChildNodes[1].InnerText; | ||
result.Add(name, value); | ||
} | ||
|
||
return result; | ||
} | ||
|
||
public static string GetResourceType(this FileSystemInfo fileName) | ||
{ | ||
switch (fileName.Name.ToLower().Substring(0, Math.Min(3, fileName.Name.Length))) | ||
{ | ||
case "col": | ||
return "color"; | ||
case "boo": | ||
return "bool"; | ||
case "dim": | ||
return "dimen"; | ||
case "ite": | ||
return "item"; | ||
case "int": | ||
return "integer"; | ||
default: | ||
return "string"; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
using System.Reflection; | ||
|
||
namespace ResourceMigrator | ||
{ | ||
public class Helpers | ||
{ | ||
public static string GetAssemblyVersion() | ||
{ | ||
return Assembly.GetAssembly(typeof(Program)).GetName().Version.ToString(); | ||
} | ||
} | ||
} |
Oops, something went wrong.