Removed pkg installer, removed dain mention

This commit is contained in:
N00MKRAD
2021-01-15 19:28:42 +01:00
parent 9f2014f7eb
commit 3ba9564d8c
11 changed files with 3 additions and 3028 deletions

View File

@@ -219,12 +219,6 @@
<Compile Include="Forms\BigPreviewForm.Designer.cs">
<DependentUpon>BigPreviewForm.cs</DependentUpon>
</Compile>
<Compile Include="Forms\InstallerForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Forms\InstallerForm.Designer.cs">
<DependentUpon>InstallerForm.cs</DependentUpon>
</Compile>
<Compile Include="Forms\SettingsForm.cs">
<SubType>Form</SubType>
</Compile>
@@ -240,7 +234,6 @@
<Compile Include="IO\ConfigParser.cs" />
<Compile Include="Data\FlowPackage.cs" />
<Compile Include="IO\ModelDownloader.cs" />
<Compile Include="IO\PkgInstaller.cs" />
<Compile Include="Data\Packages.cs" />
<Compile Include="IO\PkgUtils.cs" />
<Compile Include="Main\AutoEncode.cs" />
@@ -275,7 +268,6 @@
<Compile Include="OS\Updater.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="IO\Setup.cs" />
<Compile Include="MiscUtils\FormatUtils.cs" />
<Compile Include="UI\GetWebInfo.cs" />
<Compile Include="UI\MainUiFunctions.cs" />
@@ -291,9 +283,6 @@
<EmbeddedResource Include="Forms\BigPreviewForm.resx">
<DependentUpon>BigPreviewForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Forms\InstallerForm.resx">
<DependentUpon>InstallerForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Forms\SettingsForm.resx">
<DependentUpon>SettingsForm.cs</DependentUpon>
</EmbeddedResource>

25
Code/Form1.Designer.cs generated
View File

@@ -88,7 +88,6 @@
this.patreonBtn = new HTAlt.WinForms.HTButton();
this.paypalBtn = new HTAlt.WinForms.HTButton();
this.discordBtn = new HTAlt.WinForms.HTButton();
this.installerBtn = new HTAlt.WinForms.HTButton();
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.longProgBar = new HTAlt.WinForms.HTProgressBar();
this.cancelBtn = new System.Windows.Forms.Button();
@@ -578,7 +577,8 @@
this.label14.Name = "label14";
this.label14.Size = new System.Drawing.Size(884, 142);
this.label14.TabIndex = 2;
this.label14.Text = resources.GetString("label14.Text");
this.label14.Text = "Flowframes - Created by n00mkrad aka nmkd\r\n\r\nBased on:\r\n- RIFE by hzwer\r\n- rife-n" +
"cnn-vulkan by nihui";
//
// runBtn
//
@@ -853,25 +853,6 @@
this.discordBtn.UseVisualStyleBackColor = false;
this.discordBtn.Click += new System.EventHandler(this.discordBtn_Click);
//
// installerBtn
//
this.installerBtn.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48)))));
this.installerBtn.ButtonImage = global::Flowframes.Properties.Resources.baseline_fact_check_white_48dp;
this.installerBtn.DrawImage = true;
this.installerBtn.FlatAppearance.BorderSize = 0;
this.installerBtn.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.installerBtn.ForeColor = System.Drawing.Color.White;
this.installerBtn.ImageIndex = 0;
this.installerBtn.ImageSizeMode = HTAlt.WinForms.HTButton.ButtonImageSizeMode.Zoom;
this.installerBtn.Location = new System.Drawing.Point(468, 12);
this.installerBtn.Name = "installerBtn";
this.installerBtn.Size = new System.Drawing.Size(40, 40);
this.installerBtn.TabIndex = 9;
this.toolTip1.SetToolTip(this.installerBtn, "Open Package Installer");
this.installerBtn.UseVisualStyleBackColor = false;
this.installerBtn.Visible = false;
this.installerBtn.Click += new System.EventHandler(this.installerBtn_Click);
//
// pictureBox1
//
this.pictureBox1.BackgroundImage = global::Flowframes.Properties.Resources.questmark_72px_bordeer;
@@ -1325,7 +1306,6 @@
this.Controls.Add(this.paypalBtn);
this.Controls.Add(this.discordBtn);
this.Controls.Add(this.longProgBar);
this.Controls.Add(this.installerBtn);
this.Controls.Add(this.panel1);
this.Controls.Add(this.logBox);
this.Controls.Add(this.progressCircle);
@@ -1420,7 +1400,6 @@
private System.Windows.Forms.Button utilsDedupTestBtn;
private System.Windows.Forms.Button utilsDedupBtn;
private System.Windows.Forms.Label label26;
private HTAlt.WinForms.HTButton installerBtn;
private HTAlt.WinForms.HTProgressBar longProgBar;
private System.Windows.Forms.Button cancelBtn;
private HTAlt.WinForms.HTButton discordBtn;

