Пример #1
0
        public static void FindPossibleValuesForKey(string file, string key)
        {
            KVLib.KeyValue srcDoc = KVLib.KVParser.KV1.Parse(File.ReadAllText(file));

            List <string> foundValues = new List <string>();


            foreach (KVLib.KeyValue k in srcDoc.Children)
            {
                KVLib.KeyValue val = k[key];
                if (val == null)
                {
                    continue;
                }
                string sval = val.GetString();
                if (!foundValues.Contains(sval))
                {
                    foundValues.Add(sval);
                }
            }

            KVLib.KeyValue outDoc = new KVLib.KeyValue("PossibleValues");
            int            count  = 0;

            foreach (string s in foundValues)
            {
                outDoc += new KVLib.KeyValue(count.ToString()) + s;
                count++;
            }

            File.WriteAllText(key + ".txt", outDoc.ToString());
        }
Пример #2
0
        public static void FindPossibleValuesForKey(string file, string key)
        {
            KVLib.KeyValue srcDoc = KVLib.KVParser.KV1.Parse(File.ReadAllText(file));

            List<string> foundValues = new List<string>();


            foreach (KVLib.KeyValue k in srcDoc.Children)
            {
                KVLib.KeyValue val = k[key];
                if (val == null) continue;
                string sval = val.GetString();
                if (!foundValues.Contains(sval)) foundValues.Add(sval);
            }

            KVLib.KeyValue outDoc = new KVLib.KeyValue("PossibleValues");
            int count = 0;
            foreach (string s in foundValues)
            {
                outDoc += new KVLib.KeyValue(count.ToString()) + s;
                count++;
            }

            File.WriteAllText(key + ".txt", outDoc.ToString());
        }
Пример #3
0
        public static void GenerateDataPropertiesFromKeyValues(string file, string baseKey, string outputFile)
        {
            KVLib.KeyValue kv = KVLib.KVParser.KV1.Parse(File.ReadAllText(file));
            kv = kv[baseKey];

            KVLib.KeyValue doc = new KVLib.KeyValue("Schema");


            foreach (KVLib.KeyValue k in kv.Children)
            {
                KVLib.KeyValue property = new KVLib.KeyValue(k.Key);
                property += new KVLib.KeyValue("Category") + "Misc";
                property += new KVLib.KeyValue("Description") + "No Description Set";
                string type = DetermineType(k);
                property += new KVLib.KeyValue("Type") + type;
                property += new KVLib.KeyValue("DefaultValue") + k.GetString();

                doc += property;
            }

            File.WriteAllText(outputFile, doc.ToString());
        }
Пример #4
0
        public static void GenerateDataPropertiesFromKeyValues(string file, string baseKey, string outputFile)
        {
            KVLib.KeyValue kv = KVLib.KVParser.KV1.Parse(File.ReadAllText(file));
            kv = kv[baseKey];

            KVLib.KeyValue doc = new KVLib.KeyValue("Schema");


            foreach (KVLib.KeyValue k in kv.Children)
            {
                KVLib.KeyValue property = new KVLib.KeyValue(k.Key);
                property += new KVLib.KeyValue("Category") + "Misc";
                property += new KVLib.KeyValue("Description") + "No Description Set";
                string type = DetermineType(k);
                property += new KVLib.KeyValue("Type") + type;
                property += new KVLib.KeyValue("DefaultValue") + k.GetString();

                doc += property;


            }

            File.WriteAllText(outputFile, doc.ToString());
        }