static void Render_Span(int ToFolder, int FormFolder) { try { CodeFFMPEG code = new CodeFFMPEG(); Process process = new Process(); ProcessStartInfo startInfo = new ProcessStartInfo(); startInfo.WindowStyle = ProcessWindowStyle.Hidden; startInfo.WorkingDirectory = string.Format(@"C:\RACC"); startInfo.FileName = "copy.bat"; process.StartInfo = startInfo; process.Start(); process.Close(); #region Edit Image #region Xử lý video0 try { if (!File.Exists(string.Format(@"C:\RACC\Data\Video0\Image\image1.jpg"))) { Edit_Image.Convert_All_Jpg(0); Thread.Sleep(5000); Edit_Image.Keep_Origin_Image(0); File.Delete(@"C:\RACC\Data\Video0\Image\image.jpg"); } } catch (Exception) { } #endregion for (int i = ToFolder; i < FormFolder; i++) { if (File.Exists(string.Format(@"C:\RACC\Data\Video{0}\Image\image1.jpg", FormFolder - 1))) { break; } jump: if (i >= FormFolder) { break; } try { if (File.Exists(string.Format(@"C:\RACC\Data\Video{0}\Image\image1.jpg", i))) { i++; goto jump; } Edit_Image.Convert_All_Jpg(i); Thread.Sleep(1000); Edit_Image.Keep_Origin_Image(i); string path = string.Format(@"C:\RACC\Data\Video{0}\Image\image.jpg", i); File.Delete(path); Thread.Sleep(1000); } catch (Exception) { Console.WriteLine("Không xử lý đk ảnh thứ : " + i); } Thread.Sleep(1000); } #endregion #region Code trong theard for (int k = ToFolder; k < FormFolder; k++) { Jump: if (k >= FormFolder) { break; } #region Kiểm tra File tồn tại và xử lý chuỗi input // nếu file đã được tạo thì pass qua if (File.Exists("C:\\RACC\\Data\\Video" + (k) + "\\Image\\VideoImage.mp4")) { Console.WriteLine("\n Đã hoàn thành Video:" + k + " OK"); k++; goto Jump; } Standardize_The_String.English(k); #endregion #region Hàm code if (!File.Exists(string.Format(@"C:\RACC\Data\Video{0}\Image\1.jpg", k))) { if (!File.Exists(string.Format(@"C:\RACC\Data\Video{0}\Image\2.jpg", k))) { Edit_Image.Change_Image_Name(k); // Thread.Sleep(1000); Thread.Sleep(5000); } } if (!File.Exists(string.Format(@"C:\RACC\Data\Video{0}\Image\TotalMusic.mp3", k))) { TextToSpeech.Start(k, "span"); // Thread.Sleep(1000); Thread.Sleep(3000); code.Join_Voice(k); // Thread.Sleep(1000); Thread.Sleep(2000); } try { code.Create_Video(k); } catch (Exception) { goto ketthuc; } #endregion bool check = false; int SolanLap = 0; do { if (File.Exists("C:\\RACC\\Data\\Video" + k + "\\Image\\VideoImage.mp4")) { Console.WriteLine("\n Đã hoàn thành Video:" + k + " OK"); check = true; } SolanLap++; if (SolanLap == 2) { goto ketthuc; } Thread.Sleep(5000); } while (!check); ketthuc: #region Create Thumb Create_Thumbnail.Origin(k); #endregion } #endregion } catch (Exception) { } }
static void Render_VideoSound1_Span(int ToFolder, int FormFolder) { try { thrdSleep(5); CodeFFMPEG code = new CodeFFMPEG(); #region Code Japan Video for (int k = ToFolder; k < FormFolder; k++) { #region Check Jump1: if (k >= FormFolder) { break; } if (File.Exists("C:\\RACC\\Data\\Video" + (k) + "\\Image\\VideoSound1.mp4")) { k++; Console.WriteLine("\n Đã hoàn thành Video:" + k + " OK"); goto Jump1; } #endregion #region Code Standardize_The_String.English(k); try { code.Span_Video(k); } catch (Exception) { Console.WriteLine(string.Format("Có lỗi khi render video: {0} : Bỏ qua và tiếp tục làm video khác", k)); k++; goto Jump1; } // Thread.Sleep(18000); thrdSleep(50); bool check = false; int SoLanLap = 0; do { if (File.Exists("C:\\RACC\\Data\\Video" + k + "\\Image\\VideoSound1.mp4")) { Console.WriteLine("\n Đã hoàn thành Video:" + k + " OK"); check = true; } SoLanLap++; if (SoLanLap == 3) { goto Video_Error; } Thread.Sleep(2000); } while (!check); Video_Error :; #endregion } #endregion } catch (Exception) { } }