Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
JamDoggie committed May 8, 2022
2 parents 83a24ef + 185b747 commit 3801c44
Show file tree
Hide file tree
Showing 10 changed files with 281 additions and 132 deletions.
43 changes: 35 additions & 8 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,12 @@ jobs:
cp "${{ github.workspace }}/Occlusion Voice Chat_CrossPlatform/linuxdeblibs/SDL2.a" "${{ github.workspace }}/occlusionlinuxrelease/SDL2.a";
cp "${{ github.workspace }}/Occlusion Voice Chat_CrossPlatform/linuxdeblibs/opus.so" "${{ github.workspace }}/occlusionlinuxrelease/opus.so"

- name: Publish the auto updater into the published occlusion directory.
run:
dotnet publish "${{ github.workspace }}\OcclusionAutoUpdater\OcclusionAutoUpdater.csproj" -c "Release" -r linux-x64 -p:PublishSingleFile=false -p:IncludeNativeLibrariesForSelfExtract=false --self-contained false --output "${{ github.workspace }}/occlusionlinuxrelease/autoupdater/"

- name: Zip the published binaries.
uses: master-atul/tar-action@v1.0.2
uses: master-atul/tar-action@v1.1.0
with:
command: c
cwd: '${{ github.workspace }}/'
Expand All @@ -54,23 +58,23 @@ jobs:


build-mac:
# Mac OS 10.15 Catalina
runs-on: macos-10.15
# Mac OS 11 Big Sur
runs-on: macos-11
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- uses: actions/setup-dotnet@v1
with:
dotnet-version: '6.0.x'
dotnet-version: '6.0.202'

- name: Restore Occlusions libraries
run:
dotnet restore "${{ github.workspace }}\Occlusion Voice Chat_CrossPlatform\Occlusion Voice Chat_CrossPlatform.csproj" -r osx-x64

- name: Publish Occlusion to a folder.
run:
dotnet msbuild "${{ github.workspace }}\Occlusion Voice Chat_CrossPlatform\Occlusion Voice Chat_CrossPlatform.csproj" -t:BundleApp -p:UseAppHost=true -p:RuntimeIdentifier=osx-x64 -property:Configuration=Release
dotnet msbuild "${{ github.workspace }}\Occlusion Voice Chat_CrossPlatform\Occlusion Voice Chat_CrossPlatform.csproj" -t:BundleApp -p:PublishSingleFile=true -p:IncludeNativeLibrariesForSelfExtract=true -p:UseAppHost=true -p:RuntimeIdentifier=osx-x64 -property:Configuration=Release

- name: Create publish folder.
run:
Expand All @@ -86,8 +90,25 @@ jobs:
cp "${{ github.workspace }}/Occlusion Voice Chat_CrossPlatform/maclibs/SDL2.a" "${{ github.workspace }}/occlusionmacbuild/Occlusion Voice Chat.app/Contents/MacOS/SDL2.a";
cp "${{ github.workspace }}/Occlusion Voice Chat_CrossPlatform/maclibs/opus.dylib" "${{ github.workspace }}/occlusionmacbuild/Occlusion Voice Chat.app/Contents/MacOS/opus.dylib"

- name: Publish the auto updater into the published occlusion directory.
run:
dotnet publish "${{ github.workspace }}\OcclusionAutoUpdater\OcclusionAutoUpdater.csproj" -c "Release" -r osx-x64 -p:PublishSingleFile=false -p:IncludeNativeLibrariesForSelfExtract=false --self-contained false --output "${{ github.workspace }}/macupdater/"

- name: Zip the auto updater binaries.
uses: master-atul/[email protected]
with:
command: c
cwd: '${{ github.workspace }}/'
files: |
./macupdater
outPath: occlusion-mac-updater.tar.gz

- name: Copy published auto updater to the folder.
run:
cp -R "${{ github.workspace }}/macupdater/." "${{ github.workspace }}/occlusionmacbuild/Occlusion Voice Chat.app/Contents/MacOS/autoupdater/"

- name: Zip the published binaries.
uses: master-atul/tar-action@v1.0.2
uses: master-atul/tar-action@v1.1.0
with:
command: c
cwd: '${{ github.workspace }}/'
Expand All @@ -100,6 +121,12 @@ jobs:
with:
name: occlusion-mac64-installer-artifact
path: occlusion-mac-x64-binaries.tar.gz

- name: And also upload an artifact for the updater
uses: actions/upload-artifact@v2
with:
name: occlusion-mac64-updater-artifact
path: occlusion-mac-updater.tar.gz

