Skip to content

Commit

Permalink
Add: optional .osdb files association
Browse files Browse the repository at this point in the history
  • Loading branch information
Piotrekol committed Jun 2, 2019
1 parent 035ed27 commit 7e6a8b6
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
10 changes: 9 additions & 1 deletion App/Initalizer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public class Initalizer : ApplicationContext
public static CollectionEditor CollectionEditor { get; private set; }
private IUserDialogs UserDialogs { get; set; }// = new GuiComponents.UserDialogs();
public static OsuStatsApi WebCollectionProvider = new OsuStatsApi("", OsuFileIo.LoadedMaps);
public void Run()
public void Run(string[] args)
{
//IUserDialogs can be implemented in WinForm or WPF or Gtk or Console or...?
UserDialogs = GuiComponentsProvider.Instance.GetClassImplementing<IUserDialogs>();
Expand All @@ -51,6 +51,14 @@ public void Run()
var collectionAddRemoveForm = GuiComponentsProvider.Instance.GetClassImplementing<ICollectionAddRenameForm>();
CollectionEditor = new CollectionEditor(CollectionsManager, CollectionsManager, collectionAddRemoveForm, OsuFileIo.LoadedMaps);

if (args.Length > 0)
{
if (File.Exists(args[0]))
{
CollectionsManager.EditCollection(CollectionEditArgs.AddCollections(OsuFileIo.CollectionLoader.LoadCollection(args[0])));
}
}

var UpdateChecker = new UpdateChecker();
UpdateChecker.currentVersion = System.Reflection.Assembly.GetExecutingAssembly()
.GetName()
Expand Down
4 changes: 2 additions & 2 deletions App/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ static class Program
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
static void Main(string[] args)
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
var app = new Initalizer();
app.Run();
app.Run(args);
Application.Run(app);
}
}
Expand Down
9 changes: 9 additions & 0 deletions InnoSetup/script.iss
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,13 @@ OutputBaseFilename=CollectionManagerSetup
SetupIconFile=..\App\Resources\logo.ico
Compression=lzma
SolidCompression=yes
ChangesAssociations=yes
[Registry]

Root: HKCR; Subkey: ".osdb"; ValueData: "{#MyAppName}"; Flags: uninsdeletevalue; ValueType: string; ValueName: ""; Tasks: osdbAssociation
Root: HKCR; Subkey: "{#MyAppName}"; ValueData: "Program {#MyAppName}"; Flags: uninsdeletekey; ValueType: string; ValueName: ""; Tasks: osdbAssociation
Root: HKCR; Subkey: "{#MyAppName}\DefaultIcon"; ValueData: "{app}\{#MyAppExeName},0"; ValueType: string; ValueName: ""; Tasks: osdbAssociation
Root: HKCR; Subkey: "{#MyAppName}\shell\open\command"; ValueData: """{app}\{#MyAppExeName}"" ""%1"""; ValueType: string; ValueName: ""; Tasks: osdbAssociation

[CustomMessages]
MyAppOld=The Setup detected application version
Expand All @@ -39,6 +46,8 @@ Name: "english"; MessagesFile: "compiler:Default.isl"

[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
Name: osdbAssociation; Description: "Associate "".osdb"" extension"; GroupDescription: File extensions:

Name: "quicklaunchicon"; Description: "{cm:CreateQuickLaunchIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked; OnlyBelowVersion: 0,6.1

[Files]
Expand Down

0 comments on commit 7e6a8b6

Please sign in to comment.