Beispiel #1
0
        public Dictionary <string, FlagList> GetFlagLists(string folderPath)
        {
            Dictionary <string, FlagList> flagList = new Dictionary <string, FlagList>();

            string[] fileEntries = Directory.GetFiles(folderPath);
            foreach (string fileName in fileEntries)
            {
                if (fileName.EndsWith(".xml"))
                {
                    AddToFlagList(xmlLoader.GetFlagLists(fileName), ref flagList);
                }
                else
                {
                    continue;
                }
            }

            string[] subdirectoryEntries = Directory.GetDirectories(folderPath);
            foreach (string subdirectory in subdirectoryEntries)
            {
                GetFlagLists(subdirectory);
            }

            return(flagList);
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            var source = "";
            var target = "";

            if (args.Length == 2)
            {
                source = args[0];
                target = args[1];
            }
            while (!isValid(source))
            {
                Console.Write("Source File: ");
                source = Console.ReadLine();
            }
            while (!isValid(target))
            {
                Console.Write("Target File: ");
                target = Console.ReadLine();
            }

            try
            {
                ILoader     loader     = GetLoader(target);
                var         flagList   = loader.GetFlagLists(source);
                IConversion conversion = GetConversion(Path.GetExtension(target));
                conversion.Convert(flagList, Path.GetFileName(source), target, "error.txt");
                Console.WriteLine("Success!!");
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
        }
Beispiel #3
0
 void LoadFlagLists(ILoader loader)
 {
     flagLists = loader.GetFlagLists(filePath);
     comboBoxFlaga.Items.Clear();
     if (flagLists.Count == 0)
     {
         return;
     }
     foreach (KeyValuePair <string, FlagList> pair in flagLists)
     {
         comboBoxFlaga.Items.Add(pair.Key);
     }
     if (comboBoxFlaga.Items.Count > 0)
     {
         comboBoxFlaga.SelectedIndex = 0;
         selectedFlagList            = flagLists[comboBoxFlaga.Items[0].ToString()];
     }
 }