mirror of
https://github.com/twiglet/cs2j.git
synced 2025-01-18 13:15:17 +01:00
better error message when we can't read trasnlation template
This commit is contained in:
parent
a49a462f45
commit
f2ddedd5eb
@ -360,7 +360,7 @@ namespace Twiglet.CS2J.Translator
|
|||||||
// Verify the signature of the signed XML.
|
// Verify the signature of the signed XML.
|
||||||
if (!VerifyXml(xmlDoc, RsaKey))
|
if (!VerifyXml(xmlDoc, RsaKey))
|
||||||
{
|
{
|
||||||
Console.Out.WriteLine("Bad / Missing signature found for " + fullName);
|
Console.Out.WriteLine("Bad / Missing signature found for " + fullName);
|
||||||
badXmlTxCount--;
|
badXmlTxCount--;
|
||||||
if (badXmlTxCount <= 0)
|
if (badXmlTxCount <= 0)
|
||||||
{
|
{
|
||||||
@ -374,9 +374,13 @@ namespace Twiglet.CS2J.Translator
|
|||||||
|
|
||||||
txStream.Seek(0, SeekOrigin.Begin);
|
txStream.Seek(0, SeekOrigin.Begin);
|
||||||
}
|
}
|
||||||
TypeRepTemplate t = TypeRepTemplate.newInstance(txStream);
|
try {
|
||||||
// Fullname has form: <path>/<key>.xml
|
TypeRepTemplate t = TypeRepTemplate.newInstance(txStream);
|
||||||
AppEnv[t.TypeName+(t.TypeParams != null && t.TypeParams.Length > 0 ? "'" + t.TypeParams.Length.ToString() : "")] = t;
|
// Fullname has form: <path>/<key>.xml
|
||||||
|
AppEnv[t.TypeName+(t.TypeParams != null && t.TypeParams.Length > 0 ? "'" + t.TypeParams.Length.ToString() : "")] = t;
|
||||||
|
} catch (Exception e) {
|
||||||
|
Console.WriteLine ("WARNING -- Could not import " + fullName + " (" + e.Message + ")");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Here's where we do the real work...
|
// Here's where we do the real work...
|
||||||
|
@ -2218,38 +2218,34 @@ namespace Twiglet.CS2J.Translator.TypeRep
|
|||||||
string typeType = null;
|
string typeType = null;
|
||||||
// class, interface, enum, etc.
|
// class, interface, enum, etc.
|
||||||
bool found = false;
|
bool found = false;
|
||||||
|
|
||||||
try {
|
while (reader.Read () && !found) {
|
||||||
while (reader.Read () && !found) {
|
if (reader.NodeType == XmlNodeType.Element) {
|
||||||
if (reader.NodeType == XmlNodeType.Element) {
|
switch (reader.LocalName) {
|
||||||
switch (reader.LocalName) {
|
case "Class":
|
||||||
case "Class":
|
typeType = "Twiglet.CS2J.Translator.TypeRep.ClassRepTemplate";
|
||||||
typeType = "Twiglet.CS2J.Translator.TypeRep.ClassRepTemplate";
|
break;
|
||||||
break;
|
case "Struct":
|
||||||
case "Struct":
|
typeType = "Twiglet.CS2J.Translator.TypeRep.StructRepTemplate";
|
||||||
typeType = "Twiglet.CS2J.Translator.TypeRep.StructRepTemplate";
|
break;
|
||||||
break;
|
case "Interface":
|
||||||
case "Interface":
|
typeType = "Twiglet.CS2J.Translator.TypeRep.InterfaceRepTemplate";
|
||||||
typeType = "Twiglet.CS2J.Translator.TypeRep.InterfaceRepTemplate";
|
break;
|
||||||
break;
|
case "Enum":
|
||||||
case "Enum":
|
typeType = "Twiglet.CS2J.Translator.TypeRep.EnumRepTemplate";
|
||||||
typeType = "Twiglet.CS2J.Translator.TypeRep.EnumRepTemplate";
|
break;
|
||||||
break;
|
case "Delegate":
|
||||||
case "Delegate":
|
typeType = "Twiglet.CS2J.Translator.TypeRep.DelegateRepTemplate";
|
||||||
typeType = "Twiglet.CS2J.Translator.TypeRep.DelegateRepTemplate";
|
break;
|
||||||
break;
|
default:
|
||||||
default:
|
typeType = "UnknownType";
|
||||||
typeType = "UnknownType";
|
break;
|
||||||
break;
|
}
|
||||||
}
|
found = true;
|
||||||
found = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
s.Seek (0, SeekOrigin.Begin);
|
|
||||||
ret = (TypeRepTemplate)Deserialize (s, System.Type.GetType (typeType));
|
|
||||||
} catch (Exception e) {
|
|
||||||
Console.WriteLine ("WARNING -- (Deserialize) " + e.Message);
|
|
||||||
}
|
}
|
||||||
|
s.Seek (0, SeekOrigin.Begin);
|
||||||
|
ret = (TypeRepTemplate)Deserialize (s, System.Type.GetType (typeType));
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user