mirror of https://github.com/bmgjet/Ruyi-GUI.git
Add More Error Checking
This commit is contained in:
parent
9113aec649
commit
12e8e332c6
|
@ -53,7 +53,6 @@
|
|||
this.Direction = new System.Windows.Forms.ComboBox();
|
||||
this.LowMemoryMode = new System.Windows.Forms.CheckBox();
|
||||
this.Offloadlbl = new System.Windows.Forms.Label();
|
||||
this.GPUOffload = new System.Windows.Forms.TextBox();
|
||||
this.Samplerlbl = new System.Windows.Forms.Label();
|
||||
this.Steps = new System.Windows.Forms.TextBox();
|
||||
this.Stepslbl = new System.Windows.Forms.Label();
|
||||
|
@ -73,7 +72,7 @@
|
|||
this.timer2 = new System.Windows.Forms.Timer(this.components);
|
||||
this.Batch = new System.Windows.Forms.Button();
|
||||
this.panel1 = new System.Windows.Forms.Panel();
|
||||
this.Updates = new System.Windows.Forms.CheckBox();
|
||||
this.GPUOffload = new System.Windows.Forms.ComboBox();
|
||||
this.Weighttxt = new System.Windows.Forms.TextBox();
|
||||
this.Weightlbl = new System.Windows.Forms.Label();
|
||||
this.LoraButton = new System.Windows.Forms.Button();
|
||||
|
@ -81,6 +80,7 @@
|
|||
this.Loralbl = new System.Windows.Forms.Label();
|
||||
this.label1 = 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);
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).BeginInit();
|
||||
|
@ -89,7 +89,7 @@
|
|||
//
|
||||
// pictureBox1
|
||||
//
|
||||
this.pictureBox1.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
|
||||
this.pictureBox1.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
|
||||
this.pictureBox1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.pictureBox1.Location = new System.Drawing.Point(6, 6);
|
||||
this.pictureBox1.Margin = new System.Windows.Forms.Padding(2);
|
||||
|
@ -100,7 +100,7 @@
|
|||
//
|
||||
// pictureBox2
|
||||
//
|
||||
this.pictureBox2.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
|
||||
this.pictureBox2.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
|
||||
this.pictureBox2.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.pictureBox2.Location = new System.Drawing.Point(276, 6);
|
||||
this.pictureBox2.Margin = new System.Windows.Forms.Padding(2);
|
||||
|
@ -245,9 +245,8 @@
|
|||
this.Resolution.FormattingEnabled = true;
|
||||
this.Resolution.Items.AddRange(new object[] {
|
||||
"384",
|
||||
"480",
|
||||
"512",
|
||||
"720",
|
||||
"640",
|
||||
"768",
|
||||
"896"});
|
||||
this.Resolution.Location = new System.Drawing.Point(166, 372);
|
||||
|
@ -275,11 +274,13 @@
|
|||
this.AspectRatio.Items.AddRange(new object[] {
|
||||
"21:9",
|
||||
"16:9",
|
||||
"5:4",
|
||||
"4:3",
|
||||
"3:2",
|
||||
"1:1",
|
||||
"2:3",
|
||||
"3:4",
|
||||
"4:5",
|
||||
"9:16",
|
||||
"9:21"});
|
||||
this.AspectRatio.Location = new System.Drawing.Point(93, 372);
|
||||
|
@ -351,7 +352,7 @@
|
|||
// LowMemoryMode
|
||||
//
|
||||
this.LowMemoryMode.AutoSize = true;
|
||||
this.LowMemoryMode.Location = new System.Drawing.Point(113, 425);
|
||||
this.LowMemoryMode.Location = new System.Drawing.Point(91, 424);
|
||||
this.LowMemoryMode.Margin = new System.Windows.Forms.Padding(2);
|
||||
this.LowMemoryMode.Name = "LowMemoryMode";
|
||||
this.LowMemoryMode.Size = new System.Drawing.Size(142, 17);
|
||||
|
@ -369,17 +370,6 @@
|
|||
this.Offloadlbl.TabIndex = 23;
|
||||
this.Offloadlbl.Text = "GPU Offload Steps:";
|
||||
//
|
||||
// GPUOffload
|
||||
//
|
||||
this.GPUOffload.Location = new System.Drawing.Point(6, 422);
|
||||
this.GPUOffload.Margin = new System.Windows.Forms.Padding(2);
|
||||
this.GPUOffload.MaxLength = 2;
|
||||
this.GPUOffload.Name = "GPUOffload";
|
||||
this.GPUOffload.Size = new System.Drawing.Size(95, 20);
|
||||
this.GPUOffload.TabIndex = 24;
|
||||
this.GPUOffload.Text = "0";
|
||||
this.GPUOffload.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.NumberOnly);
|
||||
//
|
||||
// Samplerlbl
|
||||
//
|
||||
this.Samplerlbl.AutoSize = true;
|
||||
|
@ -495,7 +485,7 @@
|
|||
this.PlayVideo.Enabled = false;
|
||||
this.PlayVideo.Location = new System.Drawing.Point(6, 548);
|
||||
this.PlayVideo.Name = "PlayVideo";
|
||||
this.PlayVideo.Size = new System.Drawing.Size(544, 24);
|
||||
this.PlayVideo.Size = new System.Drawing.Size(324, 24);
|
||||
this.PlayVideo.TabIndex = 35;
|
||||
this.PlayVideo.Text = "Play Video";
|
||||
this.PlayVideo.UseVisualStyleBackColor = true;
|
||||
|
@ -563,7 +553,7 @@
|
|||
//
|
||||
// panel1
|
||||
//
|
||||
this.panel1.Controls.Add(this.Updates);
|
||||
this.panel1.Controls.Add(this.GPUOffload);
|
||||
this.panel1.Controls.Add(this.Weighttxt);
|
||||
this.panel1.Controls.Add(this.Weightlbl);
|
||||
this.panel1.Controls.Add(this.LoraButton);
|
||||
|
@ -581,7 +571,6 @@
|
|||
this.panel1.Controls.Add(this.Steps);
|
||||
this.panel1.Controls.Add(this.Stepslbl);
|
||||
this.panel1.Controls.Add(this.Samplerlbl);
|
||||
this.panel1.Controls.Add(this.GPUOffload);
|
||||
this.panel1.Controls.Add(this.Offloadlbl);
|
||||
this.panel1.Controls.Add(this.LowMemoryMode);
|
||||
this.panel1.Controls.Add(this.Directionlbl);
|
||||
|
@ -610,19 +599,26 @@
|
|||
this.panel1.Size = new System.Drawing.Size(544, 507);
|
||||
this.panel1.TabIndex = 41;
|
||||
//
|
||||
// Updates
|
||||
// GPUOffload
|
||||
//
|
||||
this.Updates.AutoSize = true;
|
||||
this.Updates.Location = new System.Drawing.Point(382, 449);
|
||||
this.Updates.Name = "Updates";
|
||||
this.Updates.Size = new System.Drawing.Size(150, 17);
|
||||
this.Updates.TabIndex = 48;
|
||||
this.Updates.Text = "Check For Model Updates";
|
||||
this.Updates.UseVisualStyleBackColor = true;
|
||||
this.GPUOffload.FormattingEnabled = true;
|
||||
this.GPUOffload.Items.AddRange(new object[] {
|
||||
"0",
|
||||
"10",
|
||||
"7",
|
||||
"5",
|
||||
"1"});
|
||||
this.GPUOffload.Location = new System.Drawing.Point(6, 422);
|
||||
this.GPUOffload.MaxLength = 2;
|
||||
this.GPUOffload.Name = "GPUOffload";
|
||||
this.GPUOffload.Size = new System.Drawing.Size(80, 21);
|
||||
this.GPUOffload.TabIndex = 48;
|
||||
this.GPUOffload.Text = "0";
|
||||
this.GPUOffload.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.NumberOnly);
|
||||
//
|
||||
// Weighttxt
|
||||
//
|
||||
this.Weighttxt.Location = new System.Drawing.Point(330, 422);
|
||||
this.Weighttxt.Location = new System.Drawing.Point(314, 422);
|
||||
this.Weighttxt.Margin = new System.Windows.Forms.Padding(2);
|
||||
this.Weighttxt.MaxLength = 4;
|
||||
this.Weighttxt.Name = "Weighttxt";
|
||||
|
@ -634,7 +630,7 @@
|
|||
// Weightlbl
|
||||
//
|
||||
this.Weightlbl.AutoSize = true;
|
||||
this.Weightlbl.Location = new System.Drawing.Point(282, 426);
|
||||
this.Weightlbl.Location = new System.Drawing.Point(266, 425);
|
||||
this.Weightlbl.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
|
||||
this.Weightlbl.Name = "Weightlbl";
|
||||
this.Weightlbl.Size = new System.Drawing.Size(44, 13);
|
||||
|
@ -643,10 +639,10 @@
|
|||
//
|
||||
// LoraButton
|
||||
//
|
||||
this.LoraButton.Location = new System.Drawing.Point(445, 422);
|
||||
this.LoraButton.Location = new System.Drawing.Point(361, 422);
|
||||
this.LoraButton.Margin = new System.Windows.Forms.Padding(2);
|
||||
this.LoraButton.Name = "LoraButton";
|
||||
this.LoraButton.Size = new System.Drawing.Size(87, 22);
|
||||
this.LoraButton.Size = new System.Drawing.Size(171, 22);
|
||||
this.LoraButton.TabIndex = 45;
|
||||
this.LoraButton.Text = "Select";
|
||||
this.LoraButton.UseVisualStyleBackColor = true;
|
||||
|
@ -655,17 +651,17 @@
|
|||
// Loratxt
|
||||
//
|
||||
this.Loratxt.BackColor = System.Drawing.SystemColors.ButtonHighlight;
|
||||
this.Loratxt.Location = new System.Drawing.Point(318, 400);
|
||||
this.Loratxt.Location = new System.Drawing.Point(314, 400);
|
||||
this.Loratxt.Margin = new System.Windows.Forms.Padding(2);
|
||||
this.Loratxt.Name = "Loratxt";
|
||||
this.Loratxt.ReadOnly = true;
|
||||
this.Loratxt.Size = new System.Drawing.Size(215, 20);
|
||||
this.Loratxt.Size = new System.Drawing.Size(219, 20);
|
||||
this.Loratxt.TabIndex = 44;
|
||||
//
|
||||
// Loralbl
|
||||
//
|
||||
this.Loralbl.AutoSize = true;
|
||||
this.Loralbl.Location = new System.Drawing.Point(282, 403);
|
||||
this.Loralbl.Location = new System.Drawing.Point(279, 403);
|
||||
this.Loralbl.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
|
||||
this.Loralbl.Name = "Loralbl";
|
||||
this.Loralbl.Size = new System.Drawing.Size(31, 13);
|
||||
|
@ -705,6 +701,16 @@
|
|||
this.VideoRes.Text = "auto";
|
||||
this.VideoRes.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.VideoRes_KeyPress);
|
||||
//
|
||||
// Updates
|
||||
//
|
||||
this.Updates.AutoSize = true;
|
||||
this.Updates.Location = new System.Drawing.Point(336, 553);
|
||||
this.Updates.Name = "Updates";
|
||||
this.Updates.Size = new System.Drawing.Size(214, 17);
|
||||
this.Updates.TabIndex = 48;
|
||||
this.Updates.Text = "Check For Model Updates On Generate";
|
||||
this.Updates.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// timer3
|
||||
//
|
||||
this.timer3.Interval = 5000;
|
||||
|
@ -715,6 +721,7 @@
|
|||
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.Updates);
|
||||
this.Controls.Add(this.panel1);
|
||||
this.Controls.Add(this.RunJobs);
|
||||
this.Controls.Add(this.RemoveJob);
|
||||
|
@ -735,6 +742,7 @@
|
|||
this.panel1.ResumeLayout(false);
|
||||
this.panel1.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
|
@ -763,7 +771,6 @@
|
|||
private System.Windows.Forms.ComboBox Direction;
|
||||
private System.Windows.Forms.CheckBox LowMemoryMode;
|
||||
private System.Windows.Forms.Label Offloadlbl;
|
||||
private System.Windows.Forms.TextBox GPUOffload;
|
||||
private System.Windows.Forms.Label Samplerlbl;
|
||||
private System.Windows.Forms.TextBox Steps;
|
||||
private System.Windows.Forms.Label Stepslbl;
|
||||
|
@ -792,6 +799,7 @@
|
|||
private System.Windows.Forms.Label Loralbl;
|
||||
private System.Windows.Forms.Timer timer3;
|
||||
private System.Windows.Forms.CheckBox Updates;
|
||||
private System.Windows.Forms.ComboBox GPUOffload;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -14,11 +14,10 @@ using System.Drawing;
|
|||
using System.IO;
|
||||
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.Security.Policy;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
@ -33,19 +32,20 @@ namespace Ruyi_GUI
|
|||
public static Process process;
|
||||
public bool DoingJobs = false;
|
||||
public bool Not100 = true;
|
||||
public DateTime StartTime;
|
||||
|
||||
public Form1()
|
||||
{
|
||||
InitializeComponent();
|
||||
if (File.Exists("Config.cfg")) { LoadSettings(File.ReadAllText("Config.cfg")); }
|
||||
else { SaveSettings(); }
|
||||
if (!File.Exists("environment.bat"))
|
||||
if (!File.Exists("environment.bat") || !Directory.Exists("system"))
|
||||
{
|
||||
MessageBox.Show("environment.bat file missing, Is this exe being ran from Forge Install folder?", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
MessageBox.Show("Missing system folder and environment.bat file! \nIs this being ran from python environment?", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
if (!Directory.Exists("Ruyi-Models-main") || !File.Exists(Path.Combine("Ruyi-Models-main", "predict_i2v.py")))
|
||||
{
|
||||
if (MessageBox.Show("Missing predict_i2v.py! Download from Github Repo?", "Error", MessageBoxButtons.YesNo, MessageBoxIcon.Error) == DialogResult.Yes)
|
||||
if (MessageBox.Show("Missing Ruyi-Models-main!\nClone from Github Repo?", "Error", MessageBoxButtons.YesNo, MessageBoxIcon.Error) == DialogResult.Yes)
|
||||
{
|
||||
using (var client = new WebClient())
|
||||
{
|
||||
|
@ -59,12 +59,17 @@ namespace Ruyi_GUI
|
|||
}
|
||||
}
|
||||
}
|
||||
else { return; }
|
||||
}
|
||||
if (File.Exists(Path.Combine("Ruyi-Models-main", "predict_i2v.py")))
|
||||
{
|
||||
PythonCode = File.ReadAllLines(Path.Combine("Ruyi-Models-main", "predict_i2v.py"));
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("Missing predict_i2v.py file", "Error", 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; }
|
||||
|
@ -97,7 +102,7 @@ namespace Ruyi_GUI
|
|||
}
|
||||
catch
|
||||
{
|
||||
MessageBox.Show("Fault loading Config.cfg, Maybe Try Delete it so it can regenerate.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
MessageBox.Show("Fault loading Config.cfg.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
if (File.Exists(Img1.Text)) { pictureBox1.BackgroundImage = new Bitmap(Img1.Text); }
|
||||
if (File.Exists(Img2.Text)) { pictureBox2.BackgroundImage = new Bitmap(Img2.Text); }
|
||||
|
@ -129,10 +134,7 @@ namespace Ruyi_GUI
|
|||
return Path.GetDirectoryName(path);
|
||||
}
|
||||
|
||||
public byte[] GetHash(string inputString)
|
||||
{
|
||||
using (HashAlgorithm algorithm = SHA256.Create()) { return algorithm.ComputeHash(Encoding.UTF8.GetBytes(inputString)); }
|
||||
}
|
||||
public byte[] GetHash(string inputString) { using (HashAlgorithm algorithm = SHA256.Create()) { return algorithm.ComputeHash(Encoding.UTF8.GetBytes(inputString)); } }
|
||||
|
||||
public string GetHashString(string inputString)
|
||||
{
|
||||
|
@ -155,7 +157,9 @@ namespace Ruyi_GUI
|
|||
AppendTextBox("Saving Mp4...");
|
||||
GenerateButton.BeginInvoke(new Action(() => { GenerateButton.Enabled = true; }));
|
||||
panel1.BeginInvoke(new Action(() => { panel1.Enabled = true; }));
|
||||
LogMessages.Add("Finished Generation @ " + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
|
||||
Updates.BeginInvoke(new Action(() => { Updates.Enabled = true; }));
|
||||
var Elapsed = DateTime.Now - StartTime;
|
||||
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); }
|
||||
|
@ -301,13 +305,15 @@ namespace Ruyi_GUI
|
|||
if (string.IsNullOrEmpty(CallCode)) { MessageBox.Show("Bad Python Code", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); 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")); }
|
||||
LogMessages.Add("Starting Generation: [" + FrameRate.Text + "-" + Resolution.Text + "] " + Path.GetFileName(Img1.Text) + " @ " + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
|
||||
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"));
|
||||
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...");
|
||||
var processInfo = new ProcessStartInfo("cmd.exe", "/c call " + Path.Combine(AssemblyDirectory(), "environment.bat") + " && cd " + Path.Combine(AssemblyDirectory(), "Ruyi-Models-main") + " && python i2v.py %*");
|
||||
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;
|
||||
processInfo.RedirectStandardError = true;
|
||||
|
@ -364,37 +370,46 @@ namespace Ruyi_GUI
|
|||
saveFileDialog1.ShowDialog();
|
||||
VideoOut.Text = saveFileDialog1.FileName;
|
||||
}
|
||||
private string GetCommandLineArgs(int processId)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var searcher = new ManagementObjectSearcher($"SELECT CommandLine FROM Win32_Process WHERE ProcessId = {processId}"))
|
||||
{
|
||||
foreach (ManagementObject obj in searcher.Get()) { return obj["CommandLine"]?.ToString(); }
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
return "";
|
||||
}
|
||||
|
||||
private void Form1_FormClosing(object sender, FormClosingEventArgs e)
|
||||
{
|
||||
timer1.Enabled = false;
|
||||
SaveSettings();
|
||||
if (process != null)
|
||||
{
|
||||
try { process.Kill(); } catch { }
|
||||
}
|
||||
if (process != null) { try { process.Kill(); } catch { } }
|
||||
Process[] processes = Process.GetProcesses();
|
||||
bool isPythonRunning = processes.Any(p => p.ProcessName.Equals("python", StringComparison.OrdinalIgnoreCase));
|
||||
if (isPythonRunning)
|
||||
foreach (var process in processes)
|
||||
{
|
||||
if (MessageBox.Show("python.exe is running. Do you want to close it?", "Error", MessageBoxButtons.YesNo, MessageBoxIcon.Error) == DialogResult.Yes)
|
||||
if (process.ProcessName.Equals("python", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
foreach (var process in processes)
|
||||
if (GetCommandLineArgs(process.Id).Contains("i2v.py"))
|
||||
{
|
||||
if (process.ProcessName.Equals("python", StringComparison.OrdinalIgnoreCase))
|
||||
if (MessageBox.Show(@"""python i2v.py"" is running. Do you want to close it?", "Error", MessageBoxButtons.YesNo, MessageBoxIcon.Error) == DialogResult.Yes)
|
||||
{
|
||||
LogMessages.Add("Terminating Python Process");
|
||||
process.Kill();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
File.AppendAllLines("log.txt", LogMessages);
|
||||
LogMessages.Clear();
|
||||
}
|
||||
|
||||
private void PlayVideo_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (File.Exists(VideoOut.Text))
|
||||
{
|
||||
System.Diagnostics.Process.Start(VideoOut.Text);
|
||||
}
|
||||
if (File.Exists(VideoOut.Text)) { System.Diagnostics.Process.Start(VideoOut.Text); }
|
||||
}
|
||||
|
||||
private void timer1_Tick(object sender, EventArgs e)
|
||||
|
@ -426,6 +441,11 @@ namespace Ruyi_GUI
|
|||
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; }
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -565,6 +585,7 @@ namespace Ruyi_GUI
|
|||
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;
|
||||
|
|
|
@ -12,6 +12,21 @@
|
|||
<FileAlignment>512</FileAlignment>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
<Deterministic>true</Deterministic>
|
||||
<PublishUrl>publish\</PublishUrl>
|
||||
<Install>true</Install>
|
||||
<InstallFrom>Disk</InstallFrom>
|
||||
<UpdateEnabled>false</UpdateEnabled>
|
||||
<UpdateMode>Foreground</UpdateMode>
|
||||
<UpdateInterval>7</UpdateInterval>
|
||||
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
|
||||
<UpdatePeriodically>false</UpdatePeriodically>
|
||||
<UpdateRequired>false</UpdateRequired>
|
||||
<MapFileExtensions>true</MapFileExtensions>
|
||||
<ApplicationRevision>0</ApplicationRevision>
|
||||
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
|
||||
<IsWebBootstrapper>false</IsWebBootstrapper>
|
||||
<UseApplicationTrust>false</UseApplicationTrust>
|
||||
<BootstrapperEnabled>true</BootstrapperEnabled>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
|
@ -24,15 +39,16 @@
|
|||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<DebugType>none</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<ErrorReport>none</ErrorReport>
|
||||
<WarningLevel>0</WarningLevel>
|
||||
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
<CheckForOverflowUnderflow>true</CheckForOverflowUnderflow>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<ApplicationIcon>AIIcon.ico</ApplicationIcon>
|
||||
|
@ -41,6 +57,7 @@
|
|||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.IO.Compression.FileSystem" />
|
||||
<Reference Include="System.Management" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
|
@ -88,5 +105,17 @@
|
|||
<ItemGroup>
|
||||
<Content Include="AIIcon.ico" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<BootstrapperPackage Include=".NETFramework,Version=v4.8">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>Microsoft .NET Framework 4.8 %28x86 and x64%29</ProductName>
|
||||
<Install>true</Install>
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>.NET Framework 3.5 SP1</ProductName>
|
||||
<Install>false</Install>
|
||||
</BootstrapperPackage>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
|
@ -0,0 +1,13 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<PublishUrlHistory>publish\</PublishUrlHistory>
|
||||
<InstallUrlHistory />
|
||||
<SupportUrlHistory />
|
||||
<UpdateUrlHistory />
|
||||
<BootstrapperUrlHistory />
|
||||
<ErrorReportUrlHistory />
|
||||
<FallbackCulture>en-US</FallbackCulture>
|
||||
<VerifyUploadedFiles>false</VerifyUploadedFiles>
|
||||
</PropertyGroup>
|
||||
</Project>
|
Loading…
Reference in New Issue