-
Notifications
You must be signed in to change notification settings - Fork 31
Adeed support for .prj and .wad files in FileAssociation #1181
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,6 +9,8 @@ public partial class FormMain : DarkForm | |
| private bool _wasPRJ2Checked = false; | ||
| private bool _wasWAD2Checked = false; | ||
| private bool _wasTRPROJChecked = false; | ||
| private bool _wasPRJChecked = false; | ||
| private bool _wasWADChecked = false; | ||
|
|
||
| public FormMain() | ||
| { | ||
|
|
@@ -17,7 +19,9 @@ public FormMain() | |
|
|
||
| protected override void OnLoad(EventArgs e) | ||
| { | ||
| _wasPRJChecked = checkBox_prj.Checked = Association.IsAssociatedWith(".prj", DefaultPaths.TombEditorExecutable); | ||
| _wasPRJ2Checked = checkBox_prj2.Checked = Association.IsAssociatedWith(".prj2", DefaultPaths.TombEditorExecutable); | ||
| _wasWADChecked = checkBox_wad.Checked = Association.IsAssociatedWith(".wad", DefaultPaths.WadToolExecutable); | ||
| _wasWAD2Checked = checkBox_wad2.Checked = Association.IsAssociatedWith(".wad2", DefaultPaths.WadToolExecutable); | ||
| _wasTRPROJChecked = checkBox_trproj.Checked = Association.IsAssociatedWith(".trproj", DefaultPaths.TombIDEExecutable); | ||
|
|
||
|
|
@@ -33,11 +37,21 @@ private void button_Apply_Click(object sender, EventArgs e) | |
| else | ||
| Association.ClearAssociations(".prj2"); | ||
|
|
||
| if (checkBox_prj.Checked) | ||
| Program.AssociatePRJ(); | ||
| else | ||
| Association.ClearAssociations(".prj"); | ||
|
|
||
| if (checkBox_wad2.Checked) | ||
| Program.AssociateWAD2(); | ||
| else | ||
| Association.ClearAssociations(".wad2"); | ||
|
|
||
| if (checkBox_wad.Checked) | ||
| Program.AssociateWAD(); | ||
| else | ||
| Association.ClearAssociations(".wad"); | ||
|
|
||
| if (checkBox_trproj.Checked) | ||
| Program.AssociateTRPROJ(); | ||
| else | ||
|
|
@@ -46,6 +60,8 @@ private void button_Apply_Click(object sender, EventArgs e) | |
| _wasPRJ2Checked = checkBox_prj2.Checked; | ||
| _wasWAD2Checked = checkBox_wad2.Checked; | ||
| _wasTRPROJChecked = checkBox_trproj.Checked; | ||
| _wasPRJChecked = checkBox_prj.Checked; | ||
| _wasWADChecked = checkBox_wad.Checked; | ||
|
|
||
| button_Apply.Enabled = false; | ||
| } | ||
|
|
@@ -54,8 +70,10 @@ private void button_Close_Click(object sender, EventArgs e) | |
| => Close(); | ||
|
|
||
| private void checkBox_CheckedChanged(object sender, EventArgs e) | ||
| => button_Apply.Enabled = checkBox_prj2.Checked != _wasPRJ2Checked | ||
| || checkBox_wad2.Checked != _wasWAD2Checked | ||
| || checkBox_trproj.Checked != _wasTRPROJChecked; | ||
| => button_Apply.Enabled = checkBox_prj.Checked != _wasPRJChecked | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Another indentation inconsistency. Use tabs instead of spaces. Additionally, the OR chain below should have 4 tabs instead of 5 |
||
| || checkBox_prj2.Checked != _wasPRJ2Checked | ||
| || checkBox_wad.Checked != _wasWADChecked | ||
| || checkBox_wad2.Checked != _wasWAD2Checked | ||
| || checkBox_trproj.Checked != _wasTRPROJChecked; | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -38,20 +38,30 @@ private static void OpenGUI() | |
|
|
||
| private static void RunAssociation() | ||
| { | ||
| AssociatePRJ(); | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Again, use tabs instead of spaces please. |
||
| AssociatePRJ2(); | ||
| AssociateWAD(); | ||
| AssociateWAD2(); | ||
| AssociateTRPROJ(); | ||
| } | ||
|
|
||
| private static void RunAssociationWithBinaryArgs(string args) | ||
| private static void RunAssociationWithBinaryArgs(string args) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as above. |
||
| { | ||
| bool associatePRJ2 = int.Parse(args[1].ToString()) != 0; | ||
| bool associateWAD2 = int.Parse(args[2].ToString()) != 0; | ||
| bool associateTRPROJ = int.Parse(args[3].ToString()) != 0; | ||
| bool associatePRJ = int.Parse(args[1].ToString()) != 0; | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The order of args has changed here, we can't do this due to compatibility reasons with the old installer. Please restore the previous PRJ2, WAD2 and TRPROJ order and add the new PRJ and WAD entries at the end. |
||
| bool associatePRJ2 = int.Parse(args[2].ToString()) != 0; | ||
| bool associateWAD = int.Parse(args[3].ToString()) != 0; | ||
| bool associateWAD2 = int.Parse(args[4].ToString()) != 0; | ||
| bool associateTRPROJ = int.Parse(args[5].ToString()) != 0; | ||
|
|
||
| if (associatePRJ) | ||
| AssociatePRJ(); | ||
|
|
||
| if (associatePRJ2) | ||
| AssociatePRJ2(); | ||
|
|
||
| if (associateWAD) | ||
| AssociateWAD(); | ||
|
|
||
| if (associateWAD2) | ||
| AssociateWAD2(); | ||
|
|
||
|
|
@@ -61,7 +71,9 @@ private static void RunAssociationWithBinaryArgs(string args) | |
|
|
||
| private static void RunDeassociation() // Is this even a real word? | ||
| { | ||
| Association.ClearAssociations(".prj"); | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Indentation inconsistency. |
||
| Association.ClearAssociations(".prj2"); | ||
| Association.ClearAssociations(".wad"); | ||
| Association.ClearAssociations(".wad2"); | ||
| Association.ClearAssociations(".trproj"); | ||
| } | ||
|
|
@@ -76,6 +88,16 @@ public static void AssociatePRJ2() | |
| Association.SetAssociation(extension, openWith, description, iconPath); | ||
| } | ||
|
|
||
| public static void AssociatePRJ() | ||
| { | ||
| string extension = ".prj"; | ||
| string openWith = DefaultPaths.TombEditorExecutable; | ||
| string description = "TombEditor Project File"; | ||
| string iconPath = Path.Combine(DefaultPaths.ResourcesDirectory, "te_file.ico"); | ||
|
|
||
| Association.SetAssociation(extension, openWith, description, iconPath); | ||
| } | ||
|
|
||
| public static void AssociateWAD2() | ||
| { | ||
| string extension = ".wad2"; | ||
|
|
@@ -86,6 +108,16 @@ public static void AssociateWAD2() | |
| Association.SetAssociation(extension, openWith, description, iconPath); | ||
| } | ||
|
|
||
| public static void AssociateWAD() | ||
| { | ||
| string extension = ".wad"; | ||
| string openWith = DefaultPaths.WadToolExecutable; | ||
| string description = "Wad Object File"; | ||
| string iconPath = Path.Combine(DefaultPaths.ResourcesDirectory, "wt_file.ico"); | ||
|
|
||
| Association.SetAssociation(extension, openWith, description, iconPath); | ||
| } | ||
|
|
||
| public static void AssociateTRPROJ() | ||
| { | ||
| string extension = ".trproj"; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indentation inconsistency, we use tabs rather than spaces in this part of the code.