public static void SaveRepository(SurfAlgo algo) { if (algo == SurfAlgo.Linear) { SaveRepoForLinear(); } else { SaveRepoForFlann(); } }
public static bool IsRepositoryInMemoryLoaded(SurfAlgo algo) { if (algo == SurfAlgo.Linear) { return(Exists(_SURFRecord2List)); } else { return(Exists(_superMatrixDataSet)); } }
/// <summary> /// Load the cache from the File /// </summary> /// <param name="fullFileName">File the full file path, else, it will try to load from default file if it exists</param> /// <returns></returns> public static void LoadRespositoryFromFile(SurfAlgo surfAlgo, string fullFileName = "") { string repoFileStoragePath = string.Empty; string defaultRepoFileStorageName = surfAlgo == SurfAlgo.Linear ? "observerFeatureSets.bin" : "superMatrix.bin"; if (string.IsNullOrWhiteSpace(fullFileName)) { repoFileStoragePath = Path.Combine(SaveDirectoryPath, defaultRepoFileStorageName); } else { repoFileStoragePath = fullFileName; } if (!File.Exists(repoFileStoragePath)) { throw new ArgumentException(string.Format("Can't find Surf Repository file at {0} :", repoFileStoragePath)); } FileStream stream = File.OpenRead(repoFileStoragePath); var formatter = new BinaryFormatter(); if (surfAlgo == SurfAlgo.Linear) { List <SURFRecord2> observerFeatureSets = (List <SURFRecord2>)formatter.Deserialize(stream); stream.Close(); AddSURFRecord2List(observerFeatureSets); } else if (surfAlgo == SurfAlgo.Flaan) { SuperMatrixType superMatrix = (SuperMatrixType)formatter.Deserialize(stream); stream.Close(); AddSuperMatrixList(superMatrix); } //Polenter.Serialization.SharpSerializerBinarySettings st = new Polenter.Serialization.SharpSerializerBinarySettings(Polenter.Serialization.BinarySerializationMode.SizeOptimized); //Polenter.Serialization.SharpSerializer serializer = new Polenter.Serialization.SharpSerializer(st); //List<SURFRecord2> observerFeatureSets = (List<SURFRecord2>)serializer.Deserialize(repoFileStoragePath); }
public static void SaveRepository(SurfAlgo algo) { if (algo == SurfAlgo.Linear) SaveRepoForLinear(); else SaveRepoForFlann(); }
/// <summary> /// Load the cache from the File /// </summary> /// <param name="fullFileName">File the full file path, else, it will try to load from default file if it exists</param> /// <returns></returns> public static void LoadRespositoryFromFile(SurfAlgo surfAlgo, string fullFileName = "") { string repoFileStoragePath = string.Empty; string defaultRepoFileStorageName = surfAlgo == SurfAlgo.Linear ? "observerFeatureSets.bin" : "superMatrix.bin"; if (string.IsNullOrWhiteSpace(fullFileName)) { repoFileStoragePath = Path.Combine(SaveDirectoryPath, defaultRepoFileStorageName); } else { repoFileStoragePath = fullFileName; } if (!File.Exists(repoFileStoragePath)) throw new ArgumentException(string.Format("Can't find Surf Repository file at {0} :", repoFileStoragePath)); FileStream stream = File.OpenRead(repoFileStoragePath); var formatter = new BinaryFormatter(); if (surfAlgo == SurfAlgo.Linear) { List<SURFRecord2> observerFeatureSets = (List<SURFRecord2>)formatter.Deserialize(stream); stream.Close(); AddSURFRecord2List(observerFeatureSets); } else if (surfAlgo == SurfAlgo.Flaan) { SuperMatrixType superMatrix = (SuperMatrixType)formatter.Deserialize(stream); stream.Close(); AddSuperMatrixList(superMatrix); } //Polenter.Serialization.SharpSerializerBinarySettings st = new Polenter.Serialization.SharpSerializerBinarySettings(Polenter.Serialization.BinarySerializationMode.SizeOptimized); //Polenter.Serialization.SharpSerializer serializer = new Polenter.Serialization.SharpSerializer(st); //List<SURFRecord2> observerFeatureSets = (List<SURFRecord2>)serializer.Deserialize(repoFileStoragePath); }
public static bool IsRepositoryInMemoryLoaded(SurfAlgo algo) { if (algo == SurfAlgo.Linear) { return Exists(_SURFRecord2List); } else { return Exists(_superMatrixDataSet); } }