Esempio n. 1
0
 private static void HandleFiles(ProcessFile processFile, string filePattern)
 {
     if (filePattern.Contains("*"))
     {
         ProcessAsterix(filePattern, processFile);
     }
     else if (filePattern.Equals("-r"))
     {
         Stack<string> stack = new Stack<string>();
         stack.Push(Directory.GetCurrentDirectory());
         while (stack.Count > 0)
         {
             string dir = stack.Pop();
             DirectoryInfo dirInfo = new DirectoryInfo(dir);
             string pattern = Path.Combine(dirInfo.FullName, "*.jpg");
             ProcessAsterix(pattern, processFile);
             try
             {
                 foreach (string dn in Directory.GetDirectories(dir))
                 {
                     stack.Push(dn);
                 }
             }
             catch (Exception ex)
             {
                 log.WarnFormat("Failed to find directory: {0}", ex);
             }
         }
     }
     else
     {
         ProcessOneFile(filePattern, processFile);
     }
 }
Esempio n. 2
0
        internal static double RunProcessFile(ProcessFile processFile, string filePath, IKeyValueCollection keyValueCollection, IUIntCollection uIntCollection)
        {
            double processTime = 0;

            try
            {
                var time = processFile?.Invoke(filePath, keyValueCollection, uIntCollection);
                processTime = time == null ? 0 : time.Value;
            }
            catch (OutOfMemoryException)
            {
                Console.WriteLine("Not enough memory. Couldn't perform this test.");
                processTime = 0;
            }
            catch (Exception)
            {
                Console.WriteLine("EXCEPTION. Couldn't perform this test.");
                processTime = 0;
            }

            GC.Collect();
            Thread.Sleep(1000);

            return(processTime);
        }
Esempio n. 3
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            var tempPath = Path.Combine(env.ContentRootPath, "temp");

            CreateDirectory(tempPath);

            app.UseTus(context => new DefaultTusConfiguration
            {
                //Local onde os arquivos temporários serão salvos
                Store = new TusDiskStore(tempPath),
                // URL onde os uploads devem ser realizados.
                UrlPath = "/upload",
                Events  = new Events
                {
                    //O que fazer quando o upload for finalizado
                    OnFileCompleteAsync = async ctx =>
                    {
                        var file = await((ITusReadableStore)ctx.Store).GetFileAsync(ctx.FileId, ctx.CancellationToken);
                        await ProcessFile.SaveFileAsync(file, env);
                    }
                }
            });

            app.UseStaticFiles();
        }
Esempio n. 4
0
        public async Task ProcessFileLogicImgNoTag()
        {
            var file = new FakeFile {
                ContentType = string.Empty
            };

            var data  = new FakeApiDataEntityHandler <VisibleFile>();
            var logic = new CoreApiLogicHandler();
            var cloud = new FakeCloudHandler();

            logic.Result.Setup(m => m.Execute(It.IsAny <ProcessImage>()))
            .Returns(ActionConfirm.CreateSuccess("File Processed"));

            var command = new ProcessFile
            {
                DataHandler  = data,
                Source       = file,
                CloudHandler = cloud,
                LogicHandler = logic,
                CurrentUser  = StandardUser
            };

            await command.Execute();

            cloud.HasExecuted.Should().BeFalse();
            logic.HasExecuted.Should().BeTrue();

            data.HasExecuted.Should().BeFalse();
            data.HasCommitted.Should().BeFalse();
            logic.Result.Verify(s => s.Execute(It.IsAny <ProcessImage>()), Times.Once());
        }
Esempio n. 5
0
        public async Task ProcessFileLogicVid()
        {
            var file = new FakeFile {
                ContentType = "video", FileName = "vid.mp4"
            };

            var data  = new FakeApiDataEntityHandler <VisibleFile>();
            var logic = new CoreApiLogicHandler();
            var cloud = new FakeCloudHandler();

            var command = new ProcessFile
            {
                DataHandler  = data,
                Source       = file,
                CloudHandler = cloud,
                LogicHandler = logic,
                CurrentUser  = StandardUser
            };

            await command.Execute();

            cloud.HasExecuted.Should().BeFalse();
            logic.HasExecuted.Should().BeFalse();

            data.HasExecuted.Should().BeFalse();
            data.HasCommitted.Should().BeFalse();
            logic.Result.Verify(s => s.Execute(It.IsAny <ProcessImage>()), Times.Never());
        }
Esempio n. 6
0
 private void OnProcessFile(object filename)
 {
     if (ProcessFile != null)
     {
         ProcessFile.Invoke(filename);
     }
 }
Esempio n. 7
0
        public IActionResult PostFileTxt([FromForm] FileText info)
        {
            if (info == null)
            {
                return(BadRequest());
            }

            info.Date = DateTime.Now;
            _log.Add(info).Wait();
            ProcessFile processFile = new ProcessFile(new ProcessFileTxt());

            try
            {
                Response.Headers.Add("Access-Control-Allow-Origin", new[] { (string)Request.Headers["Origin"] });
                MemoryStream fileProcessed = processFile.FileProcess(info.File);
                return(File(fileProcessed, "text/plain", textFileOutput));
            }
            catch (OutOfMemoryException)
            {
                return(BadRequest());
            }
            catch (Exception)
            {
                return(BadRequest());
            }
        }
Esempio n. 8
0
        public void FullUnitTest()
        {
            string inputFile   = GetTestFilePath("UTinput.xml");
            var    testProcess = new ProcessFile(inputFile);

            StreamWriter log;
            var          logPath = GetTestFilePath("server.log");

            if (!File.Exists(logPath))
            {
                log = new StreamWriter(logPath);
            }
            else
            {
                log = File.AppendText(logPath);
            }

            TradeResult tradeResult = testProcess.Run(writeCsv: false, log);

            Assert.AreEqual(3, tradeResult.TradeValues.Count, "TradeValues list is missing some values.");

            Assert.AreEqual(new Tuple <int, int, TradeResult.TradeState>(200, 2, TradeResult.TradeState.Pending), tradeResult.TradeValues[0]);
            Assert.AreEqual(new Tuple <int, int, TradeResult.TradeState>(222, 1, TradeResult.TradeState.Rejected), tradeResult.TradeValues[1]);
            Assert.AreEqual(new Tuple <int, int, TradeResult.TradeState>(234, 3, TradeResult.TradeState.Accepted), tradeResult.TradeValues[2]);
        }