build-win:
# Windows Server 2019
Expand All @@ -125,7 +152,7 @@ jobs:

- name: Publish the auto updater into the published occlusion directory.
run:
dotnet publish "${{ github.workspace }}\OcclusionAutoUpdater\OcclusionAutoUpdater.csproj" -c "Release Win" -r win-x64 --self-contained true --output "occlusionwinrelease\"
dotnet publish "${{ github.workspace }}\OcclusionAutoUpdater\OcclusionAutoUpdater.csproj" -c "Release Win" -r win-x64 --self-contained true --output "occlusionwinrelease\autoupdater\"

#- name: Zip the published binaries.
# uses: papeloto/action-zip@v1
Expand All @@ -146,7 +173,7 @@ jobs:

- name: Finally, publish the installer
run:
dotnet publish "${{ github.workspace }}\occlusioninstallerclone\CrossPlatformInstallerBase\CrossPlatformInstallerBase.csproj" -c "Release" -r win-x64 --self-contained true --output "installerpublish\"
dotnet publish "${{ github.workspace }}\occlusioninstallerclone\CrossPlatformInstallerBase\CrossPlatformInstallerBase.csproj" -p:PublishSingleFile=true -c "Release" -r win-x64 --self-contained true --output "installerpublish\"

- name: Rename the installer.
run:
Expand Down
4 changes: 2 additions & 2 deletions Occlusion Voice Chat_CrossPlatform/App.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -193,12 +193,12 @@ public override void Initialize()

string exePath = AppContext.BaseDirectory;

string autoUpdaterPath = $"OcclusionAutoUpdater.exe";
string autoUpdaterPath = $"autoupdater/OcclusionAutoUpdater.exe";

// Check if we're on Linux or Mac
if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux) || RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
{
autoUpdaterPath = $"{exePath}/OcclusionAutoUpdater";
autoUpdaterPath = $"{exePath}/autoupdater/OcclusionAutoUpdater";
}

if (File.Exists(autoUpdaterPath))
Expand Down
37 changes: 34 additions & 3 deletions OcclusionAutoUpdater/App.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,50 @@
<Setter Property="Background" Value="#4f4f5e"></Setter>
</Style>

<StyleInclude Source="avares://Avalonia.Themes.Default/DefaultTheme.xaml"/>
<StyleInclude Source="avares://OcclusionAutoUpdater/DefaultTheme.xaml"/>
<StyleInclude Source="avares://Avalonia.Themes.Fluent/Accents/BaseDark.xaml" />
<StyleInclude Source="avares://Avalonia.Themes.Fluent/Accents/Base.xaml" />
<StyleInclude Source="avares://Avalonia.Themes.Fluent/Accents/AccentColors.xaml" />
<StyleInclude Source="avares://Avalonia.Themes.Fluent/Accents/FluentControlResourcesDark.xaml" />
<Style Selector="TextBox /template/ Border">

<Style Selector="TextBox">
<Setter Property="CornerRadius" Value="5" />
</Style>

<Style Selector="Button /template/ ContentPresenter">
<Style Selector="Button">
<Setter Property="CornerRadius" Value="5" />
</Style>

<Style Selector="ScrollBar /template/ Border">
<Setter Property="CornerRadius" Value="6" />
</Style>

<Style Selector="ScrollBar:vertical /template/ Thumb">
<Setter Property="Width" Value="8" />
</Style>

<Style Selector="ScrollBar:horizontal /template/ Thumb">
<Setter Property="Height" Value="8" />
</Style>

<Style Selector="Button">
<Setter Property="Transitions">
<Setter.Value>
<Transitions>
<BrushTransition Property="Background" Duration="0:0:0.2">
<BrushTransition.Easing>
<QuadraticEaseOut></QuadraticEaseOut>
</BrushTransition.Easing>
</BrushTransition>
</Transitions>
</Setter.Value>
</Setter>
</Style>

<Style Selector="Button:pointerover">
<Setter Property="Background" Value="{DynamicResource ThemeControlHoverBrush}"></Setter>
</Style>

