Esempio n. 1
0
        private static void LoadUpTerms()
        {
            var ut    = new UpTerms();
            var items = LoadJsonUp();

            for (int i = 0; i <= items.Types.Count; i++)
            {
                Console.WriteLine(ut.Types[i].Enum.Value);
            }
        }
Esempio n. 2
0
        public static UpTerms LoadJsonUp()
        {
            JsonSerializer serializer = new JsonSerializer();
            UpTerms        items      = new UpTerms();

            using (FileStream s = File.Open(@"C:\Users\xdaval\Documents\ALLFO\upp.json", FileMode.Open))
                using (StreamReader sr = new StreamReader(s))
                    using (JsonReader reader = new JsonTextReader(sr))
                    {
                        while (reader.Read())
                        {
                            // deserialize only when there's "{" character in the stream
                            if (reader.TokenType == JsonToken.StartObject)
                            {
                                items = serializer.Deserialize <UpTerms>(reader);
                            }
                        }
                    }
            return(items);
        }