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

remove trial only 'features'

This commit is contained in:
Kevin Glynn 2013-03-15 17:16:18 +01:00
parent 376a374301
commit 9f06a5d2d1
5 changed files with 2 additions and 121 deletions

View File

@ -9,10 +9,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Antlr3.Runtime", "Antlr.Run
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CS2JTemplateGenerator", "CS2JTemplateGenerator\CS2JTemplateGenerator.csproj", "{B72D065B-862A-469B-87F1-2E521AC7CA08}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CS2JTemplateGenerator", "CS2JTemplateGenerator\CS2JTemplateGenerator.csproj", "{B72D065B-862A-469B-87F1-2E521AC7CA08}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CS2JTemplateSigner", "CS2JTemplateSigner\CS2JTemplateSigner.csproj", "{DF234BD4-A292-4C92-AC8E-F97D3E821079}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CS2JKeyGenerator", "CS2JKeyGenerator\CS2JKeyGenerator.csproj", "{F294E768-56C3-438A-A3E5-8FA39825262E}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Nini", "Nini\Nini.csproj", "{CB5C2235-43B2-4B37-B866-D5D33F0E68B0}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Nini", "Nini\Nini.csproj", "{CB5C2235-43B2-4B37-B866-D5D33F0E68B0}"
EndProject EndProject
Global Global

View File

@ -39,7 +39,6 @@ namespace Twiglet.CS2J.Translator
private static StringTemplateGroup templates = null; private static StringTemplateGroup templates = null;
private static bool doEarlyExit = false; private static bool doEarlyExit = false;
private static RSACryptoServiceProvider RsaKey = null;
private static int badXmlTxCountTrigger = 3 + 4 - 2; private static int badXmlTxCountTrigger = 3 + 4 - 2;
private static int badXmlTxCount = badXmlTxCountTrigger; private static int badXmlTxCount = badXmlTxCountTrigger;
@ -313,18 +312,6 @@ namespace Twiglet.CS2J.Translator
AppEnv.Alts.Add(alt); AppEnv.Alts.Add(alt);
} }
// Initialise RSA signing key so that we can verify signatures
RsaKey = new RSACryptoServiceProvider();
string rsaPubXml = RSAPubKey.PubKey;
// Comment out code to read pub key from a file. To easy to re-sign xml files and import your own key!
// if (!String.IsNullOrEmpty(cfg.KeyFile))
// {
// XmlReader reader = XmlReader.Create(cfg.KeyFile);
// reader.MoveToContent();
// rsaPubXml = reader.ReadOuterXml();
// }
RsaKey.FromXmlString(rsaPubXml);
// Load .Net templates // Load .Net templates
// Do we have schemas for the templates? // Do we have schemas for the templates?
if (cfg.NetSchemaDir.Count == 0) if (cfg.NetSchemaDir.Count == 0)
@ -545,33 +532,6 @@ namespace Twiglet.CS2J.Translator
// Suck in translation file // Suck in translation file
Stream txStream = new FileStream(fullName, FileMode.Open, FileAccess.Read); Stream txStream = new FileStream(fullName, FileMode.Open, FileAccess.Read);
if (numLines < numLines - 1)
{
// TRIAL ONLY
// Create a new XML document.
XmlDocument xmlDoc = new XmlDocument();
// Load an XML file into the XmlDocument object.
xmlDoc.PreserveWhitespace = true;
xmlDoc.Load(txStream);
// Verify the signature of the signed XML.
if (!VerifyXml(xmlDoc, RsaKey))
{
Console.Out.WriteLine("WARNING: Bad / Missing signature found for " + fullName);
badXmlTxCount--;
if (badXmlTxCount <= 0)
{
Console.Out.WriteLine("\n This is a trial version of CS2J. It is to be used for evaluation purposes only.");
Console.Out.WriteLine(" The .Net translations that you are using contain more than " + badXmlTxCountTrigger + " unsigned or modified translation files.");
Console.Out.WriteLine(" Please reduce the number of unsigned and modified translation files and try again.");
Console.Out.WriteLine("\n Contact Twiglet Software at info@twigletsoftware.com (http://www.twigletsoftware.com) for licensing details.");
Environment.Exit(1);
}
}
txStream.Seek(0, SeekOrigin.Begin);
}
try { try {
TypeRepTemplate t = TypeRepTemplate.newInstance(txStream); TypeRepTemplate t = TypeRepTemplate.newInstance(txStream);
// Fullname has form: <path>/<key>.xml // Fullname has form: <path>/<key>.xml
@ -615,18 +575,6 @@ namespace Twiglet.CS2J.Translator
cfg.DebugLevel = saveDebugLevel; cfg.DebugLevel = saveDebugLevel;
} }
private static string limit(string inp) {
if (numLines > numLines - 1)
return inp;
// TRIAL ONLY
String[] lines = inp.Split(newLines, numLines+1, StringSplitOptions.None);
if (lines.Length <= numLines) {
return inp;
}
lines[numLines] = Regex.Replace(lines[numLines], "\\w", "x");
return String.Join(Environment.NewLine, lines);
}
// Here's where we do the real work... // Here's where we do the real work...
public static void translateFile(string fullName) public static void translateFile(string fullName)
{ {
@ -754,7 +702,7 @@ namespace Twiglet.CS2J.Translator
{ {
if (cfg.DebugLevel >= 1) Console.Out.WriteLine("Writing out {0}", javaFName); if (cfg.DebugLevel >= 1) Console.Out.WriteLine("Writing out {0}", javaFName);
StreamWriter javaW = new StreamWriter(javaFName); StreamWriter javaW = new StreamWriter(javaFName);
javaW.Write(limit(outputMaker.compilation_unit().ToString())); javaW.Write(outputMaker.compilation_unit().ToString());
javaW.Close(); javaW.Close();
} }
else else
@ -784,7 +732,7 @@ namespace Twiglet.CS2J.Translator
if (cfg.DebugLevel >= 1) Console.Out.WriteLine("Writing out {0}", serTy.FileName); if (cfg.DebugLevel >= 1) Console.Out.WriteLine("Writing out {0}", serTy.FileName);
StreamWriter javaW = new StreamWriter(serTy.FileName); StreamWriter javaW = new StreamWriter(serTy.FileName);
javaW.Write(limit(pkgST.ToString())); javaW.Write(pkgST.ToString());
javaW.Close(); javaW.Close();
} }
} }