Esempio n. 9
0
        private static ArrayList m_fileList = new ArrayList(); // temp list to hold photo files names

        #endregion Fields

        #region Methods

        // knows about .gpx files and Project.photoAnalyzeOnLoad:
        public static void enlistPhotoFolder(string filename, SortedList foldersToProcess, ProcessFile imageFileProcessor)
        {
            string folderName = null;		// stays null for .loc files
            if (AllFormats.isZipFile(filename))
            {
                folderName = filename;
            }
            else if (AllFormats.isGpxFile(filename))
            {
                if (Project.photoAnalyzeOnLoad)
                {
                    FileInfo fi = new FileInfo(filename);
                    folderName = fi.DirectoryName;
                }
            }
            else
            {
                DirectoryInfo di = new DirectoryInfo(filename);
                if (di.Exists)
                {
                    folderName = di.FullName;
                }
            }

            // gpx and zip files are candidates for processing (containing) folder for photos:
            if (folderName != null && !foldersToProcess.ContainsKey(folderName))
            {
                // delayed processing of photo images in folder(s), as we need to have all trackpoints in memory first to relate to them:
                PhotoFolderToProcess pf = new PhotoFolderToProcess();
                pf.name = folderName;
                pf.imageFileProcessor = imageFileProcessor;
                foldersToProcess.Add(folderName, pf);
            }
        }
Esempio n. 10
0
        static void Main(string[] args)
        {
            try
            {
                int n1 = int.Parse(Console.ReadLine());
                int n2 = int.Parse(Console.ReadLine());

                int result = n1 / n2;

                Console.WriteLine(result);
            }
            catch (DivideByZeroException)
            {
                Console.WriteLine($"Não é possivel dividir por zero");
            }
            catch (FormatException)
            {
                Console.WriteLine($"O numeros devem ser inteiros");
            }
            finally
            {
                //Muito usado para fechar arquivos e conexão com banco
                Console.WriteLine($"Finally");
            }
            Console.WriteLine("Hello World!");

            ProcessFile.Run();
        }
        public void TestProcessFile()
        {
            var output = new StringWriter();

            Console.SetOut(output);

            ProcessFile pf = new ProcessFile();

            pf.ProcessJSONFiles(@"C:\sample-data", @"C:\Processed");

            StringBuilder sb = new StringBuilder();

            sb.AppendLine("Processing drop-1.json");
            sb.AppendLine("Completed drop-1.json");
            sb.AppendLine("Power Tools - Artarmon - 20");
            sb.AppendLine("Power Tools - Notting Hill - 44");
            sb.AppendLine("Power Tools - Notting Hill - 44");
            sb.AppendLine("Power Tools - Oakleigh - 7");
            sb.AppendLine("Processing drop-2.json");
            sb.AppendLine("Discarding drop-2.json, incorrect qtysum");
            sb.AppendLine("Power Tools - Artarmon - 20");
            sb.AppendLine("Power Tools - Notting Hill - 44");
            sb.AppendLine("Power Tools - Notting Hill - 44");
            sb.AppendLine("Power Tools - Oakleigh - 7");
            sb.AppendLine("Processing drop-3.json");
            sb.AppendLine("Completed drop-3.json");
            sb.AppendLine("Power Tools - Artarmon - 21");
            sb.AppendLine("Power Tools - Notting Hill - 44");
            sb.AppendLine("Power Tools - Notting Hill - 44");
            sb.AppendLine("Power Tools - Oakleigh - 12");
            sb.AppendLine("Tiles - Oakleigh - 1");

            Assert.Equal(output.ToString(), sb.ToString());
        }
Esempio n. 12
0
        static void GetSlotNumber()
        {
            ProcessFile fp   = new ProcessFile();
            int         slot = fp.GetSlotNumber();

            Console.WriteLine($"SRED SLOT={slot}");
            Console.ReadKey();
        }
Esempio n. 13
0
        static void Main(string[] args)
        {
            var appPath   = Settings.ApplicationPath();
            var inputPath = Path.Combine(appPath, Settings.Get("InputPath"));
            var outPath   = Path.Combine(appPath, Settings.Get("OutputPath"));

            ProcessFile.Out(inputPath, outPath);
        }
Esempio n. 14
0
        public ActionResult QuestionFileUpload(string selectedFileType, HttpPostedFileBase fileControl,
                                               string selectedSemester, string selectedDepartment, string selectedSubject, string selectedUnit,
                                               string ExamType, string chapterName)
        {
            var extension = Path.GetExtension(fileControl.FileName);

            var subjectId = _context.Courses.FirstOrDefault(u => u.CourseName == selectedSubject)?.Courseid;

            var departmentId = DatabaseData.GetDepartmentInfo(selectedDepartment)?.Id;

            var semesterId = DatabaseData.GetSemesterInfo(selectedSemester)?.Id;

            var unit = Convert.ToInt32(selectedUnit);

            var type = (int)Enum.Parse(typeof(ExamType), ExamType);

            var chapterId = _context.Chapters.FirstOrDefault(x =>
                                                             x.SemesterId == semesterId && x.DepartmentId == departmentId && x.CourseId == subjectId &&
                                                             x.UnitNo == unit && x.ChapterName == chapterName)?.Id;

            // Word file
            if (extension == ".docx" || extension == ".doc")
            {
                ProcessFile.WordFile(fileControl);
            }

            // CSV file
            else if (extension == ".csv" || extension == ".CSV")
            {
                var data = ProcessFile.CsvFile(fileControl);
                if (data.questions == null)
                {
                    TempData["UploadError"] = data.error;
                    return(View("Index"));
                }

                foreach (var q in data.questions)
                {
                    _context.Questions.Add(new Question
                    {
                        ChapterId       = chapterId,
                        CourseId        = subjectId,
                        DepartmentId    = Convert.ToString(departmentId),
                        DifficultyLevel = q.Level,
                        QuestionText    = q.Question,
                        QuestionType    = type,
                        SemesterId      = Convert.ToString(semesterId),
                        UnitId          = unit
                    });
                }
                _context.SaveChangesAsync();

                Alert("Success", "Question set added successfully", Enums.NotificationType.success);

                return(RedirectToAction("Index", "Question"));
            }
            return(null);
        }
Esempio n. 15
0
        public void GetFilterTest_NoFilter()
        {
            List <Message> messages   = ProcessFile.ProcessMessages("MessagesTest.csv", 20, 0);
            FiltersFlds    filterFlds = new FiltersFlds(null, DateTime.MinValue, DateTime.MaxValue, null, "And");
            Filters        filter     = new Filters();
            var            query      = filter.GetFilter(filterFlds, messages);

            Assert.AreEqual(20, query.Count());
        }
