Compare commits

...

5 Commits

6 changed files with 664 additions and 160 deletions

View File

@ -1,9 +1,9 @@
# Ruyi-GUI Setup Guide
Complete Environment Download at<br>
[Ruyi-GUI-V1.0.7z](https://github.com/bmgjet/Ruyi-GUI/blob/master/Ruyi-GUI-V1.0.7z)
[Ruyi-GUI-V1.0.7z](https://github.com/bmgjet/Ruyi-GUI/blob/master/Ruyi-GUI-V1.0.7z) Out of date now, If you use this version get the latest Ruyi-GUI.exe from Ruyi-GUI/bin/Release<br>
[Ruyi-GUI-V1.1.7z](https://mega.nz/file/rKYDAbiI#Rz9krUDiAowH3afG5jb8hn0EETXNhGVEZOPvqSYspBs) Hosted on Mega since github only allows 1 big upload a month.
## Screenshot
## Screenshot (Old)
![Ruyi-GUI Screenshot](https://raw.githubusercontent.com/bmgjet/Ruyi-GUI/refs/heads/master/guiscreenshot.png)

View File

@ -64,12 +64,12 @@
this.Scheduler = new System.Windows.Forms.ComboBox();
this.GenerateButton = new System.Windows.Forms.Button();
this.PlayVideo = new System.Windows.Forms.Button();
this.timer1 = new System.Windows.Forms.Timer(this.components);
this.FileWatch = new System.Windows.Forms.Timer(this.components);
this.AddJob = new System.Windows.Forms.Button();
this.JobList = new System.Windows.Forms.ListBox();
this.RemoveJob = new System.Windows.Forms.Button();
this.RunJobs = new System.Windows.Forms.Button();
this.timer2 = new System.Windows.Forms.Timer(this.components);
this.JobsTimer = new System.Windows.Forms.Timer(this.components);
this.Batch = new System.Windows.Forms.Button();
this.panel1 = new System.Windows.Forms.Panel();
this.GPUOffload = new System.Windows.Forms.ComboBox();
@ -78,10 +78,42 @@
this.LoraButton = new System.Windows.Forms.Button();
this.Loratxt = new System.Windows.Forms.TextBox();
this.Loralbl = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.Mp4Reslbl = new System.Windows.Forms.Label();
this.VideoRes = new System.Windows.Forms.ComboBox();
this.Updates = new System.Windows.Forms.CheckBox();
this.timer3 = new System.Windows.Forms.Timer(this.components);
this.CrashChecker = new System.Windows.Forms.Timer(this.components);
this.GPUPerf = new System.Windows.Forms.Timer(this.components);
this.discordlbl = new System.Windows.Forms.Label();
this.discordhook = new System.Windows.Forms.TextBox();
this.Errorlbl = new System.Windows.Forms.Label();
this.MissingSystemlbl = new System.Windows.Forms.Label();
this.MissingRuyilbl = new System.Windows.Forms.Label();
this.MissingPredictlbl = new System.Windows.Forms.Label();
this.FaultLoadinglbl = new System.Windows.Forms.Label();
this.LoadingAilbl = new System.Windows.Forms.Label();
this.IsRunninglbl = new System.Windows.Forms.Label();
this.Error1 = new System.Windows.Forms.Label();
this.Error2 = new System.Windows.Forms.Label();
this.Error3 = new System.Windows.Forms.Label();
this.Error4 = new System.Windows.Forms.Label();
this.Error5 = new System.Windows.Forms.Label();
this.Error6 = new System.Windows.Forms.Label();
this.Error7 = new System.Windows.Forms.Label();
this.Error8 = new System.Windows.Forms.Label();
this.Error9 = new System.Windows.Forms.Label();
this.Error10 = new System.Windows.Forms.Label();
this.Error11 = new System.Windows.Forms.Label();
this.Error12 = new System.Windows.Forms.Label();
this.Error13 = new System.Windows.Forms.Label();
this.Error14 = new System.Windows.Forms.Label();
this.Error15 = new System.Windows.Forms.Label();
this.Error16 = new System.Windows.Forms.Label();
this.Error17 = new System.Windows.Forms.Label();
this.Error18 = new System.Windows.Forms.Label();
this.Error19 = new System.Windows.Forms.Label();
this.Error20 = new System.Windows.Forms.Label();
this.Error21 = new System.Windows.Forms.Label();
this.Error22 = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).BeginInit();
this.panel1.SuspendLayout();
@ -281,7 +313,6 @@
"2:3",
"3:4",
"4:5",
"9:16",
"9:21"});
this.AspectRatio.Location = new System.Drawing.Point(93, 372);
this.AspectRatio.Margin = new System.Windows.Forms.Padding(2);
@ -388,7 +419,7 @@
this.Steps.Name = "Steps";
this.Steps.Size = new System.Drawing.Size(95, 20);
this.Steps.TabIndex = 27;
this.Steps.Text = "25";
this.Steps.Text = "20";
this.Steps.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.NumberOnly);
//
// Stepslbl
@ -491,11 +522,11 @@
this.PlayVideo.UseVisualStyleBackColor = true;
this.PlayVideo.Click += new System.EventHandler(this.PlayVideo_Click);
//
// timer1
// FileWatch
//
this.timer1.Enabled = true;
this.timer1.Interval = 2000;
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
this.FileWatch.Enabled = true;
this.FileWatch.Interval = 2000;
this.FileWatch.Tick += new System.EventHandler(this.FileWatch_Tick);
//
// AddJob
//
@ -528,18 +559,18 @@
//
// RunJobs
//
this.RunJobs.Location = new System.Drawing.Point(556, 493);
this.RunJobs.Location = new System.Drawing.Point(556, 534);
this.RunJobs.Name = "RunJobs";
this.RunJobs.Size = new System.Drawing.Size(228, 79);
this.RunJobs.Size = new System.Drawing.Size(228, 38);
this.RunJobs.TabIndex = 39;
this.RunJobs.Text = "Run Jobs";
this.RunJobs.UseVisualStyleBackColor = true;
this.RunJobs.Click += new System.EventHandler(this.RunJobs_Click);
//
// timer2
// JobsTimer
//
this.timer2.Interval = 1000;
this.timer2.Tick += new System.EventHandler(this.timer2_Tick);
this.JobsTimer.Interval = 1500;
this.JobsTimer.Tick += new System.EventHandler(this.JobsTimer_Tick);
//
// Batch
//
@ -559,7 +590,7 @@
this.panel1.Controls.Add(this.LoraButton);
this.panel1.Controls.Add(this.Loratxt);
this.panel1.Controls.Add(this.Loralbl);
this.panel1.Controls.Add(this.label1);
this.panel1.Controls.Add(this.Mp4Reslbl);
this.panel1.Controls.Add(this.VideoRes);
this.panel1.Controls.Add(this.Batch);
this.panel1.Controls.Add(this.Schedulerlbl);
@ -668,15 +699,15 @@
this.Loralbl.TabIndex = 43;
this.Loralbl.Text = "Lora:";
//
// label1
// Mp4Reslbl
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(447, 357);
this.label1.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(84, 13);
this.label1.TabIndex = 42;
this.label1.Text = "Mp4 Resolution:";
this.Mp4Reslbl.AutoSize = true;
this.Mp4Reslbl.Location = new System.Drawing.Point(447, 357);
this.Mp4Reslbl.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.Mp4Reslbl.Name = "Mp4Reslbl";
this.Mp4Reslbl.Size = new System.Drawing.Size(84, 13);
this.Mp4Reslbl.TabIndex = 42;
this.Mp4Reslbl.Text = "Mp4 Resolution:";
//
// VideoRes
//
@ -711,16 +742,362 @@
this.Updates.Text = "Check For Model Updates On Generate";
this.Updates.UseVisualStyleBackColor = true;
//
// timer3
// CrashChecker
//
this.timer3.Interval = 5000;
this.timer3.Tick += new System.EventHandler(this.timer3_Tick);
this.CrashChecker.Interval = 10000;
this.CrashChecker.Tick += new System.EventHandler(this.CrashChecker_Tick);
//
// GPUPerf
//
this.GPUPerf.Interval = 4000;
this.GPUPerf.Tick += new System.EventHandler(this.GPUPerf_Tick);
//
// discordlbl
//
this.discordlbl.AutoSize = true;
this.discordlbl.Location = new System.Drawing.Point(555, 486);
this.discordlbl.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.discordlbl.Name = "discordlbl";
this.discordlbl.Size = new System.Drawing.Size(202, 13);
this.discordlbl.TabIndex = 49;
this.discordlbl.Text = "Discord webhook: (Posts to discord if set)";
//
// discordhook
//
this.discordhook.Location = new System.Drawing.Point(556, 504);
this.discordhook.Margin = new System.Windows.Forms.Padding(2);
this.discordhook.MaxLength = 99999;
this.discordhook.Name = "discordhook";
this.discordhook.Size = new System.Drawing.Size(228, 20);
this.discordhook.TabIndex = 50;
//
// Errorlbl
//
this.Errorlbl.AutoSize = true;
this.Errorlbl.Location = new System.Drawing.Point(828, 12);
this.Errorlbl.Name = "Errorlbl";
this.Errorlbl.Size = new System.Drawing.Size(29, 13);
this.Errorlbl.TabIndex = 51;
this.Errorlbl.Text = "Error";
this.Errorlbl.Visible = false;
//
// MissingSystemlbl
//
this.MissingSystemlbl.AutoSize = true;
this.MissingSystemlbl.Location = new System.Drawing.Point(828, 25);
this.MissingSystemlbl.Name = "MissingSystemlbl";
this.MissingSystemlbl.Size = new System.Drawing.Size(436, 13);
this.MissingSystemlbl.TabIndex = 52;
this.MissingSystemlbl.Text = "Missing system folder and environment.bat file! Is this being ran from a python e" +
"nvironment?";
this.MissingSystemlbl.Visible = false;
//
// MissingRuyilbl
//
this.MissingRuyilbl.AutoSize = true;
this.MissingRuyilbl.Location = new System.Drawing.Point(828, 38);
this.MissingRuyilbl.Name = "MissingRuyilbl";
this.MissingRuyilbl.Size = new System.Drawing.Size(253, 13);
this.MissingRuyilbl.TabIndex = 53;
this.MissingRuyilbl.Text = "Missing Ruyi-Models-main! Clone from Github Repo?";
this.MissingRuyilbl.Visible = false;
//
// MissingPredictlbl
//
this.MissingPredictlbl.AutoSize = true;
this.MissingPredictlbl.Location = new System.Drawing.Point(828, 51);
this.MissingPredictlbl.Name = "MissingPredictlbl";
this.MissingPredictlbl.Size = new System.Drawing.Size(130, 13);
this.MissingPredictlbl.TabIndex = 54;
this.MissingPredictlbl.Text = "Missing predict_i2v.py file!";
this.MissingPredictlbl.Visible = false;
//
// FaultLoadinglbl
//
this.FaultLoadinglbl.AutoSize = true;
this.FaultLoadinglbl.Location = new System.Drawing.Point(828, 64);
this.FaultLoadinglbl.Name = "FaultLoadinglbl";
this.FaultLoadinglbl.Size = new System.Drawing.Size(121, 13);
this.FaultLoadinglbl.TabIndex = 55;
this.FaultLoadinglbl.Text = "Fault loading Config.cfg.";
this.FaultLoadinglbl.Visible = false;
//
// LoadingAilbl
//
this.LoadingAilbl.AutoSize = true;
this.LoadingAilbl.Location = new System.Drawing.Point(828, 77);
this.LoadingAilbl.Name = "LoadingAilbl";
this.LoadingAilbl.Size = new System.Drawing.Size(127, 13);
this.LoadingAilbl.TabIndex = 56;
this.LoadingAilbl.Text = "Loading AI Please Wait...";
this.LoadingAilbl.Visible = false;
//
// IsRunninglbl
//
this.IsRunninglbl.AutoSize = true;
this.IsRunninglbl.Location = new System.Drawing.Point(828, 90);
this.IsRunninglbl.Name = "IsRunninglbl";
this.IsRunninglbl.Size = new System.Drawing.Size(172, 13);
this.IsRunninglbl.TabIndex = 57;
this.IsRunninglbl.Text = "is running. Do you want to close it?";
this.IsRunninglbl.Visible = false;
//
// Error1
//
this.Error1.AutoSize = true;
this.Error1.Location = new System.Drawing.Point(828, 103);
this.Error1.Name = "Error1";
this.Error1.Size = new System.Drawing.Size(163, 13);
this.Error1.TabIndex = 58;
this.Error1.Text = "You Must Select A Video Output!";
this.Error1.Visible = false;
//
// Error2
//
this.Error2.AutoSize = true;
this.Error2.Location = new System.Drawing.Point(828, 116);
this.Error2.Name = "Error2";
this.Error2.Size = new System.Drawing.Size(157, 13);
this.Error2.TabIndex = 59;
this.Error2.Text = "You Must Select A Input Image!";
this.Error2.Visible = false;
//
// Error3
//
this.Error3.AutoSize = true;
this.Error3.Location = new System.Drawing.Point(828, 129);
this.Error3.Name = "Error3";
this.Error3.Size = new System.Drawing.Size(129, 13);
this.Error3.TabIndex = 60;
this.Error3.Text = "Frame Rate Can\'t Be Null!";
this.Error3.Visible = false;
//
// Error4
//
this.Error4.AutoSize = true;
this.Error4.Location = new System.Drawing.Point(828, 142);
this.Error4.Name = "Error4";
this.Error4.Size = new System.Drawing.Size(135, 13);
this.Error4.TabIndex = 61;
this.Error4.Text = "Aspect Ratio Can\'t Be Null!";
this.Error4.Visible = false;
//
// Error5
//
this.Error5.AutoSize = true;
this.Error5.Location = new System.Drawing.Point(828, 155);
this.Error5.Name = "Error5";
this.Error5.Size = new System.Drawing.Size(124, 13);
this.Error5.TabIndex = 62;
this.Error5.Text = "Resolution Can\'t Be Null!";
this.Error5.Visible = false;
//
// Error6
//
this.Error6.AutoSize = true;
this.Error6.Location = new System.Drawing.Point(828, 168);
this.Error6.Name = "Error6";
this.Error6.Size = new System.Drawing.Size(116, 13);
this.Error6.TabIndex = 63;
this.Error6.Text = "Direction Can\'t Be Null!";
this.Error6.Visible = false;
//
// Error7
//
this.Error7.AutoSize = true;
this.Error7.Location = new System.Drawing.Point(828, 181);
this.Error7.Name = "Error7";
this.Error7.Size = new System.Drawing.Size(106, 13);
this.Error7.TabIndex = 64;
this.Error7.Text = "Motion Can\'t Be Null!";
this.Error7.Visible = false;
//
// Error8
//
this.Error8.AutoSize = true;
this.Error8.Location = new System.Drawing.Point(828, 194);
this.Error8.Name = "Error8";
this.Error8.Size = new System.Drawing.Size(148, 13);
this.Error8.TabIndex = 65;
this.Error8.Text = "Mp4 Resolution Can\'t Be Null!";
this.Error8.Visible = false;
//
// Error9
//
this.Error9.AutoSize = true;
this.Error9.Location = new System.Drawing.Point(829, 207);
this.Error9.Name = "Error9";
this.Error9.Size = new System.Drawing.Size(134, 13);
this.Error9.TabIndex = 66;
this.Error9.Text = "GPU Offload Can\'t Be Null!";
this.Error9.Visible = false;
//
// Error10
//
this.Error10.AutoSize = true;
this.Error10.Location = new System.Drawing.Point(829, 220);
this.Error10.Name = "Error10";
this.Error10.Size = new System.Drawing.Size(101, 13);
this.Error10.TabIndex = 67;
this.Error10.Text = "Steps Can\'t Be Null!";
this.Error10.Visible = false;
//
// Error11
//
this.Error11.AutoSize = true;
this.Error11.Location = new System.Drawing.Point(829, 233);
this.Error11.Name = "Error11";
this.Error11.Size = new System.Drawing.Size(90, 13);
this.Error11.TabIndex = 68;
this.Error11.Text = "Cfg Can\'t Be Null!";
this.Error11.Visible = false;
//
// Error12
//
this.Error12.AutoSize = true;
this.Error12.Location = new System.Drawing.Point(829, 246);
this.Error12.Name = "Error12";
this.Error12.Size = new System.Drawing.Size(99, 13);
this.Error12.TabIndex = 69;
this.Error12.Text = "Seed Can\'t Be Null!";
this.Error12.Visible = false;
//
// Error13
//
this.Error13.AutoSize = true;
this.Error13.Location = new System.Drawing.Point(829, 259);
this.Error13.Name = "Error13";
this.Error13.Size = new System.Drawing.Size(122, 13);
this.Error13.TabIndex = 70;
this.Error13.Text = "Scheduler Can\'t Be Null!";
this.Error13.Visible = false;
//
// Error14
//
this.Error14.AutoSize = true;
this.Error14.Location = new System.Drawing.Point(829, 272);
this.Error14.Name = "Error14";
this.Error14.Size = new System.Drawing.Size(132, 13);
this.Error14.TabIndex = 71;
this.Error14.Text = "Lora Weight Can\'t Be Null!";
this.Error14.Visible = false;
//
// Error15
//
this.Error15.AutoSize = true;
this.Error15.Location = new System.Drawing.Point(829, 286);
this.Error15.Name = "Error15";
this.Error15.Size = new System.Drawing.Size(162, 13);
this.Error15.TabIndex = 72;
this.Error15.Text = "Aspect Ratio Not A Valid Format!";
this.Error15.Visible = false;
//
// Error16
//
this.Error16.AutoSize = true;
this.Error16.Location = new System.Drawing.Point(829, 299);
this.Error16.Name = "Error16";
this.Error16.Size = new System.Drawing.Size(172, 13);
this.Error16.TabIndex = 73;
this.Error16.Text = "Mp4 Resolution Not A Valid Format";
this.Error16.Visible = false;
//
// Error17
//
this.Error17.AutoSize = true;
this.Error17.Location = new System.Drawing.Point(829, 311);
this.Error17.Name = "Error17";
this.Error17.Size = new System.Drawing.Size(183, 13);
this.Error17.TabIndex = 74;
this.Error17.Text = "Invalid Video Frames Setting [24-120]";
this.Error17.Visible = false;
//
// Error18
//
this.Error18.AutoSize = true;
this.Error18.Location = new System.Drawing.Point(828, 324);
this.Error18.Name = "Error18";
this.Error18.Size = new System.Drawing.Size(230, 13);
this.Error18.TabIndex = 75;
this.Error18.Text = "Invalid Generation Resolution Setting [384-896]";
this.Error18.Visible = false;
//
// Error19
//
this.Error19.AutoSize = true;
this.Error19.Location = new System.Drawing.Point(829, 339);
this.Error19.Name = "Error19";
this.Error19.Size = new System.Drawing.Size(236, 13);
this.Error19.TabIndex = 76;
this.Error19.Text = "Invalid GPU Offload Steps Setting [0, 10, 7, 5, 1]";
this.Error19.Visible = false;
//
// Error20
//
this.Error20.AutoSize = true;
this.Error20.Location = new System.Drawing.Point(829, 352);
this.Error20.Name = "Error20";
this.Error20.Size = new System.Drawing.Size(161, 13);
this.Error20.TabIndex = 77;
this.Error20.Text = "Invalid Camera Direction Setting!";
this.Error20.Visible = false;
//
// Error21
//
this.Error21.AutoSize = true;
this.Error21.Location = new System.Drawing.Point(829, 365);
this.Error21.Name = "Error21";
this.Error21.Size = new System.Drawing.Size(112, 13);
this.Error21.TabIndex = 78;
this.Error21.Text = "Invalid Motion Setting!";
this.Error21.Visible = false;
//
// Error22
//
this.Error22.AutoSize = true;
this.Error22.Location = new System.Drawing.Point(829, 378);
this.Error22.Name = "Error22";
this.Error22.Size = new System.Drawing.Size(332, 13);
this.Error22.TabIndex = 79;
this.Error22.Text = "python.exe is not running. Maybe it crashed, Please check the log.txt";
this.Error22.Visible = false;
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(552, 577);
this.Controls.Add(this.Error22);
this.Controls.Add(this.Error21);
this.Controls.Add(this.Error20);
this.Controls.Add(this.Error19);
this.Controls.Add(this.Error18);
this.Controls.Add(this.Error17);
this.Controls.Add(this.Error16);
this.Controls.Add(this.Error15);
this.Controls.Add(this.Error14);
this.Controls.Add(this.Error13);
this.Controls.Add(this.Error12);
this.Controls.Add(this.Error11);
this.Controls.Add(this.Error10);
this.Controls.Add(this.Error9);
this.Controls.Add(this.Error8);
this.Controls.Add(this.Error7);
this.Controls.Add(this.Error6);
this.Controls.Add(this.Error5);
this.Controls.Add(this.Error4);
this.Controls.Add(this.Error3);
this.Controls.Add(this.Error2);
this.Controls.Add(this.Error1);
this.Controls.Add(this.IsRunninglbl);
this.Controls.Add(this.LoadingAilbl);
this.Controls.Add(this.FaultLoadinglbl);
this.Controls.Add(this.MissingPredictlbl);
this.Controls.Add(this.MissingRuyilbl);
this.Controls.Add(this.MissingSystemlbl);
this.Controls.Add(this.Errorlbl);
this.Controls.Add(this.discordhook);
this.Controls.Add(this.discordlbl);
this.Controls.Add(this.Updates);
this.Controls.Add(this.panel1);
this.Controls.Add(this.RunJobs);
@ -782,24 +1159,56 @@
private System.Windows.Forms.ComboBox Scheduler;
private System.Windows.Forms.Button GenerateButton;
private System.Windows.Forms.Button PlayVideo;
private System.Windows.Forms.Timer timer1;
private System.Windows.Forms.Timer FileWatch;
private System.Windows.Forms.Button AddJob;
private System.Windows.Forms.ListBox JobList;
private System.Windows.Forms.Button RemoveJob;
private System.Windows.Forms.Button RunJobs;
private System.Windows.Forms.Timer timer2;
private System.Windows.Forms.Timer JobsTimer;
private System.Windows.Forms.Button Batch;
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label Mp4Reslbl;
private System.Windows.Forms.ComboBox VideoRes;
private System.Windows.Forms.TextBox Weighttxt;
private System.Windows.Forms.Label Weightlbl;
private System.Windows.Forms.Button LoraButton;
private System.Windows.Forms.TextBox Loratxt;
private System.Windows.Forms.Label Loralbl;
private System.Windows.Forms.Timer timer3;
private System.Windows.Forms.Timer CrashChecker;
private System.Windows.Forms.CheckBox Updates;
private System.Windows.Forms.ComboBox GPUOffload;
private System.Windows.Forms.Timer GPUPerf;
private System.Windows.Forms.Label discordlbl;
private System.Windows.Forms.TextBox discordhook;
private System.Windows.Forms.Label Errorlbl;
private System.Windows.Forms.Label MissingSystemlbl;
private System.Windows.Forms.Label MissingRuyilbl;
private System.Windows.Forms.Label MissingPredictlbl;
private System.Windows.Forms.Label FaultLoadinglbl;
private System.Windows.Forms.Label LoadingAilbl;
private System.Windows.Forms.Label IsRunninglbl;
private System.Windows.Forms.Label Error1;
private System.Windows.Forms.Label Error2;
private System.Windows.Forms.Label Error3;
private System.Windows.Forms.Label Error4;
private System.Windows.Forms.Label Error5;
private System.Windows.Forms.Label Error6;
private System.Windows.Forms.Label Error7;
private System.Windows.Forms.Label Error8;
private System.Windows.Forms.Label Error9;
private System.Windows.Forms.Label Error10;
private System.Windows.Forms.Label Error11;
private System.Windows.Forms.Label Error12;
private System.Windows.Forms.Label Error13;
private System.Windows.Forms.Label Error14;
private System.Windows.Forms.Label Error15;
private System.Windows.Forms.Label Error16;
private System.Windows.Forms.Label Error17;
private System.Windows.Forms.Label Error18;
private System.Windows.Forms.Label Error19;
private System.Windows.Forms.Label Error20;
private System.Windows.Forms.Label Error21;
private System.Windows.Forms.Label Error22;
}
}

