main: Updated prerequisite install
This commit is contained in:
parent
7909f111cb
commit
fffafcd89e
@ -6,6 +6,13 @@ namespace FireWalletLite;
|
||||
|
||||
public partial class Loader : Form
|
||||
{
|
||||
#region Constants
|
||||
|
||||
private readonly MainForm mainForm = new();
|
||||
private readonly bool hideScreen = true; // Hide screen or not (for debug)
|
||||
private readonly Process HSDProcess;
|
||||
|
||||
#endregion
|
||||
public Loader()
|
||||
{
|
||||
InitializeComponent();
|
||||
@ -62,14 +69,6 @@ public partial class Loader : Form
|
||||
mainForm.Show();
|
||||
}
|
||||
|
||||
#region Constants
|
||||
|
||||
private readonly MainForm mainForm = new();
|
||||
private readonly bool hideScreen = true;
|
||||
private readonly Process HSDProcess;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Git
|
||||
|
||||
public void CloneRepository(string repositoryUrl, string destinationPath)
|
||||
@ -184,30 +183,36 @@ public partial class Loader : Form
|
||||
mainForm.AddLog(ex.Message);
|
||||
if (ex.Message.Contains("to start process 'git'"))
|
||||
{
|
||||
var notifyForm = new NotifyForm("Git needs to be installed\nCheck logs for more details");
|
||||
var notifyForm = new NotifyForm("Git is not installed\nPlease install it to install HSD dependencies",
|
||||
"Install", "https://git-scm.com/download/win");
|
||||
notifyForm.ShowDialog();
|
||||
notifyForm.Dispose();
|
||||
Environment.Exit(21);
|
||||
}
|
||||
else if (ex.Message.Contains("to start process 'node'"))
|
||||
{
|
||||
var notifyForm = new NotifyForm("Node needs to be installed\nCheck logs for more details");
|
||||
var notifyForm = new NotifyForm("Node is not installed\nPlease install it to install HSD dependencies",
|
||||
"Install", "https://nodejs.org/en/download");
|
||||
notifyForm.ShowDialog();
|
||||
notifyForm.Dispose();
|
||||
Environment.Exit(22);
|
||||
}
|
||||
else if (ex.Message.Contains("to start process 'npm'"))
|
||||
{
|
||||
var notifyForm = new NotifyForm("NPM needs to be installed\nCheck logs for more details");
|
||||
var notifyForm = new NotifyForm("NPM is not installed\nPlease install it to install HSD dependencies",
|
||||
"Install", "https://docs.npmjs.com/downloading-and-installing-node-js-and-npm");
|
||||
notifyForm.ShowDialog();
|
||||
notifyForm.Dispose();
|
||||
Environment.Exit(23);
|
||||
}
|
||||
else
|
||||
{
|
||||
var notifyForm = new NotifyForm("Git/NPM Install FAILED\nCheck logs for more details");
|
||||
notifyForm.ShowDialog();
|
||||
notifyForm.Dispose();
|
||||
Environment.Exit(24);
|
||||
}
|
||||
|
||||
Environment.Exit(24);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -8,11 +8,14 @@ public partial class NotifyForm : Form
|
||||
private bool allowClose = true;
|
||||
private readonly string altLink;
|
||||
|
||||
private readonly string dir = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) +
|
||||
"\\FireWallet\\";
|
||||
|
||||
private readonly bool Linkcopy;
|
||||
private Dictionary<string, string> theme;
|
||||
public Dictionary<string, string> Theme { get; set; } = new()
|
||||
{
|
||||
{ "background", "#000000" },
|
||||
{ "foreground", "#8e05c2"},
|
||||
{ "background-alt", "#3e065f"},
|
||||
{ "foreground-alt", "#ffffff"}
|
||||
};
|
||||
|
||||
public NotifyForm(string Message)
|
||||
{
|
||||
@ -100,150 +103,34 @@ public partial class NotifyForm : Form
|
||||
|
||||
private void UpdateTheme()
|
||||
{
|
||||
// Check if file exists
|
||||
if (!Directory.Exists(dir)) CreateConfig(dir);
|
||||
if (!File.Exists(dir + "theme.txt")) CreateConfig(dir);
|
||||
if (!Theme.ContainsKey("background") || !Theme.ContainsKey("background-alt") ||
|
||||
!Theme.ContainsKey("foreground") || !Theme.ContainsKey("foreground-alt")) return;
|
||||
|
||||
// Read file
|
||||
var sr = new StreamReader(dir + "theme.txt");
|
||||
theme = new Dictionary<string, string>();
|
||||
while (!sr.EndOfStream)
|
||||
{
|
||||
var line = sr.ReadLine();
|
||||
var split = line.Split(':');
|
||||
theme.Add(split[0].Trim(), split[1].Trim());
|
||||
}
|
||||
|
||||
sr.Dispose();
|
||||
|
||||
if (!theme.ContainsKey("background") || !theme.ContainsKey("background-alt") ||
|
||||
!theme.ContainsKey("foreground") || !theme.ContainsKey("foreground-alt")) return;
|
||||
|
||||
// Apply theme
|
||||
BackColor = ColorTranslator.FromHtml(theme["background"]);
|
||||
// Apply Theme
|
||||
BackColor = ColorTranslator.FromHtml(Theme["background"]);
|
||||
|
||||
// Foreground
|
||||
ForeColor = ColorTranslator.FromHtml(theme["foreground"]);
|
||||
ForeColor = ColorTranslator.FromHtml(Theme["foreground"]);
|
||||
|
||||
|
||||
// Need to specify this for each groupbox to override the black text
|
||||
foreach (Control c in Controls) ThemeControl(c);
|
||||
|
||||
|
||||
// Transparancy
|
||||
applyTransparency(theme);
|
||||
}
|
||||
|
||||
private void ThemeControl(Control c)
|
||||
{
|
||||
if (c.GetType() == typeof(GroupBox) || c.GetType() == typeof(Panel))
|
||||
{
|
||||
c.ForeColor = ColorTranslator.FromHtml(theme["foreground"]);
|
||||
c.ForeColor = ColorTranslator.FromHtml(Theme["foreground"]);
|
||||
foreach (Control sub in c.Controls) ThemeControl(sub);
|
||||
}
|
||||
|
||||
if (c.GetType() == typeof(TextBox) || c.GetType() == typeof(Button)
|
||||
|| c.GetType() == typeof(ComboBox) || c.GetType() == typeof(StatusStrip))
|
||||
{
|
||||
c.ForeColor = ColorTranslator.FromHtml(theme["foreground-alt"]);
|
||||
c.BackColor = ColorTranslator.FromHtml(theme["background-alt"]);
|
||||
c.ForeColor = ColorTranslator.FromHtml(Theme["foreground-alt"]);
|
||||
c.BackColor = ColorTranslator.FromHtml(Theme["background-alt"]);
|
||||
}
|
||||
}
|
||||
|
||||
private void applyTransparency(Dictionary<string, string> theme)
|
||||
{
|
||||
if (theme.ContainsKey("transparent-mode"))
|
||||
switch (theme["transparent-mode"])
|
||||
{
|
||||
case "mica":
|
||||
var accent = new AccentPolicy { AccentState = AccentState.ACCENT_ENABLE_BLURBEHIND };
|
||||
var accentStructSize = Marshal.SizeOf(accent);
|
||||
var accentPtr = Marshal.AllocHGlobal(accentStructSize);
|
||||
Marshal.StructureToPtr(accent, accentPtr, false);
|
||||
var data = new WindowCompositionAttributeData
|
||||
{
|
||||
Attribute = WindowCompositionAttribute.WCA_ACCENT_POLICY,
|
||||
SizeOfData = accentStructSize,
|
||||
Data = accentPtr
|
||||
};
|
||||
User32.SetWindowCompositionAttribute(Handle, ref data);
|
||||
Marshal.FreeHGlobal(accentPtr);
|
||||
break;
|
||||
case "key":
|
||||
if (theme.ContainsKey("transparency-key"))
|
||||
switch (theme["transparency-key"])
|
||||
{
|
||||
case "alt":
|
||||
TransparencyKey = ColorTranslator.FromHtml(theme["background-alt"]);
|
||||
break;
|
||||
case "main":
|
||||
TransparencyKey = ColorTranslator.FromHtml(theme["background"]);
|
||||
break;
|
||||
default:
|
||||
TransparencyKey = ColorTranslator.FromHtml(theme["transparency-key"]);
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
case "percent":
|
||||
if (theme.ContainsKey("transparency-percent"))
|
||||
Opacity = Convert.ToDouble(theme["transparency-percent"]) / 100;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void CreateConfig(string dir)
|
||||
{
|
||||
if (!Directory.Exists(dir)) Directory.CreateDirectory(dir);
|
||||
var sw = new StreamWriter(dir + "theme.txt");
|
||||
sw.WriteLine("background: #000000");
|
||||
sw.WriteLine("foreground: #8e05c2");
|
||||
sw.WriteLine("background-alt: #3e065f");
|
||||
sw.WriteLine("foreground-alt: #ffffff");
|
||||
sw.WriteLine("transparent-mode: off");
|
||||
sw.WriteLine("transparency-key: main");
|
||||
sw.WriteLine("transparency-percent: 90");
|
||||
|
||||
sw.Dispose();
|
||||
}
|
||||
|
||||
// Required for mica effect
|
||||
internal enum AccentState
|
||||
{
|
||||
ACCENT_DISABLED = 0,
|
||||
ACCENT_ENABLE_GRADIENT = 1,
|
||||
ACCENT_ENABLE_TRANSPARENTGRADIENT = 2,
|
||||
ACCENT_ENABLE_BLURBEHIND = 3,
|
||||
ACCENT_INVALID_STATE = 4
|
||||
}
|
||||
|
||||
internal enum WindowCompositionAttribute
|
||||
{
|
||||
WCA_ACCENT_POLICY = 19
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
internal struct AccentPolicy
|
||||
{
|
||||
public AccentState AccentState;
|
||||
public int AccentFlags;
|
||||
public int GradientColor;
|
||||
public int AnimationId;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
internal struct WindowCompositionAttributeData
|
||||
{
|
||||
public WindowCompositionAttribute Attribute;
|
||||
public IntPtr Data;
|
||||
public int SizeOfData;
|
||||
}
|
||||
|
||||
internal static class User32
|
||||
{
|
||||
[DllImport("user32.dll")]
|
||||
internal static extern int SetWindowCompositionAttribute(IntPtr hwnd, ref WindowCompositionAttributeData data);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
@ -37,6 +37,27 @@
|
||||
"PrivateKeyFile" = "8:"
|
||||
"TimeStampServer" = "8:"
|
||||
"InstallerBootstrapper" = "3:2"
|
||||
"BootstrapperCfg:{63ACBE69-63AA-4F98-B2B6-99F9E24495F2}"
|
||||
{
|
||||
"Enabled" = "11:TRUE"
|
||||
"PromptEnabled" = "11:TRUE"
|
||||
"PrerequisitesLocation" = "2:1"
|
||||
"Url" = "8:"
|
||||
"ComponentsUrl" = "8:"
|
||||
"Items"
|
||||
{
|
||||
"{EDC2488A-8267-493A-A98E-7D9C3B36CDF3}:.NETFramework,Version=v4.7.2"
|
||||
{
|
||||
"Name" = "8:Microsoft .NET Framework 4.7.2 (x86 and x64)"
|
||||
"ProductCode" = "8:.NETFramework,Version=v4.7.2"
|
||||
}
|
||||
"{EDC2488A-8267-493A-A98E-7D9C3B36CDF3}:Microsoft.NetCore.DesktopRuntime.6.0.x64"
|
||||
{
|
||||
"Name" = "8:.NET Desktop Runtime 6.0.18 (x64)"
|
||||
"ProductCode" = "8:Microsoft.NetCore.DesktopRuntime.6.0.x64"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
"Release"
|
||||
{
|
||||
@ -53,6 +74,14 @@
|
||||
"PrivateKeyFile" = "8:"
|
||||
"TimeStampServer" = "8:"
|
||||
"InstallerBootstrapper" = "3:2"
|
||||
"BootstrapperCfg:{63ACBE69-63AA-4F98-B2B6-99F9E24495F2}"
|
||||
{
|
||||
"Enabled" = "11:TRUE"
|
||||
"PromptEnabled" = "11:TRUE"
|
||||
"PrerequisitesLocation" = "2:1"
|
||||
"Url" = "8:"
|
||||
"ComponentsUrl" = "8:"
|
||||
}
|
||||
}
|
||||
}
|
||||
"Deployable"
|
||||
@ -141,7 +170,7 @@
|
||||
"Name" = "8:Microsoft Visual Studio"
|
||||
"ProductName" = "8:FireWalletLite"
|
||||
"ProductCode" = "8:{23670E44-E1CD-40B5-881D-40657BD30860}"
|
||||
"PackageCode" = "8:{EBE2AF53-E970-4708-9E43-05366A939681}"
|
||||
"PackageCode" = "8:{2AC188AF-0BEF-4B0E-BD6F-F44A7EEB94F3}"
|
||||
"UpgradeCode" = "8:{6966FD44-6B8C-43C0-981A-E36449BF2DA8}"
|
||||
"AspNetVersion" = "8:"
|
||||
"RestartWWWService" = "11:FALSE"
|
||||
|
Loading…
Reference in New Issue
Block a user