Esempio n. 16
0
 public static void FolderTransport(string inputFolder, string outputFolder, ProcessFile pf)
 {
     foreach (string inputFilePath in Directory.EnumerateFiles(inputFolder))
     {
         Console.WriteLine("Processing " + inputFilePath);
         string fileName       = inputFilePath.Split('\\').Last();
         string outputFilePath = Path.Combine(outputFolder, fileName);
         pf(inputFilePath, outputFilePath);
     }
 }
Esempio n. 17
0
 /// <summary>
 /// Processes all files on the given <paramref name="path"/> matching the specified <paramref name="searchPattern"/>.
 /// </summary>
 /// <remarks>
 /// The input <paramref name="path"/> can be a file or a directory.
 /// </remarks>
 /// <param name="path">The root path to the file(s) to be processed.</param>
 /// <param name="searchPattern">The search pattern to be used.  A value of <b>null</b> or <b>""</b> indicates that all files are a match.</param>
 /// <param name="proc">The method to call for each matching file.</param>
 /// <param name="recursive">Whether or not the <paramref name="path"/> should be searched recursively.</param>
 public static void Process(string path, string searchPattern, ProcessFile proc, bool recursive)
 {
     Process(path, searchPattern,
         delegate(string filePath, out bool cancel)
         {
             cancel = false;
             proc(filePath);
         },
         recursive);
 }
Esempio n. 18
0
 /// <summary>
 /// Processes all files on the given <paramref name="path"/> matching the specified <paramref name="searchPattern"/>.
 /// </summary>
 /// <remarks>
 /// The input <paramref name="path"/> can be a file or a directory.
 /// </remarks>
 /// <param name="path">The root path to the file(s) to be processed.</param>
 /// <param name="searchPattern">The search pattern to be used.  A value of <b>null</b> or <b>""</b> indicates that all files are a match.</param>
 /// <param name="proc">The method to call for each matching file.</param>
 /// <param name="recursive">Whether or not the <paramref name="path"/> should be searched recursively.</param>
 public static void Process(string path, string searchPattern, ProcessFile proc, bool recursive)
 {
     Process(path, searchPattern,
             delegate(string filePath, out bool cancel)
     {
         cancel = false;
         proc(filePath);
     },
             recursive);
 }
Esempio n. 19
0
        public void WriteOutputTest()
        {
            var words   = "test";
            var article = "test my test.";

            var outStr = ProcessFile.GenerateOutPut(article, words);


            Assert.IsTrue(outStr.Equals(" a. test {2:1,1}\r\n"));
        }
Esempio n. 20
0
 public static void Launch(ProcessFile file)
 {
     Process.Start(new ProcessStartInfo
     {
         FileName         = file.Path,
         Arguments        = file.Arguments,
         WorkingDirectory = file.StartInFolder,
         WindowStyle      = file.WindowStyle
     });
 }
 public static void Launch(ProcessFile file)
 {
     Process.Start(new ProcessStartInfo
     {
         FileName = file.Path,
         Arguments = file.Arguments,
         WorkingDirectory = file.StartInFolder,
         WindowStyle = file.WindowStyle
     });
 }
Esempio n. 22
0
        public async Task <JsonResult> Index(string stringToProcess)
        {
            //stringToProcess = "Hello";
            string HardCodeString = @"<InputDocument>
			<DeclarationList>
			  <Declaration Command='DEFAULT' Version='5.13'>
				<DeclarationHeader>
				  <Jurisdiction>IE</Jurisdiction>
				  <CWProcedure>IMPORT</CWProcedure>
				  <DeclarationDestination>CUSTOMSWAREIE</DeclarationDestination>
				  <DocumentRef>71Q0019681</DocumentRef>
				  <SiteID>DUB</SiteID>
				  <AccountCode>G0779837</AccountCode>
				  </DeclarationHeader>
				</Declaration>
			</DeclarationList>
		  </InputDocument>
		"        ;

            XmlDocument doc = new XmlDocument();

            doc.LoadXml(HardCodeString);

            try
            {
                doc.LoadXml(string.IsNullOrEmpty(stringToProcess) ? HardCodeString : stringToProcess);


                var    result  = ProcessFile.ProcessFileXml(doc);
                string message = string.Empty;
                switch (result)
                {
                case 0:
                    message = "The document was structured correctly";
                    break;

                case -1:
                    message = "Invalid command specified";
                    break;

                case -2:
                    message = "Invalid Site specified";
                    break;

                default:
                    break;
                }

                return(new JsonResult(new { StatusCode = result, Message = message }));
            }
            catch (XmlException ex)
            {
                return(new JsonResult(ex.ToString()));
            }
        }
Esempio n. 23
0
        public void GetFilterTest_FilterDates()
        {
            List <Message> messages   = ProcessFile.ProcessMessages("MessagesTest.csv", 20, 0);
            DateTime       minDate    = Convert.ToDateTime("02-10-2020");
            DateTime       maxDate    = Convert.ToDateTime("04-10-2020");;
            FiltersFlds    filterFlds = new FiltersFlds(null, minDate, maxDate, null, "And");
            Filters        filter     = new Filters();
            var            query      = filter.GetFilter(filterFlds, messages);

            Assert.AreEqual(12, query.Count());
        }
Esempio n. 24
0
        public void GetFilterTest_FilterDatesORNumberORText()
        {
            List <Message> messages   = ProcessFile.ProcessMessages("MessagesTest.csv", 20, 0);
            DateTime       minDate    = Convert.ToDateTime("02-10-2020");
            DateTime       maxDate    = Convert.ToDateTime("02-10-2020");;
            FiltersFlds    filterFlds = new FiltersFlds("1", minDate, maxDate, "ge 10", "OR");
            Filters        filter     = new Filters();
            var            query      = filter.GetFilter(filterFlds, messages);

            Assert.AreEqual(9, query.Count());
        }
Esempio n. 25
0
        public static int processSmugmugPhotoGalleryImage(ProcessFile imageFileProcessor, string gpxName, string imageName,
                                                          XmlRpcStruct imageUrls, XmlRpcStruct imageExif)
        {
            int ret = 0;

            PhotoDescr photoDescr = PhotoDescr.FromSmugmugPhotoGallery(imageName, imageUrls, imageExif);

            string thumbUrl = photoDescr.imageThumbSource;

            ret = imageFileProcessor(null, null, gpxName, thumbUrl);                    // do the rest of the work

            return(ret);
        }
