Skip to content

Commit

Permalink
Minor update
Browse files Browse the repository at this point in the history
  • Loading branch information
Sergey004 committed Feb 10, 2024
1 parent 304a4ac commit cb0520b
Show file tree
Hide file tree
Showing 9 changed files with 98 additions and 61 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/auto_realase.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
on:
push:
# Sequence of patterns matched against refs/tags
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10

name: Create Release

jobs:
build:
name: Create Release
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
body: |
Changes in this Release
- First Change
- Second Change
draft: false
prerelease: false
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ on:

jobs:
build:
runs-on: windows-2019
runs-on: windows-latest
steps:
- name: Save state
run: echo "{name}={value}" >> $GITHUB_STATE
Expand Down
62 changes: 18 additions & 44 deletions Quest2-VRC.Core/Modules/ADB.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using AdvancedSharpAdbClient;
using Microsoft.Toolkit.Uwp.Notifications;
using System;
using System.Diagnostics;
using System.IO;
Expand Down Expand Up @@ -171,31 +172,16 @@ public static void DownLoadADB()
var client = new WebClient();

Check warning on line 172 in Quest2-VRC.Core/Modules/ADB.cs

View workflow job for this annotation

GitHub Actions / build

'WebClient.WebClient()' is obsolete: 'WebRequest, HttpWebRequest, ServicePoint, and WebClient are obsolete. Use HttpClient instead.' (https://aka.ms/dotnet-warnings/SYSLIB0014)

Check warning on line 172 in Quest2-VRC.Core/Modules/ADB.cs

View workflow job for this annotation

GitHub Actions / build

'WebClient.WebClient()' is obsolete: 'WebRequest, HttpWebRequest, ServicePoint, and WebClient are obsolete. Use HttpClient instead.' (https://aka.ms/dotnet-warnings/SYSLIB0014)
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows) == true)
{
Notify_service.NotfyDowload();
string uri = "https://dl.google.com/android/repository/platform-tools-latest-windows.zip";
string filename = "platform-tools-latest-windows.zip";
string extractPath = AppDomain.CurrentDomain.BaseDirectory;
client.DownloadFile(uri, filename);
Notify_service.NotfyComplited();
ZipFile.ExtractToDirectory(filename, extractPath);
File.Delete(filename);
}
if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX) == true) // Really Mac OS?!
{
string uri = "https://dl.google.com/android/repository/platform-tools-latest-darwin.zip";
string filename = "platform-tools-latest-darwin.zip";
string extractPath = AppDomain.CurrentDomain.BaseDirectory;
client.DownloadFile(uri, filename);
ZipFile.ExtractToDirectory(filename, extractPath);
File.Delete(filename);
}
if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux) == true) // Well, I can't imagine who would use this lib under Linux and in Mac OS XD
{
string uri = "https://dl.google.com/android/repository/platform-tools-latest-linux.zip";
string filename = "platform-tools-latest-linux.zip";
string extractPath = AppDomain.CurrentDomain.BaseDirectory;
client.DownloadFile(uri, filename);
ZipFile.ExtractToDirectory(filename, extractPath);
File.Delete(filename);
}

Console.WriteLine("Download completed");
}
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows) == true)
Expand All @@ -205,35 +191,15 @@ public static void DownLoadADB()
{
Console.WriteLine("Can't start adb server, please try again");


}
}
if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux) == true)
{
StartServerResult result = server.StartServer(@"platform-tools/adb", false);
if (result != StartServerResult.Started)
{
Console.WriteLine("Can't start adb server, please try again");


}
}
if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX) == true)
{
StartServerResult result = server.StartServer(@"platform-tools/adb", false);
if (result != StartServerResult.Started)
{
Console.WriteLine("Can't start adb server, please try again");


}
}
}
catch (WebException)
{
Console.WriteLine("Unable to download ADB from Google servers, try again or download files manually https://developer.android.com/studio/releases/platform-tools, press any key to exit");


}

}
Expand All @@ -243,25 +209,33 @@ public static void DownLoadADB()
}
}





