internal static int Main(string[] args) { Contract.Ensures(Contract.Result <int>() <= 0); #if DEBUG File.WriteAllText("args.txt", string.Join("\", \"", args)); #endif try { me = new Xslt(); Tuple <bool, XsltError> argsSuccess = me.ProcessArgs(args); if (!argsSuccess.Item1) { return((int)argsSuccess.Item2); } return((int)me.Process()); } catch (Exception ex) { #if DEBUG ShowError(false, string.Format(CultureInfo.CurrentCulture, XsltResources.Exception, ex.ToString()), XsltError.SystemError, string.Format(CultureInfo.CurrentCulture, "0x{0:X}".ToLower(CultureInfo.CurrentCulture), (int)XsltError.SystemError)); #else ShowError(false, string.Format(CultureInfo.CurrentCulture, XsltResources.Exception, ex.Message), string.Format(CultureInfo.CurrentCulture, "0x{0:X}".ToLower(CultureInfo.CurrentCulture), (int)XsltError.MSXSL_E_SYSTEM_ERROR)); #endif return((int)XsltError.SystemError); } finally { Console.BackgroundColor = CurrentBackgroundColor; Console.ForegroundColor = CurrentForegroundColor; } }
private static void RunTest(string[] args, int exitcode, string diffFile) { int result = Xslt.Main(args); Assert.AreEqual(result, exitcode); if (!string.IsNullOrEmpty(diffFile)) { string baseline = File.ReadAllText(Path.Combine("Useful\\Tests\\XsltTest\\baseline", diffFile)); string output = File.ReadAllText(diffFile); Assert.AreEqual(baseline, output); } }