1
0
mirror of https://github.com/twiglet/cs2j.git synced 2025-01-18 13:15:17 +01:00

reference old TranslationTemplate

This commit is contained in:
Kevin Glynn 2010-12-30 18:45:36 +01:00
parent a309b80531
commit 99211b1a8c
2 changed files with 19 additions and 12 deletions

View File

@ -5,6 +5,8 @@ using NDesk.Options;
using RusticiSoftware.Translator.CLR; using RusticiSoftware.Translator.CLR;
using RusticiSoftware.Translator.Utils; using RusticiSoftware.Translator.Utils;
using System.Xml.Serialization; using System.Xml.Serialization;
using RusticiSoftware.Translator;
using OldT = RusticiSoftware.Translator.TypeRepTemplate;
namespace UpdateTxFiles namespace UpdateTxFiles
{ {
@ -13,8 +15,8 @@ namespace UpdateTxFiles
private const string VERSION = "2010.1.1"; private const string VERSION = "2010.1.1";
private static int Verbosity = 0; private static int Verbosity = 0;
private static DirectoryHT<TypeRepTemplate> oldAppEnv = new DirectoryHT<TypeRepTemplate>(null); private static DirectoryHT<OldT> oldAppEnv = new DirectoryHT<OldT>(null);
private static DirectoryHT<TypeRepTemplate> newAppEnv = new DirectoryHT<TypeRepTemplate>(null); private static DirectoryHT<OldT> newAppEnv = new DirectoryHT<OldT>(null);
public delegate void FileProcessor(string fName); public delegate void FileProcessor(string fName);
@ -60,19 +62,20 @@ namespace UpdateTxFiles
foreach (string r in inDirs) foreach (string r in inDirs)
doFile(r, ".xml", addOldNetTranslation, null); doFile(r, ".xml", addOldNetTranslation, null);
foreach (KeyValuePair<string,TypeRepTemplate> de in oldAppEnv) foreach (KeyValuePair<string,OldT> de in oldAppEnv)
{ {
String xmlFName = Path.Combine(outDir, String xmlFName = Path.Combine(outDir,
((string)de.Key).Replace('.', Path.DirectorySeparatorChar) + ".xml"); ((string)de.Key).Replace('.', Path.DirectorySeparatorChar) + ".xml");
String xmlFDir = Path.GetDirectoryName(xmlFName); String xmlFDir = Path.GetDirectoryName(xmlFName);
if (!Directory.Exists(xmlFDir)) Console.WriteLine (xmlFName + ": " + de.Value.Java);
{ // if (!Directory.Exists(xmlFDir))
Directory.CreateDirectory(xmlFDir); // {
} // Directory.CreateDirectory(xmlFDir);
XmlSerializer s = new XmlSerializer(de.Value.GetType()); // }
TextWriter w = new StreamWriter(xmlFName); // XmlSerializer s = new XmlSerializer(de.Value.GetType());
s.Serialize(w, de.Value); // TextWriter w = new StreamWriter(xmlFName);
w.Close(); // s.Serialize(w, de.Value);
// w.Close();
} }
} }
else else
@ -127,7 +130,7 @@ namespace UpdateTxFiles
public static void addOldNetTranslation(string fullName) public static void addOldNetTranslation(string fullName)
{ {
Stream s = new FileStream(fullName, FileMode.Open, FileAccess.Read); Stream s = new FileStream(fullName, FileMode.Open, FileAccess.Read);
TypeRepTemplate t = TypeRepTemplate.newInstance(s); OldT t = OldT.newInstance(s);
oldAppEnv[t.TypeName] = t; oldAppEnv[t.TypeName] = t;
} }
} }

View File

@ -32,6 +32,10 @@
<ItemGroup> <ItemGroup>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Xml" /> <Reference Include="System.Xml" />
<Reference Include="Translator, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\antlr2\Translator\bin\Debug\Translator.exe</HintPath>
</Reference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="Main.cs" /> <Compile Include="Main.cs" />