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();
|
||||
|
||||
string[] commandLineArgs = Environment.GetCommandLineArgs();
|
||||
|
||||
bool hasCommands = await LoadCommandLine(commandLineArgs);
|
||||
if (!hasCommands)
|
||||
{
|
||||
newToolStripMenuItem_Click(null, null);
|
||||
}
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
return await Task.Run(() =>
|
||||
|
@ -23,8 +23,8 @@ DefaultGroupName={#MyAppName}
|
||||
DisableProgramGroupPage=yes
|
||||
; Remove the following line to run in administrative install mode (install for all users.)
|
||||
PrivilegesRequired=lowest
|
||||
OutputDir=L:\gitlab-hiimray\fizzy-launcher\bin
|
||||
OutputBaseFilename=fizzy-launcher-64
|
||||
OutputDir=L:\gitlab-hiimray\bookmark-manager-r4\bin
|
||||
OutputBaseFilename=bookmark-manager-64
|
||||
Compression=lzma
|
||||
SolidCompression=yes
|
||||
WizardStyle=modern
|
||||
@ -36,7 +36,7 @@ Name: "english"; MessagesFile: "compiler:Default.isl"
|
||||
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
|
||||
|
||||
[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
|
||||
|
||||
[Icons]
|
||||
|
@ -23,8 +23,8 @@ DefaultGroupName={#MyAppName}
|
||||
DisableProgramGroupPage=yes
|
||||
; Remove the following line to run in administrative install mode (install for all users.)
|
||||
PrivilegesRequired=lowest
|
||||
OutputDir=L:\gitlab-hiimray\fizzy-launcher\bin
|
||||
OutputBaseFilename=fizzy-launcher-86
|
||||
OutputDir=L:\gitlab-hiimray\bookmark-manager-r4\bin
|
||||
OutputBaseFilename=bookmark-manager-86
|
||||
Compression=lzma
|
||||
SolidCompression=yes
|
||||
WizardStyle=modern
|
||||
@ -36,7 +36,7 @@ Name: "english"; MessagesFile: "compiler:Default.isl"
|
||||
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
|
||||
|
||||
[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
|
||||
|
||||
[Icons]
|
||||
|
Loading…
Reference in New Issue
Block a user