Skip to content

Commit

Permalink
https issue fix (#4)
Browse files Browse the repository at this point in the history
* 0.4.0-dev1

- Updated workflows
- Updated logger
- Implemented CurlWrapper. CurlWrapper is a CURL wrapper that allows you to download files from https sites. This is important for Windows XP, Server 2003, as these operating systems do not have their native full TLS 1.2 implementation.
- Updated copyright and added some warnings (or TODOs)
- Add custom event when pressed ctrl + c key
- Updated readme.md

This build was tested on Windows XP Professional x64 edition. Should also work on Windows Server 2003 x86/x64 and on Windows XP x86
  • Loading branch information
nixxoq authored Jul 27, 2024
1 parent d5590a0 commit f89d482
Show file tree
Hide file tree
Showing 15 changed files with 400 additions and 109 deletions.
135 changes: 91 additions & 44 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,61 +1,108 @@
name: Build on push to development
name: Build xp-apps and components

on:
push:
branches:
- development
- https-issue

jobs:
build_debug:
runs-on: windows-2019

steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Checkout code
uses: actions/checkout@v4
with:
ref: 'https-issue'

- name: setup-msbuild
uses: microsoft/setup-msbuild@v2

- name: Restore dependencies
run: nuget restore

- name: Build Debug (any cpu)
run: msbuild /t:Build /p:Configuration=Debug /p:Platform="Any CPU"

- name: Publish Debug any cpu artifacts
uses: actions/upload-artifact@v4
with:
name: Debug
path: |
bin\Debug\DotNetZip.dll
bin\Debug\Newtonsoft.Json.dll
bin\Debug\xp-apps.exe
bin\Debug\Updater.exe
bin\Debug\NLog.dll
- name: setup-msbuild
uses: microsoft/setup-msbuild@v2

- name: Restore dependencies
run: nuget restore

- name: Build Debug (any cpu)
run: msbuild /t:Build /p:Configuration=Debug /p:Platform="Any CPU"

- name: Create output directory
run: mkdir xp-apps\Debug

- name: Install 7-Zip
run: |
choco install 7zip -y
Import-Module $env:ChocolateyInstall\helpers\chocolateyProfile.psm1
RefreshEnv
- name: Download and unpack curl
run: |
Invoke-WebRequest -Uri "https://winampplugins.co.uk/curl/curl_7_46_0_openssl_nghttp2_x86.7z" -OutFile "curl.7z"
7z x -o"curl_temp" curl.7z
mkdir xp-apps\Debug\curl
move curl_temp\curl.exe xp-apps\Debug\curl\
move curl_temp\ca-bundle.crt xp-apps\Debug\curl\
Remove-Item -Recurse -Force curl_temp
- name: Copy Debug artifacts
run: |
xcopy bin\Debug\*.dll xp-apps\Debug /Y
xcopy bin\Debug\xp-apps.exe xp-apps\Debug /Y
xcopy Updater\bin\Debug\*.dll xp-apps\Debug /Y
xcopy Updater\bin\Debug\Updater.exe xp-apps\Debug /Y
- name: Publish Debug any cpu artifacts
uses: actions/upload-artifact@v4
with:
name: Debug
path: xp-apps\Debug

build_release:
runs-on: windows-2019

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: setup-msbuild
uses: microsoft/setup-msbuild@v2
- name: Checkout code
uses: actions/checkout@v4
with:
ref: 'https-issue'

- name: Restore dependencies
run: nuget restore

- name: Build Release (any cpu)
run: msbuild /t:Build /p:Configuration=Release /p:Platform="Any CPU"

- name: Publish Release any cpu artifacts
uses: actions/upload-artifact@v4
with:
name: Release
path: |
bin\Release\DotNetZip.dll
bin\Release\Newtonsoft.Json.dll
bin\Release\xp-apps.exe
bin\Release\Updater.exe
bin\Release\NLog.dll
- name: setup-msbuild
uses: microsoft/setup-msbuild@v2

- name: Restore dependencies
run: nuget restore

- name: Build Release (any cpu)
run: msbuild /t:Build /p:Configuration=Release /p:Platform="Any CPU"

- name: Create output directory
run: mkdir xp-apps\Release

- name: Install 7-Zip
run: |
choco install 7zip -y
Import-Module $env:ChocolateyInstall\helpers\chocolateyProfile.psm1
RefreshEnv
- name: Download and unpack curl
run: |
Invoke-WebRequest -Uri "https://winampplugins.co.uk/curl/curl_7_46_0_openssl_nghttp2_x86.7z" -OutFile "curl.7z"
7z x -o"curl_temp" curl.7z
mkdir xp-apps\Release\curl
move curl_temp\curl.exe xp-apps\Release\curl\
move curl_temp\ca-bundle.crt xp-apps\Release\curl\
Remove-Item -Recurse -Force curl_temp
- name: Copy Release artifacts
run: |
xcopy bin\Release\*.dll xp-apps\Release /Y
xcopy bin\Release\xp-apps.exe xp-apps\Release /Y
xcopy Updater\bin\Release\*.dll xp-apps\Release /Y
xcopy Updater\bin\Release\Updater.exe xp-apps\Release /Y
- name: Publish Release any cpu artifacts
uses: actions/upload-artifact@v4
with:
name: Release
path: xp-apps\Release
1 change: 0 additions & 1 deletion LATEST_RELEASE

This file was deleted.

48 changes: 31 additions & 17 deletions Program.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using System;
using System.Net;
using System.Diagnostics;
using System.Threading;
using xp_apps.sources;

Expand All @@ -9,26 +9,25 @@ public static class Program
{
public static void Main()
{
SimpleLogger.SetupLog();
SimpleLogger.SetupLog("xp-apps");

#if DEBUG
SimpleLogger.Logger.Debug(
$"Current architecture: {Helper.OsArchitecture} | Current OS: {Environment.OSVersion}");
var args = MainScreen.GetCommandArgs()?.Length > 0
? string.Join(" ", MainScreen.GetCommandArgs())
var args = Helper.GetCommandArgs()?.Length > 0
? string.Join(" ", Helper.GetCommandArgs())
: "No additional arguments";
SimpleLogger.Logger.Debug($"Used command-line arguments: {args}");
#endif

ServicePointManager.Expect100Continue = true;
ServicePointManager.SecurityProtocol = (SecurityProtocolType)3072;

Console.CancelKeyPress += OnExit;

if (Convert.ToBoolean(Updater.CheckForUpdates()))
{
Console.WriteLine(
"A new version of the program is available.\nIf you want to update, please run \"xp-apps --self-update\".");
Thread.Sleep(2000);
}

// Cache.FetchLatestVersion();
// Checks if current operating system is Windows XP (NT 5.1 & NT 5.2)
// However, I am thinking about adding support for Windows Vista when the One-Core-API 4.1.0 will be released 👀
Expand All @@ -42,16 +41,31 @@ public static void Main()

// Checks if .NET Framework 4.5 or newer is installed
// Its need for TLS 1.2 protocol
if (!MainScreen.IsDotNet45OrNewer())
{
Console.WriteLine(
"This program works only with installed .NET Framework 4.0 and 4.5+\nMake sure you have installed the One-Core-API before installing .NET Framework 4.5+!");
Console.WriteLine("Press any key to exit...");
Console.ReadLine();
return;
}
// if (!MainScreen.IsDotNet45OrNewer())
// {
// Console.WriteLine(
// "This program works only with installed .NET Framework 4.0 and 4.5+\nMake sure you have installed the One-Core-API before installing .NET Framework 4.5+!");
// Console.WriteLine("Press any key to exit...");
// Console.ReadLine();
// return;
// }

MainScreen.ParseArgs();
MainScreen.ParseArgs();
}

private static void OnExit(object sender, ConsoleCancelEventArgs e)
{
Console.WriteLine("\nctrl + c key detected, exiting...");

Process.Start(new ProcessStartInfo
{
FileName = "taskkill",
Arguments = "/f /im curl.exe",
CreateNoWindow = true,
UseShellExecute = false
});

Environment.Exit(0);
}
}
}
10 changes: 5 additions & 5 deletions Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("xp-apps")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyDescription("A package manager for Windows XP.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("xp-apps")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCopyright("Copyright © nixxoq 2024")]
[assembly: AssemblyTrademark("nixxoq")]
[assembly: AssemblyCulture("")]

// Setting ComVisible to false makes the types in this assembly not visible
Expand All @@ -31,5 +31,5 @@
// 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("0.2.0.0")]
[assembly: AssemblyFileVersion("0.2.0-dev2")]
[assembly: AssemblyVersion("0.3.0.0")]
[assembly: AssemblyFileVersion("0.3.0-dev1")]
21 changes: 17 additions & 4 deletions Readme.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,30 @@
## xp-apps

> [!IMPORTANT]
> This is the development build of xp-apps.
> This is the development build of xp-apps.
> If you want to download the development build, go to the [actions](https://github.com/nixxoq/xp-apps/actions)
>
> Otherwise, go to [main](https://github.com/nixxoq/xp-apps/tree/main) branch to view the old README and other files
<!-- A repository with applications that work with One-Core-API -->
### Package manager for Windows XP with modern applications that work with One-Core-API
### A Package manager for Windows XP

### TODO:

- [ ] Implement Updater
### xp-apps

- [ ] Finalize update process
- [ ] Implement custom-user repositories
- [ ] Base
- [ ] Option to disable or enable custom repositories
- [ ] Update repositories (update command)
- [x] [Partially] If any download link uses the https protocol, the program should use CurlWrapper instead of
WebClient()
- [ ] Commands:
- [ ] Finalize self-update command
- [ ] Automatic installation - Automatic Installation (idk, maybe there will be an additional parameter in JSON
file, where there will be a list of commands to be executed).
- [ ] Update command (Update repositories)
- [ ] clear-cache
- [ ] download (download only package)

### If you found a bug, please create new issue. Thank you!
2 changes: 2 additions & 0 deletions Updater/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ private static void Main(string[] args)
{
Thread.Sleep(2000);

#warning TODO: Reimplement using http or CurlWrapper (if data.nixxoq.xyz is not available)
using (var client = new WebClient())
{
client.DownloadFile(sources.Updater.LatestReleaseZip, "xp-apps.zip");
Expand All @@ -22,6 +23,7 @@ private static void Main(string[] args)
foreach (var file in zipFile) file.Extract(".", ExtractExistingFileAction.OverwriteSilently);
}

#warning TODO: Rename original exe file if user changed (why not?)
File.Delete("xp-apps.zip");

Console.WriteLine("Application has been updated successfully. Press any key to exit...");
Expand Down
4 changes: 2 additions & 2 deletions Updater/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("xp_apps.Updater")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCopyright("Copyright © nixxoq 2024")]
[assembly: AssemblyTrademark("nixxoq")]
[assembly: AssemblyCulture("")]

// Setting ComVisible to false makes the types in this assembly not visible
Expand Down
Loading

0 comments on commit f89d482

Please sign in to comment.