public string GetFileId(string path) { try { return(FileProvide.GetInstance(path).ID); } catch (Exception e) { Log(e.ToString()); throw; } }
public FileStates GetFileStates(string path) { try { return(FileProvide.GetInstance(path).States); } catch (Exception e) { Log(e.ToString()); throw; } }
public FileStates[] GetProvidedFiles() { try { return(FileProvide.GetProvidedFiles().Select(p => p.States).ToArray()); } catch (Exception e) { Log(e.ToString()); throw; } }
public FileStates[] GetProvidedFilesPage(int pageSize, int pageIndex) { try { IEnumerable <FileProvide> files = FileProvide.GetProvidedFiles().Skip(pageSize * pageIndex).Take(pageSize); return(files.Select(p => p.States).ToArray()); } catch (Exception e) { Log(e.ToString()); throw; } }
public void StartUnprovideFileForAll(string path) { try { FileProvide file = FileProvide.GetInstance(path); Task.Run(new Action(file.Unprovide)); } catch (Exception e) { Log(e.ToString()); throw; } }
public void UnprovideFileForAll(string path) { try { FileProvide file = FileProvide.GetInstance(path); file.Unprovide(); } catch (Exception e) { Log(e.ToString()); throw; } }
public string ProvideFile(string path) { try { FileProvide file = FileProvide.GetInstance(path); file.ProvideOne(); return(file.ID); } catch (Exception e) { Log(e.ToString()); throw; } }
public string StartProvideFile(string path) { try { FileProvide file = FileProvide.GetInstance(path); Task.Run(new Action(file.ProvideOne)); return(file.ID); } catch (Exception e) { Log(e.ToString()); throw; } }
public static FileProvide GetInstance(string path) { lock (provideFiles) { if (provideFiles.TryGetValue(path, out FileProvide file)) { return(file); } file = new FileProvide(path); provideFiles.Add(path, file); return(file); } }