예제 #1
0
파일: Program.cs 프로젝트: EugeneMostert/EM
        private static void Read(string json)
        {
            Hierarchy         = new FileHierArchy();
            Hierarchy.Classes = new List <Class>();
            bool           isClass    = false;
            bool           isProperty = false;
            JsonTextReader reader     = new JsonTextReader(new StringReader(json));

            while (reader.Read())
            {
                if (reader.Value != null)
                {
                    if (isClass)
                    {
                        Hierarchy.Classes.Add(new Class(reader.Value.ToString(), AccessModifier.Public));
                        isProperty = true;
                        isClass    = false;
                    }
                    Console.WriteLine("Token: {0}, Value: {1}", reader.TokenType, reader.Value);
                }
                else
                {
                    Console.WriteLine("Token: {0}", reader.TokenType);
                    if (reader.TokenType == JsonToken.StartObject)
                    {
                        isClass = true;//Hierarchy.Classes.Add(new Class { Name = })
                    }
                }
            }
        }
예제 #2
0
        public FileHierArchy ConstructClass()
        {
            var dic   = new Dictionary <string, object>();
            var props = new Dictionary <string, string>();

            FileHierarchy           = new FileHierArchy();
            FileHierarchy.Namespace = NameSpace;
            FileHierarchy.Classes   = new List <Class>();

            RecursiveClasses(IntialClassName, JObject);

            return(FileHierarchy);
        }
예제 #3
0
 public NamespaceWriter(FileHierArchy fileHierArchy, bool addAttritbute)
 {
     this.FileHierarchy = fileHierArchy;
     this.AddAttritbute = addAttritbute;
     FileBuilder        = new StringBuilder();
 }