Skip to content

Commit

Permalink
Update docs and installation method
Browse files Browse the repository at this point in the history
  • Loading branch information
erri120 committed Jun 4, 2024
1 parent 9b1411b commit 95782f5
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 45 deletions.
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
INSTALLATION_METHOD_ARCHIVE: App should have been installed via archive.
INSTALLATION_METHOD_INNO_SETUP: Installed via InnoSetup (Windows)
INSTALLATION_METHOD_FLATPAK: Installed via Flatpak (Linux)
INSTALLATION_METHOD_PACKAGE_MANAGER: Installed with a package manager.
INSTALLATION_METHOD_APPIMAGE: Running via AppImage (Linux)
________________
Expand Down
41 changes: 18 additions & 23 deletions docs/Contributing.md
Original file line number Diff line number Diff line change
@@ -1,33 +1,28 @@
!!! info "Describes how to compile and run the Nexus Mods App."
## Code Contributions

The Nexus Mods App is programmed in C# with latest .NET Runtime. Setup should be easy.
### Prerequisites

- The latest version of the [.NET SDK](https://dotnet.microsoft.com/en-us/download/dotnet/8.0).
- An IDE:
- [JetBrains Rider](https://www.jetbrains.com/rider/) and the [Avalonia Rider Extension](https://plugins.jetbrains.com/plugin/14839-avaloniarider),
- [Visual Studio](https://visualstudio.microsoft.com/downloads/) and the [Avalonia Visual Studio Extension](https://marketplace.visualstudio.com/items?itemName=AvaloniaTeam.AvaloniaVS).

## Prerequisites

- Download the Latest [.NET SDK](https://dotnet.microsoft.com/en-us/download/dotnet/8.0).
- Download an IDE, recommended options below:
- [Visual Studio](https://visualstudio.microsoft.com/downloads/)
- [JetBrains Rider](https://www.jetbrains.com/rider/)

Our development team uses Rider; however, Visual Studio is a great free offering on Windows.
Other code editors, like [VS Code](https://code.visualstudio.com/), may work for you with [extensions](https://marketplace.visualstudio.com/items?itemName=ms-dotnettools.csdevkit);
however, they may be a bit more complicated to use.

That's all. Open the project (`.sln`), build, and you're done.
There are also some [Item Templates](https://github.com/AvaloniaUI/avalonia-dotnet-templates) for Avalonia that can be very useful to have,
helping you make things like new 'Windows' and 'Controls' easier.

## Tools for UI Development
### Writing code

Visual Studio and JetBrains Rider both have avalonia extensions that allow previewing ui designs (`.axaml` files).
Make sure to follow our [Development Guidelines](./development-guidelines/UICodingGuidelines.md).

- [Visual Studio Extension](https://marketplace.visualstudio.com/items?itemName=AvaloniaTeam.AvaloniaVS)
- [Rider Extension](https://plugins.jetbrains.com/plugin/14839-avaloniarider)
## Translations

You can install via the web or from inside the IDE extension managers themselves.
Translations are currently handled via the IDE. See [this issue](https://github.com/Nexus-Mods/NexusMods.App/issues/598) for more details.

There are also some [Item Templates](https://github.com/AvaloniaUI/avalonia-dotnet-templates) for Avalonia that can be very useful to have,
helping you make things like new 'Windows' and 'Controls' easier.
## For Package Maintainers

## Code Guidelines
If you want to create a package for your distribution, here are some helpful tips to get started:

Have a look inside [Development Guidelines](./development-guidelines/DependencyInjection.md) 😉.
- If possible, use `nexusmods-app` for the package name.
- We ship a build of `7zz` and use that executable unless you set `NEXUSMODS_APP_USE_SYSTEM_EXTRACTOR=1` when publishing. See [this issue](https://github.com/Nexus-Mods/NexusMods.App/issues/1306#issuecomment-2095755699) for details.
- Set `INSTALLATION_METHOD_PACKAGE_MANAGER` when publishing. We have an integrated updater that will notify users about new versions. If you set this flag, we'll tell the user to update with their package manager.
- Let us know if you have questions or if you published a new package by joining our Discord.
2 changes: 1 addition & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ You can download the AppImage file `NexusMods.App.x86_64.AppImage` from the [lat

#### System Package Manager

This page will be updated with [Repology](https://repology.org/) once packages start appearing. If you're want to create a package for a platform, see [Contributing](./Contributing.md) for more details.
This page will be updated with [Repology](https://repology.org/) once packages start appearing. If you're want to create a package for a platform, see [Contributing](./Contributing.md#for-package-maintainers) for more details.

### macOS

Expand Down
18 changes: 9 additions & 9 deletions src/NexusMods.App.BuildInfo/CompileConstants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ public static class CompileConstants
InstallationMethod.Archive;
#elif INSTALLATION_METHOD_APPIMAGE
InstallationMethod.AppImage;
#elif INSTALLATION_METHOD_FLATPAK
InstallationMethod.Flatpak;
#elif INSTALLATION_METHOD_PACKAGE_MANAGER
InstallationMethod.PackageManager;
#elif INSTALLATION_METHOD_INNO_SETUP
InstallationMethod.InnoSetup;
#else
Expand All @@ -41,27 +41,27 @@ public static class CompileConstants
public enum InstallationMethod
{
/// <summary>
/// Manual.
/// Manual installation, or from source. This is the default value.
/// </summary>
Manually = 0,

/// <summary>
/// Via the archive.
/// The App was packaged into an archive.
/// </summary>
Archive,

/// <summary>
/// Via the AppImage.
/// The App was packaged into an AppImage.
/// </summary>
AppImage,

/// <summary>
/// Via the Flatpak.
/// The App was installed using a package manager.
/// </summary>
Flatpak,
PackageManager,

/// <summary>
/// Via the Inno Setup.
/// The App was installed using the InnoSetup.
/// </summary>
InnoSetup
InnoSetup,
}
20 changes: 9 additions & 11 deletions src/NexusMods.App.UI/Overlays/Updater/UpdaterViewModel.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Runtime.InteropServices;
using System.Text.Json;
using System.Text.Json.Serialization;
using System.Windows.Input;
Expand Down Expand Up @@ -100,12 +99,13 @@ public async Task<bool> ShouldShow()
_logger.LogInformation("New version available: {Version}", latestRelease.Version);

var asset = FindAsset(latestRelease);
if (asset is null) return false;

_logger.LogInformation("Asset found: {Asset}", asset.Name);
UpdateUrl = asset.BrowserDownloadUrl;
NewVersion = latestRelease.Version;

if (Method is InstallationMethod.AppImage or InstallationMethod.Flatpak)
if (Method is InstallationMethod.AppImage or InstallationMethod.PackageManager)
{
ShowSystemUpdateMessage = true;
}
Expand All @@ -120,24 +120,22 @@ public async Task<bool> ShouldShow()

}

private Asset FindAsset(Release latestRelease)
private Asset? FindAsset(Release latestRelease)
{
switch (Method)
{
case InstallationMethod.Flatpak:
throw new UnreachableException("Flatpak is not supported yet");
case InstallationMethod.InnoSetup:
return latestRelease.Assets.First(r => r.Name.EndsWith(".exe"));
return latestRelease.Assets.FirstOrDefault(r => r.Name.EndsWith(".exe"));
case InstallationMethod.Archive when RuntimeInformation.IsOSPlatform(OSPlatform.Windows) &&
RuntimeInformation.OSArchitecture == Architecture.X64:
return latestRelease.Assets.First(r => r.Name.EndsWith(".win-x64.zip"));
return latestRelease.Assets.FirstOrDefault(r => r.Name.EndsWith(".win-x64.zip"));
case InstallationMethod.Archive when RuntimeInformation.IsOSPlatform(OSPlatform.Linux) &&
RuntimeInformation.OSArchitecture == Architecture.X64:
return latestRelease.Assets.First(r => r.Name.EndsWith(".linux-x64.zip"));
return latestRelease.Assets.FirstOrDefault(r => r.Name.EndsWith(".linux-x64.zip"));
case InstallationMethod.AppImage:
return latestRelease.Assets.First(r => r.Name.EndsWith(".AppImage"));
return latestRelease.Assets.FirstOrDefault(r => r.Name.EndsWith(".AppImage"));
default:
throw new UnreachableException("Unsupported installation method");
return null;
}
}

Expand Down

0 comments on commit 95782f5

Please sign in to comment.