Skip to content

Commit

Permalink
Merge pull request #2161 from marticliment/split-into-separate-projects
Browse files Browse the repository at this point in the history
Separate UniGetUI into modules
  • Loading branch information
marticliment authored May 19, 2024
2 parents db6f1bc + 710e41f commit 350bd0b
Show file tree
Hide file tree
Showing 351 changed files with 13,564 additions and 11,421 deletions.
3 changes: 1 addition & 2 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
src/wingetui/choco-cli/** linguist-vendored
src/wingetui/ExternalLibraries/** linguist-vendored
src/UniGetUI.PackageEngine.Managers.Chocolatey/choco-cli/** linguist-vendored
32 changes: 10 additions & 22 deletions .github/workflows/dotnet-desktop.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
name: Build
name: Test and Build

on:
pull_request:
branches: [ "main" ]
workflow_dispatch:


jobs:

build:
runs-on: windows-latest # For a list of available runner types, refer to
# https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idruns-on

steps:
- name: Checkout
- name: Checkout the repository
uses: actions/checkout@v4
with:
fetch-depth: 0
Expand All @@ -24,28 +23,17 @@ jobs:
with:
dotnet-version: 8.0.x

- name: Install winget
- name: Install WinGet
uses: Cyberboss/install-winget@v1


# Add MSBuild to the PATH: https://github.com/microsoft/setup-msbuild
- name: Setup MSBuild.exe
uses: microsoft/[email protected]

# Execute all unit tests in the solution
# - name: Execute unit tests
# run: dotnet test

# Restore the application to populate the obj folder with RuntimeIdentifiers

- name: Setup App Sdk
- name: Run Tests
run: |
cd InstallerExtras
./appsdk.exe
cd src
dotnet test -v q --nologo
cd ..
- name: build and run
- name: Build solution
run: |
mkdir out
msbuild src/UniGetUI.sln /noLogo /property:Configuration=Release /property:Platform=x64 /restore:True /interactive:False /property:OutputPath=.\out
exit $LASTEXITCODE
cd src
dotnet publish -v q UniGetUI.sln /noLogo /restore:True /interactive:False
exit $LASTEXITCODE
15 changes: 14 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,20 @@ src/packages/
src/UniGetUI/bin
src/UniGetUI/obj


src/WindowsPackageManager.Interop/bin
src/WindowsPackageManager.Interop/obj
src/WindowsPackageManager.Interop/out
src/WindowsPackageManager.Interop/outpublish

src/UniGetU*/bin
src/UniGetU*/obj
src/UniGetU*/out
src/UniGetU*/outpublish

src/ExternalLibraries.*/bin
src/ExternalLibraries.*/obj
src/ExternalLibraries.*/out
src/ExternalLibraries.*/outpublish

src/.vs
src/.vscode
Expand Down Expand Up @@ -65,3 +76,5 @@ src/UniGetUI/choco-cli/redirects/cup.exe.ignore
src/UniGetUI/choco-cli/bin/ssh-copy-id.exe
src/UniGetUI/choco-cli/extensions/chocolatey-visualstudio/
src/UniGetUI/choco-cli/extensions/chocolatey-dotnetfx/

*.user
2 changes: 1 addition & 1 deletion WingetUI.iss
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!

