Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
michioxd committed Feb 8, 2024
1 parent 345540b commit fbc5376
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 2 deletions.
32 changes: 31 additions & 1 deletion TinyDRPC.iss
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ OutputBaseFilename=TinyDRPC-setup
Compression=lzma
SolidCompression=yes
WizardStyle=modern
AppMutex=Global\{#MyAppName}

[UninstallDelete]
Type: files; Name: "{app}\TinyDRPC.ini"

[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"
Expand All @@ -54,9 +58,35 @@ Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChang
function InitializeSetup: Boolean;
begin
#ifdef Dependency_Path_NetCoreCheck
Dependency_AddDotNet80;
Dependency_AddDotNet80Desktop;
#endif
Result := True;
end;
function IsAppRunning(const FileName: string): Boolean;
var
FWMIService: Variant;
FSWbemLocator: Variant;
FWbemObjectSet: Variant;
begin
Result := false;
FSWbemLocator := CreateOleObject('WBEMScripting.SWBEMLocator');
FWMIService := FSWbemLocator.ConnectServer('', 'root\CIMV2', '', '');
FWbemObjectSet := FWMIService.ExecQuery(Format('SELECT Name FROM Win32_Process Where Name="%s"',[FileName]));
Result := (FWbemObjectSet.Count > 0);
FWbemObjectSet := Unassigned;
FWMIService := Unassigned;
FSWbemLocator := Unassigned;
end;
function InitializeUninstall(): Boolean;
begin
if IsAppRunning('{#MyAppExeName}') then
begin
MsgBox('The TinyDRPC is currently running. Please close it before continuing.', mbError, MB_OK);
Result := False;
end
else
Result := True;
end;
2 changes: 1 addition & 1 deletion Utils/Configuration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public class Configuration
public class ConfigurationManager
{
private static readonly string ConfigPathName = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "TinyDRPC");
private static readonly string ConfigFileName = Path.Combine(ConfigPathName, "TinyDRPC.inf");
private static readonly string ConfigFileName = Path.Combine(ConfigPathName, "TinyDRPC.ini");

public Configuration LoadConfiguration()
{
Expand Down

0 comments on commit fbc5376

Please sign in to comment.