コード例 #1
0
 private void ExecuteTests(string version)
 {
     foreach (var p in new Testdata().ReadTestfiles(version))
     {
         string actualJsx = AbstractNode.Decode(p.Jsxbin, false);
         Assert.True(p.Jsx == actualJsx, $"Decoding JSXBIN {version} does not match expected output in {p.JsxFilename}.");
     }
 }
コード例 #2
0
 private void ExecuteTests(string version)
 {
     foreach (var p in new Testdata().ReadTestfiles(version))
     {
         string actualJsx = AbstractNode.Decode(p.Jsxbin, false);
         Assert.AreEqual(p.Jsx, actualJsx, string.Format("Decoding JSXBIN {0} does not match expected output in {1}.", version, p.JsxFilename));
     }
 }
コード例 #3
0
 static void Decode(DecodeArgs decoderArgs)
 {
     try
     {
         Console.WriteLine("Decoding {0}", decoderArgs.JsxbinFilepath);
         string jsxbin = File.ReadAllText(decoderArgs.JsxbinFilepath, Encoding.ASCII);
         string jsx    = AbstractNode.Decode(jsxbin, decoderArgs.PrintStructure);
         jsx = new Beautifier().Beautify(jsx);
         File.WriteAllText(decoderArgs.JsxFilepath, jsx, Encoding.UTF8);
         Console.WriteLine("Jsxbin successfully decoded to {0}", decoderArgs.JsxFilepath);
     }
     catch (Exception ex)
     {
         Console.WriteLine("Decoding failed. If this problem persists, please raise an issue on github. Error message: {0}. Stacktrace: {1}.", ex.Message, ex.StackTrace);
     }
 }