#define MyAppVersion "3.1.0-beta"
#define MyAppVersion "3.1.0-alpha"
#define MyAppName "UniGetUI (formerly WingetUI)"
#define MyAppPublisher "Martí Climent"
#define MyAppURL "https://github.com/marticliment/WingetUI"
Expand Down
4 changes: 2 additions & 2 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ To translate WingetUI to other languages or to update an old translation, please
| <img src='https://flagcdn.com/gb.svg' width=20> &nbsp; English - English | 100% | [marticliment](https://github.com/marticliment), [ppvnf](https://github.com/ppvnf) |
| <img src='https://flagcdn.com/es.svg' width=20> &nbsp; Spanish - Castellano | 100% | [apazga](https://github.com/apazga), [dalbitresb12](https://github.com/dalbitresb12), [evaneliasyoung](https://github.com/evaneliasyoung), [guplem](https://github.com/guplem), [JMoreno97](https://github.com/JMoreno97), [marticliment](https://github.com/marticliment), [rubnium](https://github.com/rubnium), [uKER](https://github.com/uKER) |
| <img src='https://flagcdn.com/ir.svg' width=20> &nbsp; Persian - فارسی‎ | 66% | [Imorate](https://github.com/Imorate), [itsarian](https://github.com/itsarian), [Mahdi-Hazrati](https://github.com/Mahdi-Hazrati), [smsi2001](https://github.com/smsi2001) |
| <img src='https://flagcdn.com/fi.svg' width=20> &nbsp; Finnish - Suomi | 43% | [simakuutio](https://github.com/simakuutio) |
| <img src='https://flagcdn.com/fi.svg' width=20> &nbsp; Finnish - Suomi | 50% | [simakuutio](https://github.com/simakuutio) |
| <img src='https://flagcdn.com/fr.svg' width=20> &nbsp; French - Français | 100% | BreatFR, Evans Costa, [PikPakPik](https://github.com/PikPakPik), Rémi Guerrero, [W1L7dev](https://github.com/W1L7dev) |
| <img src='https://flagcdn.com/in.svg' width=20> &nbsp; Hindi - हिंदी | 56% | [atharva_xoxo](https://github.com/atharva_xoxo), [satanarious](https://github.com/satanarious) |
| <img src='https://flagcdn.com/hr.svg' width=20> &nbsp; Croatian - Hrvatski | 60% | Stjepan Treger |
Expand Down Expand Up @@ -156,7 +156,7 @@ To translate WingetUI to other languages or to update an old translation, please
| <img src='https://flagcdn.com/cn.svg' width=20> &nbsp; Simplified Chinese (China) | 100% | Aaron Liu, adfnekc, [arthurfsy2](https://github.com/arthurfsy2), [bai0012](https://github.com/bai0012), BUGP Association, ciaran, CnYeSheng, Cololi, [FloatStream](https://github.com/FloatStream), [SpaceTimee](https://github.com/SpaceTimee), Yisme |
| <img src='https://flagcdn.com/tw.svg' width=20> &nbsp; Traditional Chinese (Taiwan) | 100% | Aaron Liu, CnYeSheng, Cololi, [Henryliu880922](https://github.com/Henryliu880922), [yrctw](https://github.com/yrctw) |

Last updated: Fri May 17 00:11:37 2024
Last updated: Sun May 19 14:36:17 2024
<!-- END Autogenerated translations -->


Expand Down
18 changes: 9 additions & 9 deletions scripts/Languages/LangData.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,29 +9,29 @@
import os
import json

if os.path.exists("../src/UniGetUI/Assets/Data/Contributors.list"):
f = open("../src/UniGetUI/Assets/Data/Contributors.list", "r", encoding="utf-8")
if os.path.exists("../src/UniGetUI.Core.Data/Assets/Data/Contributors.list"):
f = open("../src/UniGetUI.Core.Data/Assets/Data/Contributors.list", "r", encoding="utf-8")
contributors = f.readlines()
else:
print("No contributors file!")
contributors = []

if os.path.exists("../src/UniGetUI/Assets/Data/Translators.json"):
f = open("../src/UniGetUI/Assets/Data/Translators.json", "r", encoding="utf-8")
if os.path.exists("../src/UniGetUI.Core.LanguageEngine/Assets/Data/Translators.json"):
f = open("../src/UniGetUI.Core.LanguageEngine/Assets/Data/Translators.json", "r", encoding="utf-8")
languageCredits = json.load(f)
else:
print("No translators file!")
languageCredits = {}

if os.path.exists("../src/UniGetUI/Assets/Data/TranslatedPercentages.json"):
f = open("../src/UniGetUI/Assets/Data/TranslatedPercentages.json", "r", encoding="utf-8")
if os.path.exists("../src/UniGetUI.Core.LanguageEngine/Assets/Data/TranslatedPercentages.json"):
f = open("../src/UniGetUI.Core.LanguageEngine/Assets/Data/TranslatedPercentages.json", "r", encoding="utf-8")
untranslatedPercentage = json.load(f)
else:
print("No translated percent file!")
untranslatedPercentage = {}

if os.path.exists("../src/UniGetUI/Assets/Data/LanguagesReference.json"):
f = open("../src/UniGetUI/Assets/Data/LanguagesReference.json", "r", encoding="utf-8")
if os.path.exists("../src/UniGetUI.Core.LanguageEngine/Assets/Data/LanguagesReference.json"):
f = open("../src/UniGetUI.Core.LanguageEngine/Assets/Data/LanguagesReference.json", "r", encoding="utf-8")
languageReference = json.load(f)
else:
print("No translated percent file!")
Expand Down Expand Up @@ -88,7 +88,7 @@ def getMarkdownSupportLangs():

dir = os.path.dirname(__file__)
for lang, langName in languageReference.items():
if (not os.path.exists(f"{dir}/../../src/UniGetUI/Assets/Languages/lang_{lang}.json")):
if (not os.path.exists(f"{dir}/../../src/UniGetUI.Core.LanguageEngine/Assets/Languages/lang_{lang}.json")):
continue

perc = untranslatedPercentage[lang] if (lang in untranslatedPercentage) else "100%"
Expand Down
5 changes: 3 additions & 2 deletions scripts/apply_versions.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,15 @@ def fileReplaceLinesWith(filename: str, list: dict[str, str], encoding="utf-8"):
f.write(data)
f.truncate()

fileReplaceLinesWith("src/UniGetUI/Core/Data/Core.cs", {
fileReplaceLinesWith("src/UniGetUI.Core.Data/Core.cs", {
" public static string VersionName = ": f" \"{versionName}\"; // Do not modify this line, use file scripts/apply_versions.py\n",
" public static double VersionNumber = ": f" {versionCode}; // Do not modify this line, use file scripts/apply_versions.py\n",
}, encoding="utf-8-sig")

fileReplaceLinesWith("src/UniGetUI/UniGetUI.csproj", {
fileReplaceLinesWith("src/Solution.props", {
"\t<FileVersion>": f"{versionISS}</FileVersion>\n",
"\t<InformationalVersion>": f"{versionName}</InformationalVersion>\n",
"\t<ApplicationVersion>": f"{versionName}</ApplicationVersion>\n",
}, encoding="utf-8-sig")

fileReplaceLinesWith("WingetUI.iss", {
Expand Down
8 changes: 4 additions & 4 deletions scripts/download_translations.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
print("nocommit")
print(sys.argv[1])

os.chdir(os.path.normpath(os.path.join(root_dir, "src/UniGetUI/Assets/Languages")))
os.chdir(os.path.normpath(os.path.join(root_dir, "src/UniGetUI.Core.LanguageEngine/Assets/Languages")))

print()
print("-------------------------------------------------------")
Expand Down Expand Up @@ -133,13 +133,13 @@
# languageCredits = {json.dumps(langCredits, indent=2, ensure_ascii=False)}
# """

with open(os.path.join(root_dir, "src/UniGetUI/Assets/Data/Translators.json"), "w", encoding="utf-8") as f:
with open(os.path.join(root_dir, "src/UniGetUI.Core.LanguageEngine/Assets/Data/Translators.json"), "w", encoding="utf-8") as f:
f.write(json.dumps(langCredits, indent=2, ensure_ascii=False))

with open(os.path.join(root_dir, "src/UniGetUI/Assets/Data/TranslatedPercentages.json"), "w", encoding="utf-8") as f:
with open(os.path.join(root_dir, "src/UniGetUI.Core.LanguageEngine/Assets/Data/TranslatedPercentages.json"), "w", encoding="utf-8") as f:
f.write(json.dumps(langPerc, indent=2, ensure_ascii=False))

# translations_filepath = os.path.normpath(os.path.join(root_dir, "UniGetUI/Core/Data/Translations.py"))
# translations_filepath = os.path.normpath(os.path.join(root_dir, "UniGetUI.Core.LanguageEngine/Core/Data/Translations.py"))
# with open(translations_filepath, "w", encoding="utf-8") as f:
# f.write(outputString.strip())

Expand Down
2 changes: 1 addition & 1 deletion scripts/generate_json_from_excel.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
try:
workbook = xlrd.open_workbook('screenshot_database.xlsx')
except:
os.system("python -m pip install xlrd==1.2.0")
os.system("python -m pip install xlrd==1.0.0")
import xlrd
workbook = xlrd.open_workbook('screenshot_database.xlsx')

Expand Down
2 changes: 1 addition & 1 deletion scripts/get_contributors.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
# contributorsInfo = {json.dumps(contributorsInfo, indent=2, ensure_ascii=False)}
# """

contributors_filepath = os.path.normpath(os.path.join(root_dir, "src/UniGetUI/Assets/Data/Contributors.list"))
contributors_filepath = os.path.normpath(os.path.join(root_dir, "src/UniGetUI.Core.Data/Assets/Data/Contributors.list"))
with open(contributors_filepath, "w", encoding="utf-8") as f:
f.writelines(contributors)

Expand Down
10 changes: 10 additions & 0 deletions src/ExternalLibraries.Clipboard/ExternalLibraries.Clipboard.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Platforms>AnyCPU;x64;ARM64</Platforms>
</PropertyGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -1,25 +1,10 @@
using System;
using System.ComponentModel;
using System.ComponentModel;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;

namespace UniGetUI.ExternalLibraries.Clipboard
namespace ExternalLibraries.Clipboard
{
public class Main
{
public static string? GetText()
{
return WindowsClipboard.GetText();
}

public static void SetText(string text)
{
WindowsClipboard.SetText(text);
}
}

static class WindowsClipboard
public static class WindowsClipboard
{
const uint cfUnicodeText = 13;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System.Runtime.InteropServices;
using UniGetUI.ExternalLibraries.Pickers.Guids;
using ExternalLibraries.Pickers.Guids;

namespace UniGetUI.ExternalLibraries.Pickers.Classes;
namespace ExternalLibraries.Pickers.Classes;

// ---------------------------------------------------
// .NET classes representing runtime callable wrappers
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System.Runtime.InteropServices;
using UniGetUI.ExternalLibraries.Pickers.Guids;
using ExternalLibraries.Pickers.Guids;

namespace UniGetUI.ExternalLibraries.Pickers.Classes;
namespace ExternalLibraries.Pickers.Classes;

// ---------------------------------------------------
// .NET classes representing runtime callable wrappers
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
using UniGetUI.ExternalLibraries.Pickers.Enums;
using UniGetUI.ExternalLibraries.Pickers.Interfaces;
using UniGetUI.ExternalLibraries.Pickers.Structures;
using System.Collections.Generic;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using ExternalLibraries.Pickers.Enums;
using ExternalLibraries.Pickers.Interfaces;
using ExternalLibraries.Pickers.Structures;

namespace UniGetUI.ExternalLibraries.Pickers.Classes;
namespace ExternalLibraries.Pickers.Classes;

internal static class Helper
{
Expand All @@ -18,24 +18,24 @@ internal static class Helper
/// <returns>Path to selected file, folder or empty string.</returns>
internal static string ShowOpen(nint windowHandle, FOS fos, List<string>? typeFilters = null)
{
var dialog = new FileOpenDialog();
FileOpenDialog dialog = new();
try
{
dialog.SetOptions(fos);

if (typeFilters != null)
{
typeFilters.Insert(0, string.Join("; ", typeFilters));
var filterSpecs = typeFilters.Select(f => new COMDLG_FILTERSPEC(f)).ToArray();
COMDLG_FILTERSPEC[] filterSpecs = typeFilters.Select(f => new COMDLG_FILTERSPEC(f)).ToArray();

dialog.SetFileTypes((uint)filterSpecs.Length, filterSpecs);
}

if (dialog.Show(windowHandle) != 0)
return string.Empty;

dialog.GetResult(out var item);
item.GetDisplayName(SIGDN.SIGDN_FILESYSPATH, out var path);
dialog.GetResult(out IShellItem item);
item.GetDisplayName(SIGDN.SIGDN_FILESYSPATH, out string path);
return path;
}
finally
Expand All @@ -48,14 +48,14 @@ internal static string ShowOpen(nint windowHandle, FOS fos, List<string>? typeFi

internal static string ShowSave(nint windowHandle, FOS fos, List<string>? typeFilters = null, string name = "")
{
var dialog = new FileSaveDialog();
FileSaveDialog dialog = new();
try
{
dialog.SetOptions(fos);

if (typeFilters != null)
{
var filterSpecs = typeFilters.Select(f => new COMDLG_FILTERSPEC(f)).ToArray();
COMDLG_FILTERSPEC[] filterSpecs = typeFilters.Select(f => new COMDLG_FILTERSPEC(f)).ToArray();

dialog.SetFileTypes((uint)filterSpecs.Length, filterSpecs);
}
Expand All @@ -66,8 +66,8 @@ internal static string ShowSave(nint windowHandle, FOS fos, List<string>? typeFi
if (dialog.Show(windowHandle) != 0)
return string.Empty;

dialog.GetResult(out var item);
item.GetDisplayName(SIGDN.SIGDN_FILESYSPATH, out var path);
dialog.GetResult(out IShellItem item);
item.GetDisplayName(SIGDN.SIGDN_FILESYSPATH, out string path);
return path;
}
finally
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace UniGetUI.ExternalLibraries.Pickers.Enums;
namespace ExternalLibraries.Pickers.Enums;

// https://learn.microsoft.com/en-us/windows/win32/api/shobjidl_core/ne-shobjidl_core-fdap
internal enum FDAP
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace UniGetUI.ExternalLibraries.Pickers.Enums;
namespace ExternalLibraries.Pickers.Enums;

// https://learn.microsoft.com/en-us/windows/win32/api/shobjidl_core/ne-shobjidl_core-fde_overwrite_response
internal enum FDE_OVERWRITE_RESPONSE
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace UniGetUI.ExternalLibraries.Pickers.Enums;
namespace ExternalLibraries.Pickers.Enums;

// https://learn.microsoft.com/en-us/windows/win32/api/shobjidl_core/ne-shobjidl_core-fde_shareviolation_response
internal enum FDE_SHAREVIOLATION_RESPONSE
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System;

namespace UniGetUI.ExternalLibraries.Pickers.Enums;
namespace ExternalLibraries.Pickers.Enums;

[Flags]
// https://learn.microsoft.com/ru-ru/windows/win32/api/shobjidl_core/ne-shobjidl_core-_fileopendialogoptions
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace UniGetUI.ExternalLibraries.Pickers.Enums;
namespace ExternalLibraries.Pickers.Enums;

internal enum HRESULT : long
{
Expand Down
Loading

0 comments on commit 350bd0b

Please sign in to comment.