Esempio n. 26
0
        public static int processSmugmugPhotoGalleryImage(ProcessFile imageFileProcessor, string gpxName, string imageName,
				XmlRpcStruct imageUrls, XmlRpcStruct imageExif)
        {
            int ret = 0;

            PhotoDescr photoDescr = PhotoDescr.FromSmugmugPhotoGallery(imageName, imageUrls, imageExif);

            string thumbUrl = photoDescr.imageThumbSource;

            ret = imageFileProcessor(null, null, gpxName, thumbUrl);	// do the rest of the work

            return ret;
        }
        public async Task <ActionResult> OnPost()
        {
            var rptFileUpload = Path.GetTempPath() + Guid.NewGuid().ToString() + ".txt";
            var tempFile      = Path.GetTempPath() + Guid.NewGuid().ToString() + ".txt";

            using (var fileStream = new FileStream(rptFileUpload, FileMode.Create))
            {
                await Upload.CopyToAsync(fileStream);
            }

            ProcessFile.Process(rptFileUpload, tempFile, _hostingEnvironment.ContentRootPath + "\\Data");
            return(new RedirectToPageResult("Index"));
        }
Esempio n. 28
0
        private void 导出谱图ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            int index;

            if (int.TryParse(dgv_searchRe.SelectedRows[0].Cells[0].Value.ToString(), out index))
            {
                string   sqlstr  = "select Name,Wavelength,Spectrum from JewDataTable  WHERE ID = " + index;
                var      datalst = SqliteHelper.ExecDataTable(sqlstr);
                string   name    = (string)datalst.Rows[0]["Name"];
                double[] wave    = ProcessArray.StringToDouble((string)datalst.Rows[0]["Wavelength"]);
                double[] spec    = ProcessArray.StringToDouble((string)datalst.Rows[0]["Spectrum"]);

                ProcessFile.saveCurrentTwoArray(name, wave, spec);
            }
        }
Esempio n. 29
0
        public void TestAddressesOutputValidation()
        {
            string csvFileName       = Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory, "GoodCSV.csv");
            string addressesFileName = Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory, "GoodAddresses.txt");

            CreateGoodCSV(csvFileName);
            ProcessFile processFile = new ProcessFile();
            var         result      = processFile.ValidateCSV(csvFileName);
            bool        hasHeader   = processFile.ValidateCSVHeader(csvFileName) == "True";

            result = processFile.ProcessCSV(csvFileName, hasHeader);
            result = processFile.ExportAddresses(addressesFileName);
            Assert.IsTrue((string.IsNullOrEmpty(result)) & (File.Exists(addressesFileName)) & (ValidateOutput(addressesFileName, BuildAddressValidationSet())));
            DeleteFile(csvFileName);
            DeleteFile(addressesFileName);
        }
        //Used when delegate is a blocking method
        public async Task BlockingProcessAsync(ProcessFile process)
        {
            var fileList = await driveService.Files.List().ExecuteAsync();

            if (fileList.Items == null)
            {
                Console.WriteLine("No file is found.");
                return;
            }

            var allFiles = fileList.Items;

            foreach (Google.Apis.Drive.v2.Data.File fileResource in allFiles)
            {
                process(fileResource);
            }
        }
Esempio n. 31
0
        public async Task <IActionResult> Upload([FromForm] IFormFile file)
        {
            var process = new ProcessFile {
                CloudHandler = CloudHandler, CurrentUser = CurrentUser, Source = file
            };
            await LogicHandler.Execute(process);

            if (process.Result.Success)
            {
                await DataHandler.Commit();

                var result = Mapper.Map <VisibleViewModel>(process.Model);
                return(Json(result));
            }

            return(NotFound());
        }
Esempio n. 32
0
        private void 导出当前数据ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            int length = (int)processSpec.ShowWavelength_MinMax[1] - (int)processSpec.ShowWavelength_MinMax[0] + 1;

            if (length <= 0)
            {
                return;
            }
            double[] one_nmWave = new double[length];
            for (int i = 0; i < one_nmWave.Length; i++)
            {
                one_nmWave[i] = i + (int)processSpec.ShowWavelength_MinMax[0];
            }
            double[] newy = ProcessArray.FixArrayY(one_nmWave, processSpec.showX, processSpec.showY);

            ProcessFile.saveCurrentTwoArray(DateTime.Now.ToFileTime().ToString(), one_nmWave, newy);
        }
Esempio n. 33
0
        public ProcessFileTests()
        {
            _mockLogger  = new Mock <ILogger <Report> >();
            _processFile = new ProcessFile(_mockLogger.Object);
            Settings settings = new Settings()
            {
                PathSettings = new PathSettings
                {
                    Default = $"{Environment.CurrentDirectory}",
                    In      = "\\data\\in",
                    Out     = "\\data\\out"
                }
            };

            _options = Options.Create(settings);
            Directory.CreateDirectory($"{ _options.Value.PathSettings.Default }{_options.Value.PathSettings.In}");
            Directory.CreateDirectory($"{ _options.Value.PathSettings.Default }{_options.Value.PathSettings.Out}");
        }
Esempio n. 34
0
        private void FileProcess_Click(object sender, EventArgs e)
        {
            string path = @"" + FilePath.Text;
            //Instances of lines of the file, and the class that will get the data

            ProcessFile   processFile;
            FileRW        lines = new FileRW();
            StringBuilder sb    = new StringBuilder();
            string        targetPath;

            try
            {
                //Read
                processFile = new ProcessFile(lines.ReadFile(path));
                sb.AppendLine("Arquivo Lido com suscesso!");
                TextLog.AppendText(sb.ToString());
                //Process
                processFile.CreateConciliation(processFile.Spf);
                sb.AppendLine("Arquivo processado com sucesso!");
                TextLog.Clear();
                TextLog.AppendText(sb.ToString());
                //Write
                targetPath = lines.WriteFile(path, processFile.Conciliations);
                sb.AppendLine("Arquivo gravado com sucesso!");
                sb.AppendLine("Processo Finalizado!");
                TextLog.Clear();
                TextLog.AppendText(sb.ToString());
                //OpenFolder
                Process prc = new Process();
                prc.StartInfo.FileName = targetPath;
                prc.Start();
                path = Path.GetDirectoryName(targetPath);
                prc.StartInfo.WorkingDirectory = path;
                prc.StartInfo.FileName         = path;
                prc.Start();
            }
            catch (IOException ex)
            {
                sb.AppendLine("An error occurred!!");
                sb.AppendLine(ex.Message);
                TextLog.Clear();
                TextLog.AppendText(sb.ToString());
            }
        }
