예제 #1
0
        public List <CEpubFicFile> LoadEpubsFromFolder(string vsFilepath)
        {
            try
            {
                var dirs = Directory.EnumerateFiles(vsFilepath, "*.epub", SearchOption.AllDirectories);

                foreach (string currentFile in dirs)
                {
                    CEpubFicFile oEpub = new CEpubFicFile(currentFile);
                    EpubList.Add(oEpub);
                    //string fileName = currentFile.Substring(sourceDirectory.Length + 1);
                    //  Directory.Move(currentFile, Path.Combine(archiveDirectory, fileName));
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
            return(EpubList);

            /*
             *          var dirs = Directory.GetFiles(vsFilepath, "*.epub", SearchOption.AllDirectories);
             *          //this.oEpubFileList.SetObjects(dirs);
             *          foreach (var sfile in dirs)
             *          {
             *                  cEpubFile oEpub = new cEpubFile(sfile);
             *
             *                  _epubList.Add(oEpub);
             *                  //    count ++;
             *          }
             *          return null;
             * */
        }
예제 #2
0
        private async Task DoWork(CEpubFicFile epubFile)
        {
            Func <string> function = new Func <string>(() => MakeWork(epubFile));
            TaskFactory   oFactory = new TaskFactory();
            string        res      = await oFactory.StartNew <string>(function);

            Task task = Task.Factory.StartNew(DoWork(epubFile.LoadFileAsync()));
            //  task.
        }
예제 #3
0
        private async Task <int> HandleFileAsync(string vDir)
        {
            //Console.WriteLine("HandleFile enter");
            int count = 0;
            var dirs  = Directory.GetFiles(vDir, "*.epub", SearchOption.AllDirectories);

            //this.oEpubFileList.SetObjects(dirs);
            foreach (var sfile in dirs)
            {
                CEpubFicFile oEpub = new CEpubFicFile(sfile);
                //	lblStatus.Text = sfile;
                EpubList.Add(oEpub);
                count++;
            }
            //		oEpubFileList.SetObjects(_epubList);
            return(count);
        }
예제 #4
0
        private async void ProcessDataAsync(string vDir)
        {
            // Start the HandleFile method.
            //   Task<int> task = HandleFileAsync(sFileName);
            var dirs = Directory.GetFiles(vDir, "*.epub", SearchOption.AllDirectories);

            //this.oEpubFileList.SetObjects(dirs);
            foreach (var sfile in dirs)
            {
                CEpubFicFile oEpub = new CEpubFicFile(sfile);
                //	lblStatus.Text = sfile;
                EpubList.Add(oEpub);
                // count ++;
            }
            //		oEpubFileList.SetObjects(_epubList);
            //int x = await task;
            //lblProcessed.Text = x.ToString();
        }
예제 #5
0
 private string MakeWork(CEpubFicFile epubFile)
 {
     epubFile.LoadFile();
     return(epubFile.FileName);
 }
예제 #6
0
 private Task CreateReadTask(CEpubFicFile epub)
 {
     return(null);
 }