Ejemplo n.º 1
0
        //public void RenameRecordedFile(RunConfig conf)
        //{
        //    string sNewFile = conf.Name_Case;

        //    if (isWrongInit)
        //        return;

        //    for (int i = 0; i < 300; i++)
        //    {
        //        string pattern = "CASE";

        //        DirectoryInfo taskDirectory = new DirectoryInfo(movieDirectory);
        //        FileInfo[] taskFiles = taskDirectory.GetFiles(pattern + "*");

        //        if (taskFiles.Length > 0)
        //        {
        //            foreach (var item in taskFiles)
        //            {
        //                string newFileName = string.Format("{0}\\{1}", item.DirectoryName, item.Name.Replace(pattern, sNewFile));
        //                System.IO.File.Move(item.FullName, newFileName);
        //            }
        //            break;
        //        }

        //        System.Threading.Thread.Sleep(200);
        //    }
        //}


        public void RenameRecordedFile1(RunConfig conf)
        {
            if (isWrongInit)
            {
                return;
            }

            string sNewFileName      = string.Format("{0}_{1}_{2}.mp4", conf.Name_Program, conf.Name_Map, conf.Name_Config);
            string sNewFileDirectory = string.Format("{0}\\{1}", movieDirectoryOutput, sNewFileName);

            if (System.IO.File.Exists(sNewFileDirectory))
            {
                sNewFileName      = string.Format("{0}_{1}_{2}_{3}.mp4", conf.Name_Program, conf.Name_Map, conf.Name_Config, DateTime.Now.ToString("yyyy_MM_dd_hh_mm_ss"));
                sNewFileDirectory = string.Format("{0}\\{1}", movieDirectoryOutput, sNewFileName);
            }

            for (int j = 0; j < 300; j++)
            {
                DirectoryInfo taskDirectory = new DirectoryInfo(movieDirectoryInput);
                FileInfo[]    taskFiles     = taskDirectory.GetFiles("*");

                if (taskFiles.Length > 0)
                {
                    System.IO.File.Move(taskFiles[0].FullName, sNewFileDirectory);

                    for (int i = 1; i < taskFiles.Length; i++)
                    {
                        System.IO.File.Delete(taskFiles[i].FullName);
                    }
                    break;
                }

                System.Threading.Thread.Sleep(200);
            }

            //    //for (int i = 0; i < 300; i++)
            //    //{
            //    //string pattern = "CASE";

            //    DirectoryInfo taskDirectory = new DirectoryInfo(movieDirectoryInput);
            //    FileInfo[] taskFiles = taskDirectory.GetFiles("*");

            //    if (taskFiles.Length > 0)
            //    {
            //        foreach (var item in taskFiles)
            //        {
            //            //string newFileName = string.Format("{0}\\{1}", item.DirectoryName, item.Name.Replace(pattern, sNewFile));
            //            System.IO.File.Move(item.FullName, newFileName);
            //        }
            //        //break;
            //    }

            //    System.Threading.Thread.Sleep(200);
            ////}
        }
Ejemplo n.º 2
0
        public void StartRecord(RunConfig item)
        {
            VisualizerConfig it = new VisualizerConfig(item.ID_Case, 0, "", item.Name_Case, item.Name_Config, item.Name_Map, item.Name_Program, "");

            StartRecord(it);
        }