Esempio n. 35
0
        public void TestNamesOutput()
        {
            string csvFileName   = Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory, "GoodCSV.csv");
            string namesFileName = Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory, "GoodNames.txt");
            string nameTestFile  = Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory, "NamesTest.txt");

            CreateGoodCSV(csvFileName);
            CreateNamesTestFile(nameTestFile);
            ProcessFile processFile = new ProcessFile();
            var         result      = processFile.ValidateCSV(csvFileName);
            bool        hasHeader   = processFile.ValidateCSVHeader(csvFileName) == "True";

            result = processFile.ProcessCSV(csvFileName, hasHeader);
            result = processFile.ExportNames(namesFileName);
            Assert.IsTrue((string.IsNullOrEmpty(result)) & (File.Exists(namesFileName)) & (File.Exists(nameTestFile)) & (CompareFileContent(namesFileName, nameTestFile)));
            DeleteFile(csvFileName);
            DeleteFile(namesFileName);
            DeleteFile(nameTestFile);
        }
Esempio n. 36
0
        static void Main(string[] args)
        {

            //if (args.Length == 0)
            //{
            //    Console.WriteLine("Usage:ConcaveGenerator file");
            //}
            //else
            //{
            double value;
            List<Point2d> result = new List<Point2d>();
            ProcessFile data = new ProcessFile();
            List<Coordinate> points = new List<Coordinate>();
            points = data.readFile("greencopy.txt");
            //Console.WriteLine("输入分割阈值:");
            //value = Convert.ToDouble(Console.ReadLine());
            result = data.separate(points, 0.8);
            data.writeFile(result);


            //}

        }
Esempio n. 37
0
        private void checkEdge_Click(object sender, RoutedEventArgs e)
        {
            ProcessFile data = new ProcessFile();
            List<Coordinate> cloud = data.readFile();

            cloud.Sort();
            for (int j = 0, i = 0; i < cloud.Count; i++)
            {
                if (cloud[i].z > cloud[j].z - 0.8)
                {
                    surface.Add(cloud[i]);
                }
                else
                {
                    addList(this.pointList, checkBall());
                    j = i;
                    surface.Clear();
                }
            }
            data.writeFile(this.pointList);
        }
Esempio n. 38
0
        private static void Main(string[] args)
        {
            if (args.Count() == 0)
            {
                Console.WriteLine("PreGoogle filename [exiftool] [simulate]");
            }
            else
            {
                InitilizeLogging();
                Console.Clear();

                ProcessFile processFile = new ProcessFile(log);
                SetParams(args, processFile);

                HandleFiles(processFile, args[0]);
            }
        }
Esempio n. 39
0
        private void processFolder()
        {
            Cursor.Current = Cursors.WaitCursor;
            myFileOrFolder.importFolderButton.Enabled = false;
            myFileOrFolder.browseFolderButton.Enabled = false;
            WaypointsCache.resetBoundaries();

            string photoFolderPath = myFileOrFolder.folderTextBox.Text.Trim();
            Project.photoFolderPath = photoFolderPath;
            Project.insertRecentFile(photoFolderPath);

            ProcessFile imageFileProcessor = new ProcessFile(processImageFile);

            PhotoWaypoints.cleanPhotoTrackpointsBySource(photoFolderPath);
            collectTimeShiftControlValues();

            // read all .gpx files in the folder first:
            DirectoryInfo di = new DirectoryInfo(photoFolderPath);

            SortedList foldersToProcess = new SortedList();
            foreach(FileInfo fi in di.GetFiles())
            {
                if(AllFormats.isGpxFile(fi.FullName) || AllFormats.isLocFile(fi.FullName))
                {
                    FileAndZipIO.readFile(fi.FullName, null, null, imageFileProcessor, foldersToProcess, false);
                }
            }

            if(foldersToProcess.Count == 0)
            {
                // there are no .gpx or loc files there, but may be only images. We are explicitly asked to scan the images and
                // relate them to the trackpoints which are already in memory (say, just received from GPS)

                FileAndZipIO.enlistPhotoFolder(photoFolderPath, foldersToProcess, imageFileProcessor);
            }

            bool needsRefresh = false;

            // delayed processing of photo images in folder(s), as we need to have all trackpoints in memory first to relate to them:
            for(int i=0; i < foldersToProcess.Count ;i++)
            {
                PhotoFolderToProcess pf = (PhotoFolderToProcess)foldersToProcess.GetByIndex(i);

                if(!timeShiftEnabledCheckBox.Checked)
                {
                    bool hasFoundFile = false;
                    FileAndZipIO.readPhotoParameters(pf.name, out hasFoundFile);
                    FileAndZipIO.usedPhotoParametersFile = hasFoundFile;
                    if(hasFoundFile)
                    {
                        needsRefresh = true;
                    }
                }

                FileAndZipIO.processImagesInPhotoFolder(pf.imageFileProcessor, pf.name, true);
            }

            if(m_doZoomIn)
            {
                PictureManager.This.CameraManager.zoomToCorners();
            }
            else
            {
                PictureManager.This.CameraManager.ProcessCameraMove();
            }

            if(needsRefresh)
            {
                configureTimeshiftChoices(false, false);
            }

            setCurrentPhotoPreview();

            myFileOrFolder.importFolderButton.Enabled = true;
            myFileOrFolder.browseFolderButton.Enabled = true;
            Cursor.Current = Cursors.Default;

            setupButtons();
        }
