Пример #1
5
 static void LoadFile(DataAccess da, int version_id, string filename, bool is_todo, bool is_missing, bool is_niex)
 {
     Console.WriteLine ("Loading {0}...", filename);
     using (StreamReader reader = new StreamReader (filename)) {
         string comment;
         string line;
         int n = 0;
         while ((line = reader.ReadLine ()) != null) {
             string name = line.Trim ();
             comment = null;
             if (is_todo) {
                 string [] parts = name.Split ('-');
                 name = parts [0].Trim ();
                 comment = parts [1].Trim ();
                 if (comment == "")
                     comment = null;
             }
             da.InsertMember (version_id, name, is_todo, is_missing, is_niex, false, null, comment);
             n++;
             if ((n % 1000) == 0)
                 Console.WriteLine (n);
         }
     }
 }
Пример #2
0
 static int LoadVersion(DataAccess da, string base_path)
 {
     string filename = Path.Combine (base_path, "version.txt");
     string name = null;
     DateTime date;
     using (StreamReader reader = new StreamReader (filename)) {
         name = reader.ReadLine ().Trim ();
         date = DateTime.Parse (reader.ReadLine ());
     }
     if (String.IsNullOrEmpty (name))
         throw new ApplicationException ("Invalid name");
     Console.WriteLine ("Version: {0} Date: {1}", name, date);
     return da.InsertVersion (name, date);
 }
Пример #3
0
 static void LoadTodo(DataAccess da, int version_id, string base_path)
 {
     LoadFile (da, version_id, Path.Combine (base_path, "monotodo.txt"), true, false, false);
 }
Пример #4
0
 static void LoadMissing(DataAccess da, int version_id, string base_path)
 {
     LoadFile (da, version_id, Path.Combine (base_path, "missing.txt"), false, true, false);
 }
Пример #5
0
 static void LoadException(DataAccess da, int version_id, string base_path)
 {
     LoadFile (da, version_id, Path.Combine (base_path, "exception.txt"), false, false, true);
 }