View File

@ -1,9 +0,0 @@
using System;
using System.Reflection;
// Control Eazfuscator.NET
[assembly: Obfuscation(Feature = "code control flow obfuscation", Exclude = false)]
[assembly: Obfuscation(Feature = "Apply to type Twiglet.CS2J.Translator.TypeRep.*: all", Exclude = true, ApplyToMembers = true)]
[assembly: Obfuscation(Feature = "Apply to type Twiglet.CS2J.Translator.Transform.JavaMaker: all", Exclude = true, ApplyToMembers = true)]
[assembly: Obfuscation(Feature = "Apply to type AntlrCSharp.csParser: all", Exclude = true, ApplyToMembers = true)]

View File

@ -1,52 +0,0 @@
/*
Copyright 2010,2011 Kevin Glynn (kevin.glynn@twigletsoftware.com)
*/
using System;
using System.Text;
namespace Twiglet.CS2J.Translator
{
public class RSAPubKey
{
private static string _key = @"
<RSAKeyValue>
<Modulus>iTXgwMVsIk25/pstsBVNNVONs5Q4haeikef5YcRBuTh6slndGs5cj7h0LSHRqPNesp3EwVmwJYY11bDkutN1+rzs9EH3X4vJI6SKgKEHDi5ZV1kfZ8eA3xos8TKNvE4WK33+0ZmZJYkL0sknFyEOIGVmk/OiAlsriNZ7NeerWuU=</Modulus>
<Exponent>EQ==</Exponent>
</RSAKeyValue>
";
public static string PubKey {
get
{
string[] xx = _key.Split(new Char[] { '<','>' });
if (xx.Length != 13)
throw new ArgumentException("Signing Key is malformed");
xx[4] = new RSAPubKey().furl(xx[4].ToCharArray());
StringBuilder yy = new StringBuilder(xx[0]);
for (int i = 1; i < xx.Length; i+=2) {
yy.Append("<");
yy.Append(xx[i]);
yy.Append(">");
yy.Append(xx[i+1]);
}
return yy.ToString();
}
}
private string
furl(Char[] key)
{
Char zz = key[7];
key[7] = key[21];
key[21] = zz;
zz = key[key.Length - 7];
key[key.Length - 7] = key[key.Length - 21];
key[key.Length - 21] = zz;
return new String(key);
}
}
}

View File

@ -52,7 +52,6 @@
<Compile Include="CS2JMain\CS2JMain.cs" /> <Compile Include="CS2JMain\CS2JMain.cs" />
<Compile Include="CS2JMain\CS2JSettings.cs" /> <Compile Include="CS2JMain\CS2JSettings.cs" />
<Compile Include="CS2JMain\Main.cs" /> <Compile Include="CS2JMain\Main.cs" />
<Compile Include="CS2JMain\Obfuscate.cs" />
<Compile Include="CS2JMain\Templates.cs" /> <Compile Include="CS2JMain\Templates.cs" />
<Compile Include="CS2JTemplate\TranslationTemplate.cs" /> <Compile Include="CS2JTemplate\TranslationTemplate.cs" />
<Compile Include="CS2JTransform\CommonWalker.cs" /> <Compile Include="CS2JTransform\CommonWalker.cs" />
@ -63,7 +62,6 @@
<Compile Include="CS2JUtil\Constants.cs" /> <Compile Include="CS2JUtil\Constants.cs" />
<Compile Include="CS2JUtil\DirectoryHT.cs" /> <Compile Include="CS2JUtil\DirectoryHT.cs" />
<Compile Include="CS2JUtil\Set.cs" /> <Compile Include="CS2JUtil\Set.cs" />
<Compile Include="CS2JMain\RSAPubKey.cs" />
<Compile Include="CS2JTransform\NetFragments.cs" /> <Compile Include="CS2JTransform\NetFragments.cs" />
<Compile Include="CS2JTransform\SyntaxFragments.cs" /> <Compile Include="CS2JTransform\SyntaxFragments.cs" />
</ItemGroup> </ItemGroup>