public static void StopADB()
{
if (!AdbServer.Instance.GetStatus().IsRunning == false)

Check warning on line 218 in Quest2-VRC.Core/Modules/ADB.cs

View workflow job for this annotation

GitHub Actions / build

This call site is reachable on all platforms. 'IAdbServer.GetStatus()' is only supported on: 'Windows' 10.0.17763.0 and later. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1416)
{
try

{

ToastNotificationManagerCompat.History.Clear();
ToastNotificationManagerCompat.Uninstall();

ForceKillADB();
Environment.Exit(1987);
}
catch
{
catch
{
// IDK how this works
}

}
else
{
ToastNotificationManagerCompat.History.Clear();
ToastNotificationManagerCompat.Uninstall();
Environment.Exit(1987);
}

Expand Down
3 changes: 2 additions & 1 deletion Quest2-VRC.Core/Quest2-VRC.Core.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0-windows7.0</TargetFramework>
<TargetFramework>net8.0-windows10.0.19041.0</TargetFramework>
<OutputType>Library</OutputType>
<RootNamespace>Quest2_VRC</RootNamespace>
<LangVersion>latest</LangVersion>
Expand Down Expand Up @@ -56,6 +56,7 @@
<ItemGroup>
<PackageReference Include="AdvancedSharpAdbClient" Version="2.5.8" />
<PackageReference Include="Bespoke.Osc" Version="1.0.0" />
<PackageReference Include="Microsoft.Toolkit.Uwp.Notifications" Version="7.1.3" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="OpenRGB.NET" Version="1.7.0" />
<PackageReference Include="System.Management" Version="8.0.0" />
Expand Down
30 changes: 30 additions & 0 deletions Quest2-VRC.Core/Services/Notify_service.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
using Microsoft.Toolkit.Uwp.Notifications;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace Quest2_VRC
{
public class Notify_service
{
static public void NotfyDowload()
{
new ToastContentBuilder()
.AddText("ADB Dowload")
.AddText("Started")
.Show();
}
static public void NotfyComplited()
{
new ToastContentBuilder()
.AddText("ADB Dowload")
.AddText("Complited")
.Show();
Thread.Sleep(5000);

}
}
}
9 changes: 4 additions & 5 deletions Quest2-VRC.GUI/MainWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,13 @@ public MainWindow()
materialSkinManager.AddFormToManage(this);
materialSkinManager.Theme = MaterialSkinManager.Themes.DARK;
materialSkinManager.ColorScheme = new ColorScheme(Primary.Amber800, Primary.Amber900, Primary.Cyan500, Accent.Cyan700, TextShade.WHITE);
materialLabel5.Text = resources.GetString("Ready");
if (File.Exists("platform-tools\\adb.exe") == false)
{
MessageBox.Show(resources.GetString("ADBNotFound"), resources.GetString("Error"), MessageBoxButtons.OK, MessageBoxIcon.Error);
ADB.DownLoadADB();
}

materialLabel5.Text = resources.GetString("Ready");


}


Expand All @@ -46,7 +45,7 @@ private void disableButtons()
materialButton3.Enabled = false;
materialButton4.Enabled = false;
materialButton5.Enabled = false;
materialButton6.Enabled = false;
//materialButton6.Enabled = false;
materialSwitch1.Enabled = false;
materialCheckbox2.Enabled = false;
materialTextBox1.Enabled = false;
Expand All @@ -59,7 +58,7 @@ private void enadleButtons()
materialButton3.Enabled = true;
materialButton4.Enabled = true;
materialButton5.Enabled = true;
materialButton6.Enabled = true;
//materialButton6.Enabled = true;
materialSwitch1.Enabled = true;
materialCheckbox2.Enabled = true;
materialTextBox1.Enabled = true;
Expand Down
20 changes: 11 additions & 9 deletions Quest2-VRC.GUI/Program.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using Microsoft.Toolkit.Uwp.Notifications;
using System;
using System.CommandLine;
using System.Diagnostics;
using System.Globalization;
Expand Down Expand Up @@ -79,29 +80,30 @@ static void Handler(bool forceeng, bool enhancedoculuscontrol)
}

}
ToastNotificationManagerCompat.Uninstall();
Environment.Exit(1987); //Hehe yep I FNAF fan :) (This exit code = 0)
}
static void GUI()
{

Process[] processes = Process.GetProcessesByName(System.Reflection.Assembly.GetExecutingAssembly().GetName().Name);


if (processes.Length > 1)
{

Application.EnableVisualStyles();
MessageBox.Show("Only one instance of the program can be opened!", System.Reflection.Assembly.GetExecutingAssembly().GetName().Name, MessageBoxButtons.OK, MessageBoxIcon.Error);
Environment.Exit(1987);
}
else
{
Application.EnableVisualStyles();
Application.SetHighDpiMode(HighDpiMode.SystemAware);
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new MainWindow());

Application.EnableVisualStyles();
Application.SetHighDpiMode(HighDpiMode.SystemAware);
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new MainWindow());


}

Expand Down
2 changes: 2 additions & 0 deletions Quest2-VRC.GUI/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
[assembly: AssemblyCopyright("Copyright © 2023")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: System.Resources.NeutralResourcesLanguage("en-US")]


// Установка значения False для параметра ComVisible делает типы в этой сборке невидимыми
// для компонентов COM. Если необходимо обратиться к типу в этой сборке через
Expand Down
2 changes: 1 addition & 1 deletion Quest2-VRC.GUI/Quest2-VRC.GUI.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0-windows7.0</TargetFramework>
<TargetFramework>net8.0-windows10.0.19041.0</TargetFramework>
<OutputType>WinExe</OutputType>
<RootNamespace>Quest2_VRC</RootNamespace>
<LangVersion>latest</LangVersion>
Expand Down

0 comments on commit cb0520b

Please sign in to comment.