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); } }
public static DBIndex LoadFromString(string indexString) { DBIndex dbIndex = JsonConvert.DeserializeObject <DBIndex>(indexString); if (dbIndex == null) { dbIndex = new DBIndex(); } return(dbIndex); }
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(); } }