private static void InitializeDecoders(ScanState scanState, double version) { decoders.Clear(); var type = typeof(INode); var types = AppDomain.CurrentDomain.GetAssemblies() .SelectMany(s => s.GetTypes()) .Where(p => p.IsClass && !p.IsAbstract && p.IsSubclassOf(typeof(AbstractNode))); foreach (var t in types) { INode n = (INode)Activator.CreateInstance(t); if (n.JsxbinVersion == ALL_VERSIONS || n.JsxbinVersion == version) { decoders.Add(n.Marker, t); } } if (version == 1.0) { referenceDecoder = new ReferenceDecoderVersion1(); } else { referenceDecoder = new ReferenceDecoderVersion2(); } }
public char GetCurrentAndAdvanceCore(ScanState scanState) { char cur = scanState.getCur(); scanState.Inc(); return(cur); }
public static string Decode(string jsxbin, bool printStructure) { string normalized = jsxbin.Replace("\n", "").Replace("\r", "").Replace("\\", ""); Match versionMatch = Regex.Match(normalized, "^@JSXBIN@ES@([\\d.]+)@"); double version = ALL_VERSIONS; if (versionMatch.Success) version = double.Parse(versionMatch.Groups[1].Value, CultureInfo.InvariantCulture); string noheader = Regex.Replace(normalized, "^@JSXBIN@ES@[\\d.]+@", ""); scanState = new ScanState(noheader); InitializeDecoders(scanState, version); var root = new RootNode(); root.PrintStructure = printStructure; root.Decode(); var jsx = root.PrettyPrint(); return string.Join(Environment.NewLine, jsx); }
public static string Decode(string jsxbin, bool printStructure) { string normalized = jsxbin.Replace("\n", "").Replace("\r", "").Replace("\\", ""); Match versionMatch = Regex.Match(normalized, "^@JSXBIN@ES@([\\d.]+)@"); double version = ALL_VERSIONS; if (versionMatch.Success) { version = double.Parse(versionMatch.Groups[1].Value); } string noheader = Regex.Replace(normalized, "^@JSXBIN@ES@[\\d.]+@", ""); scanState = new ScanState(noheader); InitializeDecoders(scanState, version); var root = new RootNode(); root.PrintStructure = printStructure; root.Decode(); var jsx = root.PrettyPrint(); return(string.Join(Environment.NewLine, jsx)); }
public char GetCurrentAndAdvance(ScanState scanState) { return(GetCurrentAndAdvanceCore(scanState)); }
private static void InitializeDecoders(ScanState scanState, double version) { decoders.Clear(); var type = typeof(INode); var types = AppDomain.CurrentDomain.GetAssemblies() .SelectMany(s => s.GetTypes()) .Where(p => p.IsClass && !p.IsAbstract && p.IsSubclassOf(typeof(AbstractNode))); foreach (var t in types) { INode n = (INode)Activator.CreateInstance(t); if (n.JsxbinVersion == ALL_VERSIONS || n.JsxbinVersion == version) decoders.Add(n.Marker, t); } if (version == 1.0) referenceDecoder = new ReferenceDecoderVersion1(); else referenceDecoder = new ReferenceDecoderVersion2(); }
public char GetCurrentAndAdvanceCore(ScanState scanState) { char cur = scanState.getCur(); scanState.Inc(); return cur; }
public char GetCurrentAndAdvance(ScanState scanState) { return GetCurrentAndAdvanceCore(scanState); }