Example #1
0
 public string GetFileId(string path)
 {
     try
     {
         return(FileProvide.GetInstance(path).ID);
     }
     catch (Exception e)
     {
         Log(e.ToString());
         throw;
     }
 }
Example #2
0
 public FileStates GetFileStates(string path)
 {
     try
     {
         return(FileProvide.GetInstance(path).States);
     }
     catch (Exception e)
     {
         Log(e.ToString());
         throw;
     }
 }
Example #3
0
 public FileStates[] GetProvidedFiles()
 {
     try
     {
         return(FileProvide.GetProvidedFiles().Select(p => p.States).ToArray());
     }
     catch (Exception e)
     {
         Log(e.ToString());
         throw;
     }
 }
Example #4
0
 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;
     }
 }
Example #5
0
 public void StartUnprovideFileForAll(string path)
 {
     try
     {
         FileProvide file = FileProvide.GetInstance(path);
         Task.Run(new Action(file.Unprovide));
     }
     catch (Exception e)
     {
         Log(e.ToString());
         throw;
     }
 }
Example #6
0
 public void UnprovideFileForAll(string path)
 {
     try
     {
         FileProvide file = FileProvide.GetInstance(path);
         file.Unprovide();
     }
     catch (Exception e)
     {
         Log(e.ToString());
         throw;
     }
 }
Example #7
0
        public string ProvideFile(string path)
        {
            try
            {
                FileProvide file = FileProvide.GetInstance(path);
                file.ProvideOne();

                return(file.ID);
            }
            catch (Exception e)
            {
                Log(e.ToString());
                throw;
            }
        }
Example #8
0
        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;
            }
        }
Example #9
0
        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);
            }
        }