/// <summary> /// Handles the index building process for specified range. /// </summary> private void BuildIndex(IDatabaseProcessor <T> processor, FileInfo[] dataFiles, int startIndex, int loopCount) { var localIndex = new JObject[loopCount]; for (int i = 0; i < loopCount; i++) { var file = dataFiles[i + startIndex]; localIndex[i] = processor.LoadData(Path.GetFileNameWithoutExtension(file.Name), false).SerializeIndex(); } lock (index) { for (int i = 0; i < localIndex.Length; i++) { Set(localIndex[i]); } } }
/// <summary> /// Returns data which loads the full data on-the-go. /// </summary> private IEnumerator <T> GetLoadingData(List <JObject> source) { // If fully loaded, simply convert the Json object to type T. if (fullLoaded) { foreach (var s in source) { yield return(processor.ConvertToData(s)); } } // If not fully loaded, load the data and convert to type T. else { foreach (var s in source) { yield return(processor.LoadData(s["Id"].ToString(), true)); } } }