Exemple #1
0
        private static bool LoadDataBase(string path, AddNewCrncMethod AddCrnc)
        {
            DB_Validate(path);
            StreamReader sr;

            try
            {
                sr = new StreamReader(path);
            }
            catch
            {
                return(false);
            }

            string line;

            while ((line = sr.ReadLine()) != null)
            {
                if (line.Length == 3)
                {
                    AddCrnc(line);
                }
            }

            sr.Close();


            return(true);
        }
Exemple #2
0
        public static void DB_Load(string db_path, AddNewCrncMethod AddCrnc)
        {
            if (LoadDataBase(db_path, AddCrnc))
            {
                return;
            }

            string[] defCrncs = new string[]
            {
                "USD", "EUR", "UAH", "AUD", "AZN",
                "ALL", "DZD", "XCD", "AOA", "ARS",
                "AWG", "AFN", "BSD", "BDT", "BBD",
                "BHD", "BYN", "XOF", "BOB", "BRL",
                "BIF", "BTN", "VUV", "GBP", "VES",
                "XAF", "VND", "GYD", "GHS", "GMD"
            };
            foreach (string crnc in defCrncs)
            {
                AddCrnc(crnc);
            }

            SaveDataBase(db_path, new List <string>(defCrncs));
        }