Added: command line support
This commit is contained in:
parent
dbdc654268
commit
90473e092d
48
MainForm.cs
48
MainForm.cs
@ -85,8 +85,14 @@ namespace FizzyLauncher
|
|||||||
|
|
||||||
InvalidateAppSession();
|
InvalidateAppSession();
|
||||||
|
|
||||||
|
string[] commandLineArgs = Environment.GetCommandLineArgs();
|
||||||
|
|
||||||
|
bool hasCommands = await LoadCommandLine(commandLineArgs);
|
||||||
|
if (!hasCommands)
|
||||||
|
{
|
||||||
newToolStripMenuItem_Click(null, null);
|
newToolStripMenuItem_Click(null, null);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected async override void OnClosing(CancelEventArgs e)
|
protected async override void OnClosing(CancelEventArgs e)
|
||||||
{
|
{
|
||||||
@ -936,6 +942,48 @@ namespace FizzyLauncher
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected async Task<bool> LoadCommandLine(string[] args)
|
||||||
|
{
|
||||||
|
bool rs = false;
|
||||||
|
|
||||||
|
if (args.Length > 1)
|
||||||
|
{
|
||||||
|
int i = 1;
|
||||||
|
while (true)
|
||||||
|
{
|
||||||
|
if (i > (args.Length - 1))
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (args[i].Trim().ToLower())
|
||||||
|
{
|
||||||
|
case "-o":
|
||||||
|
case "-open":
|
||||||
|
if ((i + 1) > (args.Length - 1)) break;
|
||||||
|
|
||||||
|
string openFilename = args[(i + 1)];
|
||||||
|
if (string.IsNullOrWhiteSpace(openFilename)) break;
|
||||||
|
if (!File.Exists(openFilename)) break;
|
||||||
|
|
||||||
|
await LoadFile(openFilename);
|
||||||
|
|
||||||
|
//LoadBookmarksForm loadFileForm = new LoadBookmarksForm(this, openFilename);
|
||||||
|
//loadFileForm.ShowDialog();
|
||||||
|
|
||||||
|
rs = true;
|
||||||
|
|
||||||
|
i++;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return rs;
|
||||||
|
}
|
||||||
|
|
||||||
protected async Task<Result> LoadFile(string filename)
|
protected async Task<Result> LoadFile(string filename)
|
||||||
{
|
{
|
||||||
return await Task.Run(() =>
|
return await Task.Run(() =>
|
||||||
|
@ -23,8 +23,8 @@ DefaultGroupName={#MyAppName}
|
|||||||
DisableProgramGroupPage=yes
|
DisableProgramGroupPage=yes
|
||||||
; Remove the following line to run in administrative install mode (install for all users.)
|
; Remove the following line to run in administrative install mode (install for all users.)
|
||||||
PrivilegesRequired=lowest
|
PrivilegesRequired=lowest
|
||||||
OutputDir=L:\gitlab-hiimray\fizzy-launcher\bin
|
OutputDir=L:\gitlab-hiimray\bookmark-manager-r4\bin
|
||||||
OutputBaseFilename=fizzy-launcher-64
|
OutputBaseFilename=bookmark-manager-64
|
||||||
Compression=lzma
|
Compression=lzma
|
||||||
SolidCompression=yes
|
SolidCompression=yes
|
||||||
WizardStyle=modern
|
WizardStyle=modern
|
||||||
@ -36,7 +36,7 @@ Name: "english"; MessagesFile: "compiler:Default.isl"
|
|||||||
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
|
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
|
||||||
|
|
||||||
[Files]
|
[Files]
|
||||||
Source: "L:\gitlab-hiimray\fizzy-launcher\bin\Release\64\fizzylauncher.exe"; DestDir: "{app}"; Flags: ignoreversion
|
Source: "L:\gitlab-hiimray\bookmark-manager-r4\bin\Release\64\bookmarkmanager.exe"; DestDir: "{app}"; Flags: ignoreversion
|
||||||
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
|
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
|
||||||
|
|
||||||
[Icons]
|
[Icons]
|
||||||
|
@ -23,8 +23,8 @@ DefaultGroupName={#MyAppName}
|
|||||||
DisableProgramGroupPage=yes
|
DisableProgramGroupPage=yes
|
||||||
; Remove the following line to run in administrative install mode (install for all users.)
|
; Remove the following line to run in administrative install mode (install for all users.)
|
||||||
PrivilegesRequired=lowest
|
PrivilegesRequired=lowest
|
||||||
OutputDir=L:\gitlab-hiimray\fizzy-launcher\bin
|
OutputDir=L:\gitlab-hiimray\bookmark-manager-r4\bin
|
||||||
OutputBaseFilename=fizzy-launcher-86
|
OutputBaseFilename=bookmark-manager-86
|
||||||
Compression=lzma
|
Compression=lzma
|
||||||
SolidCompression=yes
|
SolidCompression=yes
|
||||||
WizardStyle=modern
|
WizardStyle=modern
|
||||||
@ -36,7 +36,7 @@ Name: "english"; MessagesFile: "compiler:Default.isl"
|
|||||||
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
|
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
|
||||||
|
|
||||||
[Files]
|
[Files]
|
||||||
Source: "L:\gitlab-hiimray\fizzy-launcher\bin\Release\86\fizzylauncher.exe"; DestDir: "{app}"; Flags: ignoreversion
|
Source: "L:\gitlab-hiimray\bookmark-manager-r4\bin\Release\86\bookmarkmanager.exe"; DestDir: "{app}"; Flags: ignoreversion
|
||||||
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
|
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
|
||||||
|
|
||||||
[Icons]
|
[Icons]
|
||||||
|
Loading…
Reference in New Issue
Block a user