<Style Selector="ProgressBar /template/ Border">
<Setter Property="CornerRadius" Value="5" />
</Style>
Expand Down
24 changes: 10 additions & 14 deletions OcclusionAutoUpdater/App.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public static async Task<bool> NewerVersionAvailable()
}
break;
case OperatingSystem.Mac:
if (asset.ContentType == "application/gzip" && asset.Name.StartsWith("occlusion-mac-x64-binaries"))
if (asset.ContentType == "application/x-gzip" && asset.Name.StartsWith("occlusion-mac-x64-binaries"))
{
DownloadLink = asset.BrowserDownloadUrl;
return true;
Expand All @@ -111,20 +111,16 @@ public static async Task<bool> NewerVersionAvailable()
// Method that gets the current operating system and returns an enum.
public static OperatingSystem? GetOperatingSystem()
{
var os = Environment.OSVersion;
var platform = os.Platform;
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
return OperatingSystem.Windows;

if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
return OperatingSystem.Mac;

if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
return OperatingSystem.Linux;

switch (platform)
{
case PlatformID.Win32NT:
return OperatingSystem.Windows;
case PlatformID.Unix:
return OperatingSystem.Linux;
case PlatformID.MacOSX:
return OperatingSystem.Mac;
default:
return null;
}
return null;
}


Expand Down
19 changes: 15 additions & 4 deletions OcclusionAutoUpdater/DefaultTheme.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@
<Style.Resources>

<Color x:Key="ThemeAccentColor">#CC7F2EDB</Color>
<Color x:Key="ThemeAccentColor2">#CCDCD82C</Color>
<Color x:Key="ThemeAccentColor3">#CCDB822E</Color>
<Color x:Key="ThemeAccentColor4">#FF282830</Color>
<Color x:Key="ThemeAccentColor2">#CC7F2EDB</Color>
<Color x:Key="ThemeAccentColor3">#CC7F2EDB</Color>
<Color x:Key="ThemeAccentColor4">#CC7F2EDB</Color>

<Color x:Key="ThemeBackgroundColor">#FF3F3F4A</Color>
<Color x:Key="ThemeBorderLowColor">#FF31313B</Color>
<Color x:Key="ThemeBorderMidColor">#00FFFFFF</Color>
<Color x:Key="ThemeBorderHighColor">#FF282830</Color>
<Color x:Key="ThemeControlLowerColor">#3b3b47</Color>
<Color x:Key="ThemeControlLowColor">#FF3F3F4A</Color>
<Color x:Key="ThemeControlMidColor">#FF454552</Color>
<Color x:Key="ThemeControlHighColor">#FF808080</Color>
Expand All @@ -31,6 +32,7 @@
<SolidColorBrush x:Key="ThemeBorderHighBrush" Color="{DynamicResource ThemeBorderHighColor}"></SolidColorBrush>
<SolidColorBrush x:Key="ThemeControlLowBrush" Color="{DynamicResource ThemeControlLowColor}"></SolidColorBrush>
<SolidColorBrush x:Key="ThemeControlMidBrush" Color="{DynamicResource ThemeControlMidColor}"></SolidColorBrush>
<SolidColorBrush x:Key="ThemeControlHoverBrush" Color="#4f4f5e"/>
<SolidColorBrush x:Key="ThemeControlHighBrush" Color="{DynamicResource ThemeControlHighColor}"></SolidColorBrush>
<SolidColorBrush x:Key="ThemeControlHighlightLowBrush" Color="{DynamicResource ThemeControlHighlightLowColor}"></SolidColorBrush>
<SolidColorBrush x:Key="ThemeControlHighlightMidBrush" Color="{DynamicResource ThemeControlHighlightMidColor}"></SolidColorBrush>
Expand All @@ -45,15 +47,24 @@
<SolidColorBrush x:Key="ThemeAccentBrush4" Color="{DynamicResource ThemeAccentColor4}"></SolidColorBrush>
<SolidColorBrush x:Key="ErrorBrush" Color="{DynamicResource ErrorColor}"></SolidColorBrush>
<SolidColorBrush x:Key="ErrorLowBrush" Color="{DynamicResource ErrorLowColor}"></SolidColorBrush>
<SolidColorBrush x:Key="ToggleSwitchFillOn" Color="{DynamicResource ThemeAccentColor}"></SolidColorBrush>
<SolidColorBrush x:Key="ToggleSwitchFillOnPointerOver" Color="{DynamicResource ThemeAccentColor2}"></SolidColorBrush>
<SolidColorBrush x:Key="ToggleSwitchFillOnPressed" Color="{DynamicResource ThemeAccentColor3}"></SolidColorBrush>
<SolidColorBrush x:Key="ToggleSwitchStrokeOff" Color="{DynamicResource ThemeControlHighColor}"></SolidColorBrush>

<Thickness x:Key="ThemeBorderThickness">0</Thickness>
<QuinticEaseOut x:Key="SmoothScrollEase"/>
<BounceEaseIn x:Key="ScrollEase"/>

<Thickness x:Key="ThemeBorderThickness">0</Thickness>
<sys:Double x:Key="ThemeDisabledOpacity">0.5</sys:Double>

<sys:Double x:Key="FontSizeSmall">10</sys:Double>
<sys:Double x:Key="FontSizeNormal">12</sys:Double>
<sys:Double x:Key="FontSizeLarge">16</sys:Double>

<sys:Double x:Key="ScrollBarThickness">20</sys:Double>


</Style.Resources>

</Style>
9 changes: 9 additions & 0 deletions OcclusionAutoUpdater/MacOSFunctions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
using System.Runtime.InteropServices;

namespace OcclusionAutoUpdater;

public static class MacOSFunctions
{
[DllImport("/usr/lib/libSystem.dylib", SetLastError = true)]
public static extern int chmod(string pathname, int mode);
}
18 changes: 8 additions & 10 deletions OcclusionAutoUpdater/OcclusionAutoUpdater.csproj
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk" TreatAsLocalProperty="SelfContained">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
<ApplicationIcon>Occlusion_icon.ico</ApplicationIcon>
<RuntimeIdentifiers>win-x64;linux-x64</RuntimeIdentifiers>
<PublishTrimmed>true</PublishTrimmed>
<RuntimeIdentifiers>win-x64;linux-x64;osx-x64</RuntimeIdentifiers>
<Configurations>Debug;Release;Debug Win;Release Win</Configurations>
<ApplicationManifest>app.manifest</ApplicationManifest>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DefineConstants></DefineConstants>
<DebugType>pdbonly</DebugType>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug Win|AnyCPU'">
Expand All @@ -32,12 +30,12 @@
<Generator>MSBuild:Compile</Generator>
</AvaloniaResource>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Avalonia" Version="0.10.12" />
<PackageReference Include="Avalonia.Desktop" Version="0.10.12" />
<PackageReference Include="Avalonia.Diagnostics" Version="0.10.12" />
<PackageReference Include="Avalonia.Native" Version="0.10.12" />
<PackageReference Include="Avalonia.ReactiveUI" Version="0.10.12" />
<ItemGroup>
<PackageReference Include="Avalonia" Version="0.10.13" />
<PackageReference Include="Avalonia.Desktop" Version="0.10.13" />
<PackageReference Include="Avalonia.Diagnostics" Version="0.10.13" />
<PackageReference Include="Avalonia.Native" Version="0.10.13" />
<PackageReference Include="Avalonia.ReactiveUI" Version="0.10.13" />
<PackageReference Include="Octokit" Version="0.50.0" />
<PackageReference Include="SharpZipLib" Version="1.3.3" />
</ItemGroup>
Expand Down
8 changes: 4 additions & 4 deletions OcclusionAutoUpdater/Views/MainWindow.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@
xmlns:vm="using:OcclusionAutoUpdater.ViewModels"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d" Width="450" Height="150"
MinWidth="450" MaxWidth="450" MinHeight="150" MaxHeight="150"
mc:Ignorable="d" Width="530" Height="150"
x:Class="OcclusionAutoUpdater.Views.MainWindow"
Icon="/Assets/Occlusion_icon.ico"
Title="Occlusion Auto Updater"
Background="#3f3f4a" FontFamily="Verdana">
Background="{DynamicResource ThemeBorderLowColor}" FontFamily="Verdana">

<Window.Resources>
<PageSlide x:Key="PageSlider" Duration="0:0:0.5" Orientation="Horizontal">
Expand Down Expand Up @@ -42,7 +41,8 @@
<StackPanel VerticalAlignment="Center" HorizontalAlignment="Stretch" Orientation="Vertical">
<TextBlock HorizontalAlignment="Center" TextAlignment="Center" FontSize="13" Margin="0 10 0 0">Downloading update. This shouldn't take long.</TextBlock>
<Grid Margin="30 10 30 0" Height="25">
<ProgressBar Name="DownloadBar" Minimum="0" Maximum="1" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"/>
<ProgressBar Name="DownloadBar" Background="#3f3f4a" CornerRadius="5"
Minimum="0" Maximum="1" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"/>
<TextBlock Name="ProgressText" Margin="10 0 0 0" VerticalAlignment="Center">0%</TextBlock>
</Grid>
</StackPanel>
Expand Down
Loading

0 comments on commit 3801c44

Please sign in to comment.