Esempio n. 40
0
        /// <summary>
        /// imageFileProcessor can be null - the default one will be used, same with insertWaypointHandler and insertEarthquakeHandler
        /// 
        /// for a .jpg file just calls image file processor.
        /// for .gpx, .loc, .zip, .gpz and .wpt files calls BaseFormat.processor() and adds to foldersToProcess
        /// 
        /// returns true on success
        /// </summary>
        /// <param name="fileName"></param>
        /// <param name="insertWaypointHandler"></param>
        /// <param name="insertEarthquakeHandler"></param>
        /// <param name="imageFileProcessor"></param>
        /// <param name="foldersToProcess"></param>
        /// <returns></returns>
        public static bool readFile(string fileName, InsertWaypoint insertWaypointHandler, InsertEarthquake insertEarthquakeHandler,
                                        ProcessFile imageFileProcessor, SortedList foldersToProcess, bool addToRecent)
        {
            bool isSuccess = false;

            fileName = Project.GetLongPathName(new FileInfo(fileName).FullName);	// make sure we are not dealing with 8.3 notation here

            if (insertWaypointHandler == null)
            {
                insertWaypointHandler = new InsertWaypoint(WaypointsCache.insertWaypoint);
            }

            if (insertEarthquakeHandler == null)
            {
                insertEarthquakeHandler = new InsertEarthquake(EarthquakesCache.insertEarthquake);
            }

            if (imageFileProcessor == null)
            {
                imageFileProcessor = new ProcessFile(FileAndZipIO.processImageFile);
            }

            if (AllFormats.isTiffFile(fileName))
            {
                #region  Handle a GeoTiff file

                GeoTiff geoTiff = new GeoTiff(fileName);
                try
                {
                    geoTiff.init();
                }
                catch { }

                if (geoTiff.isValid)
                {
                    CustomMapsCache.RemoveCustomMapsBySource(fileName);

                    CustomMap cm = new CustomMapGeotiff(geoTiff);
                    Project.customMapId++;
                    cm.Id = Project.customMapId;
                    CustomMapsCache.AddCustomMap(cm);

                    WaypointsCache.pushBoundaries(cm.Location);
                    WaypointsCache.pushBoundaries(new GeoCoord(geoTiff.BottomLeftLng, geoTiff.BottomLeftLat));
                    WaypointsCache.pushBoundaries(new GeoCoord(geoTiff.TopRightLng, geoTiff.TopRightLat));
                    WaypointsCache.pushBoundaries(new GeoCoord(geoTiff.BottomRightLng, geoTiff.BottomRightLat));

                    // success, worth adding to imported list, if not repeat read:
                    bool repeatRead = isRepeatRead(fileName);
                    if (!repeatRead)
                    {
                        FormattedFileDescr ffd = new FormattedFileDescr(fileName, FileGeoTIFF.FormatName, false);
                        Project.FileDescrList.Add(ffd);
                    }
                    string msg = "OK: read file " + fileName + (repeatRead ? " (repeat read)" : "");
                    LibSys.StatusBar.Trace(msg);
                    LibSys.StatusBar.Trace("* " + msg);

                    isSuccess = true;	// will ensure refresh is called
                }
                else
                {
                    LibSys.StatusBar.Error("readFile - not a GeoTIFF file: " + fileName);
                }
                #endregion  // Handle a GeoTiff file
            }
            else if (fileName.ToLower().EndsWith(".jpg"))
            {
                #region Single JPEG image probably dropped

                PhotoWaypoints.cleanPhotoTrackpoints(fileName);
                try
                {
                    LibSys.StatusBar.Trace("   ...readFile - processing image file: " + fileName);
                    if (imageFileProcessor(null, null, fileName, fileName) > 0)
                    {
                        Project.photoFileName = fileName;
                        isSuccess = true;	// will ensure refresh is called
                    }
                }
                catch (Exception exc)
                {
                    LibSys.StatusBar.Error("Exception: " + exc.Message);
                }
                #endregion // Single JPEG image probably dropped
            }
            else
            {
                LibSys.StatusBar.Trace("   ...readFile - processing formatted file: " + fileName);

                #region Processing formatted file - zip, gpx

                BaseFormat format = AllFormats.formatByFileName(fileName);
                if (format != null)
                {
                    string formatName = AllFormats.formatNameByFileName(fileName);
                    format.InsertWaypoint = insertWaypointHandler;
                    format.InsertEarthquake = insertEarthquakeHandler;
                    FileListStruct fls = new FileListStruct(fileName, formatName, new FormatProcessor(format.process), false);
                    WaypointsCache.RemoveWaypointsBySource(fls.filename);
                    // actually read the file. If ZIP processor is there, it will read all enclosed .GPX files.
                    if (fls.processor("", fls.filename, fls.filename))		// boundaries pushed in WaypointsCache.insertWaypoint()
                    {
                        // knows about .gpx files and Project.photoAnalyzeOnLoad:
                        enlistPhotoFolder(fls.filename, foldersToProcess, imageFileProcessor);

                        // success, worth adding to imported list, if not repeat read:
                        bool repeatRead = isRepeatRead(fileName);
                        if (!repeatRead)
                        {
                            FormattedFileDescr ffd = new FormattedFileDescr(fileName, formatName, false);
                            Project.FileDescrList.Add(ffd);
                        }
                        string msg = "OK: read file " + fileName + (repeatRead ? " (repeat read)" : "");
                        LibSys.StatusBar.Trace(msg);
                        LibSys.StatusBar.Trace("* " + msg);
                        isSuccess = true;
                    }
                    else
                    {
                        LibSys.StatusBar.Trace("* Error: while processing file " + fileName);
                        Project.ErrorBox(Project.mainForm, "Error processing file:\n\n" + fls.filename);
                    }
                }
                else
                {
                    LibSys.StatusBar.Trace("* Error: unrecognized format " + fileName);
                    Project.ErrorBox(Project.mainForm, "Unrecognized format:\n\n" + fileName);
                }
                #endregion // Processing formatted file - zip, gpx

            }
            if (addToRecent && isSuccess)
            {
                Project.insertRecentFile(fileName);
            }
            return isSuccess;
        }
Esempio n. 41
0
        // processor can be null
        /// <summary>
        /// fileName points to a file in a folder.
        /// imageFileProcessor can be null
        /// reads photoParameters, calls processImagesInPhotoFolder() to process images in the folder and subfolders
        /// returns number of successfully related images
        /// </summary>
        /// <param name="fileName"></param>
        /// <param name="imageFileProcessor"></param>
        /// <returns></returns>
        public static int processPhotoFolderByFile(string fileName, ProcessFile imageFileProcessor)
        {
            int ret = 0;

            LibSys.StatusBar.Trace("IP: processPhotoFolderByFile file: " + fileName + " photoAnalyzeOnLoad=" + Project.photoAnalyzeOnLoad);

            bool isZipFile = AllFormats.isZipFile(fileName);

            FileAndZipIO.usedPhotoParametersFile = false;

            if (Project.photoAnalyzeOnLoad || isZipFile)
            {
                if (!isZipFile)
                {
                    warnPhotoAnalyzeOnLoad(fileName);	// can turn Project.photoAnalyzeOnLoad off
                }

                if (Project.photoAnalyzeOnLoad)
                {
                    try
                    {
                        if (imageFileProcessor == null)
                        {
                            imageFileProcessor = new ProcessFile(FileAndZipIO.processImageFile);
                        }

                        string folderPath;

                        if (isZipFile)
                        {
                            folderPath = fileName;
                        }
                        else
                        {
                            FileInfo fi = new FileInfo(fileName);

                            folderPath = fi.DirectoryName;
                        }

                        // read in whatever was stored in parameters file (like time shift):
                        bool hasFoundFile = false;
                        readPhotoParameters(folderPath, out hasFoundFile);
                        FileAndZipIO.usedPhotoParametersFile = hasFoundFile;

                        ret += processImagesInPhotoFolder(imageFileProcessor, folderPath, true);
                    }
                    catch { }
                }
            }
            return ret;
        }