View File

@@ -50,7 +50,6 @@ namespace Flowframes
ConfigParser.LoadComboxIndex(aiCombox);
Setup.Init();
UpdateStepByStepControls(true);
Initialized();
@@ -236,7 +235,7 @@ namespace Flowframes
{
Logger.Log($"SetWorking({state})", true);
SetProgress(-1);
Control[] controlsToDisable = new Control[] { runBtn, runStepBtn, stepSelector, settingsBtn, installerBtn };
Control[] controlsToDisable = new Control[] { runBtn, runStepBtn, stepSelector, settingsBtn };
Control[] controlsToHide = new Control[] { runBtn, runStepBtn, stepSelector };
progressCircle.Visible = state;
cancelBtn.Visible = state;
@@ -324,11 +323,6 @@ namespace Flowframes
UtilsTab.Dedupe(inputTbox.Text.Trim(), true);
}
private void installerBtn_Click(object sender, EventArgs e)
{
new InstallerForm().ShowDialog();
}
private void cancelBtn_Click(object sender, EventArgs e)
{
SetTab("interpolation");

View File

@@ -117,14 +117,6 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="label14.Text" xml:space="preserve">
<value>Flowframes - Created by n00mkrad aka nmkd
Based on:
- dain-ncnn-vulkan by nihui, originally based on DAIN (Depth-Aware Video Frame Interpolation) by baowenbo
- RIFE by hzwer
- rife-ncnn-vulkan by nihui</value>
</data>
<metadata name="inFolderDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>

View File

@@ -1,177 +0,0 @@
namespace Flowframes.Forms
{
partial class InstallerForm
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(InstallerForm));
this.pkgList = new System.Windows.Forms.CheckedListBox();
this.titleLabel = new System.Windows.Forms.Label();
this.logBox = new System.Windows.Forms.TextBox();
this.downloadPackagesBtn = new System.Windows.Forms.Button();
this.doneBtn = new System.Windows.Forms.Button();
this.redownloadPkgsBtn = new System.Windows.Forms.Button();
this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
this.pkgInfoTextbox = new System.Windows.Forms.TextBox();
this.SuspendLayout();
//
// pkgList
//
this.pkgList.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48)))));
this.pkgList.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.pkgList.ForeColor = System.Drawing.Color.White;
this.pkgList.FormattingEnabled = true;
this.pkgList.Location = new System.Drawing.Point(12, 62);
this.pkgList.Name = "pkgList";
this.pkgList.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.pkgList.Size = new System.Drawing.Size(398, 292);
this.pkgList.TabIndex = 0;
this.pkgList.SelectedIndexChanged += new System.EventHandler(this.pkgList_SelectedIndexChanged);
//
// titleLabel
//
this.titleLabel.AutoSize = true;
this.titleLabel.Font = new System.Drawing.Font("Yu Gothic UI", 21.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.titleLabel.ForeColor = System.Drawing.Color.White;
this.titleLabel.Location = new System.Drawing.Point(12, 9);
this.titleLabel.Margin = new System.Windows.Forms.Padding(3, 0, 3, 10);
this.titleLabel.Name = "titleLabel";
this.titleLabel.Size = new System.Drawing.Size(229, 40);
this.titleLabel.TabIndex = 1;
this.titleLabel.Text = "Package Installer";
//
// logBox
//
this.logBox.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
this.logBox.ForeColor = System.Drawing.Color.White;
this.logBox.Location = new System.Drawing.Point(622, 62);
this.logBox.MinimumSize = new System.Drawing.Size(4, 21);
this.logBox.Multiline = true;
this.logBox.Name = "logBox";
this.logBox.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
this.logBox.Size = new System.Drawing.Size(300, 427);
this.logBox.TabIndex = 6;
this.logBox.TabStop = false;
//
// downloadPackagesBtn
//
this.downloadPackagesBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.downloadPackagesBtn.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48)))));
this.downloadPackagesBtn.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.downloadPackagesBtn.ForeColor = System.Drawing.Color.LightGreen;
this.downloadPackagesBtn.Location = new System.Drawing.Point(416, 62);
this.downloadPackagesBtn.Name = "downloadPackagesBtn";
this.downloadPackagesBtn.Size = new System.Drawing.Size(200, 60);
this.downloadPackagesBtn.TabIndex = 9;
this.downloadPackagesBtn.Text = "Install Selected Packages\r\n(Uninstall Deselected Packages)";
this.toolTip1.SetToolTip(this.downloadPackagesBtn, "This will install ticked packages and uninstall the ones you unticked (if they ar" +
"e installed).");
this.downloadPackagesBtn.UseVisualStyleBackColor = false;
this.downloadPackagesBtn.Click += new System.EventHandler(this.downloadPackagesBtn_Click);
//
// doneBtn
//
this.doneBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.doneBtn.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48)))));
this.doneBtn.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.doneBtn.ForeColor = System.Drawing.Color.White;
this.doneBtn.Location = new System.Drawing.Point(416, 314);
this.doneBtn.Name = "doneBtn";
this.doneBtn.Size = new System.Drawing.Size(200, 40);
this.doneBtn.TabIndex = 10;
this.doneBtn.Text = "Done";
this.doneBtn.UseVisualStyleBackColor = false;
this.doneBtn.Click += new System.EventHandler(this.doneBtn_Click);
//
// redownloadPkgsBtn
//
this.redownloadPkgsBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.redownloadPkgsBtn.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48)))));
this.redownloadPkgsBtn.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.redownloadPkgsBtn.ForeColor = System.Drawing.Color.White;
this.redownloadPkgsBtn.Location = new System.Drawing.Point(416, 128);
this.redownloadPkgsBtn.Name = "redownloadPkgsBtn";
this.redownloadPkgsBtn.Size = new System.Drawing.Size(200, 40);
this.redownloadPkgsBtn.TabIndex = 11;
this.redownloadPkgsBtn.Text = "Redownload Selected Package";
this.toolTip1.SetToolTip(this.redownloadPkgsBtn, "This will first uninstall the installed packages and then redownload them.");
this.redownloadPkgsBtn.UseVisualStyleBackColor = false;
this.redownloadPkgsBtn.Click += new System.EventHandler(this.redownloadPkgsBtn_Click);
//
// pkgInfoTextbox
//
this.pkgInfoTextbox.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48)))));
this.pkgInfoTextbox.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.pkgInfoTextbox.ForeColor = System.Drawing.Color.White;
this.pkgInfoTextbox.Location = new System.Drawing.Point(12, 360);
this.pkgInfoTextbox.MinimumSize = new System.Drawing.Size(4, 21);
this.pkgInfoTextbox.Multiline = true;
this.pkgInfoTextbox.Name = "pkgInfoTextbox";
this.pkgInfoTextbox.Size = new System.Drawing.Size(604, 129);
this.pkgInfoTextbox.TabIndex = 12;
this.pkgInfoTextbox.TabStop = false;
this.pkgInfoTextbox.Text = "Friendly Name:\r\nPackage Name:\r\nDownload Size:\r\n\r\nDescription:";
//
// InstallerForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(32)))), ((int)(((byte)(32)))), ((int)(((byte)(32)))));
this.ClientSize = new System.Drawing.Size(934, 501);
this.Controls.Add(this.pkgInfoTextbox);
this.Controls.Add(this.redownloadPkgsBtn);
this.Controls.Add(this.doneBtn);
this.Controls.Add(this.downloadPackagesBtn);
this.Controls.Add(this.logBox);
this.Controls.Add(this.titleLabel);
this.Controls.Add(this.pkgList);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MaximizeBox = false;
this.Name = "InstallerForm";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Flowframes Package Installer";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.InstallerForm_FormClosing);
this.Load += new System.EventHandler(this.InstallerForm_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.CheckedListBox pkgList;
private System.Windows.Forms.Label titleLabel;
private System.Windows.Forms.TextBox logBox;
private System.Windows.Forms.Button downloadPackagesBtn;
private System.Windows.Forms.Button doneBtn;
private System.Windows.Forms.ToolTip toolTip1;
private System.Windows.Forms.Button redownloadPkgsBtn;
private System.Windows.Forms.TextBox pkgInfoTextbox;
}
}

