Skip to content
This repository was archived by the owner on Sep 11, 2023. It is now read-only.

Commit 51397f1

Browse files
authored
Java installation removal (#119)
* remove old lysis java system and added basicpawn's lysis.net * improve decompiling message * remove unnecesary DLLs from new lysis
1 parent 6906237 commit 51397f1

File tree

12 files changed

+80
-259
lines changed

12 files changed

+80
-259
lines changed
6.34 MB
Binary file not shown.
946 KB
Binary file not shown.
869 KB
Binary file not shown.
29.5 KB
Binary file not shown.
255 KB
Binary file not shown.
-285 KB
Binary file not shown.

Spcode.csproj

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,6 @@
204204
<Compile Include="Utils\Models\Hotkey.cs" />
205205
<Compile Include="Utils\Models\HotkeyInfo.cs" />
206206
<Compile Include="Utils\HotkeyUtils.cs" />
207-
<Compile Include="Utils\JavaInstallation.cs" />
208207
<Compile Include="Utils\NamesHelper.cs" />
209208
<Compile Include="Utils\ObjectBrowserUtils.cs" />
210209
<Compile Include="Utils\Paths.cs" />
@@ -593,9 +592,7 @@
593592
<Version>1.1.0</Version>
594593
</PackageReference>
595594
</ItemGroup>
596-
<ItemGroup>
597-
<Folder Include="Resources\Translations\" />
598-
</ItemGroup>
595+
<ItemGroup />
599596
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
600597
<PropertyGroup>
601598
<PreBuildEvent>cd ..\..\Deploy\

UI/MainWindow/MainWindowCommands.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -609,15 +609,23 @@ private void Command_TidyCode(bool All)
609609
/// </summary>
610610
private async void Command_Decompile()
611611
{
612+
ProgressDialogController? msg = null;
612613
try
613614
{
614-
var decomp = new DecompileUtil();
615-
await decomp.DecompilePlugin();
615+
var file = DecompileUtil.GetFile();
616+
msg = await this.ShowProgressAsync(Translate("Decompiling") + "...", file.Name, false, MetroDialogOptions);
617+
msg.SetIndeterminate();
618+
ProcessUITasks();
619+
TryLoadSourceFile(DecompileUtil.GetDecompiledPlugin(file), out _);
616620
}
617621
catch (Exception ex)
618622
{
619623
await this.ShowMessageAsync(Translate("Error"), ex.Message, settings: MetroDialogOptions);
620624
}
625+
finally
626+
{
627+
await msg.CloseAsync();
628+
}
621629
}
622630

623631
/// <summary>

UI/MainWindow/MainWindowObjectBrowser.cs

Lines changed: 25 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,12 @@ private async void OBItemDecompile_Click(object sender, RoutedEventArgs e)
142142
var selectedItemFile = ((ObjectBrowser.SelectedItem as TreeViewItem)?.Tag as ObjectBrowserTag)?.Value;
143143
if (selectedItemFile != null)
144144
{
145-
await new DecompileUtil().DecompilePlugin(selectedItemFile);
145+
var fInfo = new FileInfo(selectedItemFile);
146+
var msg = await this.ShowProgressAsync(Translate("Decompiling") + "...", fInfo.Name, false, MetroDialogOptions);
147+
msg.SetIndeterminate();
148+
ProcessUITasks();
149+
TryLoadSourceFile(DecompileUtil.GetDecompiledPlugin(fInfo), out _);
150+
await msg.CloseAsync();
146151
}
147152
}
148153

@@ -160,26 +165,26 @@ private void OBItemRename_Click(object sender, RoutedEventArgs e)
160165
ObjectBrowser.ContextMenu = null;
161166

162167
// If we didn't receive an empty name...
163-
if (!string.IsNullOrEmpty(renameWindow.NewName))
168+
if (string.IsNullOrEmpty(renameWindow.NewName))
164169
{
165-
var oldFileInfo = new FileInfo(fileTag.Value);
166-
var newFileInfo = new FileInfo(oldFileInfo.DirectoryName + @"\" + renameWindow.NewName);
170+
return;
171+
}
172+
var oldFileInfo = new FileInfo(fileTag.Value);
173+
var newFileInfo = new FileInfo(oldFileInfo.DirectoryName + @"\" + renameWindow.NewName);
167174

168-
// Rename file
169-
File.Move(oldFileInfo.FullName, newFileInfo.FullName);
175+
// Rename file
176+
File.Move(oldFileInfo.FullName, newFileInfo.FullName);
170177

171-
// If the new extension is not supported by SPCode, remove it from object browser
172-
// else, rename and update the item
173-
if (!FileIcons.ContainsKey(newFileInfo.Extension))
174-
{
175-
file.Visibility = Visibility.Collapsed;
176-
return;
177-
}
178-
else
179-
{
180-
fileTag.Value = newFileInfo.FullName;
181-
file.Header = BuildTreeViewItemContent(renameWindow.NewName, FileIcons[newFileInfo.Extension]);
182-
}
178+
// If the new extension is not supported by SPCode, remove it from object browser
179+
// else, rename and update the item
180+
if (!FileIcons.ContainsKey(newFileInfo.Extension))
181+
{
182+
file.Visibility = Visibility.Collapsed;
183+
}
184+
else
185+
{
186+
fileTag.Value = newFileInfo.FullName;
187+
file.Header = BuildTreeViewItemContent(renameWindow.NewName, FileIcons[newFileInfo.Extension]);
183188
}
184189
}
185190
}
@@ -578,8 +583,8 @@ private void ChangeObjectBrowserToDrives()
578583
}
579584

580585
/// <summary>
581-
/// <para> Helper function to build an expanded item's contents. </para>
582-
/// <para> It outs a TreeViewItem list to be used when using the Reload function to keep directories expanded after refreshing. </para>
586+
/// Helper function to build an expanded item's contents. <br/>
587+
/// It outs a TreeViewItem list to be used when using the Reload function to keep directories expanded after refreshing.
583588
/// </summary>
584589
/// <param name="dir">Directory to fetch contents from.</param>
585590
/// <param name="itemsToExpand">List of items that were expanded before calling this function to reload the Object Browser items.</param>

Utils/Constants.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ public static class Constants
4040
public const string ErrorFilterRegex = @"^(?<File>.+?)\((?<Line>[0-9]+(\s*--\s*[0-9]+)?)\)\s*:\s*(?<Type>[a-zA-Z]+\s+([a-zA-Z]+\s+)?[0-9]+)\s*:(?<Details>.+)";
4141
public const string FileSaveFilters = @"Sourcepawn Files (*.sp *.inc)|*.sp;*.inc|All Files (*.*)|*.*";
4242
public const string FileOpenFilters = @"Sourcepawn Files (*.sp *.inc)|*.sp;*.inc|Sourcemod Plugins (*.smx)|*.smx|All Files (*.*)|*.*";
43+
public static string DecompileFileFilters = "Sourcepawn Plugins (*.smx)|*.smx";
4344
#endregion
4445

4546
#region Other

0 commit comments

Comments
 (0)