Skip to content

Commit

Permalink
EZ_Updater updated to avoid admin rights problem & custom args added …
Browse files Browse the repository at this point in the history
…to ShortCute
  • Loading branch information
Haruki1707 committed Mar 13, 2022
1 parent c81c404 commit 77c3c5f
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 11 deletions.
2 changes: 1 addition & 1 deletion ShortCutes/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace ShortCutes
static class Program
{
[STAThread]
static void Main()
static void Main(string[] args)
{
if (IsUserAdministrator() == false)
{
Expand Down
4 changes: 2 additions & 2 deletions ShortCutes/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@
// Puede especificar todos los valores o usar los valores predeterminados de número de compilación y de revisión
// utilizando el carácter "*", como se muestra a continuación:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.4")]
[assembly: AssemblyFileVersion("1.4")]
[assembly: AssemblyVersion("1.4.1")]
[assembly: AssemblyFileVersion("1.4.1")]
[assembly: NeutralResourcesLanguage("en")]
2 changes: 1 addition & 1 deletion ShortCutes/ShortCutes.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@
<Version>4.1.0</Version>
</PackageReference>
<PackageReference Include="EZ_Updater">
<Version>0.5.0.3</Version>
<Version>0.5.3.1</Version>
</PackageReference>
<PackageReference Include="Fody">
<Version>6.0.0</Version>
Expand Down
8 changes: 7 additions & 1 deletion ShortCutes/ShortCutesForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,13 @@ public ShortCutes()

private async void ShortCutes_Shown(object sender, EventArgs e)
{
if (await Updater.CheckUpdateAsync("Haruki1707", "ShortCutes")) new MessageForm("", 4).ShowDialog();
if (await Updater.CheckUpdateAsync("Haruki1707", "ShortCutes"))
{
if (Updater.CannotWriteOnDir)
MessageForm.Error(Updater.Message);
else
new MessageForm("", 4).ShowDialog();
}
}

public static void Form1_UIThreadException(object sender, ThreadExceptionEventArgs t)
Expand Down
7 changes: 3 additions & 4 deletions ShortCutes/UI-forms/MessageForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -143,13 +143,12 @@ private void UIChange(object sender, EventArgs e)
Messagelbl.Text = Updater.Message;
progressBar1.Value = Updater.ProgressPercentage;

switch (Updater.State)
switch (Updater.ShortState)
{
case UpdaterState.Canceled:
case UpdaterState.InstallFailed:
case UpdaterShortState.Canceled:
OKbtn.Visible = true;
break;
case UpdaterState.Installed:
case UpdaterShortState.Installed:
Application.Restart();
break;
}
Expand Down
9 changes: 7 additions & 2 deletions ShortCutes/src/Roslyn Form Code.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public class CuteLauncher : Form
private string GameName = "%GAME%";
private int standarHeight = %HEIGHT%;
private bool WaitForWindowChange = %WAITCHANGE%;
private static string ExtraArgs = "";
System.Reflection.Assembly assembly = System.Reflection.Assembly.GetExecutingAssembly();

public CuteLauncher()
Expand Down Expand Up @@ -110,7 +111,7 @@ private void ExecuteEmu_Tick(object sender, EventArgs e)
//Emulator execution
ShortCute.StartInfo.WorkingDirectory = "..\\";
ShortCute.StartInfo.FileName = "..\\" + Emulator;
ShortCute.StartInfo.Arguments = "%ARGUMENTS%";
ShortCute.StartInfo.Arguments = "%ARGUMENTS%" + ExtraArgs;
ShortCute.Start();

TimerSC.Interval = 100;
Expand Down Expand Up @@ -193,8 +194,12 @@ protected override CreateParams CreateParams
}

[STAThread]
static void Main()
static void Main(string[] args)
{
if (args.Length > 0)
foreach (string arg in args)
ExtraArgs += " " + arg;

Application.EnableVisualStyles();
Application.Run(new CuteLauncher());
}
Expand Down

0 comments on commit 77c3c5f

Please sign in to comment.