Exemplo n.º 1
0
        private static void TransferAddition(string crPath)
        {
            BackupDB();
            FancyWriter.WriteSlow("Copying to current");
            var           dataPath   = crPath;
            var           targetPath = Path.Combine(databaseWorkspaceFolderPath, "Database", "Current", "logoData");
            DirectoryInfo drInfo     = new DirectoryInfo(dataPath);
            int           i          = 0;

            foreach (var file in drInfo.GetFiles())
            {
                FancyWriter.UpdateStatus("Copying new dataset to current database", (ushort)i,
                                         (ushort)drInfo.GetFiles().Length, true);
                file.CopyTo(Path.Combine(targetPath, file.Name), true);
                i++;
            }
        }
Exemplo n.º 2
0
        private static bool DataParserParse(string framesPath, string gtFilePath, string rectMode, uint width,
                                            uint height, string txtSavePath, string combinedSavePath, string curDir)
        {
            FancyWriter.WriteHeader("GT Parsing");
            var exeFolderPath = Path.Combine(buildFolderPath, "DarkLabelDataParser", "Debug");
            var exePath       = Path.Combine(buildFolderPath, exeFolderPath, "DarkLabelDataParser.exe"); //TODO make cross platform

            if (!File.Exists(exePath))
            {
                FancyWriter.WriteSlow("Your tools path is invalid. Please reconsider reconfiguring.");
                return(false);
            }
            if (!File.Exists(gtFilePath))
            {
                FancyWriter.WriteSlow("Your gtFile path is invalid. Please check.");
                return(false);
            }
            Directory.SetCurrentDirectory(txtSavePath);
            var myProcess = new Process();
            var info      = new ProcessStartInfo(exePath,
                                                 framesPath + "/ " + gtFilePath + " " + rectMode + " " + width + " " + height)
            {
                UseShellExecute = true
            };

            myProcess.StartInfo = info;
            myProcess.Start();
            //string error = myProcess.StandardError.ReadToEnd();
            myProcess.WaitForExit();
            Console.WriteLine("Parsing finished. Copying files to same directory.");

            var frames = Directory.GetFiles(Directory.GetCurrentDirectory()).Where(c => c.EndsWith(".txt")).ToList();

            Directory.SetCurrentDirectory(curDir);
            ushort p = 0;

            foreach (var frame in frames)
            {
                FancyWriter.UpdateStatus("Copying txt files... ", p, (ushort)frames.Count(), true);
                var pathToSaveTo = Path.Combine(combinedSavePath, Path.GetFileName(frame));
                if (!File.Exists(pathToSaveTo))
                {
                    File.Copy(frame, pathToSaveTo);
                }
                p++;
            }
            Directory.SetCurrentDirectory(framesPath);
            frames = Directory.GetFiles(framesPath).Where(c => c.EndsWith(".jpg")).ToList();
            Directory.SetCurrentDirectory(curDir);
            p = 0;
            foreach (var frame in frames)
            {
                FancyWriter.UpdateStatus("Copying jpg files... ", p, (ushort)frames.Count(), true);
                var pathToSaveTo = Path.Combine(combinedSavePath, Path.GetFileName(frame));
                if (!File.Exists(pathToSaveTo))
                {
                    File.Copy(frame, pathToSaveTo);
                }
                p++;
            }
            return(true);
        }