Esempio n. 42
0
        /// <summary>
        /// imageFileProcessor can be null.
        /// folderName is either a .zip/.gpz file name or a regular folder name
        /// processImagesInPhotoFolder() just calls imageFileProcessor on every file ending with ".jpg" - make sure time shift is in place before calling it
        /// returns number of photos realted to trackpoints.
        /// </summary>
        /// <param name="imageFileProcessor"></param>
        /// <param name="folderName"></param>
        /// <param name="doSubfolders"></param>
        /// <returns></returns>
        public static int processImagesInPhotoFolder(ProcessFile imageFileProcessor, string folderName, bool doSubfolders)
        {
            int ret = 0;
            m_fileList.Clear();

            if (imageFileProcessor == null)
            {
                imageFileProcessor = new ProcessFile(FileAndZipIO.processImageFile);
            }

            LibSys.StatusBar.Trace("IP: started bulk image analysis  in " + folderName + (doSubfolders ? " and subfolders" : "") + " -----------  " + DateTime.Now);

            if (AllFormats.isZipFile(folderName))
            {
                if (!File.Exists(folderName))
                {
                    LibSys.StatusBar.Error("Failed to open Zip");
                    throw new Exception("processImagesInPhotoFolder: Failed to open Zip " + folderName);
                }

                using (ZipFile zip = new ZipFile(folderName))
                {

                    foreach (ZipEntry entry in zip)
                    {
                        string fileName = entry.Name;
                        //LibSys.StatusBar.Trace("IP: File inside: " + fileName);
                        if (!entry.IsDirectory && fileName.ToLower().EndsWith(".jpg"))
                        {
                            try
                            {
                                LibSys.StatusBar.Trace("   ...processing enclosed image: " + fileName);

                                ret += imageFileProcessor(zip, entry, null, fileName);
                            }
                            catch (Exception exc)
                            {
                                LibSys.StatusBar.Error("Exception: " + exc); //.Message);
                            }
                        }
                    }
                }
            }
            else
            {
                fillImageFilesList(folderName, doSubfolders);

                foreach (string fileName in m_fileList)
                {
                    try
                    {
                        LibSys.StatusBar.Trace("   ...processing image file: " + fileName);

                        ret += imageFileProcessor(null, null, folderName, fileName);
                    }
                    catch (Exception exc)
                    {
                        LibSys.StatusBar.Error("Exception: " + exc); //.Message);
                    }
                }
            }

            if (ret > 0)
            {
                PhotoWaypoints.FirstWaypoint();	// set current waypoint to the first in list
            }

            LibSys.StatusBar.Trace("OK: finished bulk image analysis in " + folderName + " - related " + ret + " photos -----------  " + DateTime.Now);

            return ret;
        }
Esempio n. 43
0
        private void processGallery()
        {
            string galleryUrl = myFileOrFolder.galleryTextBox.Text.Trim();

            if(WaypointsCache.TracksAll.Count == 0)
            {
                string warning = "Warning: there are no tracks to relate images to.\r\nTo see images on the map, you need a track.\r\n";
                if("http://heysmile.smugmug.com/gallery/576522".Equals(galleryUrl))
                {
                    if(Project.YesNoBox(this, warning + "\r\nWant to download a matching sample file?"))
                    {
                        if(!((MainForm)Project.mainForm).sampleGalleryTrackOpen())
                        {
                            return;
                        }
                    }
                    else
                    {
                        return;
                    }
                }
                else
                {
                    if(Project.YesNoBox(this, warning + "\r\nStill want to continue?"))
                    {
                    }
                    else
                    {
                        return;
                    }
                }
            }

            // need to refresh windows or the picture is messed up.
            this.Refresh();
            PictureManager.This.CameraManager.ProcessCameraMove();

            Cursor.Current = Cursors.WaitCursor;
            myFileOrFolder.importGalleryButton.Enabled = false;
            myFileOrFolder.verifyGalleryButton.Enabled = false;
            WaypointsCache.resetBoundaries();

            PhotoWaypoints.cleanPhotoTrackpointsBySource(galleryUrl);
            //			PhotoWaypoints.cleanPhotoTrackpoints(null);		// cleans all "related"
            PhotoWaypoints.cleanUnrelated("smugmug");
            collectTimeShiftControlValues();

            bool anonymously = true;

            int galleryId = -1;
            try
            {
                int pos = galleryUrl.LastIndexOf("/");
                if(pos >=0)
                {
                    string sGalleryId = galleryUrl.Substring(pos+1);
                    galleryId = Convert.ToInt32(sGalleryId);
                }
                else
                {
                    galleryId = Convert.ToInt32(galleryUrl);
                }
            }
            catch
            {
                Project.ErrorBox(this, "Gallery URL must end with ID like http://heysmile.smugmug.com/gallery/576522");
                return;
            }

            if(anonymously)
            {
                SmugMugApi.SmugMug = new SmugMugApi();
                SmugMugApi.SmugMug.LoginAnonymously();
            }
            else
            {
                if (RegistrySettings.Password.Length > 0 && RegistrySettings.AccountName.Length > 0)
                {
                    SmugMugApi.SmugMug = new SmugMugApi(RegistrySettings.Username, RegistrySettings.Password);
                    if (SmugMugApi.SmugMug.Login() == false)
                    {
                        Login login = new Login();
                        login.ShowDialog();
                    }
                }
                else
                {
                    Login login = new Login();
                    login.ShowDialog();
                }
            }

            if (SmugMugApi.SmugMug.Connected)
            {
                if(!anonymously)
                {
                    LibSys.StatusBar.Trace("OK: connected to SmugMug -- account: " + RegistrySettings.AccountName);

            //					Album[] albums = SmugMugApi.SmugMug.GetAlbums();
            //					foreach(Album album in albums)
            //					{
            //						LibSys.StatusBar.Trace("-------------");
            //						LibSys.StatusBar.Trace("AlbumID: " + album.AlbumID);
            //						LibSys.StatusBar.Trace("Title: " + album.Title);
            //						LibSys.StatusBar.Trace("" + album.ToString());
            //					}
                }
                else
                {
                    LibSys.StatusBar.Trace("OK: connected to SmugMug -- anonymously");
                }

                ProcessFile imageFileProcessor = new ProcessFile(processImageFile);

                int[] imageIds = SmugMugApi.SmugMug.GetImages(galleryId);
                foreach(int imageId in imageIds)
                {
                    LibSys.StatusBar.Trace(" ===== ImageID: " + imageId + "  =====================");

                    XmlRpcStruct imageUrls = SmugMugApi.SmugMug.GetImageURLs(imageId);
                    foreach(string key in imageUrls.Keys)
                    {
                        LibSys.StatusBar.Trace("    " + key + ": " + imageUrls[key]);
                    }

                    XmlRpcStruct imageExif = SmugMugApi.SmugMug.GetImageExif(imageId);
                    foreach(string key in imageExif.Keys)
                    {
                        LibSys.StatusBar.Trace("    " + key + ": " + imageExif[key]);
                    }

                    string imageName = "" + imageId;

                    // will not show progress in photo viewer, fromLocal flag protects from it.
                    PhotoGalleryIO.processSmugmugPhotoGalleryImage(imageFileProcessor, galleryUrl, imageName, imageUrls, imageExif);
                }
                if(m_doZoomIn)
                {
                    PictureManager.This.CameraManager.zoomToCorners();
                }
                else
                {
                    PictureManager.This.CameraManager.ProcessCameraMove();
                }

                setCurrentPhotoPreview();
            }
            else
            {
                Project.ErrorBox(this, "failed to connect to SmugMug");
                LibSys.StatusBar.Trace("Error: failed to connect to SmugMug");
            }

            myFileOrFolder.importGalleryButton.Enabled = true;
            myFileOrFolder.verifyGalleryButton.Enabled = true;
            Cursor.Current = Cursors.Default;

            setupButtons();
        }
