diff --git a/.github/workflows/compile.yaml b/.github/workflows/compile.yaml
index fc53b6ae..3f3ff43a 100644
--- a/.github/workflows/compile.yaml
+++ b/.github/workflows/compile.yaml
@@ -19,13 +19,47 @@ jobs:
# Nuget
- uses: nuget/setup-nuget@v1
- - run: nuget restore Spedit.sln
+ - run: nuget restore Spcode.sln
# Setup MSBuild
- name: Setup MSBuild.exe
uses: microsoft/setup-msbuild@v1.0.0
- # Build Project
- - name: Build Project
- run: msbuild /p:Configuration=Release
\ No newline at end of file
+ # Build Spcode
+ - name: Build Spcode
+ run: msbuild Spcode.csproj /p:Configuration=Release
+
+ # Build Installer
+ - name: Build Installer (NSIS)
+ uses: joncloud/makensis-action@v1
+ with:
+ script-file: .\bin\Release\SPCode.nsi
+
+ - name: Artifact Installer
+ uses: actions/upload-artifact@v1
+ with:
+ name: SPCode.Installer.exe
+ path: .\bin\Release\SPCode.Installer.exe
+
+
+ # Compress Portable Version
+ - name: Compress Portable Version
+ run: .\bin\Release\Compress.ps1
+ shell: powershell
+
+ - name: Artifact Portable
+ uses: actions/upload-artifact@v1
+ with:
+ name: SPCode.Portable.zip
+ path: .\bin\Release\SPCode.Portable.zip
+
+ # Build Updater
+ - name: Build Updater
+ run: msbuild Deploy\SpcodeUpdater\SpcodeUpdater.csproj /p:Configuration=Release
+
+ - name: Artifact Updater
+ uses: actions/upload-artifact@v1
+ with:
+ name: SpcodeUpdater.exe
+ path: .\Deploy\SpcodeUpdater\bin\Release\SpcodeUpdater.exe
\ No newline at end of file
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 2eb518e6..87bf077e 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -3,79 +3,94 @@ name: Publish Release
on:
push:
tags:
- - '*'
+ - '*'
jobs:
build:
runs-on: windows-latest
-
+
steps:
- - name: Checkout
- uses: actions/checkout@v2
-
- # Install the .NET Core workload
- - name: Install .NET Core
- uses: actions/setup-dotnet@v1
- with:
- dotnet-version: 3.1.100
-
- # Nuget
- - uses: nuget/setup-nuget@v1
- with:
- nuget-version: '5.x'
- - run: nuget restore Spedit.sln
-
- # Setup MSBuild
- - name: Setup MSBuild.exe
- uses: microsoft/setup-msbuild@v1.0.0
-
-
- # Build Project
- - name: Build Project
- run: msbuild /p:Configuration=Release
-
- # Build Installer
- - name: Build Installer (NSIS)
- uses: joncloud/makensis-action@v1
- with:
- script-file: .\bin\Release\SPEdit.nsi
-
- # Compress Portable Version
- - name: Compress Portable Version
- run: .\bin\Release\Compress.ps1
- shell: powershell
-
- - name: Create Release
- id: create_release
- uses: actions/create-release@v1
- env:
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- with:
- tag_name: ${{ github.ref }}
- release_name: Release ${{ github.ref }}
- draft: false
- prerelease: false
-
-
- - name: Upload Installer
- id: upload-installer
- uses: actions/upload-release-asset@v1
- env:
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- with:
- upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
- asset_path: .\bin\Release\SPEdit.Installer.exe
- asset_name: SPEdit.Installer.exe
- asset_content_type: application/octet-stream
-
- - name: Upload Portable
- id: upload-portable
- uses: actions/upload-release-asset@v1
- env:
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- with:
- upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
- asset_path: .\bin\Release\SPEdit.Portable.zip
- asset_name: SPEdit.Portable.zip
- asset_content_type: application/zip
+ - name: Checkout
+ uses: actions/checkout@v2
+
+ # Install the .NET Core workload
+ - name: Install .NET Core
+ uses: actions/setup-dotnet@v1
+ with:
+ dotnet-version: 3.1.100
+
+ # Nuget
+ - uses: nuget/setup-nuget@v1
+ with:
+ nuget-version: '5.x'
+ - run: nuget restore Spcode.sln
+
+ # Setup MSBuild
+ - name: Setup MSBuild.exe
+ uses: microsoft/setup-msbuild@v1.0.0
+
+
+ # Build Spcode
+ - name: Build Spcode
+ run: msbuild Spcode.csproj /p:Configuration=Release
+
+ # Build Installer
+ - name: Build Installer (NSIS)
+ uses: joncloud/makensis-action@v1
+ with:
+ script-file: .\bin\Release\SPCode.nsi
+
+ # Compress Portable Version
+ - name: Compress Portable Version
+ run: .\bin\Release\Compress.ps1
+ shell: powershell
+
+ # Build Updater
+ - name: Build Updater
+ run: msbuild Deploy\SpcodeUpdater\SpcodeUpdater.csproj /p:Configuration=Release
+
+ - name: Create Release
+ id: create_release
+ uses: actions/create-release@v1
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ with:
+ tag_name: ${{ github.ref }}
+ release_name: Release ${{ github.ref }}
+ draft: false
+ prerelease: false
+
+
+ - name: Upload Installer
+ id: upload-installer
+ uses: actions/upload-release-asset@v1
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ with:
+ upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
+ asset_path: .\bin\Release\SPCode.Installer.exe
+ asset_name: SPCode.Installer.exe
+ asset_content_type: application/octet-stream
+
+ - name: Upload Portable
+ id: upload-portable
+ uses: actions/upload-release-asset@v1
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ with:
+ upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
+ asset_path: .\bin\Release\SPCode.Portable.zip
+ asset_name: SPCode.Portable.zip
+ asset_content_type: application/zip
+
+ - name: Upload Updater
+ id: upload-updater
+ uses: actions/upload-release-asset@v1
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ with:
+ upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
+ asset_path: .\Deploy\SpcodeUpdater\bin\Release\SpcodeUpdater.exe
+ asset_name: SpcodeUpdater.exe
+ asset_content_type: application/octet-stream
diff --git a/App/App.config b/App/App.config
index b5000424..23dbd272 100644
--- a/App/App.config
+++ b/App/App.config
@@ -1,7 +1,7 @@
-
+
diff --git a/App/AssemblyInfo1.cs b/App/AssemblyInfo1.cs
index af28e870..c7fd4b35 100644
--- a/App/AssemblyInfo1.cs
+++ b/App/AssemblyInfo1.cs
@@ -5,12 +5,12 @@
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
-[assembly: AssemblyTitle("Spedit")]
-[assembly: AssemblyDescription("SPEdit - a lightweight sourcepawn editor")]
+[assembly: AssemblyTitle("Spcode")]
+[assembly: AssemblyDescription("SPCode - a lightweight sourcepawn editor")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("SPEdit")]
-[assembly: AssemblyCopyright("Copyright © Julien Kluge 2015")]
+[assembly: AssemblyProduct("SPCode")]
+[assembly: AssemblyCopyright("Copyright © Julien Kluge 2015 - Hexah 2020")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: NeutralResourcesLanguage("en-US")]
@@ -30,8 +30,4 @@
// Build Number
// Revision
//
-#if (DEBUG)
-[assembly: AssemblyVersion("1.12.*")]
-#else
-[assembly: AssemblyVersion("1.3.6.1")]
-#endif
+[assembly: AssemblyVersion("1.4.0.0")]
\ No newline at end of file
diff --git a/Deploy/Compress.ps1 b/Deploy/Compress.ps1
index 0a42b8e2..3b7cea23 100644
--- a/Deploy/Compress.ps1
+++ b/Deploy/Compress.ps1
@@ -1,10 +1,10 @@
$loc = Get-Location
Set-Location 'bin\Release\'
$compress = @{
-LiteralPath= "sourcepawn/", "Spedit.exe", "MahApps.Metro.dll", "ICSharpCode.AvalonEdit.dll", "System.Windows.Interactivity.dll", "Xceed.Wpf.AvalonDock.dll", "Xceed.Wpf.AvalonDock.Themes.Metro.dll", "smxdasm.dll", "LysisForSpedit.dll", "QueryMaster.dll", "Ionic.BZip2.dll", "SourcepawnCondenser.dll", "Renci.SshNet.dll", "Newtonsoft.Json.dll", "DiscordRPC.dll", "ControlzEx.dll", "lang_0_spedit.xml", "GPLv3.txt"
+LiteralPath= "sourcepawn/", "Spcode.exe", "MahApps.Metro.dll", "ICSharpCode.AvalonEdit.dll", "System.Windows.Interactivity.dll", "Xceed.Wpf.AvalonDock.dll", "Xceed.Wpf.AvalonDock.Themes.Metro.dll", "smxdasm.dll", "LysisForSpedit.dll", "QueryMaster.dll", "Ionic.BZip2.dll", "SourcepawnCondenser.dll", "Renci.SshNet.dll", "Newtonsoft.Json.dll", "DiscordRPC.dll", "ControlzEx.dll", "Octokit.dll", "lang_0_spcode.xml", "GPLv3.txt"
#Path= "sourcepawn/"
#CompressionLevel = "Fastest"
-DestinationPath = "SPEdit.Portable.zip"
+DestinationPath = "SPCode.Portable.zip"
}
Compress-Archive -Force @compress
diff --git a/Deploy/DotNetChecker.nsh b/Deploy/DotNetChecker.nsh
index 397dd249..cf60a876 100644
--- a/Deploy/DotNetChecker.nsh
+++ b/Deploy/DotNetChecker.nsh
@@ -1,50 +1,96 @@
-!macro CheckNetFramework FrameworkVersion
- Var /GLOBAL dotNetUrl
- Var /GLOBAL dotNetReadableVersion
-
- !define DOTNET452_URL "http://go.microsoft.com/fwlink/?LinkId=397708"
- !define DOTNET451_URL "http://go.microsoft.com/fwlink/?LinkId=322116"
- !define DOTNET45_URL "http://go.microsoft.com/fwlink/?LinkId=225702"
- !define DOTNET40Full_URL "http://www.microsoft.com/downloads/info.aspx?na=41&srcfamilyid=0a391abd-25c1-4fc0-919f-b21f31ab88b7&srcdisplaylang=en&u=http%3a%2f%2fdownload.microsoft.com%2fdownload%2f9%2f5%2fA%2f95A9616B-7A37-4AF6-BC36-D6EA96C8DAAE%2fdotNetFx40_Full_x86_x64.exe"
- !define DOTNET40Client_URL "http://www.microsoft.com/downloads/info.aspx?na=41&srcfamilyid=e5ad0459-cbcc-4b4f-97b6-fb17111cf544&srcdisplaylang=en&u=http%3a%2f%2fdownload.microsoft.com%2fdownload%2f5%2f6%2f2%2f562A10F9-C9F4-4313-A044-9C94E0A8FAC8%2fdotNetFx40_Client_x86_x64.exe"
- !define DOTNET35_URL "http://download.microsoft.com/download/2/0/e/20e90413-712f-438c-988e-fdaa79a8ac3d/dotnetfx35.exe"
- !define DOTNET30_URL "http://download.microsoft.com/download/2/0/e/20e90413-712f-438c-988e-fdaa79a8ac3d/dotnetfx35.exe"
- !define DOTNET20_URL "http://www.microsoft.com/downloads/info.aspx?na=41&srcfamilyid=0856eacb-4362-4b0d-8edd-aab15c5e04f5&srcdisplaylang=en&u=http%3a%2f%2fdownload.microsoft.com%2fdownload%2f5%2f6%2f7%2f567758a3-759e-473e-bf8f-52154438565a%2fdotnetfx.exe"
- !define DOTNET11_URL "http://www.microsoft.com/downloads/info.aspx?na=41&srcfamilyid=262d25e3-f589-4842-8157-034d1e7cf3a3&srcdisplaylang=en&u=http%3a%2f%2fdownload.microsoft.com%2fdownload%2fa%2fa%2fc%2faac39226-8825-44ce-90e3-bf8203e74006%2fdotnetfx.exe"
- !define DOTNET10_URL "http://www.microsoft.com/downloads/info.aspx?na=41&srcfamilyid=262d25e3-f589-4842-8157-034d1e7cf3a3&srcdisplaylang=en&u=http%3a%2f%2fdownload.microsoft.com%2fdownload%2fa%2fa%2fc%2faac39226-8825-44ce-90e3-bf8203e74006%2fdotnetfx.exe"
-
- ${If} ${FrameworkVersion} == "452"
- StrCpy $dotNetUrl ${DOTNET452_URL}
- StrCpy $dotNetReadableVersion "4.52"
+!include LogicLib.nsh
+!define LOCAL_DOTNET_INSTALLER_LOCATION $TEMP\dotnet.exe
+
+!macro CheckNetFramework FrameworkVersion ; This just takes the version, if the installer restarts in the middle it does.
+ !insertmacro CheckNetFrameworkWithRestartOptions ${FrameworkVersion} false $R0
+!macroend
+
+!macro CheckNetFrameworkDelayRestart FrameworkVersion ReturnDotNetInstalled ; This just takes the version, prevents a restart, and returns if an install happened to the caller can then handle a reboot later.
+ !insertmacro CheckNetFrameworkWithRestartOptions ${FrameworkVersion} true ${ReturnDotNetInstalled}
+!macroend
+
+!macro GetFrameworkUrlAndReadableVersions FrameworkVersion FrameworkUrl FrameworkReadableVersion
+ !ifndef DOTNET48_URL
+ !define DOTNET48_URL "https://go.microsoft.com/fwlink/?LinkId=2088631"
+ !define DOTNET472_URL "https://go.microsoft.com/fwlink/?LinkId=863265"
+ !define DOTNET471_URL "https://go.microsoft.com/fwlink/?LinkId=852104"
+ !define DOTNET47_URL "https://go.microsoft.com/fwlink/?LinkId=825302"
+ !define DOTNET462_URL "https://go.microsoft.com/fwlink/?LinkId=780600"
+ !define DOTNET461_URL "https://go.microsoft.com/fwlink/?LinkId=671743"
+ !define DOTNET46_URL "https://go.microsoft.com/fwlink/?LinkId=528232"
+ !define DOTNET452_URL "https://go.microsoft.com/fwlink/?LinkId=397708"
+ !define DOTNET451_URL "https://go.microsoft.com/fwlink/?LinkId=322116"
+ !define DOTNET45_URL "https://go.microsoft.com/fwlink/?LinkId=225702"
+ !define DOTNET40Full_URL "https://www.microsoft.com/downloads/info.aspx?na=41&srcfamilyid=0a391abd-25c1-4fc0-919f-b21f31ab88b7&srcdisplaylang=en&u=http%3a%2f%2fdownload.microsoft.com%2fdownload%2f9%2f5%2fA%2f95A9616B-7A37-4AF6-BC36-D6EA96C8DAAE%2fdotNetFx40_Full_x86_x64.exe"
+ !define DOTNET40Client_URL "https://www.microsoft.com/downloads/info.aspx?na=41&srcfamilyid=e5ad0459-cbcc-4b4f-97b6-fb17111cf544&srcdisplaylang=en&u=http%3a%2f%2fdownload.microsoft.com%2fdownload%2f5%2f6%2f2%2f562A10F9-C9F4-4313-A044-9C94E0A8FAC8%2fdotNetFx40_Client_x86_x64.exe"
+ !define DOTNET35_URL "https://download.microsoft.com/download/2/0/e/20e90413-712f-438c-988e-fdaa79a8ac3d/dotnetfx35.exe"
+ !define DOTNET30_URL "https://download.microsoft.com/download/2/0/e/20e90413-712f-438c-988e-fdaa79a8ac3d/dotnetfx35.exe"
+ !define DOTNET20_URL "https://www.microsoft.com/downloads/info.aspx?na=41&srcfamilyid=0856eacb-4362-4b0d-8edd-aab15c5e04f5&srcdisplaylang=en&u=http%3a%2f%2fdownload.microsoft.com%2fdownload%2f5%2f6%2f7%2f567758a3-759e-473e-bf8f-52154438565a%2fdotnetfx.exe"
+ !define DOTNET11_URL "https://www.microsoft.com/downloads/info.aspx?na=41&srcfamilyid=262d25e3-f589-4842-8157-034d1e7cf3a3&srcdisplaylang=en&u=http%3a%2f%2fdownload.microsoft.com%2fdownload%2fa%2fa%2fc%2faac39226-8825-44ce-90e3-bf8203e74006%2fdotnetfx.exe"
+ !define DOTNET10_URL "https://www.microsoft.com/downloads/info.aspx?na=41&srcfamilyid=262d25e3-f589-4842-8157-034d1e7cf3a3&srcdisplaylang=en&u=http%3a%2f%2fdownload.microsoft.com%2fdownload%2fa%2fa%2fc%2faac39226-8825-44ce-90e3-bf8203e74006%2fdotnetfx.exe"
+ !endif
+
+ ${If} ${FrameworkVersion} == "48"
+ StrCpy ${FrameworkUrl} ${DOTNET48_URL}
+ StrCpy ${FrameworkReadableVersion} "4.8"
+ ${ElseIf} ${FrameworkVersion} == "472"
+ StrCpy ${FrameworkUrl} ${DOTNET472_URL}
+ StrCpy ${FrameworkReadableVersion} "4.7.2"
+ ${ElseIf} ${FrameworkVersion} == "471"
+ StrCpy ${FrameworkUrl} ${DOTNET471_URL}
+ StrCpy ${FrameworkReadableVersion} "4.7.1"
+ ${ElseIf} ${FrameworkVersion} == "47"
+ StrCpy ${FrameworkUrl} ${DOTNET47_URL}
+ StrCpy ${FrameworkReadableVersion} "4.7"
+ ${ElseIf} ${FrameworkVersion} == "462"
+ StrCpy ${FrameworkUrl} ${DOTNET462_URL}
+ StrCpy ${FrameworkReadableVersion} "4.6.2"
+ ${ElseIf} ${FrameworkVersion} == "461"
+ StrCpy ${FrameworkUrl} ${DOTNET461_URL}
+ StrCpy ${FrameworkReadableVersion} "4.6.1"
+ ${ElseIf} ${FrameworkVersion} == "46"
+ StrCpy ${FrameworkUrl} ${DOTNET46_URL}
+ StrCpy ${FrameworkReadableVersion} "4.6"
+ ${ElseIf} ${FrameworkVersion} == "452"
+ StrCpy ${FrameworkUrl} ${DOTNET452_URL}
+ StrCpy ${FrameworkReadableVersion} "4.52"
${ElseIf} ${FrameworkVersion} == "451"
- StrCpy $dotNetUrl ${DOTNET451_URL}
- StrCpy $dotNetReadableVersion "4.51"
+ StrCpy ${FrameworkUrl} ${DOTNET451_URL}
+ StrCpy ${FrameworkReadableVersion} "4.51"
${ElseIf} ${FrameworkVersion} == "45"
- StrCpy $dotNetUrl ${DOTNET45_URL}
- StrCpy $dotNetReadableVersion "4.5"
+ StrCpy ${FrameworkUrl} ${DOTNET45_URL}
+ StrCpy ${FrameworkReadableVersion} "4.5"
${ElseIf} ${FrameworkVersion} == "40Full"
- StrCpy $dotNetUrl ${DOTNET40Full_URL}
- StrCpy $dotNetReadableVersion "4.0 Full"
+ StrCpy ${FrameworkUrl} ${DOTNET40Full_URL}
+ StrCpy ${FrameworkReadableVersion} "4.0 Full"
${ElseIf} ${FrameworkVersion} == "40Client"
- StrCpy $dotNetUrl ${DOTNET40Client_URL}
- StrCpy $dotNetReadableVersion "4.0 Client"
+ StrCpy ${FrameworkUrl} ${DOTNET40Client_URL}
+ StrCpy ${FrameworkReadableVersion} "4.0 Client"
${ElseIf} ${FrameworkVersion} == "35"
- StrCpy $dotNetUrl ${DOTNET35_URL}
- StrCpy $dotNetReadableVersion "3.5"
+ StrCpy ${FrameworkUrl} ${DOTNET35_URL}
+ StrCpy ${FrameworkReadableVersion} "3.5"
${ElseIf} ${FrameworkVersion} == "30"
- StrCpy $dotNetUrl ${DOTNET30_URL}
- StrCpy $dotNetReadableVersion "3.0"
+ StrCpy ${FrameworkUrl} ${DOTNET30_URL}
+ StrCpy ${FrameworkReadableVersion} "3.0"
${ElseIf} ${FrameworkVersion} == "20"
- StrCpy $dotNetUrl ${DOTNET20_URL}
- StrCpy $dotNetReadableVersion "2.0"
+ StrCpy ${FrameworkUrl} ${DOTNET20_URL}
+ StrCpy ${FrameworkReadableVersion} "2.0"
${ElseIf} ${FrameworkVersion} == "11"
- StrCpy $dotNetUrl ${DOTNET11_URL}
- StrCpy $dotNetReadableVersion "1.1"
+ StrCpy ${FrameworkUrl} ${DOTNET11_URL}
+ StrCpy ${FrameworkReadableVersion} "1.1"
${ElseIf} ${FrameworkVersion} == "10"
- StrCpy $dotNetUrl ${DOTNET10_URL}
- StrCpy $dotNetReadableVersion "1.0"
+ StrCpy ${FrameworkUrl} ${DOTNET10_URL}
+ StrCpy ${FrameworkReadableVersion} "1.0"
${EndIf}
-
+!macroend
+
+Var DidDotNetInstall
+Var dotNetUrl
+Var dotNetReadableVersion
+
+!macro CheckNetFrameworkWithRestartOptions FrameworkVersion DelayRestart ReturnDidDotNetInstall
+ !insertmacro GetFrameworkUrlAndReadableVersions ${FrameworkVersion} $dotNetUrl $dotNetReadableVersion
+
DetailPrint "Checking .NET Framework version..."
Push $0
@@ -56,59 +102,122 @@
Push $6
Push $7
+ StrCpy $DidDotNetInstall "false"
DotNetChecker::IsDotNet${FrameworkVersion}Installed
Pop $0
-
+
${If} $0 == "false"
+ ${OrIf} $0 == "f" ; if script is compiled in ANSI mode then we get only an "f" https://github.com/ReVolly/NsisDotNetChecker/issues/4
DetailPrint ".NET Framework $dotNetReadableVersion not found, download is required for program to run."
- Goto NoDotNET
+ Goto NoDotNET${FrameworkVersion}${DelayRestart}
${Else}
DetailPrint ".NET Framework $dotNetReadableVersion found, no need to install."
- Goto NewDotNET
+ Goto NewDotNET${FrameworkVersion}${DelayRestart}
${EndIf}
-NoDotNET:
+NoDotNET${FrameworkVersion}${DelayRestart}:
MessageBox MB_YESNOCANCEL|MB_ICONEXCLAMATION \
- ".NET Framework not installed. Required version: $dotNetReadableVersion.$\nDownload .NET Framework $dotNetReadableVersion from www.microsoft.com?" \
- /SD IDYES IDYES DownloadDotNET IDNO NewDotNET
- goto GiveUpDotNET ;IDCANCEL
+ ".NET Framework not installed. Required version: $dotNetReadableVersion.$\nDownload .NET Framework $dotNetReadableVersion from microsoft.com?" \
+ /SD IDYES IDYES DownloadDotNET${FrameworkVersion}${DelayRestart} IDNO NewDotNET${FrameworkVersion}${DelayRestart}
+ goto GiveUpDotNET${FrameworkVersion}${DelayRestart} ;IDCANCEL
+
+DownloadDotNET${FrameworkVersion}${DelayRestart}:
+ ; Load the stack with URL and Readable Version number
+ Push $dotNetUrl
+ Push $dotNetReadableVersion
+ Call DownloadDotNet
+ Pop $0
+ ${If} $0 == "halt"
+ Goto GiveUpDotNET${FrameworkVersion}${DelayRestart}
+ ${ElseIf} $0 == "success"
+ Push ${DelayRestart}
+ Call InstallDotNet
+ Pop $DidDotNetInstall
+ ${If} $DidDotNetInstall == "true"
+ Call CleanupDotNetInstaller
+ ${EndIf}
+ ${EndIf}
+ Goto NewDotNET${FrameworkVersion}${DelayRestart}
+
+GiveUpDotNET${FrameworkVersion}${DelayRestart}:
+ Abort "Installation canceled by user."
+
+NewDotNET${FrameworkVersion}${DelayRestart}:
+ DetailPrint "Proceeding with remainder of installation."
+ Pop $7
+ Pop $6
+ Pop $5
+ Pop $4
+ Pop $3
+ Pop $2
+ Pop $1
+ Pop $0
-DownloadDotNET:
- DetailPrint "Beginning download of .NET Framework $dotNetReadableVersion."
- NSISDL::download $dotNetUrl "$TEMP\dotnetfx.exe"
+ StrCpy ${ReturnDidDotNetInstall} $DidDotNetInstall
+!macroend
+
+; Expects the url followed by the readable version number to be pushed onto stack
+; Returns on the stack:
+; "success" == Downloaded file ready to install
+; "failed" == Download failed, but use would like to continue
+; "halt" == Download failed, and user doesn't want to continue.
+Function "DownloadDotNet"
+ Pop $1
+ Pop $0
+
+ DetailPrint "Beginning download of .NET Framework $1."
+ NSISDL::download $0 "${LOCAL_DOTNET_INSTALLER_LOCATION}"
DetailPrint "Completed download."
Pop $0
${If} $0 == "cancel"
+ Push false
MessageBox MB_YESNO|MB_ICONEXCLAMATION \
- "Download cancelled. Continue Installation?" \
- IDYES NewDotNET IDNO GiveUpDotNET
+ "Download canceled. Continue Installation?" \
+ IDYES Continue IDNO Halt
${ElseIf} $0 != "success"
+ Push false
MessageBox MB_YESNO|MB_ICONEXCLAMATION \
"Download failed:$\n$0$\n$\nContinue Installation?" \
- IDYES NewDotNET IDNO GiveUpDotNET
+ IDYES Continue IDNO Halt
+ ${Else}
+ Push "success"
+ Goto End
${EndIf}
- DetailPrint "Pausing installation while downloaded .NET Framework installer runs."
- ExecWait '$TEMP\dotnetfx.exe /q /c:"install /q"'
+Continue:
+ Push "failed"
+ Goto End
- DetailPrint "Completed .NET Framework install/update. Removing .NET Framework installer."
- Delete "$TEMP\dotnetfx.exe"
- DetailPrint ".NET Framework installer removed."
- goto NewDotNet
+Halt:
+ Push "halt"
-GiveUpDotNET:
- Abort "Installation cancelled by user."
+End:
+FunctionEnd
-NewDotNET:
- DetailPrint "Proceeding with remainder of installation."
+; Expects if we are delaying the restart
+; Returns on the stack:
+; "true" == Installer ran
+; "false" == Currently no path where this happens.
+Function "InstallDotNet"
Pop $0
- Pop $1
- Pop $2
- Pop $3
- Pop $4
- Pop $5
- Pop $6
- Pop $7
+ DetailPrint "Pausing installation while downloaded .NET Framework installer runs."
+ ${If} $0 == "true"
+ StrCpy $1 "/norestart"
+ ${Else}
+ StrCpy $1 ""
+ ${EndIf}
+
+ ExecWait '${LOCAL_DOTNET_INSTALLER_LOCATION} /q $1 /c:"install /q"'
+ Push "true"
+FunctionEnd
-!macroend
\ No newline at end of file
+; Expects if we are delaying the restart
+; Returns on the stack:
+; "true" == Installer ran
+; "false" == Currently no path where this happens.
+Function "CleanupDotNetInstaller"
+ DetailPrint "Completed .NET Framework install/update. Removing .NET Framework installer."
+ Delete "${LOCAL_DOTNET_INSTALLER_LOCATION}"
+ DetailPrint ".NET Framework installer removed."
+FunctionEnd
\ No newline at end of file
diff --git a/Deploy/SPEdit.nsi b/Deploy/SPCode.nsi
similarity index 79%
rename from Deploy/SPEdit.nsi
rename to Deploy/SPCode.nsi
index 62167ba4..95ff320d 100644
--- a/Deploy/SPEdit.nsi
+++ b/Deploy/SPCode.nsi
@@ -3,10 +3,10 @@
!include "FileAssociation.nsh"
!addplugindir .\nsis-plugins
-Name "SPEdit"
-OutFile "SPEdit.Installer.exe"
+Name "SPCode"
+OutFile "SPCode.Installer.exe"
-InstallDir $APPDATA\spedit
+InstallDir $APPDATA\spcode
RequestExecutionLevel admin
@@ -35,10 +35,10 @@ Section "Program" prog01
SectionIn 1 RO
SetOutPath $INSTDIR
-!insertmacro CheckNetFramework 45
+!insertmacro CheckNetFramework 48
-File Spedit.exe
+File Spcode.exe
File MahApps.Metro.dll
File ICSharpCode.AvalonEdit.dll
File System.Windows.Interactivity.dll
@@ -53,8 +53,9 @@ File Renci.SshNet.dll
File Newtonsoft.Json.dll
File DiscordRPC.dll
File ControlzEx.dll
+File Octokit.dll
-File lang_0_spedit.xml
+File lang_0_spcode.xml
File GPLv3.txt
IfFileExists $INSTDIR\options_0.dat OptionsExist OptionsDoesNotExist
@@ -71,14 +72,14 @@ CreateDirectory "$INSTDIR\sourcepawn\configs"
CreateDirectory "$INSTDIR\sourcepawn\configs\sm_1_10_0_6478"
File /r ".\sourcepawn"
-WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\spedit" "DisplayName" "SPEdit - A lightweight sourcepawn editor"
-WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\spedit" "UninstallString" "$INSTDIR\uninstall.exe"
-WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\spedit" "InstallLocation" "$INSTDIR"
-WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\spedit" "DisplayIcon" "$INSTDIR\Spedit.exe"
-WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\spedit" "Publisher" "Hexah"
-WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\spedit" "DisplayVersion" "1.3.4.6"
-WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\spedit" "NoModify" 1
-WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\spedit" "NoRepair" 1
+WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\spcode" "DisplayName" "SPCode - A lightweight sourcepawn editor"
+WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\spcode" "UninstallString" "$INSTDIR\uninstall.exe"
+WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\spcode" "InstallLocation" "$INSTDIR"
+WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\spcode" "DisplayIcon" "$INSTDIR\Spcode.exe"
+WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\spcode" "Publisher" "Hexah"
+WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\spcode" "DisplayVersion" "1.4.x.x"
+WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\spcode" "NoModify" 1
+WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\spcode" "NoRepair" 1
WriteUninstaller $INSTDIR\uninstall.exe
SectionEnd
@@ -87,33 +88,33 @@ SectionEnd
Section "File Association (.sp)" prog02
SectionIn 1
-${registerExtension} "$INSTDIR\Spedit.exe" ".sp" "Sourcepawn Script"
+${registerExtension} "$INSTDIR\Spcode.exe" ".sp" "Sourcepawn Script"
System::Call 'Shell32::SHChangeNotify(i ${SHCNE_ASSOCCHANGED}, i ${SHCNF_IDLIST}, i 0, i 0)'
SectionEnd
Section "File Association (.inc)" prog03
SectionIn 1
-${registerExtension} "$INSTDIR\Spedit.exe" ".inc" "Sourcepawn Include-File"
+${registerExtension} "$INSTDIR\Spcode.exe" ".inc" "Sourcepawn Include-File"
System::Call 'Shell32::SHChangeNotify(i ${SHCNE_ASSOCCHANGED}, i ${SHCNF_IDLIST}, i 0, i 0)'
SectionEnd
Section "File Association (.smx)" prog04
SectionIn 1
-${registerExtension} "$INSTDIR\Spedit.exe" ".smx" "Sourcemod Plugin"
+${registerExtension} "$INSTDIR\Spcode.exe" ".smx" "Sourcemod Plugin"
System::Call 'Shell32::SHChangeNotify(i ${SHCNE_ASSOCCHANGED}, i ${SHCNF_IDLIST}, i 0, i 0)'
SectionEnd
Section "Desktop Shortcut" prog05
SectionIn 1
-CreateShortCut "$DESKTOP\SPEdit.lnk" "$INSTDIR\Spedit.exe" ""
+CreateShortCut "$DESKTOP\SPCode.lnk" "$INSTDIR\Spcode.exe" ""
SectionEnd
Section "Startmenu Shortcut" prog06
SectionIn 1
-CreateShortCut "$SMPROGRAMS\SPEdit.lnk" "$INSTDIR\Spedit.exe" ""
+CreateShortCut "$SMPROGRAMS\SPCode.lnk" "$INSTDIR\Spcode.exe" ""
SectionEnd
Section "Uninstall"
@@ -122,7 +123,7 @@ Delete $INSTDIR\uninstall.exe
-Delete $INSTDIR\Spedit.exe
+Delete $INSTDIR\Spcode.exe
Delete $INSTDIR\MahApps.Metro.dll
Delete $INSTDIR\ICSharpCode.AvalonEdit.dll
Delete $INSTDIR\System.Windows.Interactivity.dll
@@ -138,17 +139,17 @@ Delete $INSTDIR\Newtonsoft.Json.dll
Delete $INSTDIR\DiscordRPC.dll
-Delete $INSTDIR\lang_0_spedit.xml
+Delete $INSTDIR\lang_0_spcode.xml
Delete $INSTDIR\GPLv3.txt
Delete $INSTDIR\*.dat
RMDir /r $INSTDIR\sourcepawn
RMDir $INSTDIR
-Delete "$DESKTOP\SPEdit.lnk"
-Delete "$SMPROGRAMS\SPEdit.lnk"
+Delete "$DESKTOP\SPCode.lnk"
+Delete "$SMPROGRAMS\SPCode.lnk"
-DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\spedit"
+DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\spcode"
${unregisterExtension} ".sp" "Sourcepawn Script"
${unregisterExtension} ".inc" "Sourcepawn Include-File"
diff --git a/Deploy/SpeditUpdater/App.config b/Deploy/SpcodeUpdater/App.config
similarity index 92%
rename from Deploy/SpeditUpdater/App.config
rename to Deploy/SpcodeUpdater/App.config
index 8e156463..193aecc6 100644
--- a/Deploy/SpeditUpdater/App.config
+++ b/Deploy/SpcodeUpdater/App.config
@@ -1,6 +1,6 @@
-
+
\ No newline at end of file
diff --git a/Deploy/SpeditUpdater/Icon.ico b/Deploy/SpcodeUpdater/Icon.ico
similarity index 100%
rename from Deploy/SpeditUpdater/Icon.ico
rename to Deploy/SpcodeUpdater/Icon.ico
diff --git a/Deploy/SpcodeUpdater/Program.cs b/Deploy/SpcodeUpdater/Program.cs
new file mode 100644
index 00000000..c738bb90
--- /dev/null
+++ b/Deploy/SpcodeUpdater/Program.cs
@@ -0,0 +1,65 @@
+using System;
+using System.Diagnostics;
+using System.IO;
+using System.IO.Compression;
+using System.Linq;
+using System.Threading;
+using System.Windows.Forms;
+using SpcodeUpdater.Properties;
+
+namespace SpcodeUpdater
+{
+ public static class Program
+ {
+ public delegate void InvokeDel();
+
+ [STAThread]
+ public static void Main()
+ {
+ var processes = Process.GetProcessesByName("Spcode");
+ foreach (var process in processes)
+ try
+ {
+ process.WaitForExit();
+ }
+ catch (Exception)
+ {
+ // ignored
+ }
+
+
+ Application.EnableVisualStyles();
+ Thread.Sleep(2000);
+ Application.SetCompatibleTextRenderingDefault(true);
+ var um = new UpdateMarquee();
+ um.Show();
+ Application.DoEvents(); //execute Visual
+ var t = new Thread(Worker);
+ t.Start(um);
+ Application.Run(um);
+ }
+
+ private static void Worker(object arg)
+ {
+ var um = (UpdateMarquee) arg;
+ var zipFile = Path.Combine(Environment.CurrentDirectory, "updateZipFile.zip");
+
+ var zipFileContent = Resources.Update;
+
+ File.WriteAllBytes(zipFile, zipFileContent);
+
+ var zipInfo = new FileInfo(zipFile);
+
+ using (var archive = ZipFile.OpenRead(zipInfo.FullName))
+ {
+ // Dont override the sourcemod files
+ var files = archive.Entries.Where(e => !e.FullName.StartsWith(@"sourcepawn\"));
+ foreach (var file in files) file.ExtractToFile(file.FullName, true);
+ }
+
+ zipInfo.Delete();
+
+ um.Invoke((InvokeDel) (() => { um.SetToReadyState(); }));
+ }
+ }
+}
\ No newline at end of file
diff --git a/Deploy/SpeditUpdater/Properties/Resources.Designer.cs b/Deploy/SpcodeUpdater/Properties/Resources.Designer.cs
similarity index 91%
rename from Deploy/SpeditUpdater/Properties/Resources.Designer.cs
rename to Deploy/SpcodeUpdater/Properties/Resources.Designer.cs
index f5f9ce6d..d9c4e75d 100644
--- a/Deploy/SpeditUpdater/Properties/Resources.Designer.cs
+++ b/Deploy/SpcodeUpdater/Properties/Resources.Designer.cs
@@ -8,7 +8,7 @@
//
//------------------------------------------------------------------------------
-namespace SpeditUpdater.Properties {
+namespace SpcodeUpdater.Properties {
using System;
@@ -19,7 +19,7 @@ namespace SpeditUpdater.Properties {
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
@@ -39,7 +39,7 @@ internal Resources() {
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
- global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("SpeditUpdater.Properties.Resources", typeof(Resources).Assembly);
+ global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("SpcodeUpdater.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
@@ -73,9 +73,9 @@ internal static System.Drawing.Bitmap IconPng {
///
/// Looks up a localized resource of type System.Byte[].
///
- internal static byte[] spedit1_2_0_3Update {
+ internal static byte[] Update {
get {
- object obj = ResourceManager.GetObject("spedit1_2_0_3Update", resourceCulture);
+ object obj = ResourceManager.GetObject("Update", resourceCulture);
return ((byte[])(obj));
}
}
diff --git a/Deploy/SpeditUpdater/Properties/Resources.resx b/Deploy/SpcodeUpdater/Properties/Resources.resx
similarity index 96%
rename from Deploy/SpeditUpdater/Properties/Resources.resx
rename to Deploy/SpcodeUpdater/Properties/Resources.resx
index 384952ab..560d64b8 100644
--- a/Deploy/SpeditUpdater/Properties/Resources.resx
+++ b/Deploy/SpcodeUpdater/Properties/Resources.resx
@@ -121,7 +121,7 @@
..\Res\IconPng.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
- ..\Res\spedit1.2.0.3Update.zip;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+ ..\..\..\bin\Release\SPCode.Portable.zip;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
\ No newline at end of file
diff --git a/Deploy/SpeditUpdater/Res/Icon.ico b/Deploy/SpcodeUpdater/Res/Icon.ico
similarity index 100%
rename from Deploy/SpeditUpdater/Res/Icon.ico
rename to Deploy/SpcodeUpdater/Res/Icon.ico
diff --git a/Deploy/SpeditUpdater/Res/IconPng.png b/Deploy/SpcodeUpdater/Res/IconPng.png
similarity index 100%
rename from Deploy/SpeditUpdater/Res/IconPng.png
rename to Deploy/SpcodeUpdater/Res/IconPng.png
diff --git a/Deploy/SpeditUpdater/Resources/iconRes.bmp b/Deploy/SpcodeUpdater/Resources/iconRes.bmp
similarity index 100%
rename from Deploy/SpeditUpdater/Resources/iconRes.bmp
rename to Deploy/SpcodeUpdater/Resources/iconRes.bmp
diff --git a/Deploy/SpeditUpdater/SpeditUpdater.csproj b/Deploy/SpcodeUpdater/SpcodeUpdater.csproj
similarity index 83%
rename from Deploy/SpeditUpdater/SpeditUpdater.csproj
rename to Deploy/SpcodeUpdater/SpcodeUpdater.csproj
index c305b39d..8d82a5c9 100644
--- a/Deploy/SpeditUpdater/SpeditUpdater.csproj
+++ b/Deploy/SpcodeUpdater/SpcodeUpdater.csproj
@@ -7,9 +7,9 @@
{402651FB-269B-4858-8D2A-6DF7E0B9A36E}
WinExe
Properties
- SpeditUpdater
- SpeditUpdater
- v4.5
+ SpcodeUpdater
+ SpcodeUpdater
+ v4.8
512
@@ -39,19 +39,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -96,6 +83,7 @@
ResXFileCodeGenerator
Resources.Designer.cs
+ Designer
UpdateMarquee.cs
diff --git a/Deploy/SpeditUpdater/SpeditUpdater.sln b/Deploy/SpcodeUpdater/SpeditUpdater.sln
similarity index 100%
rename from Deploy/SpeditUpdater/SpeditUpdater.sln
rename to Deploy/SpcodeUpdater/SpeditUpdater.sln
diff --git a/Deploy/SpeditUpdater/UpdateMarquee.Designer.cs b/Deploy/SpcodeUpdater/UpdateMarquee.Designer.cs
similarity index 99%
rename from Deploy/SpeditUpdater/UpdateMarquee.Designer.cs
rename to Deploy/SpcodeUpdater/UpdateMarquee.Designer.cs
index 608394f2..7d860776 100644
--- a/Deploy/SpeditUpdater/UpdateMarquee.Designer.cs
+++ b/Deploy/SpcodeUpdater/UpdateMarquee.Designer.cs
@@ -1,4 +1,4 @@
-namespace SpeditUpdater
+namespace SpcodeUpdater
{
partial class UpdateMarquee
{
diff --git a/Deploy/SpeditUpdater/UpdateMarquee.af-ZA.resx b/Deploy/SpcodeUpdater/UpdateMarquee.af-ZA.resx
similarity index 100%
rename from Deploy/SpeditUpdater/UpdateMarquee.af-ZA.resx
rename to Deploy/SpcodeUpdater/UpdateMarquee.af-ZA.resx
diff --git a/Deploy/SpcodeUpdater/UpdateMarquee.cs b/Deploy/SpcodeUpdater/UpdateMarquee.cs
new file mode 100644
index 00000000..fa3230e0
--- /dev/null
+++ b/Deploy/SpcodeUpdater/UpdateMarquee.cs
@@ -0,0 +1,29 @@
+using System;
+using System.Windows.Forms;
+using SpcodeUpdater.Properties;
+
+namespace SpcodeUpdater
+{
+ public partial class UpdateMarquee : Form
+ {
+ public UpdateMarquee()
+ {
+ InitializeComponent();
+ var bmp = Resources.IconPng;
+ pictureBox1.Image = bmp;
+ }
+
+ public void SetToReadyState()
+ {
+ label1.Text = "SPCode got updated!";
+ progressBar1.Visible = false;
+ button1.Visible = true;
+ UseWaitCursor = false;
+ }
+
+ private void button1_Click(object sender, EventArgs e)
+ {
+ Close();
+ }
+ }
+}
\ No newline at end of file
diff --git a/Deploy/SpeditUpdater/UpdateMarquee.resx b/Deploy/SpcodeUpdater/UpdateMarquee.resx
similarity index 99%
rename from Deploy/SpeditUpdater/UpdateMarquee.resx
rename to Deploy/SpcodeUpdater/UpdateMarquee.resx
index 84bb44be..30a495e3 100644
--- a/Deploy/SpeditUpdater/UpdateMarquee.resx
+++ b/Deploy/SpcodeUpdater/UpdateMarquee.resx
@@ -123,13 +123,13 @@
- 84, 42
+ 76, 34
- 4, 6, 4, 6
+ 4, 5, 4, 5
- 269, 44
+ 242, 35
@@ -154,19 +154,19 @@
NoControl
- 84, 0
+ 76, 0
4, 0, 4, 0
- 125, 25
+ 115, 20
2
- SPEdit Update
+ SPCode Update
label1
@@ -187,10 +187,10 @@
0, 0
- 4, 6, 4, 6
+ 4, 5, 4, 5
- 76, 86
+ 68, 69
StretchImage
@@ -211,13 +211,13 @@
3
- 363, 42
+ 327, 34
- 4, 6, 4, 6
+ 4, 5, 4, 5
- 124, 44
+ 112, 35
3
@@ -244,10 +244,10 @@
True
- 10, 25
+ 9, 20
- 500, 86
+ 450, 69
@@ -1957,13 +1957,13 @@
- 4, 6, 4, 6
+ 4, 5, 4, 5
CenterScreen
- SPEdit Update
+ SPCode Update
UpdateMarquee
diff --git a/Deploy/SpeditUpdater/Program.cs b/Deploy/SpeditUpdater/Program.cs
deleted file mode 100644
index d153d87b..00000000
--- a/Deploy/SpeditUpdater/Program.cs
+++ /dev/null
@@ -1,79 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.Threading;
-using System.Diagnostics;
-using System.Windows;
-using System.Windows.Forms;
-using System.IO;
-using System.IO.Compression;
-
-namespace SpeditUpdater
-{
- public static class Program
- {
- [STAThread]
- public static void Main()
- {
- Process[] p = Process.GetProcessesByName("Spedit.exe");
- if (p.Length > 0)
- {
- for (int i = 0; i < p.Length; ++i)
- {
- try
- {
- p[i].WaitForExit();
- }
- catch (Exception) { }
- }
- }
- Application.EnableVisualStyles();
- Application.SetCompatibleTextRenderingDefault(true);
- UpdateMarquee um = new UpdateMarquee();
- um.Show();
- Application.DoEvents(); //execute Visual
- Thread t = new Thread(new ParameterizedThreadStart(Worker));
- t.Start(um);
- Application.Run(um);
- }
-
- private static void Worker(object arg)
- {
- UpdateMarquee um = (UpdateMarquee)arg;
- string zipFile = Path.Combine(Environment.CurrentDirectory, "updateZipFile.zip");
-
- byte[] zipFileContent = SpeditUpdater.Properties.Resources.spedit1_2_0_3Update;
-
- File.WriteAllBytes(zipFile, zipFileContent);
-
- FileInfo zipInfo = new FileInfo(zipFile);
-
- string extractPath = Environment.CurrentDirectory;
- using (ZipArchive archieve = ZipFile.OpenRead(zipInfo.FullName))
- {
- var entries = archieve.Entries;
- foreach (var entry in entries)
- {
- string full = Path.Combine(extractPath, entry.FullName);
- FileInfo fInfo = new FileInfo(full);
- if (!Directory.Exists(fInfo.DirectoryName))
- {
- Directory.CreateDirectory(fInfo.DirectoryName);
- }
- entry.ExtractToFile(fInfo.FullName, true);
- }
- }
-
- zipInfo.Delete();
-
- um.Invoke((InvokeDel)(() =>
- {
- um.SetToReadyState();
- }));
- }
-
- public delegate void InvokeDel();
- }
-}
diff --git a/Deploy/SpeditUpdater/Res/spedit1.0.1.0Update.zip b/Deploy/SpeditUpdater/Res/spedit1.0.1.0Update.zip
deleted file mode 100644
index 71b50dd5..00000000
Binary files a/Deploy/SpeditUpdater/Res/spedit1.0.1.0Update.zip and /dev/null differ
diff --git a/Deploy/SpeditUpdater/Res/spedit1.0.2.0Update.zip b/Deploy/SpeditUpdater/Res/spedit1.0.2.0Update.zip
deleted file mode 100644
index fe162486..00000000
Binary files a/Deploy/SpeditUpdater/Res/spedit1.0.2.0Update.zip and /dev/null differ
diff --git a/Deploy/SpeditUpdater/Res/spedit1.0.3.0Update.zip b/Deploy/SpeditUpdater/Res/spedit1.0.3.0Update.zip
deleted file mode 100644
index 02ea5810..00000000
Binary files a/Deploy/SpeditUpdater/Res/spedit1.0.3.0Update.zip and /dev/null differ
diff --git a/Deploy/SpeditUpdater/Res/spedit1.0.3.1Update.zip b/Deploy/SpeditUpdater/Res/spedit1.0.3.1Update.zip
deleted file mode 100644
index 355ec432..00000000
Binary files a/Deploy/SpeditUpdater/Res/spedit1.0.3.1Update.zip and /dev/null differ
diff --git a/Deploy/SpeditUpdater/Res/spedit1.0.3.2Update.zip b/Deploy/SpeditUpdater/Res/spedit1.0.3.2Update.zip
deleted file mode 100644
index c912ea22..00000000
Binary files a/Deploy/SpeditUpdater/Res/spedit1.0.3.2Update.zip and /dev/null differ
diff --git a/Deploy/SpeditUpdater/Res/spedit1.1.0.0Update.zip b/Deploy/SpeditUpdater/Res/spedit1.1.0.0Update.zip
deleted file mode 100644
index 68477785..00000000
Binary files a/Deploy/SpeditUpdater/Res/spedit1.1.0.0Update.zip and /dev/null differ
diff --git a/Deploy/SpeditUpdater/Res/spedit1.1.1.0Update.zip b/Deploy/SpeditUpdater/Res/spedit1.1.1.0Update.zip
deleted file mode 100644
index 4635513e..00000000
Binary files a/Deploy/SpeditUpdater/Res/spedit1.1.1.0Update.zip and /dev/null differ
diff --git a/Deploy/SpeditUpdater/Res/spedit1.1.2.0Update.zip b/Deploy/SpeditUpdater/Res/spedit1.1.2.0Update.zip
deleted file mode 100644
index ce19847d..00000000
Binary files a/Deploy/SpeditUpdater/Res/spedit1.1.2.0Update.zip and /dev/null differ
diff --git a/Deploy/SpeditUpdater/Res/spedit1.1.3.0Update.zip b/Deploy/SpeditUpdater/Res/spedit1.1.3.0Update.zip
deleted file mode 100644
index b9808686..00000000
Binary files a/Deploy/SpeditUpdater/Res/spedit1.1.3.0Update.zip and /dev/null differ
diff --git a/Deploy/SpeditUpdater/Res/spedit1.2.0.0Update.zip b/Deploy/SpeditUpdater/Res/spedit1.2.0.0Update.zip
deleted file mode 100644
index e1bf399d..00000000
Binary files a/Deploy/SpeditUpdater/Res/spedit1.2.0.0Update.zip and /dev/null differ
diff --git a/Deploy/SpeditUpdater/Res/spedit1.2.0.1Update.zip b/Deploy/SpeditUpdater/Res/spedit1.2.0.1Update.zip
deleted file mode 100644
index 528f889c..00000000
Binary files a/Deploy/SpeditUpdater/Res/spedit1.2.0.1Update.zip and /dev/null differ
diff --git a/Deploy/SpeditUpdater/Res/spedit1.2.0.2Update.zip b/Deploy/SpeditUpdater/Res/spedit1.2.0.2Update.zip
deleted file mode 100644
index 087093ec..00000000
Binary files a/Deploy/SpeditUpdater/Res/spedit1.2.0.2Update.zip and /dev/null differ
diff --git a/Deploy/SpeditUpdater/Res/spedit1.2.0.3Update.zip b/Deploy/SpeditUpdater/Res/spedit1.2.0.3Update.zip
deleted file mode 100644
index c82a661d..00000000
Binary files a/Deploy/SpeditUpdater/Res/spedit1.2.0.3Update.zip and /dev/null differ
diff --git a/Deploy/SpeditUpdater/UpdateMarquee.cs b/Deploy/SpeditUpdater/UpdateMarquee.cs
deleted file mode 100644
index beb160e6..00000000
--- a/Deploy/SpeditUpdater/UpdateMarquee.cs
+++ /dev/null
@@ -1,35 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Data;
-using System.Drawing;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.Windows.Forms;
-
-namespace SpeditUpdater
-{
- public partial class UpdateMarquee : Form
- {
- public UpdateMarquee()
- {
- InitializeComponent();
- Bitmap bmp = SpeditUpdater.Properties.Resources.IconPng;
- pictureBox1.Image = (Image)bmp;
- }
-
- public void SetToReadyState()
- {
- label1.Text = "SPEdit got updated!";
- progressBar1.Visible = false;
- button1.Visible = true;
- this.UseWaitCursor = false;
- }
-
- private void button1_Click(object sender, EventArgs e)
- {
- this.Close();
- }
- }
-}
diff --git a/Deploy/nsis-plugins/DotNetChecker.dll b/Deploy/nsis-plugins/DotNetChecker.dll
index 8a5afc96..8abb548e 100644
Binary files a/Deploy/nsis-plugins/DotNetChecker.dll and b/Deploy/nsis-plugins/DotNetChecker.dll differ
diff --git a/Interop/ConfigControl.cs b/Interop/ConfigControl.cs
index b9b0361d..8474d911 100644
--- a/Interop/ConfigControl.cs
+++ b/Interop/ConfigControl.cs
@@ -5,9 +5,9 @@
using System.Windows;
using System.Xml;
using SourcepawnCondenser.SourcemodDefinition;
-using Spedit.Utils;
+using Spcode.Utils;
-namespace Spedit.Interop
+namespace Spcode.Interop
{
public static class ConfigLoader
{
diff --git a/Interop/OptionsControl.cs b/Interop/OptionsControl.cs
index 64aef9aa..78605f77 100644
--- a/Interop/OptionsControl.cs
+++ b/Interop/OptionsControl.cs
@@ -4,7 +4,7 @@
using System.Security.Cryptography;
using System.Windows.Media;
-namespace Spedit //leave this here instead of .Interop because of reasons...
+namespace Spcode //leave this here instead of .Interop because of reasons...
{
[Serializable]
public class OptionsControl
diff --git a/Interop/PipeInteropClient.cs b/Interop/PipeInteropClient.cs
index fc103f29..656af9ef 100644
--- a/Interop/PipeInteropClient.cs
+++ b/Interop/PipeInteropClient.cs
@@ -3,7 +3,7 @@
using System.IO.Pipes;
using System.Text;
-namespace Spedit.Interop
+namespace Spcode.Interop
{
public static class PipeInteropClient
{
@@ -18,7 +18,7 @@ public static void ConnectToMasterPipeAndSendData(string data)
stream.Write(stringLengthData, 0, stringLengthData.Length);
stream.Write(stringData, 0, stringData.Length);
}
- using (NamedPipeClientStream pipeClient = new NamedPipeClientStream(".", "SpeditNamedPipeServer", PipeDirection.Out, PipeOptions.Asynchronous))
+ using (NamedPipeClientStream pipeClient = new NamedPipeClientStream(".", "SpcodeNamedPipeServer", PipeDirection.Out, PipeOptions.Asynchronous))
{
pipeClient.Connect(5000);
pipeClient.Write(array, 0, array.Length);
diff --git a/Interop/PipeInteropServer.cs b/Interop/PipeInteropServer.cs
index 13dc389d..0e0b931d 100644
--- a/Interop/PipeInteropServer.cs
+++ b/Interop/PipeInteropServer.cs
@@ -1,9 +1,9 @@
-using Spedit.UI;
+using Spcode.UI;
using System;
using System.IO.Pipes;
using System.Text;
-namespace Spedit.Interop
+namespace Spcode.Interop
{
public class PipeInteropServer : IDisposable
{
@@ -37,7 +37,7 @@ private void StartInteropServer()
pipeServer.Close();
pipeServer = null;
}
- pipeServer = new NamedPipeServerStream("SpeditNamedPipeServer", PipeDirection.In, 1, PipeTransmissionMode.Byte, PipeOptions.Asynchronous);
+ pipeServer = new NamedPipeServerStream("SpcodeNamedPipeServer", PipeDirection.In, 1, PipeTransmissionMode.Byte, PipeOptions.Asynchronous);
pipeServer.BeginWaitForConnection(new AsyncCallback(PipeConnection_MessageIn), null);
}
diff --git a/Interop/TranslationProvider.cs b/Interop/TranslationProvider.cs
index 34b40e29..b61bc18b 100644
--- a/Interop/TranslationProvider.cs
+++ b/Interop/TranslationProvider.cs
@@ -8,7 +8,7 @@
using System.Xml;
using System.Windows;
-namespace Spedit.Interop
+namespace Spcode.Interop
{
public class TranslationProvider
{
@@ -42,12 +42,12 @@ public void LoadLanguage(string lang, bool Initial = false)
languageIDList.Add("");
lang = lang.Trim().ToLowerInvariant();
IsDefault = (string.IsNullOrEmpty(lang) || lang.ToLowerInvariant() == "en") && Initial;
- if (File.Exists("lang_0_spedit.xml"))
+ if (File.Exists("lang_0_spcode.xml"))
{
try
{
XmlDocument document = new XmlDocument();
- document.Load("lang_0_spedit.xml");
+ document.Load("lang_0_spcode.xml");
if (document.ChildNodes.Count < 1)
{
throw new Exception("No Root-Node: \"translations\" found");
@@ -286,12 +286,15 @@ private void FillToEnglishDefaults()
language.Add("IndentationSize", "Indentation size");
language.Add("FontFamily", "Font");
language.Add("SyntaxHigh", "Syntax Highlighting");
- language.Add("HighDeprecat", "Highlight deprecated (<1.7) syntax");
+ language.Add("HighDeprecat", "Highlight deprecated (<1.7) syntax - NOT SUPPORTED");
language.Add("Compile", "Compile");
language.Add("AutoSaveMin", "Auto save (min)");
language.Add("OBTextFile", "File Dir.");
language.Add("OBTextConfig", "Config Dir.");
language.Add("OBTextItem", "Item Dir.");
- }
+ language.Add("CopyingFiles", "Copying files");
+ language.Add("FTPUploading", "Uploading files");
+ language.Add("RCONCommand", "Seconding RCON Commands");
+ }
}
}
diff --git a/Interop/Updater/UpdateCheck.cs b/Interop/Updater/UpdateCheck.cs
index 2df7d922..5d27f8f9 100644
--- a/Interop/Updater/UpdateCheck.cs
+++ b/Interop/Updater/UpdateCheck.cs
@@ -1,77 +1,39 @@
using System;
-using System.Diagnostics;
-using System.IO;
using System.Net;
-using System.Text;
-using System.Threading;
+using System.Reflection;
+using System.Threading.Tasks;
+using Octokit;
-namespace Spedit.Interop.Updater
+namespace Spcode.Interop.Updater
{
public static class UpdateCheck
{
- public static void Check(bool Asynchronous)
+ public static async Task Check()
{
if (Program.UpdateStatus != null)
- {
if (Program.UpdateStatus.IsAvailable)
- {
return;
- }
- }
- if (Asynchronous)
- {
- Thread t = new Thread(new ThreadStart(CheckInternal));
- t.Start();
- }
- else
- {
- CheckInternal();
- }
+ await CheckInternal();
}
- private static void CheckInternal()
+ private static async Task CheckInternal()
{
- UpdateInfo info = new UpdateInfo();
+ var info = new UpdateInfo();
try
{
- using (WebClient client = new WebClient())
+ var latestVer = await GetLatest();
+ if (!IsUpToDate(Assembly.GetEntryAssembly()?.GetName().Version, Version.Parse(latestVer.TagName)))
{
-#if DEBUG
- client.Credentials = new NetworkCredential("sm", "sm_pw"); //heuheu :D
- string versionString = client.DownloadString("ftp://127.0.0.1/version_0.txt");
-#else
- string versionString = client.DownloadString("https://updater.spedit.info/version_0.txt");
-#endif
- string[] versionLines = versionString.Split('\n');
- string version = (versionLines[0].Trim()).Trim('\r');
- if (version != Program.ProgramInternalVersion)
+ info.Release = latestVer;
+ if (info.Asset == null)
{
- string destinationFileName = "updater_" + version + ".exe";
- string destinationFile = Path.Combine(Environment.CurrentDirectory, destinationFileName);
- info.IsAvailable = true;
- info.Updater_File = destinationFile;
- info.Updater_FileName = destinationFileName;
-#if DEBUG
- info.Updater_DownloadURL = "ftp://127.0.0.1/" + destinationFileName;
-#else
- info.Updater_DownloadURL = "https://updater.spedit.info/" + destinationFileName;
-#endif
- info.Update_Version = version;
- StringBuilder updateInfoString = new StringBuilder();
- if (versionLines.Length > 1)
- {
- info.Update_StringVersion = versionLines[1];
- for (int i = 1; i < versionLines.Length; ++i)
- {
- updateInfoString.AppendLine((versionLines[i].Trim()).Trim('\r'));
- }
- }
- info.Update_Info = updateInfoString.ToString();
- }
- else
- {
- info.IsAvailable = false;
+ throw new Exception("Unable to find a valid asset!");
}
+ info.IsAvailable = true;
+ }
+ else
+ {
+ info.IsAvailable = false;
}
}
catch (Exception e)
@@ -80,13 +42,30 @@ private static void CheckInternal()
info.GotException = true;
info.ExceptionMessage = e.Message;
}
+
lock (Program.UpdateStatus) //since multiple checks can occur, we'll wont override another ones...
{
- if (Program.UpdateStatus.WriteAble)
- {
- Program.UpdateStatus = info;
- }
+ if (Program.UpdateStatus.WriteAble) Program.UpdateStatus = info;
}
}
+
+
+ /*
+ * 0 -> Major
+ * 1 -> Minor
+ * 2 -> Build
+ * 3 -> Revision
+ */
+ private static bool IsUpToDate(Version currentVer, Version latestVer)
+ {
+ return currentVer.CompareTo(latestVer) >= 0;
+ }
+
+ private static async Task GetLatest()
+ {
+ var client = new GitHubClient(new ProductHeaderValue("spcode-client"));
+ var releases = await client.Repository.Release.GetAll("Hexer10", "Spcode");
+ return releases[0];
+ }
}
-}
+}
\ No newline at end of file
diff --git a/Interop/Updater/UpdateInfo.cs b/Interop/Updater/UpdateInfo.cs
index 46381404..2c39c783 100644
--- a/Interop/Updater/UpdateInfo.cs
+++ b/Interop/Updater/UpdateInfo.cs
@@ -1,29 +1,21 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
+using System.Linq;
+using Octokit;
-namespace Spedit.Interop.Updater
+namespace Spcode.Interop.Updater
{
public class UpdateInfo
{
- public bool WriteAble = true;
-
- public bool IsAvailable = false;
-
- public bool SkipDialog = false;
+ public string ExceptionMessage = string.Empty;
public bool GotException = false;
- public string ExceptionMessage = string.Empty;
- public string Updater_DownloadURL = string.Empty;
- public string Updater_FileName = string.Empty;
- public string Updater_File = string.Empty;
+ public bool IsAvailable = false;
+
+ public Release Release = null;
- public string Update_Version = string.Empty; //this version is used internally
+ public bool SkipDialog = false;
+ public bool WriteAble = true;
- public string Update_StringVersion = string.Empty; //this is, what the user will see
- public string Update_Info = string.Empty;
+ public ReleaseAsset Asset => Release.Assets.FirstOrDefault(e => e.Name == "SpcodeUpdater.exe");
}
-}
+}
\ No newline at end of file
diff --git a/Interop/Updater/UpdateWindow.xaml b/Interop/Updater/UpdateWindow.xaml
index f0e0cf92..fa334fc0 100644
--- a/Interop/Updater/UpdateWindow.xaml
+++ b/Interop/Updater/UpdateWindow.xaml
@@ -1,4 +1,4 @@
-
- /// Interaction logic for UpdateWindow.xaml
+ /// Interaction logic for UpdateWindow.xaml
///
- public partial class UpdateWindow : MetroWindow
+ public partial class UpdateWindow
{
- private UpdateInfo updateInfo;
-
- public bool Succeeded = false;
+ private readonly UpdateInfo updateInfo;
+ public bool Succeeded;
public UpdateWindow()
{
InitializeComponent();
}
+
public UpdateWindow(UpdateInfo info)
{
updateInfo = info;
InitializeComponent();
- DescriptionBox.Text = updateInfo.Update_Info;
- if (info.SkipDialog)
- {
- StartUpdate();
- }
+ DescriptionBox.Text = updateInfo.Release.Body;
+ if (info.SkipDialog) StartUpdate();
}
private void ActionYesButton_Click(object sender, RoutedEventArgs e)
@@ -49,69 +46,65 @@ private void StartUpdate()
Close();
return;
}
- ActionYesButton.Visibility = System.Windows.Visibility.Hidden;
- ActionNoButton.Visibility = System.Windows.Visibility.Hidden;
+
+ ActionYesButton.Visibility = Visibility.Hidden;
+ ActionNoButton.Visibility = Visibility.Hidden;
Progress.IsActive = true;
- MainLine.Text = "Updating to " + updateInfo.Update_StringVersion;
+ MainLine.Text = "Updating to " + updateInfo.Release.TagName;
SubLine.Text = "Downloading Updater";
- Thread t = new Thread(new ThreadStart(UpdateDownloadWorker));
+ var t = new Thread(UpdateDownloadWorker);
t.Start();
}
private void UpdateDownloadWorker()
{
- if (File.Exists(updateInfo.Updater_File))
- {
- File.Delete(updateInfo.Updater_File);
- }
+#if DEBUG
+ var asset = new ReleaseAsset("", 0, "", "SpcodeUpdater.exe", "", "", "", 0, 0, DateTimeOffset.Now,
+ DateTimeOffset.Now, "https://hexah.net/SpcodeUpdater.exe", null);
+#else
+ var asset = updateInfo.Asset;
+#endif
+ if (File.Exists(asset.Name)) File.Delete(asset.Name);
+
try
{
- using (WebClient client = new WebClient())
+ using (var client = new WebClient())
{
-#if DEBUG
- client.Credentials = new NetworkCredential("sm", "sm_pw"); //heuheu :D
-#endif
- client.DownloadFile(updateInfo.Updater_DownloadURL, updateInfo.Updater_File);
+ client.DownloadFile(asset.BrowserDownloadUrl, asset.Name);
}
}
catch (Exception e)
{
- MessageBox.Show("Error while downloading the updater." + Environment.NewLine + "Details: " + e.Message + Environment.NewLine + "$$$" + e.StackTrace,
+ MessageBox.Show(
+ "Error while downloading the updater." + Environment.NewLine + "Details: " + e.Message +
+ Environment.NewLine + "$$$" + e.StackTrace,
"Error", MessageBoxButton.OK, MessageBoxImage.Warning);
- this.Dispatcher.Invoke(() =>
- {
- Close();
- });
+ Dispatcher.Invoke(Close);
}
+
Thread.Sleep(100); //safety reasons
- this.Dispatcher.Invoke(() =>
- {
- FinalizeUpdate();
- });
+ Dispatcher.Invoke(FinalizeUpdate);
}
private void FinalizeUpdate()
{
SubLine.Text = "Starting Updater";
- this.UpdateLayout();
+ UpdateLayout();
try
{
- using (Process p = new Process())
- {
- p.StartInfo.WorkingDirectory = Environment.CurrentDirectory;
- p.StartInfo.UseShellExecute = true;
- p.StartInfo.Verb = "runas";
- p.StartInfo.FileName = updateInfo.Updater_File;
- p.Start();
- }
+ Process.Start(new ProcessStartInfo
+ {Arguments = "/C SpcodeUpdater.exe", FileName = "cmd", WindowStyle = ProcessWindowStyle.Hidden});
Succeeded = true;
}
catch (Exception e)
{
- MessageBox.Show("Error while trying to start the updater." + Environment.NewLine + "Details: " + e.Message + Environment.NewLine + "$$$" + e.StackTrace,
+ MessageBox.Show(
+ "Error while trying to start the updater." + Environment.NewLine + "Details: " + e.Message +
+ Environment.NewLine + "$$$" + e.StackTrace,
"Error", MessageBoxButton.OK, MessageBoxImage.Warning);
}
+
Close();
}
}
-}
+}
\ No newline at end of file
diff --git a/Lysis/LysisForSpedit.csproj b/Lysis/LysisForSpedit.csproj
index 28b29593..6cc2af25 100644
--- a/Lysis/LysisForSpedit.csproj
+++ b/Lysis/LysisForSpedit.csproj
@@ -9,7 +9,7 @@
Properties
LysisForSpedit
LysisForSpedit
- v4.5
+ v4.8
512
diff --git a/Program.cs b/Program.cs
index 53b1aa3a..a597cd10 100644
--- a/Program.cs
+++ b/Program.cs
@@ -1,23 +1,23 @@
-using Spedit.Interop;
-using Spedit.Interop.Updater;
-using Spedit.UI;
+using Spcode.Interop;
+using Spcode.Interop.Updater;
+using Spcode.UI;
using System;
using System.IO;
using System.Reflection;
+using System.Runtime;
using System.Text;
using System.Threading;
+using System.Threading.Tasks;
using System.Windows;
using System.Windows.Media;
-using System.Runtime;
using DiscordRPC;
-
-namespace Spedit
+using Application = System.Windows.Application;
+
+namespace Spcode
{
public static class Program
{
- public const string ProgramInternalVersion = "14";
-
- public static MainWindow MainWindow;
+ public static MainWindow MainWindow;
public static OptionsControl OptionsObject;
public static TranslationProvider Translations;
public static Config[] Configs;
@@ -30,7 +30,7 @@ public static class Program
public static Timestamps discordTime = Timestamps.Now;
[STAThread]
- public static void Main(string[] args)
+ public static async Task Main(string[] args)
{
// Init Discord RPC
discordClient.Initialize();
@@ -46,7 +46,7 @@ public static void Main(string[] args)
}
});
bool mutexReserved;
- using (new Mutex(true, "SpeditGlobalMutex", out mutexReserved))
+ using (new Mutex(true, "SpcodeGlobalMutex", out mutexReserved))
{
if (mutexReserved)
{
@@ -111,7 +111,7 @@ public static void Main(string[] args)
}
catch (Exception e)
{
- File.WriteAllText("CRASH_" + Environment.TickCount.ToString() + ".txt", BuildExceptionString(e, "SPEDIT LOADING"));
+ File.WriteAllText("CRASH_" + Environment.TickCount.ToString() + ".txt", BuildExceptionString(e, "SPCODE LOADING"));
MessageBox.Show("An error occured while loading." + Environment.NewLine + "A crash report was written in the editor-directory.",
"Error while Loading",
MessageBoxButton.OK,
@@ -125,7 +125,7 @@ public static void Main(string[] args)
{
if (OptionsObject.Program_CheckForUpdates)
{
- UpdateCheck.Check(true);
+ await UpdateCheck.Check();
}
#endif
app.Startup += App_Startup;
@@ -135,7 +135,7 @@ public static void Main(string[] args)
}
catch (Exception e)
{
- File.WriteAllText("CRASH_" + Environment.TickCount.ToString() + ".txt", BuildExceptionString(e, "SPEDIT MAIN"));
+ File.WriteAllText("CRASH_" + Environment.TickCount.ToString() + ".txt", BuildExceptionString(e, "SPCODE MAIN"));
MessageBox.Show("An error occured." + Environment.NewLine + "A crash report was written in the editor-directory.",
"Error",
MessageBoxButton.OK,
diff --git a/Properties/Resources.Designer.cs b/Properties/Resources.Designer.cs
index 2b920e9e..47b5c0f6 100644
--- a/Properties/Resources.Designer.cs
+++ b/Properties/Resources.Designer.cs
@@ -8,7 +8,7 @@
//
//------------------------------------------------------------------------------
-namespace Spedit.Properties {
+namespace Spcode.Properties {
using System;
@@ -39,7 +39,7 @@ internal Resources() {
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
- global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Spedit.Properties.Resources", typeof(Resources).Assembly);
+ global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Spcode.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
diff --git a/README.md b/README.md
index 81f8dfe6..0e6bce14 100644
--- a/README.md
+++ b/README.md
@@ -1,5 +1,5 @@
-# SPEdit
-#### _SPEdit - A lightweight sourcepawn editor._
+# SPCode
+#### _SPCode - A lightweight sourcepawn editor._
[Thread in Alliedmodders](https://forums.alliedmods.net/showthread.php?t=259917)
diff --git a/Resources/lang_0_spedit.xml b/Resources/lang_0_spcode.xml
similarity index 100%
rename from Resources/lang_0_spedit.xml
rename to Resources/lang_0_spcode.xml
diff --git a/Resources/lang_0_spedit_entryTemplate.xml b/Resources/lang_0_spcode_entryTemplate.xml
similarity index 99%
rename from Resources/lang_0_spedit_entryTemplate.xml
rename to Resources/lang_0_spcode_entryTemplate.xml
index 3d996b12..59afaa07 100644
--- a/Resources/lang_0_spedit_entryTemplate.xml
+++ b/Resources/lang_0_spcode_entryTemplate.xml
@@ -1,3 +1,4 @@
+
English
Server running
diff --git a/SourcepawnCondenser/CondenserTest/App.config b/SourcepawnCondenser/CondenserTest/App.config
index 88fa4027..193aecc6 100644
--- a/SourcepawnCondenser/CondenserTest/App.config
+++ b/SourcepawnCondenser/CondenserTest/App.config
@@ -1,6 +1,6 @@
-
+
\ No newline at end of file
diff --git a/SourcepawnCondenser/CondenserTest/CondenserTest.csproj b/SourcepawnCondenser/CondenserTest/CondenserTest.csproj
index 3fd02da0..18e8d8c0 100644
--- a/SourcepawnCondenser/CondenserTest/CondenserTest.csproj
+++ b/SourcepawnCondenser/CondenserTest/CondenserTest.csproj
@@ -9,7 +9,7 @@
Properties
CondenserTest
CondenserTest
- v4.5.2
+ v4.8
512
{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
4
diff --git a/SourcepawnCondenser/SourcepawnCondenser/App.config b/SourcepawnCondenser/SourcepawnCondenser/App.config
index d1428ad7..4bfa0056 100644
--- a/SourcepawnCondenser/SourcepawnCondenser/App.config
+++ b/SourcepawnCondenser/SourcepawnCondenser/App.config
@@ -1,6 +1,6 @@
-
+
diff --git a/SourcepawnCondenser/SourcepawnCondenser/SourcepawnCondenser.csproj b/SourcepawnCondenser/SourcepawnCondenser/SourcepawnCondenser.csproj
index 86759b74..921a8168 100644
--- a/SourcepawnCondenser/SourcepawnCondenser/SourcepawnCondenser.csproj
+++ b/SourcepawnCondenser/SourcepawnCondenser/SourcepawnCondenser.csproj
@@ -9,7 +9,7 @@
Properties
SourcepawnCondenser
SourcepawnCondenser
- v4.5
+ v4.8
512
true
diff --git a/Spedit.csproj b/Spcode.csproj
similarity index 96%
rename from Spedit.csproj
rename to Spcode.csproj
index d43400ba..130720de 100644
--- a/Spedit.csproj
+++ b/Spcode.csproj
@@ -7,9 +7,9 @@
{60D2BA42-B59B-4B49-928E-C0CDDE254917}
WinExe
Properties
- Spedit
- Spedit
- v4.5
+ Spcode
+ Spcode
+ v4.8
512
false
@@ -80,10 +80,15 @@
packages\MahApps.Metro.1.6.5\lib\net45\MahApps.Metro.dll
True
+
packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll
True
+
+ packages\Octokit.0.46.0\lib\net46\Octokit.dll
+ True
+
packages\SSH.NET.2016.1.0\lib\net40\Renci.SshNet.dll
True
@@ -99,6 +104,7 @@
+
packages\ControlzEx.3.0.2.4\lib\net45\System.Windows.Interactivity.dll
@@ -252,9 +258,9 @@
-
+
False
- Microsoft .NET Framework 4.5 %28x86 and x64%29
+ Microsoft .NET Framework 4.8 %28x86 and x64%29
true
@@ -415,10 +421,10 @@
-
+
-
-
+
+
@@ -518,9 +524,9 @@
md ".\sourcepawn\errorfiles"
md ".\nsis-plugins"
C:\Windows\system32\xcopy ".\..\..\Resources\Misc\Templates\*.*" ".\sourcepawn\templates\*.*" /e /y /q
- C:\Windows\system32\xcopy ".\..\..\Resources\Misc\Configurations" ".\sourcepawn\configs" /e /y /q
- copy ".\..\..\Resources\lang_0_spedit.xml" ".\lang_0_spedit.xml" /y
- copy ".\..\..\Deploy\SPEdit.nsi" ".\SPEdit.nsi" /y
+ C:\Windows\system32\xcopy ".\..\..\Resources\Misc\Configurations" ".\sourcepawn\configs" /e /y /q /d
+ copy ".\..\..\Resources\lang_0_spcode.xml" ".\lang_0_spcode.xml" /y
+ copy ".\..\..\Deploy\SPCode.nsi" ".\SPCode.nsi" /y
copy ".\..\..\Deploy\Compress.ps1" ".\Compress.ps1" /y
copy ".\..\..\Deploy\DotNetChecker.nsh" ".\DotNetChecker.nsh" /y
copy ".\..\..\Deploy\FileAssociation.nsh" ".\FileAssociation.nsh" /y
diff --git a/Spedit.sln b/Spcode.sln
similarity index 82%
rename from Spedit.sln
rename to Spcode.sln
index 4ab532b5..c78c67e5 100644
--- a/Spedit.sln
+++ b/Spcode.sln
@@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.29926.136
MinimumVisualStudioVersion = 10.0.40219.1
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spedit", "Spedit.csproj", "{60D2BA42-B59B-4B49-928E-C0CDDE254917}"
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spcode", "Spcode.csproj", "{60D2BA42-B59B-4B49-928E-C0CDDE254917}"
ProjectSection(ProjectDependencies) = postProject
{B4E00F2D-DD73-42C7-A0CA-BA92B2A05850} = {B4E00F2D-DD73-42C7-A0CA-BA92B2A05850}
{A8D94E5A-0CDC-4F01-8801-5770B3CA2B5B} = {A8D94E5A-0CDC-4F01-8801-5770B3CA2B5B}
@@ -11,7 +11,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spedit", "Spedit.csproj", "
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LysisForSpedit", "Lysis\LysisForSpedit.csproj", "{A8D94E5A-0CDC-4F01-8801-5770B3CA2B5B}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SpeditUpdater", "Deploy\SpeditUpdater\SpeditUpdater.csproj", "{402651FB-269B-4858-8D2A-6DF7E0B9A36E}"
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SpcodeUpdater", "Deploy\SpcodeUpdater\SpcodeUpdater.csproj", "{402651FB-269B-4858-8D2A-6DF7E0B9A36E}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SourcepawnCondenser", "SourcepawnCondenser\SourcepawnCondenser\SourcepawnCondenser.csproj", "{B4E00F2D-DD73-42C7-A0CA-BA92B2A05850}"
EndProject
@@ -20,6 +20,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CondenserTest", "Sourcepawn
{B4E00F2D-DD73-42C7-A0CA-BA92B2A05850} = {B4E00F2D-DD73-42C7-A0CA-BA92B2A05850}
EndProjectSection
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UpdaterTest", "UpdaterTest\UpdaterTest.csproj", "{9A405E24-7626-4382-BB49-1F59B72C4970}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -112,6 +114,22 @@ Global
{B1E03089-FD98-4C01-828F-8CB05F87462F}.Release|x64.Build.0 = Release|Any CPU
{B1E03089-FD98-4C01-828F-8CB05F87462F}.Release|x86.ActiveCfg = Release|Any CPU
{B1E03089-FD98-4C01-828F-8CB05F87462F}.Release|x86.Build.0 = Release|Any CPU
+ {9A405E24-7626-4382-BB49-1F59B72C4970}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {9A405E24-7626-4382-BB49-1F59B72C4970}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {9A405E24-7626-4382-BB49-1F59B72C4970}.Debug|ARM.ActiveCfg = Debug|Any CPU
+ {9A405E24-7626-4382-BB49-1F59B72C4970}.Debug|ARM.Build.0 = Debug|Any CPU
+ {9A405E24-7626-4382-BB49-1F59B72C4970}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {9A405E24-7626-4382-BB49-1F59B72C4970}.Debug|x64.Build.0 = Debug|Any CPU
+ {9A405E24-7626-4382-BB49-1F59B72C4970}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {9A405E24-7626-4382-BB49-1F59B72C4970}.Debug|x86.Build.0 = Debug|Any CPU
+ {9A405E24-7626-4382-BB49-1F59B72C4970}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {9A405E24-7626-4382-BB49-1F59B72C4970}.Release|Any CPU.Build.0 = Release|Any CPU
+ {9A405E24-7626-4382-BB49-1F59B72C4970}.Release|ARM.ActiveCfg = Release|Any CPU
+ {9A405E24-7626-4382-BB49-1F59B72C4970}.Release|ARM.Build.0 = Release|Any CPU
+ {9A405E24-7626-4382-BB49-1F59B72C4970}.Release|x64.ActiveCfg = Release|Any CPU
+ {9A405E24-7626-4382-BB49-1F59B72C4970}.Release|x64.Build.0 = Release|Any CPU
+ {9A405E24-7626-4382-BB49-1F59B72C4970}.Release|x86.ActiveCfg = Release|Any CPU
+ {9A405E24-7626-4382-BB49-1F59B72C4970}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/Spedit.sln.DotSettings b/Spedit.sln.DotSettings
new file mode 100644
index 00000000..2100afa6
--- /dev/null
+++ b/Spedit.sln.DotSettings
@@ -0,0 +1,2 @@
+
+ True
\ No newline at end of file
diff --git a/UI/Components/ColorChangeControl.xaml b/UI/Components/ColorChangeControl.xaml
index 4a519009..43dfffa5 100644
--- a/UI/Components/ColorChangeControl.xaml
+++ b/UI/Components/ColorChangeControl.xaml
@@ -1,4 +1,4 @@
-
/// Interaction logic for ColorChangeControl.xaml
diff --git a/UI/Components/DASMElement.xaml b/UI/Components/DASMElement.xaml
index ad07afb4..adbf73c7 100644
--- a/UI/Components/DASMElement.xaml
+++ b/UI/Components/DASMElement.xaml
@@ -1,4 +1,4 @@
-
/// Interaction logic for DASMElement.xaml
diff --git a/UI/Components/DASMElementHighlighter.cs b/UI/Components/DASMElementHighlighter.cs
index 52628bbf..5e3b7c91 100644
--- a/UI/Components/DASMElementHighlighter.cs
+++ b/UI/Components/DASMElementHighlighter.cs
@@ -10,7 +10,7 @@
using System.Windows;
using System.Windows.Media;
-namespace Spedit.UI.Components
+namespace Spcode.UI.Components
{
public class DASMHighlighting : IHighlightingDefinition
{
diff --git a/UI/Components/EditorElement.xaml b/UI/Components/EditorElement.xaml
index 9dc7c6f3..20707379 100644
--- a/UI/Components/EditorElement.xaml
+++ b/UI/Components/EditorElement.xaml
@@ -1,4 +1,4 @@
-
+
diff --git a/UI/Components/EditorElement.xaml.cs b/UI/Components/EditorElement.xaml.cs
index f95871e9..af61e2d1 100644
--- a/UI/Components/EditorElement.xaml.cs
+++ b/UI/Components/EditorElement.xaml.cs
@@ -13,11 +13,11 @@
using ICSharpCode.AvalonEdit.Rendering;
using ICSharpCode.AvalonEdit.Utils;
using MahApps.Metro.Controls.Dialogs;
-using Spedit.Utils.SPSyntaxTidy;
+using Spcode.Utils.SPSyntaxTidy;
using Xceed.Wpf.AvalonDock.Layout;
using Timer = System.Timers.Timer;
-namespace Spedit.UI.Components
+namespace Spcode.UI.Components
{
///
/// Interaction logic for EditorElement.xaml
@@ -494,15 +494,14 @@ public async void Close(bool ForcedToSave = false, bool CheckSavings = true)
{
var title = $"{Program.Translations.GetLanguage("SavingFile")} '" + Parent.Title.Trim('*') +
"'";
- var msg = "";
- var Result = await Program.MainWindow.ShowMessageAsync(title, msg,
+ var Result = await Program.MainWindow.ShowMessageAsync(title, "",
MessageDialogStyle.AffirmativeAndNegative, Program.MainWindow.MetroDialogOptions);
if (Result == MessageDialogResult.Affirmative) Save();
}
}
Program.MainWindow.EditorsReferences.Remove(this);
- var childs = Program.MainWindow.DockingPaneGroup.Children;
+ // var childs = Program.MainWindow.DockingPaneGroup.Children;
// foreach (var c in childs) (c as LayoutDocumentPane)?.Children.Remove(Parent);
Parent = null; //to prevent a ring depency which disables the GC from work
diff --git a/UI/Components/EditorElementBracketHighlighter.cs b/UI/Components/EditorElementBracketHighlighter.cs
index ffc8b6e0..6dbad207 100644
--- a/UI/Components/EditorElementBracketHighlighter.cs
+++ b/UI/Components/EditorElementBracketHighlighter.cs
@@ -9,7 +9,7 @@
using ICSharpCode.AvalonEdit.Rendering;
using ICSharpCode.AvalonEdit.Document;
-namespace Spedit.UI.Components
+namespace Spcode.UI.Components
{
public class BracketHighlightRenderer : IBackgroundRenderer
{
diff --git a/UI/Components/EditorElementHighlighter.cs b/UI/Components/EditorElementHighlighter.cs
index 5c6e773f..b93a296e 100644
--- a/UI/Components/EditorElementHighlighter.cs
+++ b/UI/Components/EditorElementHighlighter.cs
@@ -10,7 +10,7 @@
using ICSharpCode.AvalonEdit.Highlighting;
using ICSharpCode.AvalonEdit.Rendering;
-namespace Spedit.UI.Components
+namespace Spcode.UI.Components
{
public class AeonEditorHighlighting : IHighlightingDefinition
{
diff --git a/UI/Components/EditorFoldingStrategy.cs b/UI/Components/EditorFoldingStrategy.cs
index 9b575efe..5c316599 100644
--- a/UI/Components/EditorFoldingStrategy.cs
+++ b/UI/Components/EditorFoldingStrategy.cs
@@ -2,7 +2,7 @@
using ICSharpCode.AvalonEdit.Folding;
using System.Collections.Generic;
-namespace Spedit.UI.Components
+namespace Spcode.UI.Components
{
public class SPFoldingStrategy
{
diff --git a/UI/Components/EditorIndetation.cs b/UI/Components/EditorIndetation.cs
index ceeec881..06d12c5a 100644
--- a/UI/Components/EditorIndetation.cs
+++ b/UI/Components/EditorIndetation.cs
@@ -3,7 +3,7 @@
using ICSharpCode.AvalonEdit.Rendering;
using System.Windows.Media;
-namespace Spedit.UI.Components
+namespace Spcode.UI.Components
{
public class EditorIndetationStrategy : IIndentationStrategy
{
diff --git a/UI/Components/IntelliSenseController.cs b/UI/Components/IntelliSenseController.cs
index 804bbfa9..d3437e68 100644
--- a/UI/Components/IntelliSenseController.cs
+++ b/UI/Components/IntelliSenseController.cs
@@ -9,7 +9,7 @@
using ICSharpCode.AvalonEdit.Rendering;
using SourcepawnCondenser.SourcemodDefinition;
-namespace Spedit.UI.Components
+namespace Spcode.UI.Components
{
public partial class EditorElement
{
diff --git a/UI/Interop/LanguageChooserWindow.xaml b/UI/Interop/LanguageChooserWindow.xaml
index e8196cd8..ed1c0f5e 100644
--- a/UI/Interop/LanguageChooserWindow.xaml
+++ b/UI/Interop/LanguageChooserWindow.xaml
@@ -1,4 +1,4 @@
-
/// Interaction logic for LanguageChooserWindow.xaml
diff --git a/UI/MainWindow.xaml b/UI/MainWindow.xaml
index 5e89f93c..44d16132 100644
--- a/UI/MainWindow.xaml
+++ b/UI/MainWindow.xaml
@@ -1,13 +1,13 @@
-
@@ -122,7 +122,7 @@
-
+
@@ -237,19 +237,19 @@
-
+
-
+
-
+
diff --git a/UI/MainWindow.xaml.cs b/UI/MainWindow.xaml.cs
index f3b319ca..4207b7f5 100644
--- a/UI/MainWindow.xaml.cs
+++ b/UI/MainWindow.xaml.cs
@@ -1,5 +1,5 @@
using MahApps.Metro;
-using Spedit.UI.Components;
+using Spcode.UI.Components;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
@@ -12,11 +12,11 @@
using System.Windows.Media.Animation;
using System.Windows.Threading;
using DiscordRPC;
-using Spedit.Interop.Updater;
+using Spcode.Interop.Updater;
using Xceed.Wpf.AvalonDock.Layout;
-// using Spedit.Interop.Updater; //not delete! ?
+// using Spcode.Interop.Updater; //not delete! ?
-namespace Spedit.UI
+namespace Spcode.UI
{
///
/// Interaction logic for MainWindow.xaml
@@ -201,7 +201,7 @@ private void DockingManager_ActiveContentChanged(object sender, EventArgs e)
private void DockingManager_DocumentClosing(object sender, Xceed.Wpf.AvalonDock.DocumentClosingEventArgs e)
{
- ((EditorElement) e.Document.Content).Close();
+ (e.Document.Content as EditorElement)?.Close();
UpdateWindowTitle();
}
@@ -249,6 +249,8 @@ private void MetroWindow_Closing(object sender, CancelEventArgs e)
}
}
Program.OptionsObject.LastOpenFiles = lastOpenFiles.ToArray();
+
+ Program.discordClient.Dispose();
#if !DEBUG
if (Program.UpdateStatus.IsAvailable)
{
@@ -332,7 +334,7 @@ public void UpdateWindowTitle()
string outString;
if (ee == null)
{
- outString = "SPEdit";
+ outString = "SPCode";
Program.discordClient.SetPresence(new RichPresence()
{
State = "Idle",
@@ -345,7 +347,7 @@ public void UpdateWindowTitle()
}
else
{
- outString = ee.FullFilePath + " - SPEdit";
+ outString = ee.FullFilePath + " - SPCode";
}
if (ServerIsRunning)
{
diff --git a/UI/MainWindowBackgroundParser.cs b/UI/MainWindowBackgroundParser.cs
index 7d4e369f..f216c4bc 100644
--- a/UI/MainWindowBackgroundParser.cs
+++ b/UI/MainWindowBackgroundParser.cs
@@ -5,10 +5,10 @@
using System.Timers;
using SourcepawnCondenser;
using SourcepawnCondenser.SourcemodDefinition;
-using Spedit.UI.Components;
+using Spcode.UI.Components;
using Timer = System.Timers.Timer;
-namespace Spedit.UI
+namespace Spcode.UI
{
public partial class MainWindow
{
diff --git a/UI/MainWindowCommands.cs b/UI/MainWindowCommands.cs
index b4a59ebf..0d3388d6 100644
--- a/UI/MainWindowCommands.cs
+++ b/UI/MainWindowCommands.cs
@@ -1,14 +1,14 @@
using System.Diagnostics;
using MahApps.Metro.Controls.Dialogs;
using Microsoft.Win32;
-using Spedit.UI.Components;
-using Spedit.UI.Windows;
-using Spedit.Utils.SPSyntaxTidy;
+using Spcode.UI.Components;
+using Spcode.UI.Windows;
+using Spcode.Utils.SPSyntaxTidy;
using System.Text;
using Lysis;
using System.IO;
-namespace Spedit.UI
+namespace Spcode.UI
{
public partial class MainWindow
{
diff --git a/UI/MainWindowConfigHandler.cs b/UI/MainWindowConfigHandler.cs
index ee816c5f..9ad93ad8 100644
--- a/UI/MainWindowConfigHandler.cs
+++ b/UI/MainWindowConfigHandler.cs
@@ -1,9 +1,9 @@
-using Spedit.UI.Components;
-using Spedit.UI.Windows;
+using Spcode.UI.Components;
+using Spcode.UI.Windows;
using System.Windows;
using System.Windows.Controls;
-namespace Spedit.UI
+namespace Spcode.UI
{
public partial class MainWindow
{
diff --git a/UI/MainWindowFindReplaceHandler.cs b/UI/MainWindowFindReplaceHandler.cs
index 3fd5dbb5..5bd4d8ec 100644
--- a/UI/MainWindowFindReplaceHandler.cs
+++ b/UI/MainWindowFindReplaceHandler.cs
@@ -1,4 +1,4 @@
-using Spedit.UI.Components;
+using Spcode.UI.Components;
using System;
using System.Diagnostics;
using System.Globalization;
@@ -6,7 +6,7 @@
using System.Windows;
using System.Windows.Input;
-namespace Spedit.UI
+namespace Spcode.UI
{
public partial class MainWindow
{
diff --git a/UI/MainWindowInputHandler.cs b/UI/MainWindowInputHandler.cs
index 9952e4db..b95eaac3 100644
--- a/UI/MainWindowInputHandler.cs
+++ b/UI/MainWindowInputHandler.cs
@@ -1,7 +1,7 @@
using System.Windows;
using System.Windows.Input;
-namespace Spedit.UI
+namespace Spcode.UI
{
public partial class MainWindow
{
diff --git a/UI/MainWindowMenuHandler.cs b/UI/MainWindowMenuHandler.cs
index 11fd5a02..734ca298 100644
--- a/UI/MainWindowMenuHandler.cs
+++ b/UI/MainWindowMenuHandler.cs
@@ -1,31 +1,27 @@
-using MahApps.Metro.Controls.Dialogs;
-using Spedit.Interop.Updater;
-using Spedit.UI.Components;
-using Spedit.UI.Windows;
-using System;
+using System;
using System.Diagnostics;
using System.Reflection;
using System.Windows;
using System.Windows.Controls;
+using MahApps.Metro.Controls.Dialogs;
+using Spcode.Interop.Updater;
+using Spcode.UI.Windows;
-namespace Spedit.UI
+namespace Spcode.UI
{
public partial class MainWindow
{
private void FileMenu_Open(object sender, RoutedEventArgs e)
{
- var editors = GetAllEditorElements();
- bool EditorsAreOpen = false;
- if (editors != null)
- {
- EditorsAreOpen = (editors.Length > 0);
- }
- bool EditorIsSelected = (GetCurrentEditorElement() != null);
- ((MenuItem)((MenuItem)sender).Items[3]).IsEnabled = EditorIsSelected;
- ((MenuItem)((MenuItem)sender).Items[5]).IsEnabled = EditorIsSelected;
- ((MenuItem)((MenuItem)sender).Items[7]).IsEnabled = EditorIsSelected;
- ((MenuItem)((MenuItem)sender).Items[4]).IsEnabled = EditorsAreOpen;
- ((MenuItem)((MenuItem)sender).Items[8]).IsEnabled = EditorsAreOpen;
+ var editors = GetAllEditorElements();
+ var EditorsAreOpen = false;
+ if (editors != null) EditorsAreOpen = editors.Length > 0;
+ var EditorIsSelected = GetCurrentEditorElement() != null;
+ ((MenuItem) ((MenuItem) sender).Items[3]).IsEnabled = EditorIsSelected;
+ ((MenuItem) ((MenuItem) sender).Items[5]).IsEnabled = EditorIsSelected;
+ ((MenuItem) ((MenuItem) sender).Items[7]).IsEnabled = EditorIsSelected;
+ ((MenuItem) ((MenuItem) sender).Items[4]).IsEnabled = EditorsAreOpen;
+ ((MenuItem) ((MenuItem) sender).Items[8]).IsEnabled = EditorsAreOpen;
}
private void Menu_New(object sender, RoutedEventArgs e)
@@ -57,6 +53,7 @@ private void Menu_Close(object sender, RoutedEventArgs e)
{
Command_Close();
}
+
private void Menu_CloseAll(object sender, RoutedEventArgs e)
{
Command_CloseAll();
@@ -64,29 +61,21 @@ private void Menu_CloseAll(object sender, RoutedEventArgs e)
private void EditMenu_Open(object sender, RoutedEventArgs e)
{
- EditorElement ee = GetCurrentEditorElement();
- MenuItem menu = (MenuItem)sender;
+ var ee = GetCurrentEditorElement();
+ var menu = (MenuItem) sender;
if (ee == null)
{
foreach (var item in menu.Items)
- {
if (item is MenuItem menuItem)
- {
menuItem.IsEnabled = false;
- }
- }
}
else
{
MenuI_Undo.IsEnabled = ee.editor.CanUndo;
MenuI_Redo.IsEnabled = ee.editor.CanRedo;
- for (int i = 2; i < menu.Items.Count; ++i)
- {
+ for (var i = 2; i < menu.Items.Count; ++i)
if (menu.Items[i] is MenuItem)
- {
- ((MenuItem)menu.Items[i]).IsEnabled = true;
- }
- }
+ ((MenuItem) menu.Items[i]).IsEnabled = true;
}
}
@@ -130,13 +119,13 @@ private void Menu_JumpTo(object sender, RoutedEventArgs e)
Command_JumpTo();
}
- private void Menu_ToggleCommentLine(object sender, RoutedEventArgs e)
- {
- Command_ToggleCommentLine();
- }
+ private void Menu_ToggleCommentLine(object sender, RoutedEventArgs e)
+ {
+ Command_ToggleCommentLine();
+ }
- private void Menu_SelectAll(object sender, RoutedEventArgs e)
+ private void Menu_SelectAll(object sender, RoutedEventArgs e)
{
Command_SelectAll();
}
@@ -178,25 +167,25 @@ private void Menu_SendRCon(object sender, RoutedEventArgs e)
private void Menu_OpenWebsiteFromTag(object sender, RoutedEventArgs e)
{
- string url = (string)((MenuItem)sender).Tag;
+ var url = (string) ((MenuItem) sender).Tag;
Process.Start(new ProcessStartInfo(url));
}
private void Menu_About(object sender, RoutedEventArgs e)
{
- AboutWindow aboutWindow = new AboutWindow() { Owner = this, ShowInTaskbar = false };
+ var aboutWindow = new AboutWindow {Owner = this, ShowInTaskbar = false};
aboutWindow.ShowDialog();
}
private void Menu_OpenSPDef(object sender, RoutedEventArgs e)
{
- SPDefinitionWindow spDefinitionWindow = new SPDefinitionWindow() { Owner = this, ShowInTaskbar = false };
+ var spDefinitionWindow = new SPDefinitionWindow {Owner = this, ShowInTaskbar = false};
spDefinitionWindow.ShowDialog();
}
private void Menu_OpenOptions(object sender, RoutedEventArgs e)
{
- OptionsWindow optionsWindow = new OptionsWindow() { Owner = this, ShowInTaskbar = false };
+ var optionsWindow = new OptionsWindow {Owner = this, ShowInTaskbar = false};
optionsWindow.ShowDialog();
}
@@ -217,16 +206,16 @@ private void Menu_DecompileLysis(object sender, RoutedEventArgs e)
private void ReportBug_Click(object sender, RoutedEventArgs e)
{
- Process.Start(new ProcessStartInfo(@"https://github.com/Hexer10/Spedit/issues/new"));
+ Process.Start(new ProcessStartInfo(@"https://github.com/Hexer10/Spcode/issues/new"));
}
- private void UpdateCheck_Click(object sender, RoutedEventArgs e)
+ private async void UpdateCheck_Click(object sender, RoutedEventArgs e)
{
- UpdateCheck.Check(false);
+ await UpdateCheck.Check();
var status = Program.UpdateStatus;
if (status.IsAvailable)
{
- UpdateWindow uWindow = new UpdateWindow(status) { Owner = this };
+ var uWindow = new UpdateWindow(status) {Owner = this};
uWindow.ShowDialog();
if (uWindow.Succeeded)
{
@@ -236,52 +225,42 @@ private void UpdateCheck_Click(object sender, RoutedEventArgs e)
Program.UpdateStatus.WriteAble = false;
Program.UpdateStatus.IsAvailable = false;
}
- this.Close();
+
+ Close();
}
}
else
{
if (status.GotException)
- {
- this.ShowMessageAsync(Program.Translations.GetLanguage("FailedCheck"), Program.Translations.GetLanguage("ErrorUpdate") + Environment.NewLine + $"{Program.Translations.GetLanguage("Details")}: " + status.ExceptionMessage
- , MessageDialogStyle.Affirmative, this.MetroDialogOptions);
- }
+ await this.ShowMessageAsync(Program.Translations.GetLanguage("FailedCheck"),
+ Program.Translations.GetLanguage("ErrorUpdate") + Environment.NewLine +
+ $"{Program.Translations.GetLanguage("Details")}: " + status.ExceptionMessage
+ , MessageDialogStyle.Affirmative, MetroDialogOptions);
else
- {
- this.ShowMessageAsync(Program.Translations.GetLanguage("VersUpToDate"), string.Format(Program.Translations.GetLanguage("VersionYour"), Assembly.GetEntryAssembly()?.GetName().Version)
- , MessageDialogStyle.Affirmative, this.MetroDialogOptions);
- }
+ await this.ShowMessageAsync(Program.Translations.GetLanguage("VersUpToDate"),
+ string.Format(Program.Translations.GetLanguage("VersionYour"),
+ Assembly.GetEntryAssembly()?.GetName().Version)
+ , MessageDialogStyle.Affirmative, MetroDialogOptions);
}
}
private void MenuButton_Compile(object sender, RoutedEventArgs e)
{
- int selected = CompileButton.SelectedIndex;
+ var selected = CompileButton.SelectedIndex;
if (selected == 1)
- {
Compile_SPScripts(false);
- }
else
- {
Compile_SPScripts();
- }
}
private void MenuButton_Action(object sender, RoutedEventArgs e)
{
- int selected = CActionButton.SelectedIndex;
+ var selected = CActionButton.SelectedIndex;
if (selected == 0)
- {
Copy_Plugins();
- }
else if (selected == 1)
- {
FTPUpload_Plugins();
- }
- else if (selected == 2)
- {
- Server_Start();
- }
+ else if (selected == 2) Server_Start();
}
}
-}
+}
\ No newline at end of file
diff --git a/UI/MainWindowObjectBrowser.cs b/UI/MainWindowObjectBrowser.cs
index 8ca3e238..90aee7dd 100644
--- a/UI/MainWindowObjectBrowser.cs
+++ b/UI/MainWindowObjectBrowser.cs
@@ -1,4 +1,4 @@
-using Spedit.UI.Components;
+using Spcode.UI.Components;
using System;
using System.Collections.Generic;
using System.Diagnostics;
@@ -7,7 +7,7 @@
using System.Windows.Controls;
using System.Windows.Media.Imaging;
-namespace Spedit.UI
+namespace Spcode.UI
{
public partial class MainWindow
{
@@ -264,7 +264,7 @@ private object BuildTreeViewItemContent(string headerString, string iconFile)
{
StackPanel stack = new StackPanel {Orientation = Orientation.Horizontal};
Image image = new Image();
- string uriPath = $"/Spedit;component/Resources/{iconFile}";
+ string uriPath = $"/Spcode;component/Resources/{iconFile}";
image.Source = new BitmapImage(new Uri(uriPath, UriKind.Relative));
image.Width = 16;
image.Height = 16;
diff --git a/UI/MainWindowSPCompiler.cs b/UI/MainWindowSPCompiler.cs
index 64b62d1a..81f7ce94 100644
--- a/UI/MainWindowSPCompiler.cs
+++ b/UI/MainWindowSPCompiler.cs
@@ -5,11 +5,12 @@
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
+using System.Threading.Tasks;
using System.Windows;
using MahApps.Metro.Controls.Dialogs;
-using Spedit.Utils;
+using Spcode.Utils;
-namespace Spedit.UI
+namespace Spcode.UI
{
public partial class MainWindow
{
@@ -102,7 +103,7 @@ private async void Compile_SPScripts(bool All = true)
}
var file = filesToCompile[i];
- progressTask.SetMessage(file);
+ progressTask.SetMessage($"{file} ({i}/{compileCount}) ");
ProcessUITasks();
var fileInfo = new FileInfo(file);
stringOutput.AppendLine(fileInfo.Name);
@@ -194,9 +195,30 @@ await this.ShowMessageAsync(Program.Translations.GetLanguage("SPCompNotStarted")
{
progressTask.SetProgress(1.0);
CompileOutput.Text = stringOutput.ToString();
- if (c.AutoCopy) Copy_Plugins(true);
- if (c.AutoUpload) FTPUpload_Plugins();
- if (c.AutoRCON) Server_Query();
+ if (c.AutoCopy)
+ {
+ progressTask.SetTitle(Program.Translations.GetLanguage("CopyingFiles"));
+ progressTask.SetIndeterminate();
+ await Task.Run(() => Copy_Plugins(true));
+ progressTask.SetProgress(1.0);
+ }
+
+ if (c.AutoUpload)
+ {
+ progressTask.SetTitle(Program.Translations.GetLanguage("FTPUploading"));
+ progressTask.SetIndeterminate();
+ await Task.Run(FTPUpload_Plugins);
+ progressTask.SetProgress(1.0);
+ }
+
+ if (c.AutoRCON)
+ {
+ progressTask.SetTitle(Program.Translations.GetLanguage("RCONCommand"));
+ progressTask.SetIndeterminate();
+ await Task.Run(Server_Query);
+ progressTask.SetProgress(1.0);
+ }
+
if (CompileOutputRow.Height.Value < 11.0) CompileOutputRow.Height = new GridLength(200.0);
}
@@ -248,11 +270,14 @@ private void Copy_Plugins(bool OvertakeOutString = false)
}
if (copyCount == 0) stringOutput.AppendLine(Program.Translations.GetLanguage("NoFilesCopy"));
- if (OvertakeOutString)
- CompileOutput.AppendText(stringOutput.ToString());
- else
- CompileOutput.Text = stringOutput.ToString();
- if (CompileOutputRow.Height.Value < 11.0) CompileOutputRow.Height = new GridLength(200.0);
+ Dispatcher.Invoke(() =>
+ {
+ if (OvertakeOutString)
+ CompileOutput.AppendText(stringOutput.ToString());
+ else
+ CompileOutput.Text = stringOutput.ToString();
+ if (CompileOutputRow.Height.Value < 11.0) CompileOutputRow.Height = new GridLength(200.0);
+ });
}
}
}
@@ -297,8 +322,11 @@ private void FTPUpload_Plugins()
}
stringOutput.AppendLine(Program.Translations.GetLanguage("Done"));
- CompileOutput.Text = stringOutput.ToString();
- if (CompileOutputRow.Height.Value < 11.0) CompileOutputRow.Height = new GridLength(200.0);
+ Dispatcher.Invoke(() =>
+ {
+ CompileOutput.Text = stringOutput.ToString();
+ if (CompileOutputRow.Height.Value < 11.0) CompileOutputRow.Height = new GridLength(200.0);
+ });
}
private void Server_Start()
diff --git a/UI/MainWindowServerQuery.cs b/UI/MainWindowServerQuery.cs
index 13f6c6c8..a73055d7 100644
--- a/UI/MainWindowServerQuery.cs
+++ b/UI/MainWindowServerQuery.cs
@@ -1,108 +1,96 @@
using System;
using System.Text;
-using System.Windows;
using System.Threading.Tasks;
-using Spedit.Interop;
+using System.Windows;
using QueryMaster;
-namespace Spedit.UI
+namespace Spcode.UI
{
public partial class MainWindow
{
private void Server_Query()
{
- Config c = Program.Configs[Program.SelectedConfig];
- if (string.IsNullOrWhiteSpace(c.RConIP) || string.IsNullOrWhiteSpace(c.RConCommands))
- { return; }
- StringBuilder stringOutput = new StringBuilder();
+ var c = Program.Configs[Program.SelectedConfig];
+ if (string.IsNullOrWhiteSpace(c.RConIP) || string.IsNullOrWhiteSpace(c.RConCommands)) return;
+ var stringOutput = new StringBuilder();
try
{
- EngineType type = EngineType.GoldSource;
- if (c.RConUseSourceEngine)
- {
- type = EngineType.Source;
- }
- using (Server server = ServerQuery.GetServerInstance(type, c.RConIP, c.RConPort, null))
+ var type = EngineType.GoldSource;
+ if (c.RConUseSourceEngine) type = EngineType.Source;
+ using (var server = ServerQuery.GetServerInstance(type, c.RConIP, c.RConPort, null))
{
var serverInfo = server.GetInfo();
stringOutput.AppendLine(serverInfo.Name);
using (var rcon = server.GetControl(c.RConPassword))
{
- string[] cmds = ReplaceRconCMDVariables(c.RConCommands).Split('\n');
+ var cmds = ReplaceRconCMDVariables(c.RConCommands).Split('\n');
foreach (var cmd in cmds)
{
- Task t = Task.Run(() =>
+ var t = Task.Run(() =>
{
- string command = (cmd.Trim('\r')).Trim();
+ var command = cmd.Trim('\r').Trim();
if (!string.IsNullOrWhiteSpace(command))
- {
stringOutput.AppendLine(rcon.SendCommand(command));
- }
});
t.Wait();
}
}
}
+
stringOutput.AppendLine("Done");
}
catch (Exception e)
{
stringOutput.AppendLine("Error: " + e.Message);
}
- CompileOutput.Text = stringOutput.ToString();
- if (CompileOutputRow.Height.Value < 11.0)
+
+ Dispatcher.Invoke(() =>
{
- CompileOutputRow.Height = new GridLength(200.0);
- }
+ CompileOutput.Text = stringOutput.ToString();
+ if (CompileOutputRow.Height.Value < 11.0) CompileOutputRow.Height = new GridLength(200.0);
+ });
}
private string ReplaceRconCMDVariables(string input)
{
- if (compiledFileNames.Count < 1)
- { return input; }
+ if (compiledFileNames.Count < 1) return input;
if (input.IndexOf("{plugins_reload}", StringComparison.Ordinal) >= 0)
{
- StringBuilder replacement = new StringBuilder();
+ var replacement = new StringBuilder();
replacement.AppendLine();
foreach (var fileName in compiledFileNames)
- {
replacement.Append("sm plugins reload " + StripSMXPostFix(fileName) + ";");
- }
replacement.AppendLine();
input = input.Replace("{plugins_reload}", replacement.ToString());
}
+
if (input.IndexOf("{plugins_load}", StringComparison.Ordinal) >= 0)
{
- StringBuilder replacement = new StringBuilder();
+ var replacement = new StringBuilder();
replacement.AppendLine();
foreach (var fileName in compiledFileNames)
- {
replacement.Append("sm plugins load " + StripSMXPostFix(fileName) + ";");
- }
replacement.AppendLine();
input = input.Replace("{plugins_load}", replacement.ToString());
}
+
if (input.IndexOf("{plugins_unload}", StringComparison.Ordinal) >= 0)
{
- StringBuilder replacement = new StringBuilder();
+ var replacement = new StringBuilder();
replacement.AppendLine();
foreach (var fileName in compiledFileNames)
- {
replacement.Append("sm plugins unload " + StripSMXPostFix(fileName) + ";");
- }
replacement.AppendLine();
input = input.Replace("{plugins_unload}", replacement.ToString());
}
+
return input;
}
private string StripSMXPostFix(string fileName)
{
- if (fileName.EndsWith(".smx"))
- {
- return fileName.Substring(0, fileName.Length - 4);
- }
+ if (fileName.EndsWith(".smx")) return fileName.Substring(0, fileName.Length - 4);
return fileName;
}
}
-}
+}
\ No newline at end of file
diff --git a/UI/MainWindowTranslations.cs b/UI/MainWindowTranslations.cs
index e4a9b936..6208e311 100644
--- a/UI/MainWindowTranslations.cs
+++ b/UI/MainWindowTranslations.cs
@@ -1,8 +1,8 @@
-using Spedit.UI.Components;
+using Spcode.UI.Components;
using System.Windows.Controls;
using System.Collections.ObjectModel;
-namespace Spedit.UI
+namespace Spcode.UI
{
public partial class MainWindow
{
diff --git a/UI/STheme/SMetroTheme.cs b/UI/STheme/SMetroTheme.cs
index e5366783..254dee0d 100644
--- a/UI/STheme/SMetroTheme.cs
+++ b/UI/STheme/SMetroTheme.cs
@@ -21,14 +21,14 @@ This program is provided to you under the terms of the New BSD
using Xceed.Wpf.AvalonDock.Themes;
using System.Windows;
-namespace Spedit.UI.STheme
+namespace Spcode.UI.STheme
{
public class SMetroTheme : Theme
{
public override Uri GetResourceUri()
{
return new Uri(
- "/Spedit;component/ui/stheme/stheme.xaml",
+ "/Spcode;component/ui/stheme/stheme.xaml",
UriKind.Relative);
}
}
diff --git a/UI/Windows/AboutWindow.xaml b/UI/Windows/AboutWindow.xaml
index b51b70c1..6c5385e5 100644
--- a/UI/Windows/AboutWindow.xaml
+++ b/UI/Windows/AboutWindow.xaml
@@ -1,4 +1,4 @@
-
-
+
@@ -80,7 +80,7 @@
-
+
@@ -97,7 +97,7 @@
-
+
@@ -114,7 +114,7 @@
-
+
@@ -131,7 +131,7 @@
-
+
@@ -148,7 +148,7 @@
-
+
@@ -162,7 +162,7 @@
-
+
@@ -179,7 +179,7 @@
-
+
diff --git a/UI/Windows/AboutWindow.xaml.cs b/UI/Windows/AboutWindow.xaml.cs
index 98e8fefa..30247139 100644
--- a/UI/Windows/AboutWindow.xaml.cs
+++ b/UI/Windows/AboutWindow.xaml.cs
@@ -6,7 +6,7 @@
using System.Windows.Navigation;
using MahApps.Metro;
-namespace Spedit.UI.Windows
+namespace Spcode.UI.Windows
{
///
/// Interaction logic for AboutWindow.xaml
@@ -31,7 +31,7 @@ public AboutWindow()
g.Background = gridBrush;
}
}
- TitleBox.Text = $"SPEdit ({Assembly.GetEntryAssembly()?.GetName().Version}) - {Program.Translations.GetLanguage("SPEditCap")}";
+ TitleBox.Text = $"SPCode ({Assembly.GetEntryAssembly()?.GetName().Version}) - {Program.Translations.GetLanguage("SPEditCap")}";
LicenseField.Text = LicenseString;
}
diff --git a/UI/Windows/ConfigWindow.xaml b/UI/Windows/ConfigWindow.xaml
index eada3013..69925ab3 100644
--- a/UI/Windows/ConfigWindow.xaml
+++ b/UI/Windows/ConfigWindow.xaml
@@ -1,4 +1,4 @@
-
/// Interaction logic for AboutWindow.xaml
diff --git a/UI/Windows/NewFileWindow.xaml b/UI/Windows/NewFileWindow.xaml
index 05c1998e..e69e0986 100644
--- a/UI/Windows/NewFileWindow.xaml
+++ b/UI/Windows/NewFileWindow.xaml
@@ -1,4 +1,4 @@
-
/// Interaction logic for AboutWindow.xaml
diff --git a/UI/Windows/OptionsWindow.xaml b/UI/Windows/OptionsWindow.xaml
index f52be9c3..3694bb85 100644
--- a/UI/Windows/OptionsWindow.xaml
+++ b/UI/Windows/OptionsWindow.xaml
@@ -1,6 +1,6 @@
-
/// Interaction logic for AboutWindow.xaml
diff --git a/UI/Windows/OptionsWindowHighlighting.cs b/UI/Windows/OptionsWindowHighlighting.cs
index 8f6504e1..b023caa2 100644
--- a/UI/Windows/OptionsWindowHighlighting.cs
+++ b/UI/Windows/OptionsWindowHighlighting.cs
@@ -1,6 +1,6 @@
using System.Windows;
-namespace Spedit.UI.Windows
+namespace Spcode.UI.Windows
{
public partial class OptionsWindow
{
diff --git a/UI/Windows/SPDefinitionWindow.xaml b/UI/Windows/SPDefinitionWindow.xaml
index ad4801db..8cb20379 100644
--- a/UI/Windows/SPDefinitionWindow.xaml
+++ b/UI/Windows/SPDefinitionWindow.xaml
@@ -1,4 +1,4 @@
-
/// Interaction logic for AboutWindow.xaml
diff --git a/UpdaterTest/Program.cs b/UpdaterTest/Program.cs
new file mode 100644
index 00000000..f1789c98
--- /dev/null
+++ b/UpdaterTest/Program.cs
@@ -0,0 +1,87 @@
+using System;
+using System.IO;
+using System.IO.Compression;
+using System.Linq;
+using System.Net;
+using System.Net.Http;
+using System.Threading.Tasks;
+using Octokit;
+
+namespace UpdaterTest
+{
+ internal static class Program
+ {
+ private const string CurrentVersion = "1.3.5.0";
+
+ public static async Task Main(string[] args)
+ {
+ var lat = await GetLatest();
+ var release = lat.Assets.First(e => e.Name == "SPCode.Portable.zip");
+ Console.WriteLine(release.Id);
+ Console.WriteLine(release.Label);
+ Console.WriteLine(release.Name);
+ Console.WriteLine(release.ContentType);
+ }
+
+ private static async Task Check()
+ {
+ try
+ {
+ var latestVer = await GetLatest();
+ var release = latestVer.Assets.First(e => e.Name == "SPCode.Portable.zip");
+ Console.WriteLine(release.BrowserDownloadUrl);
+
+ using (var client = new WebClient())
+ {
+ client.DownloadFile(release.BrowserDownloadUrl, "Update.zip");
+ }
+ }
+ catch (HttpRequestException)
+ {
+ Console.WriteLine("Couldnt look for an update");
+ return;
+ }
+
+ Directory.CreateDirectory("Update");
+ var zip = ZipFile.OpenRead("Update.zip");
+
+ // Dont override the sourcemod files
+ var files = zip.Entries.Where(e => !e.FullName.StartsWith(@"sourcepawn\"));
+ foreach (var file in files) file.ExtractToFile("Update/" + file.FullName, true);
+ }
+ /*
+ * 0 -> Major
+ * 1 -> Minor
+ * 2 -> Build
+ * 3 -> Revision
+ */
+ private static bool IsUpToDate(string current, string latest)
+ {
+ var currentSplit = current.Split('.').Select(int.Parse).ToList();
+ var latestSplit = latest.Split('.').Select(int.Parse).ToList();
+
+ if (currentSplit.Count != 4)
+ throw new ArgumentException("Invalid current version string", nameof(current));
+
+ if (currentSplit.Count != 4)
+ throw new ArgumentException("Invalid latest version string", nameof(latest));
+
+ for (var i = 0; i < currentSplit.Count; i++)
+ {
+ if (latestSplit[i] > currentSplit[i])
+ return false;
+ if (latestSplit[i] < currentSplit[i])
+ return true;
+ }
+
+ return true;
+ }
+
+ private static async Task GetLatest()
+ {
+ var client = new GitHubClient(new ProductHeaderValue("spcode-client"));
+ var releases = await client.Repository.Release.GetAll("Hexer10", "Spcode");
+ return releases[0];
+ }
+ }
+}
\ No newline at end of file
diff --git a/UpdaterTest/Properties/AssemblyInfo.cs b/UpdaterTest/Properties/AssemblyInfo.cs
new file mode 100644
index 00000000..a87fdf66
--- /dev/null
+++ b/UpdaterTest/Properties/AssemblyInfo.cs
@@ -0,0 +1,35 @@
+using System.Reflection;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("UpdaterTest")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("UpdaterTest")]
+[assembly: AssemblyCopyright("Copyright © 2020")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("9A405E24-7626-4382-BB49-1F59B72C4970")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
\ No newline at end of file
diff --git a/UpdaterTest/UpdaterTest.csproj b/UpdaterTest/UpdaterTest.csproj
new file mode 100644
index 00000000..8bfeb01f
--- /dev/null
+++ b/UpdaterTest/UpdaterTest.csproj
@@ -0,0 +1,71 @@
+
+
+
+
+ Debug
+ AnyCPU
+ {9A405E24-7626-4382-BB49-1F59B72C4970}
+ Exe
+ Properties
+ UpdaterTest
+ UpdaterTest
+ v4.8
+ 512
+
+
+ AnyCPU
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+
+
+ AnyCPU
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+
+
+
+
+ ..\packages\Octokit.0.46.0\lib\net46\Octokit.dll
+ True
+
+
+
+
+
+ C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.IO.Compression\v4.0_4.0.0.0__b77a5c561934e089\System.IO.Compression.dll
+
+
+ C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.IO.Compression.FileSystem\v4.0_4.0.0.0__b77a5c561934e089\System.IO.Compression.FileSystem.dll
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/UpdaterTest/packages.config b/UpdaterTest/packages.config
new file mode 100644
index 00000000..c4ff5b79
--- /dev/null
+++ b/UpdaterTest/packages.config
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/UpdaterTest/readme.md b/UpdaterTest/readme.md
new file mode 100644
index 00000000..da1257b4
--- /dev/null
+++ b/UpdaterTest/readme.md
@@ -0,0 +1,2 @@
+# UpdaterTest
+Just a package to debug how to autoupdater works, can be ignored if you are trying only to compile Spedit.
\ No newline at end of file
diff --git a/Utils/FTP.cs b/Utils/FTP.cs
index 97410a52..c8c79019 100644
--- a/Utils/FTP.cs
+++ b/Utils/FTP.cs
@@ -3,7 +3,7 @@
using System.Net;
using Renci.SshNet;
-namespace Spedit.Utils
+namespace Spcode.Utils
{
public class FTP
{
diff --git a/Utils/ManagedAES.cs b/Utils/ManagedAES.cs
index 1e3e4b5a..2c37c244 100644
--- a/Utils/ManagedAES.cs
+++ b/Utils/ManagedAES.cs
@@ -4,7 +4,7 @@
using System.Security.Cryptography;
using System.Text;
-namespace Spedit.Utils
+namespace Spcode.Utils
{
public static class ManagedAES
{
diff --git a/Utils/SPSyntaxTidy/SPSyntaxTidy.cs b/Utils/SPSyntaxTidy/SPSyntaxTidy.cs
index f8ceba66..70604571 100644
--- a/Utils/SPSyntaxTidy/SPSyntaxTidy.cs
+++ b/Utils/SPSyntaxTidy/SPSyntaxTidy.cs
@@ -1,6 +1,6 @@
using System.Text;
-namespace Spedit.Utils.SPSyntaxTidy
+namespace Spcode.Utils.SPSyntaxTidy
{
public static class SPSyntaxTidy
{
diff --git a/Utils/SPSyntaxTidy/SPTokenizer.cs b/Utils/SPSyntaxTidy/SPTokenizer.cs
index 36c725ca..7a60b6a1 100644
--- a/Utils/SPSyntaxTidy/SPTokenizer.cs
+++ b/Utils/SPSyntaxTidy/SPTokenizer.cs
@@ -1,7 +1,7 @@
using System;
using System.Collections.Generic;
-namespace Spedit.Utils.SPSyntaxTidy
+namespace Spcode.Utils.SPSyntaxTidy
{
public static class SPTokenizer
{
diff --git a/app.config b/app.config
index 51278a45..3e0e37cf 100644
--- a/app.config
+++ b/app.config
@@ -1,3 +1,3 @@
-
+
diff --git a/packages.config b/packages.config
index 5f29b529..8e8d68e1 100644
--- a/packages.config
+++ b/packages.config
@@ -6,5 +6,6 @@
+
\ No newline at end of file