예제 #1
0
 protected void LoadIndex()
 {
     DBIndex = new DBIndex();
     string[] files = Directory.GetFiles(MainDirPath, "*" + EXTENSION_DATA);
     for (int i = 0; i < files.Length; i++)
     {
         string dataName = Path.GetFileNameWithoutExtension(files[i]);
         DBIndex.Add(dataName);
     }
 }
예제 #2
0
        public static DBIndex LoadFromString(string indexString)
        {
            DBIndex dbIndex = JsonConvert.DeserializeObject <DBIndex>(indexString);

            if (dbIndex == null)
            {
                dbIndex = new DBIndex();
            }
            return(dbIndex);
        }
예제 #3
0
 protected void LoadIndex()
 {
     try
     {
         Log("Load index.");
         string data = File.ReadAllText(IndexFilePath, ENCODING);
         DBIndex = DBIndex.LoadFromString(data);
     }
     catch (Exception ex)
     {
         LogWarning("Load index failed, Creating a new one.\n" + ex.Message);
         DBIndex = new DBIndex();
     }
 }