View File

@ -16,6 +16,7 @@ using System.IO.Compression;
using System.Linq;
using System.Management;
using System.Net;
using System.Net.Http;
using System.Reflection;
using System.Security.Cryptography;
using System.Text;
@ -33,19 +34,23 @@ namespace Ruyi_GUI
public bool DoingJobs = false;
public bool Not100 = true;
public DateTime StartTime;
public string GPUInfo;
public int MaxVram = 0;
public Form1()
{
InitializeComponent();
if (File.Exists("Lang.cfg")) { LoadLangFile(this.Controls, File.ReadAllLines("Lang.cfg")); }
else { SaveLangFile(); }
if (File.Exists("Config.cfg")) { LoadSettings(File.ReadAllText("Config.cfg")); }
else { SaveSettings(); }
if (!File.Exists("environment.bat") || !Directory.Exists("system"))
{
MessageBox.Show("Missing system folder and environment.bat file! \nIs this being ran from python environment?", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
MessageBox.Show(MissingSystemlbl.Text, Errorlbl.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
}
if (!Directory.Exists("Ruyi-Models-main") || !File.Exists(Path.Combine("Ruyi-Models-main", "predict_i2v.py")))
{
if (MessageBox.Show("Missing Ruyi-Models-main!\nClone from Github Repo?", "Error", MessageBoxButtons.YesNo, MessageBoxIcon.Error) == DialogResult.Yes)
if (MessageBox.Show(MissingRuyilbl.Text, Errorlbl.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Error) == DialogResult.Yes)
{
using (var client = new WebClient())
{
@ -63,20 +68,59 @@ namespace Ruyi_GUI
if (File.Exists(Path.Combine("Ruyi-Models-main", "predict_i2v.py")))
{
PythonCode = File.ReadAllLines(Path.Combine("Ruyi-Models-main", "predict_i2v.py"));
if (File.Exists("nvidia-smi.exe") && NvidiaSMI() != null) { GPUPerf.Enabled = true; }
}
else
{
MessageBox.Show("Missing predict_i2v.py file", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
MessageBox.Show(MissingPredictlbl.Text, Errorlbl.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
GenerateButton.Enabled = false;
Batch.Enabled = false;
}
}
private string SettingsString() { return Img1.Text + "|" + Img2.Text + "|" + VideoOut.Text + "|" + FrameRate.Text + "|" + AspectRatio.Text + "|" + Resolution.Text + "|" + Direction.Text + "|" + Motion.Text + "|" + GPUOffload.Text + "|" + LowMemoryMode.Checked + "|" + Steps.Text + "|" + Cfg.Text + "|" + Seed.Text + "|" + Scheduler.Text + "|" + VideoRes.Text + "|" + Loratxt.Text + "|" + Weighttxt.Text + "|" + Updates.Checked; }
private void RetrieveControlTexts(Control.ControlCollection controls, Dictionary<string, string> controlTexts)
{
foreach (Control control in controls)
{
if (control is Label || control is Button) { controlTexts.Add(control.Name, control.Text); }
if (control.HasChildren) { RetrieveControlTexts(control.Controls, controlTexts); }
}
}
private void SaveLangFile()
{
Dictionary<string, string> controlTexts = new Dictionary<string, string>();
RetrieveControlTexts(this.Controls, controlTexts);
using (StreamWriter writer = new StreamWriter("Lang.cfg"))
{
foreach (var kvp in controlTexts) { writer.WriteLine($"{kvp.Key},{kvp.Value}"); }
}
}
private void LoadLangFile(Control.ControlCollection controls, string[] strings)
{
foreach (Control control in controls)
{
if (control is Label || control is Button)
{
foreach (string s in strings)
{
if (s.StartsWith(control.Name))
{
control.Text = s.Replace(control.Name + ",", "");
break;
}
}
}
if (control.HasChildren) { LoadLangFile(control.Controls, strings); }
}
}
private string SettingsString() { return Img1.Text + "|" + Img2.Text + "|" + VideoOut.Text + "|" + FrameRate.Text + "|" + AspectRatio.Text + "|" + Resolution.Text + "|" + Direction.Text + "|" + Motion.Text + "|" + GPUOffload.Text + "|" + LowMemoryMode.Checked + "|" + Steps.Text + "|" + Cfg.Text + "|" + Seed.Text + "|" + Scheduler.Text + "|" + VideoRes.Text + "|" + Loratxt.Text + "|" + Weighttxt.Text + "|" + Updates.Checked + "|" + discordhook.Text; }
private void SaveSettings() { File.WriteAllText("Config.cfg", SettingsString()); }
private void LoadSettings(string Settings)
private void LoadSettings(string Settings, bool ShowError = true)
{
try
{
@ -99,16 +143,42 @@ namespace Ruyi_GUI
Loratxt.Text = SSettings[15];
Weighttxt.Text = SSettings[16];
Updates.Checked = bool.Parse(SSettings[17]);
discordhook.Text = SSettings[18];
}
catch
{
MessageBox.Show("Fault loading Config.cfg.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
if (ShowError)
{
MessageBox.Show(FaultLoadinglbl.Text, Errorlbl.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
if (File.Exists(Img1.Text)) { pictureBox1.BackgroundImage = new Bitmap(Img1.Text); }
else { pictureBox1.BackgroundImage = null; }
if (File.Exists(Img2.Text)) { pictureBox2.BackgroundImage = new Bitmap(Img2.Text); }
else { pictureBox2.BackgroundImage = null; }
}
private string[] NvidiaSMI()
{
ProcessStartInfo startInfo = new ProcessStartInfo
{
FileName = "cmd.exe",
Arguments = "/c nvidia-smi --query-gpu=temperature.gpu,memory.used,utilization.gpu --format=csv,noheader,nounits",
RedirectStandardOutput = true,
UseShellExecute = false,
CreateNoWindow = true
};
using (Process process = new Process { StartInfo = startInfo })
{
process.Start();
string output = process.StandardOutput.ReadToEnd();
process.WaitForExit();
string[] parts = output.TrimEnd('\r', '\n').Replace(" ", "").Split(',');
if (parts.Length == 3) { return parts; }
}
return null;
}
private string GetTimestamp()
{
DateTime currentTime = DateTime.UtcNow;
@ -145,49 +215,39 @@ namespace Ruyi_GUI
private void LogFiltered(string message)
{
if (string.IsNullOrEmpty(message) || message.Contains(" attn_output = torch.nn.functional.scaled_dot_product_attention(")) { return; }
LogMessages.Add(message);
if (message.Contains("%") || message.StartsWith("Fetching ")) { AppendTextBox(message); }
if (message.StartsWith("Fetching ")) { return; }
if (string.IsNullOrEmpty(message)) { return; }
if (message.Contains("%|")) { LogMessages.Add(message + GPUInfo); }
else { LogMessages.Add(message); }
if (message.StartsWith("Fetching ")) { AppendTextBox(message); return; }
if (message.Contains("%")) { AppendTextBox(message + GPUInfo); }
if (message.Contains("100%") && Not100) { Not100 = false; return; }
if (message.Contains("100%"))
{
Not100 = true;
timer3.Enabled = false;
CrashChecker.Enabled = false;
AppendTextBox("Saving Mp4...");
GenerateButton.BeginInvoke(new Action(() => { GenerateButton.Enabled = true; }));
panel1.BeginInvoke(new Action(() => { panel1.Enabled = true; }));
Updates.BeginInvoke(new Action(() => { Updates.Enabled = true; }));
var Elapsed = DateTime.Now - StartTime;
if (GPUPerf.Enabled && MaxVram > 0) { LogMessages.Add("Max Vram Usage: [" + MaxVram + "MB]"); }
LogMessages.Add("Finished Generation @ " + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "[" + Math.Round(Elapsed.TotalSeconds, 2) + "s]");
if (DoingJobs)
{
while (!File.Exists(VideoOut.Text)) { Thread.Sleep(1000); }
while (!File.Exists(VideoOut.Text)) { Thread.Sleep(500); }
DoingJobs = false;
string Job = Path.Combine("Jobs", JobList.Items[0].ToString());
if (File.Exists(Job)) { File.Delete(Job); }
JobList.Items.RemoveAt(0);
if (!string.IsNullOrEmpty(discordhook.Text) && discordhook.Text.StartsWith(@"https://discord.")) { DiscordPostFile(discordhook.Text, VideoOut.Text); }
return;
}
Task.Run(() =>
{
while (!File.Exists(VideoOut.Text)) { Thread.Sleep(1000); }
while (!File.Exists(VideoOut.Text)) { Thread.Sleep(500); }
ControlsUpdate(true);
AppendTextBox("");
});
}
}
public static string Decompress(byte[] data)
{
MemoryStream input = new MemoryStream(data);
MemoryStream output = new MemoryStream();
using (DeflateStream dstream = new DeflateStream(input, CompressionMode.Decompress))
{
dstream.CopyTo(output);
}
return Convert.ToBase64String(output.ToArray());
}
private void GenerateButton_Click(object sender, EventArgs e)
{
if (ValidateInOut())
@ -204,94 +264,94 @@ namespace Ruyi_GUI
string Lora = string.IsNullOrEmpty(Loratxt.Text) ? "None" : @"""" + Loratxt.Text.Replace(@"\", @"\\") + @"""";
foreach (string line in PythonCode)
{
if (line.StartsWith("start_image_path = "))
if (line.StartsWith("start_image_path"))
{
code += @"start_image_path = """ + Img1.Text.Replace(@"\", @"\\") + @"""" + System.Environment.NewLine;
code += @"start_image_path = """ + Img1.Text.Replace(@"\", @"\\") + @"""" + System.Environment.NewLine;
continue;
}
if (line.StartsWith("end_image_path = "))
if (line.StartsWith("end_image_path"))
{
code += "end_image_path = " + Image2.Replace(@"\", @"\\") + System.Environment.NewLine;
code += "end_image_path = " + Image2.Replace(@"\", @"\\") + System.Environment.NewLine;
continue;
}
if (line.StartsWith("output_video_path = "))
if (line.StartsWith("output_video_path"))
{
code += @"output_video_path = """ + VideoOut.Text.Replace(@"\", @"\\") + @"""" + System.Environment.NewLine;
code += @"output_video_path = """ + VideoOut.Text.Replace(@"\", @"\\") + @"""" + System.Environment.NewLine;
continue;
}
if (line.StartsWith("video_length = "))
if (line.StartsWith("video_length"))
{
code += @"video_length = " + FrameRate.Text + System.Environment.NewLine;
code += @"video_length = " + FrameRate.Text + System.Environment.NewLine;
continue;
}
if (line.StartsWith("base_resolution = "))
if (line.StartsWith("base_resolution"))
{
code += @"base_resolution = " + Resolution.Text + System.Environment.NewLine;
code += @"base_resolution = " + Resolution.Text + System.Environment.NewLine;
continue;
}
if (line.StartsWith("video_size = "))
if (line.StartsWith("video_size"))
{
code += @"video_size = " + VideoRes.Text.Replace("auto", "None") + System.Environment.NewLine;
code += @"video_size = " + VideoRes.Text.Replace("auto", "None") + System.Environment.NewLine;
continue;
}
if (line.StartsWith("aspect_ratio = "))
if (line.StartsWith("aspect_ratio"))
{
code += @"aspect_ratio = """ + AspectRatio.Text + @"""" + System.Environment.NewLine;
code += @"aspect_ratio = """ + AspectRatio.Text + @"""" + System.Environment.NewLine;
continue;
}
if (line.StartsWith("motion = "))
if (line.StartsWith("motion"))
{
code += @"motion = """ + Motion.Text + @"""" + System.Environment.NewLine;
code += @"motion = """ + Motion.Text + @"""" + System.Environment.NewLine;
continue;
}
if (line.StartsWith("camera_direction = "))
if (line.StartsWith("camera_direction"))
{
code += @"camera_direction = """ + Direction.Text + @"""" + System.Environment.NewLine;
code += @"camera_direction = """ + Direction.Text + @"""" + System.Environment.NewLine;
continue;
}
if (line.StartsWith("steps = "))
if (line.StartsWith("steps"))
{
code += @"steps = " + Steps.Text + System.Environment.NewLine;
code += @"steps = " + Steps.Text + System.Environment.NewLine;
continue;
}
if (line.StartsWith("cfg = "))
if (line.StartsWith("cfg"))
{
code += @"cfg = " + Cfg.Text + System.Environment.NewLine;
code += @"cfg = " + Cfg.Text + System.Environment.NewLine;
continue;
}
if (line.StartsWith("scheduler_name = "))
if (line.StartsWith("scheduler_name"))
{
code += @"scheduler_name = """ + Scheduler.Text + @"""" + System.Environment.NewLine;
code += @"scheduler_name = """ + Scheduler.Text + @"""" + System.Environment.NewLine;
continue;
}
if (line.StartsWith("low_gpu_memory_mode = "))
if (line.StartsWith("low_gpu_memory_mode"))
{
code += @"low_gpu_memory_mode = " + LowMemoryMode.Checked.ToString() + System.Environment.NewLine;
continue;
}
if (line.StartsWith("gpu_offload_steps = "))
if (line.StartsWith("gpu_offload_steps"))
{
code += @"gpu_offload_steps = " + GPUOffload.Text + System.Environment.NewLine;
code += @"gpu_offload_steps = " + GPUOffload.Text + System.Environment.NewLine;
continue;
}
if (line.StartsWith("seed = "))
if (line.StartsWith("seed"))
{
code += @"seed = " + Seed.Text + System.Environment.NewLine;
code += @"seed = " + Seed.Text + System.Environment.NewLine;
continue;
}
if (line.StartsWith("lora_path = "))
if (line.StartsWith("lora_path"))
{
code += @"lora_path = " + Lora + System.Environment.NewLine;
code += @"lora_path = " + Lora + System.Environment.NewLine;
continue;
}
if (line.StartsWith("lora_weight = "))
if (line.StartsWith("lora_weight"))
{
code += @"lora_weight = " + Weighttxt.Text + System.Environment.NewLine;
code += @"lora_weight = " + Weighttxt.Text + System.Environment.NewLine;
continue;
}
if (line.StartsWith("auto_update = "))
if (line.StartsWith("auto_update"))
{
code += @"auto_update = " + Updates.Checked.ToString() + System.Environment.NewLine;
code += @"auto_update = " + Updates.Checked.ToString() + System.Environment.NewLine;
continue;
}
code += line + System.Environment.NewLine;
@ -302,17 +362,16 @@ namespace Ruyi_GUI
private void ExecuteCommand()
{
string CallCode = ParsePythonCode();
if (string.IsNullOrEmpty(CallCode)) { MessageBox.Show("Bad Python Code", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; }
if (string.IsNullOrEmpty(CallCode)) { return; }
File.WriteAllText(Path.Combine("Ruyi-Models-main", "i2v.py"), CallCode);
if (File.Exists(VideoOut.Text)) { File.Move(VideoOut.Text, VideoOut.Text.Replace(".mp4", "-" + GetTimestamp() + ".mp4")); }
StartTime = DateTime.Now;
LogMessages.Add("Starting Generation: [" + FrameRate.Text + "-" + Resolution.Text + "-"+(LowMemoryMode.Checked ?"Lowmem" : "Normal") + "-"+GPUOffload.Text + "] " + Path.GetFileName(Img1.Text) + " @ " + StartTime.ToString("yyyy-MM-dd HH:mm:ss"));
LogMessages.Add("Starting Generation: [" + FrameRate.Text + "-" + Resolution.Text + "-" + (LowMemoryMode.Checked ? "Lowmem" : "Normal") + "-" + GPUOffload.Text + "] " + Path.GetFileName(Img1.Text) + " @ " + StartTime.ToString("yyyy-MM-dd HH:mm:ss"));
Task.Run(() =>
{
GenerateButton.BeginInvoke(new Action(() => { GenerateButton.Enabled = false; }));
panel1.BeginInvoke(new Action(() => { panel1.Enabled = false; }));
Updates.BeginInvoke(new Action(() => { Updates.Enabled = false; }));
AppendTextBox("Loading AI Please Wait...");
MaxVram = 0;
ControlsUpdate(false);
AppendTextBox(LoadingAilbl.Text);
var processInfo = new ProcessStartInfo("cmd.exe", "/c call " + Path.Combine(AssemblyDirectory(), "environment.bat") + " && cd " + Path.Combine(AssemblyDirectory(), "Ruyi-Models-main") + " && python i2v.py");
processInfo.CreateNoWindow = true;
processInfo.UseShellExecute = false;
@ -326,7 +385,7 @@ namespace Ruyi_GUI
process.WaitForExit();
process.Close();
});
timer3.Enabled = true;
CrashChecker.Enabled = true;
}
private string SelectImageButton()
@ -370,6 +429,7 @@ namespace Ruyi_GUI
saveFileDialog1.ShowDialog();
VideoOut.Text = saveFileDialog1.FileName;
}
private string GetCommandLineArgs(int processId)
{
try
@ -385,7 +445,10 @@ namespace Ruyi_GUI
private void Form1_FormClosing(object sender, FormClosingEventArgs e)
{
timer1.Enabled = false;
FileWatch.Enabled = false;
JobsTimer.Enabled = false;
CrashChecker.Enabled = false;
GPUPerf.Enabled = false;
SaveSettings();
if (process != null) { try { process.Kill(); } catch { } }
Process[] processes = Process.GetProcesses();
@ -395,7 +458,7 @@ namespace Ruyi_GUI
{
if (GetCommandLineArgs(process.Id).Contains("i2v.py"))
{
if (MessageBox.Show(@"""python i2v.py"" is running. Do you want to close it?", "Error", MessageBoxButtons.YesNo, MessageBoxIcon.Error) == DialogResult.Yes)
if (MessageBox.Show(@"""python i2v.py"" " + IsRunninglbl.Text, Errorlbl.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Error) == DialogResult.Yes)
{
LogMessages.Add("Terminating Python Process");
process.Kill();
@ -403,8 +466,11 @@ namespace Ruyi_GUI
}
}
}
File.AppendAllLines("log.txt", LogMessages);
LogMessages.Clear();
if (LogMessages.Count > 0)
{
File.AppendAllLines("log.txt", LogMessages);
LogMessages.Clear();
}
}
private void PlayVideo_Click(object sender, EventArgs e)
@ -412,7 +478,7 @@ namespace Ruyi_GUI
if (File.Exists(VideoOut.Text)) { System.Diagnostics.Process.Start(VideoOut.Text); }
}
private void timer1_Tick(object sender, EventArgs e)
private void FileWatch_Tick(object sender, EventArgs e)
{
if (File.Exists(VideoOut.Text)) { PlayVideo.Enabled = true; }
else { PlayVideo.Enabled = false; }
@ -425,27 +491,27 @@ namespace Ruyi_GUI
private bool ValidateInOut()
{
if (string.IsNullOrEmpty(VideoOut.Text)) { MessageBox.Show("You Must Select A Video Output", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return false; }
if (string.IsNullOrEmpty(Img1.Text)) { MessageBox.Show("You Must Select A Input Image", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return false; }
if (string.IsNullOrEmpty(FrameRate.Text)) { MessageBox.Show("Frame Rate Can't Be Null", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return false; }
if (string.IsNullOrEmpty(AspectRatio.Text)) { MessageBox.Show("Aspect Ratio Can't Be Null", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return false; }
if (string.IsNullOrEmpty(Resolution.Text)) { MessageBox.Show("Resolution Can't Be Null", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return false; }
if (string.IsNullOrEmpty(Direction.Text)) { MessageBox.Show("Direction Can't Be Null", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return false; }
if (string.IsNullOrEmpty(Motion.Text)) { MessageBox.Show("Motion Can't Be Null", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return false; }
if (string.IsNullOrEmpty(VideoRes.Text)) { MessageBox.Show("Mp4 Resolution Can't Be Null", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return false; }
if (string.IsNullOrEmpty(GPUOffload.Text)) { MessageBox.Show("GPU Offload Can't Be Null", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return false; }
if (string.IsNullOrEmpty(Steps.Text)) { MessageBox.Show("Steps Can't Be Null", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return false; }
if (string.IsNullOrEmpty(Cfg.Text)) { MessageBox.Show("Cfg Can't Be Null", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return false; }
if (string.IsNullOrEmpty(Seed.Text)) { MessageBox.Show("Seed Can't Be Null", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return false; }
if (string.IsNullOrEmpty(Scheduler.Text)) { MessageBox.Show("Scheduler Can't Be Null", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return false; }
if (string.IsNullOrEmpty(Weighttxt.Text)) { MessageBox.Show("Lora Weight Can't Be Null", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return false; }
if (!AspectRatio.Text.Contains(":")) { MessageBox.Show("Aspect Ratio Not Valid Format", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return false; }
if (!VideoRes.Text.Contains(", ") && !VideoRes.Text.Contains("None") && !VideoRes.Text.Contains("auto")) { MessageBox.Show("Mp4 Resolution Not Valid Format", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return false; }
if (int.TryParse(FrameRate.Text, out int FPS)) { if (FPS < 24 || FPS > 120) { MessageBox.Show("Invalid Video Frames Setting [24-120]", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return false; } }
if (int.TryParse(Resolution.Text, out int RES)) { if (RES < 384 || RES > 896) { MessageBox.Show("Invalid Generation Resolution Setting [384-896]", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return false; } }
if (!GPUOffload.Items.Contains(GPUOffload.Text)) { MessageBox.Show("Invalid GPU Offload Steps Setting [0, 10, 7, 5, 1]", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return false; }
if (!Direction.Items.Contains(Direction.Text)) { MessageBox.Show("Invalid Camera Direction Setting", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return false; }
if (!Motion.Items.Contains(Motion.Text)) { MessageBox.Show("Invalid Motion Setting", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return false; }
if (string.IsNullOrEmpty(VideoOut.Text)) { MessageBox.Show(Error1.Text, Errorlbl.Text, MessageBoxButtons.OK, MessageBoxIcon.Error); return false; }
if (string.IsNullOrEmpty(Img1.Text)) { MessageBox.Show(Error2.Text, Errorlbl.Text, MessageBoxButtons.OK, MessageBoxIcon.Error); return false; }
if (string.IsNullOrEmpty(FrameRate.Text)) { MessageBox.Show(Error3.Text, Errorlbl.Text, MessageBoxButtons.OK, MessageBoxIcon.Error); return false; }
if (string.IsNullOrEmpty(AspectRatio.Text)) { MessageBox.Show(Error4.Text, Errorlbl.Text, MessageBoxButtons.OK, MessageBoxIcon.Error); return false; }
if (string.IsNullOrEmpty(Resolution.Text)) { MessageBox.Show(Error5.Text, Errorlbl.Text, MessageBoxButtons.OK, MessageBoxIcon.Error); return false; }
if (string.IsNullOrEmpty(Direction.Text)) { MessageBox.Show(Error6.Text, Errorlbl.Text, MessageBoxButtons.OK, MessageBoxIcon.Error); return false; }
if (string.IsNullOrEmpty(Motion.Text)) { MessageBox.Show(Error7.Text, Errorlbl.Text, MessageBoxButtons.OK, MessageBoxIcon.Error); return false; }
if (string.IsNullOrEmpty(VideoRes.Text)) { MessageBox.Show(Error8.Text, Errorlbl.Text, MessageBoxButtons.OK, MessageBoxIcon.Error); return false; }
if (string.IsNullOrEmpty(GPUOffload.Text)) { MessageBox.Show(Error9.Text, Errorlbl.Text, MessageBoxButtons.OK, MessageBoxIcon.Error); return false; }
if (string.IsNullOrEmpty(Steps.Text)) { MessageBox.Show(Error10.Text, Errorlbl.Text, MessageBoxButtons.OK, MessageBoxIcon.Error); return false; }
if (string.IsNullOrEmpty(Cfg.Text)) { MessageBox.Show(Error11.Text, Errorlbl.Text, MessageBoxButtons.OK, MessageBoxIcon.Error); return false; }
if (string.IsNullOrEmpty(Seed.Text)) { MessageBox.Show(Error12.Text, Errorlbl.Text, MessageBoxButtons.OK, MessageBoxIcon.Error); return false; }
if (string.IsNullOrEmpty(Scheduler.Text)) { MessageBox.Show(Error13.Text, Errorlbl.Text, MessageBoxButtons.OK, MessageBoxIcon.Error); return false; }
if (string.IsNullOrEmpty(Weighttxt.Text)) { MessageBox.Show(Error14.Text, Errorlbl.Text, MessageBoxButtons.OK, MessageBoxIcon.Error); return false; }
if (!AspectRatio.Text.Contains(":")) { MessageBox.Show(Error15.Text, Errorlbl.Text, MessageBoxButtons.OK, MessageBoxIcon.Error); return false; }
if (!VideoRes.Text.Contains(", ") && !VideoRes.Text.Contains("None") && !VideoRes.Text.Contains("auto")) { MessageBox.Show(Error16.Text, Errorlbl.Text, MessageBoxButtons.OK, MessageBoxIcon.Error); return false; }
if (int.TryParse(FrameRate.Text, out int FPS)) { if (FPS < 24 || FPS > 120) { MessageBox.Show(Error17.Text, Errorlbl.Text, MessageBoxButtons.OK, MessageBoxIcon.Error); return false; } }
if (int.TryParse(Resolution.Text, out int RES)) { if (RES < 384 || RES > 896) { MessageBox.Show(Error18.Text, Errorlbl.Text, MessageBoxButtons.OK, MessageBoxIcon.Error); return false; } }
if (!GPUOffload.Items.Contains(GPUOffload.Text)) { MessageBox.Show(Error19.Text, Errorlbl.Text, MessageBoxButtons.OK, MessageBoxIcon.Error); return false; }
if (!Direction.Items.Contains(Direction.Text)) { MessageBox.Show(Error20.Text, Errorlbl.Text, MessageBoxButtons.OK, MessageBoxIcon.Error); return false; }
if (!Motion.Items.Contains(Motion.Text)) { MessageBox.Show(Error21.Text, Errorlbl.Text, MessageBoxButtons.OK, MessageBoxIcon.Error); return false; }
return true;
}
@ -472,15 +538,11 @@ namespace Ruyi_GUI
private void RunJobs_Click(object sender, EventArgs e)
{
timer2.Enabled = true;
RunJobs.Enabled = false;
JobList.Enabled = false;
AddJob.Enabled = false;
RemoveJob.Enabled = false;
JobsTimer.Enabled = true;
JobList.SelectedIndex = -1;
}
private void timer2_Tick(object sender, EventArgs e)
private void JobsTimer_Tick(object sender, EventArgs e)
{
if (DoingJobs) { return; }
if (JobList.Items.Count > 0)
@ -493,23 +555,33 @@ namespace Ruyi_GUI
else
{
AppendTextBox("");
RunJobs.Enabled = true;
JobList.Enabled = true;
AddJob.Enabled = true;
RemoveJob.Enabled = true;
timer2.Enabled = false;
ControlsUpdate(true);
JobsTimer.Enabled = false;
DoingJobs = false;
return;
}
}
private void ControlsUpdate(bool set)
{
RunJobs.BeginInvoke(new Action(() => { RunJobs.Enabled = set; }));
JobList.BeginInvoke(new Action(() => { JobList.Enabled = set; }));
discordhook.BeginInvoke(new Action(() => { discordhook.Enabled = set; }));
discordlbl.BeginInvoke(new Action(() => { discordlbl.Enabled = set; }));
AddJob.BeginInvoke(new Action(() => { AddJob.Enabled = set; }));
RemoveJob.BeginInvoke(new Action(() => { RemoveJob.Enabled = set; }));
GenerateButton.BeginInvoke(new Action(() => { GenerateButton.Enabled = set; }));
panel1.BeginInvoke(new Action(() => { panel1.Enabled = set; }));
Updates.BeginInvoke(new Action(() => { Updates.Enabled = set; }));
}
private void UpdateJobList(bool Force = false)
{
if (JobList.SelectedIndex == -1 && !Force) { return; }
int index = (JobList.SelectedIndex == -1) ? 0 : JobList.SelectedIndex;
if (File.Exists(Path.Combine("Jobs", JobList.Items[index].ToString())))
{
LoadSettings(File.ReadAllText(Path.Combine("Jobs", JobList.Items[index].ToString())));
LoadSettings(File.ReadAllText(Path.Combine("Jobs", JobList.Items[index].ToString())), false);
}
}
@ -517,14 +589,13 @@ namespace Ruyi_GUI
private void Batch_Click(object sender, EventArgs e)
{
if (this.Width == 810) { this.Width = 572; JobList.Items.Clear(); GenerateButton.Enabled = true; }
if (this.Width == 810) { this.Width = 572; JobList.Items.Clear(); }
else
{
GenerateButton.Enabled = false;
if (Directory.Exists("Jobs"))
{
DirectoryInfo d = new DirectoryInfo("Jobs");
FileInfo[] Files = d.GetFiles("*"); //Getting Text files
FileInfo[] Files = d.GetFiles("*");
foreach (FileInfo file in Files)
{
if (file.Name.Length == 64)
@ -574,25 +645,46 @@ namespace Ruyi_GUI
dialog.Dispose();
}
private void timer3_Tick(object sender, EventArgs e)
private void CrashChecker_Tick(object sender, EventArgs e)
{
Process[] processes = Process.GetProcesses();
bool isPythonRunning = processes.Any(p => p.ProcessName.Equals("python", StringComparison.OrdinalIgnoreCase));
if (!isPythonRunning)
{
AppendTextBox("Error");
timer3.Enabled = false;
MessageBox.Show("python.exe is not running. Maybe it crashed, Please check the log.txt", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
GenerateButton.Enabled = true;
panel1.Enabled = true;
Updates.Enabled = true;
RunJobs.Enabled = true;
JobList.Enabled = true;
AddJob.Enabled = true;
RemoveJob.Enabled = true;
timer2.Enabled = false;
AppendTextBox(Errorlbl.Text);
CrashChecker.Enabled = false;
ControlsUpdate(true);
JobsTimer.Enabled = false;
DoingJobs = false;
timer2.Enabled = false;
MessageBox.Show(Error22.Text, Errorlbl.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
public void DiscordPostFile(string url, string FilePath)
{
try
{
using (HttpClient httpClient = new HttpClient())
{
MultipartFormDataContent form = new MultipartFormDataContent();
var file_bytes = System.IO.File.ReadAllBytes(FilePath);
string FileName = Path.GetFileName(FilePath);
form.Add(new ByteArrayContent(file_bytes, 0, file_bytes.Length), "png-" + FileName, FileName);
httpClient.PostAsync(url, form).Wait();
LogMessages.Add("Posted Video To Discord Webhook");
}
}
catch (Exception ex) { LogMessages.Add("[Discord] " + ex.ToString()); }
}
private void GPUPerf_Tick(object sender, EventArgs e)
{
string[] Output = NvidiaSMI();
if (Output != null)
{
GPUInfo = " [GPU:" + Output[2] + "% " + Output[0] + "C " + Output[1] + "MB]";
if (int.TryParse(Output[1], out int Vram)) { if (Vram > MaxVram) { MaxVram = Vram; } }
this.Text = this.Text.Split(new string[] { " [GPU:" }, StringSplitOptions.RemoveEmptyEntries)[0] + GPUInfo;
}
}
}

View File

@ -117,15 +117,18 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<metadata name="FileWatch.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="timer2.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<metadata name="JobsTimer.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>105, 17</value>
</metadata>
<metadata name="timer3.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<metadata name="CrashChecker.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>193, 17</value>
</metadata>
<metadata name="GPUPerf.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>281, 17</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>

Binary file not shown.

Binary file not shown.