Install script finished
This commit is contained in:
		@@ -8,27 +8,31 @@ AppVersion={#version}
 | 
				
			|||||||
AppPublisher=Kwoth
 | 
					AppPublisher=Kwoth
 | 
				
			||||||
DefaultDirName={pf}\NadekoBot
 | 
					DefaultDirName={pf}\NadekoBot
 | 
				
			||||||
DefaultGroupName=NadekoBot
 | 
					DefaultGroupName=NadekoBot
 | 
				
			||||||
UninstallDisplayIcon={app}\{#sysfolder}\NadekoBot.exe
 | 
					UninstallDisplayIcon={app}\{#sysfolder}\nadeko_icon.ico
 | 
				
			||||||
Compression=lzma2
 | 
					Compression=lzma2
 | 
				
			||||||
SolidCompression=yes
 | 
					SolidCompression=yes
 | 
				
			||||||
OutputDir=userdocs:projekti/NadekoInstallerOutput
 | 
					OutputDir=userdocs:projekti/NadekoInstallerOutput
 | 
				
			||||||
OutputBaseFilename=NadekoBot-setup-{#version}
 | 
					OutputBaseFilename=NadekoBot-setup-{#version}
 | 
				
			||||||
AppReadmeFile=http://nadekobot.readthedocs.io/en/latest/Commands%20List/
 | 
					AppReadmeFile=http://nadekobot.readthedocs.io/en/1.4/Commands%20List/
 | 
				
			||||||
 | 
					ArchitecturesInstallIn64BitMode=x64
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[Files]
 | 
					[Files]
 | 
				
			||||||
;install 
 | 
					;install 
 | 
				
			||||||
Source: "src\NadekoBot\bin\Release\PublishOutput\{#target}\*"; DestDir: "{app}\{#sysfolder}"; Permissions: users-modify; Flags: recursesubdirs onlyifdoesntexist ignoreversion createallsubdirs; Excludes: "*.pdb, *.db"
 | 
					Source: "src\NadekoBot\bin\Release\PublishOutput\{#target}\*"; DestDir: "{app}\{#sysfolder}"; Permissions: users-full; Flags: recursesubdirs onlyifdoesntexist ignoreversion createallsubdirs; Excludes: "*.pdb, *.db"
 | 
				
			||||||
 | 
					;rename credentials example to credentials, but don't overwrite if it exists
 | 
				
			||||||
 | 
					Source: "src\NadekoBot\bin\Release\PublishOutput\{#target}\credentials_example.json"; DestName: "credentials.json"; DestDir: "{app}\{#sysfolder}"; Permissions: users-full; Flags: skipifsourcedoesntexist onlyifdoesntexist;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
;reinstall - i want to copy all files, but i don't want to overwrite any data files because users will lose their customization if they don't have a backup, 
 | 
					;reinstall - i want to copy all files, but i don't want to overwrite any data files because users will lose their customization if they don't have a backup, 
 | 
				
			||||||
;            and i don't want them to have to backup and then copy-merge into data folder themselves, or lose their currency images due to overwrite.
 | 
					;            and i don't want them to have to backup and then copy-merge into data folder themselves, or lose their currency images due to overwrite.
 | 
				
			||||||
Source: "src\NadekoBot\bin\Release\PublishOutput\{#target}\*"; DestDir: "{app}\{#sysfolder}"; Permissions: users-modify; Flags: recursesubdirs onlyifdestfileexists createallsubdirs; Excludes: "*.pdb, *.db, data\*, credentials.json";
 | 
					Source: "src\NadekoBot\bin\Release\PublishOutput\{#target}\*"; DestDir: "{app}\{#sysfolder}"; Permissions: users-full; Flags: recursesubdirs onlyifdestfileexists createallsubdirs; Excludes: "*.pdb, *.db, data\*, credentials.json";
 | 
				
			||||||
Source: "src\NadekoBot\bin\Release\PublishOutput\{#target}\data\*"; DestDir: "{app}\{#sysfolder}\data"; Permissions: users-modify; Flags: recursesubdirs onlyifdoesntexist createallsubdirs;
 | 
					Source: "src\NadekoBot\bin\Release\PublishOutput\{#target}\data\*"; DestDir: "{app}\{#sysfolder}\data"; Permissions: users-full; Flags: recursesubdirs onlyifdoesntexist createallsubdirs;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
;readme   
 | 
					;readme   
 | 
				
			||||||
;Source: "readme"; DestDir: "{app}"; Flags: isreadme
 | 
					;Source: "readme"; DestDir: "{app}"; Flags: isreadme
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[Run]
 | 
					[Run]
 | 
				
			||||||
Filename: "http://nadekobot.readthedocs.io/en/latest/Commands%20List/"; Flags: postinstall checked shellexec runasoriginaluser; Description: "Open Command List"
 | 
					Filename: "http://nadekobot.readthedocs.io/en/1.4/JSON%20Explanations/"; Flags: postinstall shellexec runasoriginaluser; Description: "Open setup guide"
 | 
				
			||||||
 | 
					Filename: "{app}\{#sysfolder}\credentials.json"; Flags: postinstall shellexec runasoriginaluser; Description: "Open credentials file"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[Icons]
 | 
					[Icons]
 | 
				
			||||||
; for pretty install directory
 | 
					; for pretty install directory
 | 
				
			||||||
@@ -37,3 +41,31 @@ Name: "{app}\credentials"; Filename: "{app}\{#sysfolder}\credentials.json"
 | 
				
			|||||||
Name: "{app}\data"; Filename: "{app}\{#sysfolder}\data" 
 | 
					Name: "{app}\data"; Filename: "{app}\{#sysfolder}\data" 
 | 
				
			||||||
; desktop shortcut 
 | 
					; desktop shortcut 
 | 
				
			||||||
Name: "{commondesktop}\NadekoBot"; Filename: "{app}\NadekoBot";
 | 
					Name: "{commondesktop}\NadekoBot"; Filename: "{app}\NadekoBot";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[Registry]
 | 
				
			||||||
 | 
					;make the app run as administrator
 | 
				
			||||||
 | 
					Root: "HKLM"; Subkey: "SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers"; \
 | 
				
			||||||
 | 
					    ValueType: String; ValueName: "{app}\{#sysfolder}\NadekoBot.exe"; ValueData: "RUNASADMIN"; \
 | 
				
			||||||
 | 
					    Flags: uninsdeletekeyifempty uninsdeletevalue;
 | 
				
			||||||
 | 
					Root: "HKCU"; Subkey: "SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers"; \
 | 
				
			||||||
 | 
					    ValueType: String; ValueName: "{app}\{#sysfolder}\NadekoBot.exe"; ValueData: "RUNASADMIN"; \
 | 
				
			||||||
 | 
					    Flags: uninsdeletekeyifempty uninsdeletevalue;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;ask the user if they want to delete all settings
 | 
				
			||||||
 | 
					[Code]
 | 
				
			||||||
 | 
					var
 | 
				
			||||||
 | 
					X: string;
 | 
				
			||||||
 | 
					procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
 | 
				
			||||||
 | 
					begin
 | 
				
			||||||
 | 
					  if CurUninstallStep = usPostUninstall then
 | 
				
			||||||
 | 
					  begin
 | 
				
			||||||
 | 
					    X := ExpandConstant('{app}');
 | 
				
			||||||
 | 
					    if FileExists(X + '\{#sysfolder}\data\NadekoBot.db') then begin
 | 
				
			||||||
 | 
					      if MsgBox('Do you want to delete all settings associated with this bot?', mbConfirmation, MB_YESNO) = IDYES then begin
 | 
				
			||||||
 | 
					        DelTree(X + '\{#sysfolder}', True, True, True);
 | 
				
			||||||
 | 
					      end
 | 
				
			||||||
 | 
					    end else begin
 | 
				
			||||||
 | 
					      MsgBox(X + '\{#sysfolder}\data\NadekoBot.db doesn''t exist', mbConfirmation, MB_YESNO)
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
 | 
					  end;
 | 
				
			||||||
 | 
					end;
 | 
				
			||||||
@@ -25,6 +25,7 @@ using NadekoBot.Services.Administration;
 | 
				
			|||||||
using NadekoBot.Services.Permissions;
 | 
					using NadekoBot.Services.Permissions;
 | 
				
			||||||
using NadekoBot.Services.Utility;
 | 
					using NadekoBot.Services.Utility;
 | 
				
			||||||
using NadekoBot.Services.Help;
 | 
					using NadekoBot.Services.Help;
 | 
				
			||||||
 | 
					using System.IO;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace NadekoBot
 | 
					namespace NadekoBot
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
@@ -63,6 +64,7 @@ namespace NadekoBot
 | 
				
			|||||||
        {
 | 
					        {
 | 
				
			||||||
            SetupLogger();
 | 
					            SetupLogger();
 | 
				
			||||||
            _log = LogManager.GetCurrentClassLogger();
 | 
					            _log = LogManager.GetCurrentClassLogger();
 | 
				
			||||||
 | 
					            TerribleElevatedPermissionCheck();
 | 
				
			||||||
            
 | 
					            
 | 
				
			||||||
            Credentials = new BotCredentials();
 | 
					            Credentials = new BotCredentials();
 | 
				
			||||||
            Db = new DbService(Credentials);
 | 
					            Db = new DbService(Credentials);
 | 
				
			||||||
@@ -244,11 +246,11 @@ namespace NadekoBot
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
            await LoginAsync(Credentials.Token).ConfigureAwait(false);
 | 
					            await LoginAsync(Credentials.Token).ConfigureAwait(false);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            _log.Info("Loading serveices...");
 | 
					            _log.Info("Loading services...");
 | 
				
			||||||
            AddServices();
 | 
					            AddServices();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            sw.Stop();
 | 
					            sw.Stop();
 | 
				
			||||||
            _log.Info("Connected in " + sw.Elapsed.TotalSeconds.ToString("F2"));
 | 
					            _log.Info($"Connected in {sw.Elapsed.TotalSeconds:F2} s");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            var stats = Services.GetService<IStatsService>();
 | 
					            var stats = Services.GetService<IStatsService>();
 | 
				
			||||||
            stats.Initialize();
 | 
					            stats.Initialize();
 | 
				
			||||||
@@ -295,6 +297,21 @@ namespace NadekoBot
 | 
				
			|||||||
            await Task.Delay(-1).ConfigureAwait(false);
 | 
					            await Task.Delay(-1).ConfigureAwait(false);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        private void TerribleElevatedPermissionCheck()
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            try
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                File.WriteAllText("test", "test");
 | 
				
			||||||
 | 
					                File.Delete("test");
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            catch
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                _log.Error("You must run the application as an ADMINISTRATOR.");
 | 
				
			||||||
 | 
					                Console.ReadKey();
 | 
				
			||||||
 | 
					                Environment.Exit(2);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        private static void SetupLogger()
 | 
					        private static void SetupLogger()
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            try
 | 
					            try
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -4,6 +4,7 @@
 | 
				
			|||||||
    <Description>General purpose Discord bot written in C#.</Description>
 | 
					    <Description>General purpose Discord bot written in C#.</Description>
 | 
				
			||||||
    <Copyright>Kwoth</Copyright>
 | 
					    <Copyright>Kwoth</Copyright>
 | 
				
			||||||
    <Authors>Kwoth</Authors>
 | 
					    <Authors>Kwoth</Authors>
 | 
				
			||||||
 | 
					    <PublisherName>Kwoth</PublisherName>
 | 
				
			||||||
    <TargetFramework>netcoreapp1.1</TargetFramework>
 | 
					    <TargetFramework>netcoreapp1.1</TargetFramework>
 | 
				
			||||||
    <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
 | 
					    <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
 | 
				
			||||||
    <AssemblyName>NadekoBot</AssemblyName>
 | 
					    <AssemblyName>NadekoBot</AssemblyName>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -41,8 +41,6 @@ namespace NadekoBot.Services.Administration
 | 
				
			|||||||
            _mute = mute;
 | 
					            _mute = mute;
 | 
				
			||||||
            _prot = prot;
 | 
					            _prot = prot;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            var sw = Stopwatch.StartNew();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            GuildLogSettings = gcs
 | 
					            GuildLogSettings = gcs
 | 
				
			||||||
                .ToDictionary(g => g.GuildId, g => g.LogSetting)
 | 
					                .ToDictionary(g => g.GuildId, g => g.LogSetting)
 | 
				
			||||||
                .ToConcurrent();
 | 
					                .ToConcurrent();
 | 
				
			||||||
@@ -69,9 +67,6 @@ namespace NadekoBot.Services.Administration
 | 
				
			|||||||
                }
 | 
					                }
 | 
				
			||||||
            }, null, TimeSpan.FromSeconds(15), TimeSpan.FromSeconds(15));
 | 
					            }, null, TimeSpan.FromSeconds(15), TimeSpan.FromSeconds(15));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            sw.Stop();
 | 
					 | 
				
			||||||
            _log.Debug($"Loaded in {sw.Elapsed.TotalSeconds:F2}s");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            //_client.MessageReceived += _client_MessageReceived;
 | 
					            //_client.MessageReceived += _client_MessageReceived;
 | 
				
			||||||
            _client.MessageUpdated += _client_MessageUpdated;
 | 
					            _client.MessageUpdated += _client_MessageUpdated;
 | 
				
			||||||
            _client.MessageDeleted += _client_MessageDeleted;
 | 
					            _client.MessageDeleted += _client_MessageDeleted;
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user