Esempio n. 44
0
        private void processSingleFile()
        {
            Cursor.Current = Cursors.WaitCursor;
            myFileOrFolder.importFileButton.Enabled = false;
            myFileOrFolder.browseFileButton.Enabled = false;
            WaypointsCache.resetBoundaries();

            string photoFileName = myFileOrFolder.fileTextBox.Text;
            Project.photoFileName = photoFileName;
            Project.insertRecentFile(photoFileName);

            bool isGpx = AllFormats.isGpxFile(photoFileName);
            bool isZip = AllFormats.isZipFile(photoFileName);

            if(!Project.photoAnalyzeOnLoad && (!hasWarned || isGpx))
            {
                string sWarn = "Warning: you have previously chosen not to analyze JPEG files\nby scanning containing folder and subfolders.\n\n"
                    + "To turn ON the \"Analyze when loading .GPX\" mode answer \"Yes\" here or use Options tab.\nAnswering \"No\" will read in the file, but not the photos.";

                if(Project.YesNoBox(this, sWarn))
                {
                    Project.photoAnalyzeOnLoad = true;
                }
                hasWarned = true;
            }

            if(isZip || isGpx)
            {
                // Photo collection import:
                ProcessFile imageFileProcessor = new ProcessFile(processImageFile);

                string cleanupName = photoFileName;
                if(isGpx)
                {
                    cleanupName = new FileInfo(photoFileName).DirectoryName;
                }
                PhotoWaypoints.cleanPhotoTrackpointsBySource(cleanupName);
                collectTimeShiftControlValues();

                SortedList foldersToProcess = new SortedList();
                FileAndZipIO.readFile(photoFileName, null, null, imageFileProcessor, foldersToProcess, true);		// may add to foldersToProcess

                if(foldersToProcess.Count == 0)
                {
                    // there are no .gpx or loc files there, but may be only images. We are explicitly asked to scan the images and
                    // relate them to the trackpoints which are already in memory (say, just received from GPS)

                    FileAndZipIO.enlistPhotoFolder(photoFileName, foldersToProcess, imageFileProcessor);
                }

                bool needsRefresh = false;
                // delayed processing of photo images in folder(s), as we need to have all trackpoints in memory first to relate to them:
                for(int i=0; i < foldersToProcess.Count ;i++)
                {
                    PhotoFolderToProcess pf = (PhotoFolderToProcess)foldersToProcess.GetByIndex(i);

                    if(!timeShiftEnabledCheckBox.Checked)
                    {
                        bool hasFoundFile = false;
                        FileAndZipIO.readPhotoParameters(pf.name, out hasFoundFile);
                        FileAndZipIO.usedPhotoParametersFile = hasFoundFile;
                        if(hasFoundFile)
                        {
                            needsRefresh = true;
                        }
                    }

                    FileAndZipIO.processImagesInPhotoFolder(pf.imageFileProcessor, pf.name, true);
                }

                if(m_doZoomIn)
                {
                    PictureManager.This.CameraManager.zoomToCorners();
                }
                else
                {
                    PictureManager.This.CameraManager.ProcessCameraMove();
                }

                if(needsRefresh)
                {
                    configureTimeshiftChoices(false, false);
                }
            }
            else
            {
                // single JPEG file import:
                PhotoWaypoints.cleanPhotoTrackpoints(photoFileName);
                collectTimeShiftControlValues();

                Cursor.Current = Cursors.WaitCursor;
                myFileOrFolder.browseFileButton.Enabled = false;

                try
                {
                    processImageFile(null, null, photoFileName, photoFileName);
                }
                catch (Exception exc)
                {
                    LibSys.StatusBar.Error("Exception: " + exc.Message);
                }

                PictureManager.This.CameraManager.ProcessCameraMove();
            }

            setCurrentPhotoPreview();

            myFileOrFolder.browseFileButton.Enabled = true;
            myFileOrFolder.importFileButton.Enabled = true;
            Cursor.Current = Cursors.Default;

            setupButtons();
        }
Esempio n. 45
0
 private static void SetParams(string[] args, ProcessFile processFile)
 {
     if (args.Count() == 1)
     {
         processFile.ExifTool = GetExifToolFullName();
     }
     else
     {
         if (args.Count() == 2)
         {
             if (args[1].Equals(Simulate, StringComparison.InvariantCultureIgnoreCase))
             {
                 processFile.ExifTool = GetExifToolFullName();
                 processFile.Simulate = true;
             }
             else
                 processFile.ExifTool = args[1];
         }
         else if (args.Count() == 3)
         {
             processFile.ExifTool = args[1];
             processFile.Simulate = args[2].Equals(Simulate, StringComparison.InvariantCultureIgnoreCase);
         }
     }
 }
Esempio n. 46
0
 private static void ProcessOneFile(string fileName, ProcessFile processFile)
 {
     processFile.FileName = fileName;
     processFile.Start();
 }
Esempio n. 47
0
 private static void ProcessAsterix(string filePattern, ProcessFile processFile)
 {
     FileInfo[] files = GetFiles(filePattern);
     foreach (FileInfo file in files)
     {
         processFile.FileName = file.FullName;
         processFile.Start();
     }
 }