View File

@@ -1,174 +0,0 @@
using Flowframes.IO;
using Flowframes.OS;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Flowframes.Forms
{
public partial class InstallerForm : Form
{
bool busy = false;
public InstallerForm()
{
AutoScaleMode = AutoScaleMode.None;
InitializeComponent();
}
private void InstallerForm_Load(object sender, EventArgs e)
{
PkgInstaller.installerForm = this;
Print($"Welcome to the package manager.{Environment.NewLine}Here you can install packages by ticking or uninstall by unticking them.");
RefreshGui();
EnableRequired();
if (pkgList.SelectedIndex < 0)
pkgList.SelectedIndex = 0;
}
void SetBusy (bool state)
{
busy = state;
downloadPackagesBtn.Enabled = !state;
redownloadPkgsBtn.Enabled = !state;
doneBtn.Enabled = !state;
}
private void downloadPackagesBtn_Click(object sender, EventArgs e)
{
UpdatePackages(false);
}
private async void redownloadPkgsBtn_Click(object sender, EventArgs e)
{
FlowPackage pkg = PkgUtils.GetPkg(pkgList.SelectedItem.ToString());
if (PkgUtils.IsInstalled(pkg)) // Uninstall first if force = true, to ensure a clean reinstall
PkgInstaller.Uninstall(pkg.fileName);
await Task.Delay(10);
await PkgInstaller.DownloadAndInstall(pkg.fileName);
}
async void UpdatePackages (bool force)
{
SetBusy(true);
EnableRequired();
for (int i = 0; i < pkgList.Items.Count; i++)
{
FlowPackage pkg = PkgUtils.GetPkg(pkgList.Items[i].ToString());
if(force && PkgUtils.IsInstalled(pkg)) // Uninstall first if force = true, to ensure a clean reinstall
PkgInstaller.Uninstall(pkg.fileName);
bool install = pkgList.GetItemChecked(i);
if(install && !PkgUtils.IsInstalled(pkg)) // Install if not installed
await PkgInstaller.DownloadAndInstall(pkg.fileName);
if (!install && PkgUtils.IsInstalled(pkg)) // Uninstall if installed
PkgInstaller.Uninstall(pkg.fileName);
}
Print("All tasks completed.");
SetBusy(false);
}
void RefreshGui ()
{
pkgList.Items.Clear();
foreach (FlowPackage pkg in PkgInstaller.packages)
pkgList.Items.Add(pkg.friendlyName, PkgUtils.IsInstalled(pkg));
}
void EnableRequired ()
{
for (int i = 0; i < pkgList.Items.Count; i++)
{
if(pkgList.Items[i].ToString().ToLower().Contains("required"))
pkgList.SetItemChecked(i, true);
if (pkgList.Items[i].ToString() == "Python" && IsFirstRun())
pkgList.SetItemChecked(i, !Python.IsPytorchReady()); // Enable if system pytorch was not detected
}
}
bool IsFirstRun()
{
return !PkgUtils.IsInstalled(Packages.audioVideo);
}
public void Print(string s, bool replaceLastLine = false)
{
if (replaceLastLine)
{
try
{
logBox.Text = logBox.Text.Remove(logBox.Text.LastIndexOf(Environment.NewLine));
}
catch { }
}
if (string.IsNullOrWhiteSpace(logBox.Text))
logBox.Text += s;
else
logBox.Text += Environment.NewLine + s;
logBox.SelectionStart = logBox.Text.Length;
logBox.ScrollToCaret();
}
private void InstallerForm_FormClosing(object sender, FormClosingEventArgs e)
{
if(busy || !HasRequiredPkgs(true))
e.Cancel = true;
}
bool HasRequiredPkgs (bool silent = false)
{
bool isOk = true;
for (int i = 0; i < pkgList.Items.Count; i++)
{
if (pkgList.Items[i].ToString().ToLower().Contains("required"))
{
string frName = pkgList.Items[i].ToString();
if (!PkgUtils.IsInstalled(PkgUtils.GetPkg(frName)))
{
if(!silent)
Print($"The package {pkgList.Items[i].ToString().Wrap()} is required but not installed!");
isOk = false;
EnableRequired();
}
}
}
return isOk;
}
private void doneBtn_Click(object sender, EventArgs e)
{
if (HasRequiredPkgs())
Close();
else
Print("Please click \"Download/Update Packages\".");
}
private void pkgList_SelectedIndexChanged(object sender, EventArgs e)
{
FlowPackage pkg = PkgUtils.GetPkg(PkgUtils.GetPkg(pkgList.SelectedItem.ToString()).friendlyName);
GetPkgInfo(pkg);
}
void GetPkgInfo(FlowPackage pkg)
{
string nl = Environment.NewLine;
pkgInfoTextbox.Text = $"Friendly Name: {pkg.friendlyName}";
pkgInfoTextbox.Text += $"{nl}Package Name: {pkg.fileName}";
pkgInfoTextbox.Text += $"{nl}Download Size: {pkg.downloadSizeMb} MB";
pkgInfoTextbox.Text += $"{nl}{nl}Description:{nl}{pkg.desc}";
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,117 +0,0 @@
using Flowframes.Data;
using Flowframes.Forms;
using Flowframes.Properties;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Flowframes.IO
{
class PkgInstaller
{
public static List<FlowPackage> packages = new List<FlowPackage>();
public static InstallerForm installerForm;
static string path7za = "";
public static void Init()
{
packages.Clear();
packages.Add(Packages.rifeCuda);
packages.Add(Packages.rifeNcnn);
packages.Add(Packages.dainNcnn);
packages.Add(Packages.cainNcnn);
packages.Add(Packages.python);
packages.Add(Packages.audioVideo);
packages.Add(Packages.licenses);
}
static Stopwatch sw = new Stopwatch();
public static async Task DownloadAndInstall(string filename, bool showDialog = true)
{
string savePath = Path.Combine(Paths.GetPkgPath(), filename);
string url = $"http://dl.nmkd.de/flowframes/pkgs/{filename}";
Logger.Log($"[PkgInstaller] Downloading {url}", true);
var client = new WebClient();
client.Proxy = WebRequest.DefaultWebProxy;
Print($"Downloading {filename}...");
sw.Restart();
client.DownloadProgressChanged += (sender, args) =>
{
if (sw.ElapsedMilliseconds > 250)
{
sw.Restart();
Print($"Downloading {filename}... {args.ProgressPercentage}%", true);
}
};
client.DownloadFileCompleted += (sender, args) =>
{
if (args.Error != null)
Print("Download failed: " + args.Error.Message);
Print($"Downloading {filename}... 100%", true);
};
await client.DownloadFileTaskAsync(new Uri(url), savePath);
try
{
if (Path.GetExtension(filename).ToLower() == ".7z") // Only run extractor if it's a 7z archive
{
Print($"Installing {filename}...");
await UnSevenzip(Path.Combine(Paths.GetPkgPath(), filename));
}
Print("Done installing.");
installerForm.Refresh();
}
catch (Exception e)
{
Print("Failed to install package: " + e.Message);
Logger.Log($"Failed to uninstall package {Path.GetFileNameWithoutExtension(filename)}: {e.Message}");
}
}
static async Task UnSevenzip(string path)
{
path7za = Path.Combine(Paths.GetDataPath(), "7za.exe");
if (!File.Exists(path7za))
File.WriteAllBytes(path7za, Resources.x64_7za);
Logger.Log("[PkgInstaller] Extracting " + path, true);
await Task.Delay(20);
SevenZipNET.SevenZipExtractor.Path7za = path7za;
SevenZipNET.SevenZipExtractor extractor = new SevenZipNET.SevenZipExtractor(path);
extractor.ExtractAll(Paths.GetPkgPath(), true, true);
File.Delete(path);
await Task.Delay(10);
}
public static void Uninstall(string filename)
{
try
{
string pkgName = Path.GetFileNameWithoutExtension(filename);
Logger.Log("[PkgInstaller] Uninstalling " + pkgName, true);
Print("Uninstalling " + pkgName);
Directory.Delete(Path.Combine(Paths.GetPkgPath(), pkgName), true);
Print("Done uninstalling.");
}
catch (Exception e)
{
Print("Failed to uninstall package!");
Logger.Log($"Failed to uninstall package {Path.GetFileNameWithoutExtension(filename)}: {e.Message}");
}
}
static void Print(string s, bool replaceLastLine = false)
{
if (installerForm != null)
installerForm.Print(s, replaceLastLine);
}
}
}

View File

@@ -9,18 +9,6 @@ namespace Flowframes.IO
{
class PkgUtils
{
public static FlowPackage GetPkg(string friendlyNameOrFilename)
{
foreach (FlowPackage pkg in PkgInstaller.packages)
{
if (pkg.fileName == friendlyNameOrFilename)
return pkg;
if (pkg.friendlyName == friendlyNameOrFilename)
return pkg;
}
Logger.Log("Failed to find a package with name " + friendlyNameOrFilename);
return new FlowPackage();
}
public static string GetPkgFolder (FlowPackage pkg)
{

View File

@@ -1,50 +0,0 @@
using Flowframes.IO;
using Flowframes.Properties;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Windows.Forms;
using Flowframes.Forms;
using Flowframes.Main;
namespace Flowframes
{
class Setup
{
public static void Init()
{
Console.WriteLine("Setup Init()");
if (!InstallIsValid())
{
Logger.Log("No valid installation detected");
InterpolateUtils.ShowMessage($"Some packages are missing!\n\nCheck the log ({Path.GetFileName(Paths.GetDataPath())}/{Path.GetFileName(Paths.GetLogPath())}/{Logger.defaultLogName}).", "Error");
Application.Exit();
//new InstallerForm().ShowDialog();
}
}
public static bool InstallIsValid ()
{
if (!Directory.Exists(Paths.GetPkgPath()))
{
Logger.Log("Install invalid - Reason: " + Paths.GetPkgPath() + " does not exist.", true);
return false;
}
foreach(FlowPackage pkg in PkgInstaller.packages)
{
// if pkg is required and not installed, return false
if (pkg.friendlyName.ToLower().Contains("required") && !PkgUtils.IsInstalled(pkg))
{
Logger.Log($"Required package \"{pkg.friendlyName}\" was not found!", true);
return false;
}
}
return true;
}
}
}

View File

@@ -33,7 +33,6 @@ namespace Flowframes
string oldExePath = IOUtils.GetExe() + ".old";
IOUtils.TryDeleteIfExists(oldExePath);
PkgInstaller.Init();
Networks.Init();
NvApi.Init();