Add project files.

This commit is contained in:
Taki7o7 2022-04-21 13:05:53 +02:00
commit 56c1727af0
45 changed files with 10513 additions and 0 deletions

63
.gitattributes vendored Normal file
View file

@ -0,0 +1,63 @@
###############################################################################
# Set default behavior to automatically normalize line endings.
###############################################################################
* text=auto
###############################################################################
# Set default behavior for command prompt diff.
#
# This is need for earlier builds of msysgit that does not have it on by
# default for csharp files.
# Note: This is only used by command line
###############################################################################
#*.cs diff=csharp
###############################################################################
# Set the merge driver for project and solution files
#
# Merging from the command prompt will add diff markers to the files if there
# are conflicts (Merging from VS is not affected by the settings below, in VS
# the diff markers are never inserted). Diff markers may cause the following
# file extensions to fail to load in VS. An alternative would be to treat
# these files as binary and thus will always conflict and require user
# intervention with every merge. To do so, just uncomment the entries below
###############################################################################
#*.sln merge=binary
#*.csproj merge=binary
#*.vbproj merge=binary
#*.vcxproj merge=binary
#*.vcproj merge=binary
#*.dbproj merge=binary
#*.fsproj merge=binary
#*.lsproj merge=binary
#*.wixproj merge=binary
#*.modelproj merge=binary
#*.sqlproj merge=binary
#*.wwaproj merge=binary
###############################################################################
# behavior for image files
#
# image files are treated as binary by default.
###############################################################################
#*.jpg binary
#*.png binary
#*.gif binary
###############################################################################
# diff behavior for common document formats
#
# Convert binary document formats to text before diffing them. This feature
# is only available from the command line. Turn it on by uncommenting the
# entries below.
###############################################################################
#*.doc diff=astextplain
#*.DOC diff=astextplain
#*.docx diff=astextplain
#*.DOCX diff=astextplain
#*.dot diff=astextplain
#*.DOT diff=astextplain
#*.pdf diff=astextplain
#*.PDF diff=astextplain
#*.rtf diff=astextplain
#*.RTF diff=astextplain

340
.gitignore vendored Normal file
View file

@ -0,0 +1,340 @@
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
# User-specific files
*.rsuser
*.suo
*.user
*.userosscache
*.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
[Aa][Rr][Mm]/
[Aa][Rr][Mm]64/
bld/
[Bb]in/
[Oo]bj/
[Ll]og/
# Visual Studio 2015/2017 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/
# Visual Studio 2017 auto generated files
Generated\ Files/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# NUNIT
*.VisualState.xml
TestResult.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
# Benchmark Results
BenchmarkDotNet.Artifacts/
# .NET Core
project.lock.json
project.fragment.lock.json
artifacts/
# StyleCop
StyleCopReport.xml
# Files built by Visual Studio
*_i.c
*_p.c
*_h.h
*.ilk
*.meta
*.obj
*.iobj
*.pch
*.pdb
*.ipdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*_wpftmp.csproj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
*.VC.db
*.VC.VC.opendb
# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap
# Visual Studio Trace Files
*.e2e
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# JustCode is a .NET coding add-in
.JustCode
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# AxoCover is a Code Coverage Tool
.axoCover/*
!.axoCover/settings.json
# Visual Studio code coverage results
*.coverage
*.coveragexml
# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# Note: Comment the next line if you want to checkin your web deploy settings,
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj
# Microsoft Azure Web App publish settings. Comment the next line if you want to
# checkin your Azure Web App publish settings, but sensitive information contained
# in these scripts will be unencrypted
PublishScripts/
# NuGet Packages
*.nupkg
# The packages folder can be ignored because of Package Restore
**/[Pp]ackages/*
# except build/, which is used as an MSBuild target.
!**/[Pp]ackages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/[Pp]ackages/repositories.config
# NuGet v3's project.json files produces more ignorable files
*.nuget.props
*.nuget.targets
# Microsoft Azure Build Output
csx/
*.build.csdef
# Microsoft Azure Emulator
ecf/
rcf/
# Windows Store app package directories and files
AppPackages/
BundleArtifacts/
Package.StoreAssociation.xml
_pkginfo.txt
*.appx
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!?*.[Cc]ache/
# Others
ClientBin/
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.jfm
*.pfx
*.publishsettings
orleans.codegen.cs
# Including strong name files can present a security risk
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
#*.snk
# Since there are multiple workflows, uncomment next line to ignore bower_components
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
#bower_components/
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
ServiceFabricBackup/
*.rptproj.bak
# SQL Server files
*.mdf
*.ldf
*.ndf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
*.rptproj.rsuser
*- Backup*.rdl
# Microsoft Fakes
FakesAssemblies/
# GhostDoc plugin setting file
*.GhostDoc.xml
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
node_modules/
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
*.vbw
# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions
# Paket dependency manager
.paket/paket.exe
paket-files/
# FAKE - F# Make
.fake/
# JetBrains Rider
.idea/
*.sln.iml
# CodeRush personal settings
.cr/personal
# Python Tools for Visual Studio (PTVS)
__pycache__/
*.pyc
# Cake - Uncomment if you are using it
# tools/**
# !tools/packages.config
# Tabs Studio
*.tss
# Telerik's JustMock configuration file
*.jmconfig
# BizTalk build output
*.btp.cs
*.btm.cs
*.odx.cs
*.xsd.cs
# OpenCover UI analysis results
OpenCover/
# Azure Stream Analytics local run output
ASALocalRun/
# MSBuild Binary and Structured Log
*.binlog
# NVidia Nsight GPU debugger configuration file
*.nvuser
# MFractors (Xamarin productivity tool) working folder
.mfractor/
# Local History for Visual Studio
.localhistory/
# BeatPulse healthcheck temp database
healthchecksdb

19
LICENSE Normal file
View file

@ -0,0 +1,19 @@
Copyright (c) 2022 WaGi-Coding aka. Taki7o7
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
OR OTHER DEALINGS IN THE SOFTWARE.

View file

@ -0,0 +1,31 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.32126.315
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenXR-Runtime-Switcher", "OpenXR-Runtime-Switcher\OpenXR-Runtime-Switcher.csproj", "{EF8C31E1-DDE3-4DEC-A36D-D9475EA703D4}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
Release|Any CPU = Release|Any CPU
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{EF8C31E1-DDE3-4DEC-A36D-D9475EA703D4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{EF8C31E1-DDE3-4DEC-A36D-D9475EA703D4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EF8C31E1-DDE3-4DEC-A36D-D9475EA703D4}.Debug|x64.ActiveCfg = Debug|x64
{EF8C31E1-DDE3-4DEC-A36D-D9475EA703D4}.Debug|x64.Build.0 = Debug|x64
{EF8C31E1-DDE3-4DEC-A36D-D9475EA703D4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EF8C31E1-DDE3-4DEC-A36D-D9475EA703D4}.Release|Any CPU.Build.0 = Release|Any CPU
{EF8C31E1-DDE3-4DEC-A36D-D9475EA703D4}.Release|x64.ActiveCfg = Release|x64
{EF8C31E1-DDE3-4DEC-A36D-D9475EA703D4}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {28D86E52-9C38-4EC6-A313-0EF80E57480E}
EndGlobalSection
EndGlobal

View file

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<section name="OpenXR_Runtime_Switcher.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false"/>
</sectionGroup>
</configSections>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/>
</startup>
<userSettings>
<OpenXR_Runtime_Switcher.Properties.Settings>
<setting name="UpgradeRequired" serializeAs="String">
<value>True</value>
</setting>
<setting name="CustomRuntimes" serializeAs="String">
<value>[]</value>
</setting>
</OpenXR_Runtime_Switcher.Properties.Settings>
</userSettings>
</configuration>

View file

@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OpenXR_Runtime_Switcher
{
[Serializable]
public struct CustomRuntimeSaveListEntry
{
public string Name { get; set; }
public string JsonPath { get; set; }
public string ImagePath { get; set; }
public CustomRuntimeSaveListEntry(string name, string jsonPath, string imagePath)
{
Name = name;
JsonPath = jsonPath;
ImagePath = imagePath;
}
}
}

View file

@ -0,0 +1,218 @@

namespace OpenXR_Runtime_Switcher
{
partial class Form_AddCustomRuntime
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form_AddCustomRuntime));
this.btnAdd = new System.Windows.Forms.Button();
this.btnCancel = new System.Windows.Forms.Button();
this.tbName = new System.Windows.Forms.TextBox();
this.tbPath = new System.Windows.Forms.TextBox();
this.lblName = new System.Windows.Forms.Label();
this.lblPath = new System.Windows.Forms.Label();
this.btnSearchPath = new System.Windows.Forms.Button();
this.openFileDialogLogo = new System.Windows.Forms.OpenFileDialog();
this.openFileDialogJsonPath = new System.Windows.Forms.OpenFileDialog();
this.tbImagePath = new System.Windows.Forms.TextBox();
this.lblImagePath = new System.Windows.Forms.Label();
this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
this.pictureBoxLogo = new System.Windows.Forms.PictureBox();
((System.ComponentModel.ISupportInitialize)(this.pictureBoxLogo)).BeginInit();
this.SuspendLayout();
//
// btnAdd
//
this.btnAdd.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnAdd.BackColor = System.Drawing.Color.Green;
this.btnAdd.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnAdd.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnAdd.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.btnAdd.Location = new System.Drawing.Point(377, 189);
this.btnAdd.Name = "btnAdd";
this.btnAdd.Size = new System.Drawing.Size(75, 23);
this.btnAdd.TabIndex = 32;
this.btnAdd.Text = "Add";
this.btnAdd.UseVisualStyleBackColor = false;
this.btnAdd.Click += new System.EventHandler(this.btnAdd_Click);
//
// btnCancel
//
this.btnCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnCancel.BackColor = System.Drawing.Color.DarkOrange;
this.btnCancel.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnCancel.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnCancel.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.btnCancel.Location = new System.Drawing.Point(296, 189);
this.btnCancel.Name = "btnCancel";
this.btnCancel.Size = new System.Drawing.Size(75, 23);
this.btnCancel.TabIndex = 31;
this.btnCancel.Text = "Cancel";
this.btnCancel.UseVisualStyleBackColor = false;
this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
//
// tbName
//
this.tbName.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.tbName.Location = new System.Drawing.Point(218, 35);
this.tbName.Name = "tbName";
this.tbName.Size = new System.Drawing.Size(234, 20);
this.tbName.TabIndex = 11;
//
// tbPath
//
this.tbPath.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.tbPath.Location = new System.Drawing.Point(218, 81);
this.tbPath.Name = "tbPath";
this.tbPath.Size = new System.Drawing.Size(234, 20);
this.tbPath.TabIndex = 21;
//
// lblName
//
this.lblName.AutoSize = true;
this.lblName.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lblName.Location = new System.Drawing.Point(218, 12);
this.lblName.Name = "lblName";
this.lblName.Size = new System.Drawing.Size(60, 20);
this.lblName.TabIndex = 10;
this.lblName.Text = "Name:";
//
// lblPath
//
this.lblPath.AutoSize = true;
this.lblPath.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lblPath.Location = new System.Drawing.Point(214, 58);
this.lblPath.Name = "lblPath";
this.lblPath.Size = new System.Drawing.Size(95, 20);
this.lblPath.TabIndex = 20;
this.lblPath.Text = "Json-Path:";
//
// btnSearchPath
//
this.btnSearchPath.BackColor = System.Drawing.SystemColors.ControlDark;
this.btnSearchPath.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnSearchPath.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnSearchPath.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.btnSearchPath.Location = new System.Drawing.Point(218, 107);
this.btnSearchPath.Name = "btnSearchPath";
this.btnSearchPath.Size = new System.Drawing.Size(75, 23);
this.btnSearchPath.TabIndex = 22;
this.btnSearchPath.Text = "Search";
this.btnSearchPath.UseVisualStyleBackColor = false;
this.btnSearchPath.Click += new System.EventHandler(this.btnSearchPath_Click);
//
// openFileDialogLogo
//
this.openFileDialogLogo.FileOk += new System.ComponentModel.CancelEventHandler(this.openFileDialogLogo_FileOk);
//
// openFileDialogJsonPath
//
this.openFileDialogJsonPath.FileOk += new System.ComponentModel.CancelEventHandler(this.openFileDialogJsonPath_FileOk);
//
// tbImagePath
//
this.tbImagePath.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.tbImagePath.Location = new System.Drawing.Point(218, 156);
this.tbImagePath.Name = "tbImagePath";
this.tbImagePath.Size = new System.Drawing.Size(234, 20);
this.tbImagePath.TabIndex = 58;
this.toolTip1.SetToolTip(this.tbImagePath, "Path of the Image you want to use as Logo\r\nLeave empty to use the default Logo.");
//
// lblImagePath
//
this.lblImagePath.AutoSize = true;
this.lblImagePath.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lblImagePath.Location = new System.Drawing.Point(214, 133);
this.lblImagePath.Name = "lblImagePath";
this.lblImagePath.Size = new System.Drawing.Size(97, 20);
this.lblImagePath.TabIndex = 57;
this.lblImagePath.Text = "Logo-Path:";
this.toolTip1.SetToolTip(this.lblImagePath, "Path of the Image you want to use as Logo\r\nLeave empty to use the default Logo.");
//
// pictureBoxLogo
//
this.pictureBoxLogo.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.pictureBoxLogo.Cursor = System.Windows.Forms.Cursors.Hand;
this.pictureBoxLogo.Image = global::OpenXR_Runtime_Switcher.Properties.Resources.Logo_NoLogo;
this.pictureBoxLogo.Location = new System.Drawing.Point(12, 12);
this.pictureBoxLogo.Name = "pictureBoxLogo";
this.pictureBoxLogo.Size = new System.Drawing.Size(200, 200);
this.pictureBoxLogo.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
this.pictureBoxLogo.TabIndex = 56;
this.pictureBoxLogo.TabStop = false;
this.pictureBoxLogo.Click += new System.EventHandler(this.pictureBoxLogo_Click);
//
// Form_AddCustomRuntime
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.SystemColors.ControlDarkDark;
this.ClientSize = new System.Drawing.Size(464, 221);
this.Controls.Add(this.lblImagePath);
this.Controls.Add(this.tbImagePath);
this.Controls.Add(this.btnSearchPath);
this.Controls.Add(this.lblPath);
this.Controls.Add(this.lblName);
this.Controls.Add(this.tbPath);
this.Controls.Add(this.tbName);
this.Controls.Add(this.pictureBoxLogo);
this.Controls.Add(this.btnCancel);
this.Controls.Add(this.btnAdd);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.SizableToolWindow;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MaximumSize = new System.Drawing.Size(999999999, 260);
this.MinimumSize = new System.Drawing.Size(480, 260);
this.Name = "Form_AddCustomRuntime";
this.Text = "OpenXR Runtime-Switcher | Add Custom Runtime";
((System.ComponentModel.ISupportInitialize)(this.pictureBoxLogo)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Button btnAdd;
private System.Windows.Forms.Button btnCancel;
private System.Windows.Forms.PictureBox pictureBoxLogo;
private System.Windows.Forms.TextBox tbName;
private System.Windows.Forms.TextBox tbPath;
private System.Windows.Forms.Label lblName;
private System.Windows.Forms.Label lblPath;
private System.Windows.Forms.Button btnSearchPath;
private System.Windows.Forms.OpenFileDialog openFileDialogLogo;
private System.Windows.Forms.OpenFileDialog openFileDialogJsonPath;
private System.Windows.Forms.TextBox tbImagePath;
private System.Windows.Forms.Label lblImagePath;
private System.Windows.Forms.ToolTip toolTip1;
}
}

View file

@ -0,0 +1,175 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace OpenXR_Runtime_Switcher
{
public partial class Form_AddCustomRuntime : Form
{
MainForm mainForm;
public CustomRuntimeSaveListEntry EntryToAdd = new CustomRuntimeSaveListEntry("", "", "");
public Form_AddCustomRuntime(MainForm mainForm)
{
InitializeComponent();
this.mainForm = mainForm;
}
private void pictureBoxLogo_Click(object sender, EventArgs e)
{
this.openFileDialogLogo.Filter = "Image Files (*.PNG;*.JPG;*.JPEG)|*PNG;*.JPG;*.JPEG";
this.openFileDialogLogo.RestoreDirectory = true;
this.openFileDialogLogo.Title = "Open an existing Image";
var result = openFileDialogLogo.ShowDialog();
if (result == DialogResult.OK)
{
pictureBoxLogo.Image = Image.FromFile(openFileDialogLogo.FileName);
}
}
private void btnSearchPath_Click(object sender, EventArgs e)
{
this.openFileDialogJsonPath.Filter = "OpenXR Runtime JSON File (*.JSON;)|*JSON;";
this.openFileDialogJsonPath.RestoreDirectory = true;
this.openFileDialogJsonPath.Title = "Open an existing Runtime JSON";
var result = openFileDialogJsonPath.ShowDialog();
if (result == DialogResult.OK)
{
tbPath.Text = openFileDialogJsonPath.FileName;
}
}
private void btnCancel_Click(object sender, EventArgs e)
{
this.DialogResult = DialogResult.Cancel;
this.Close();
}
private void btnAdd_Click(object sender, EventArgs e)
{
List<string> errorMessages = new List<string>();
if (string.IsNullOrWhiteSpace(tbName.Text))
{
errorMessages.Add("-| The Name cannot be empty.");
}
if (mainForm.rtm.CustomRuntimes.Select(x => x.Name).Contains(tbName.Text.ToLower(), StringComparer.OrdinalIgnoreCase))
{
errorMessages.Add("-| This Name is already in use by a custom Runtime.");
}
if (!string.IsNullOrWhiteSpace(tbPath.Text))
{
if (mainForm.rtm.PresetRuntimes.Select(x => x.JsonPath).Contains(tbPath.Text.ToLower(), StringComparer.OrdinalIgnoreCase))
{
errorMessages.Add("-| This Json Path is already in use by a Preset.");
}
}
else
{
errorMessages.Add("-| Json Path cannot be empty.");
}
if (mainForm.rtm.CustomRuntimes.Select(x => x.JsonPath).Contains(tbPath.Text.ToLower(), StringComparer.OrdinalIgnoreCase))
{
errorMessages.Add("-| This Json Path is already in use by a custom Runtime.");
}
if (!tbPath.Text.ToLower().EndsWith(".json"))
{
errorMessages.Add("-| This Json path has no \".json\" Extension.");
}
if (!File.Exists(tbImagePath.Text))
{
if (errorMessages.Count != 0)
{
errorMessages.Add("-| Invalid Logo/Logo-Path!");
}
else
{
if (MessageBox.Show("Invalid Logo/Logo-Path!" + "\n" + "Use default Logo instead?", "Add Custom Runtime", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
{
EntryToAdd.ImagePath = string.Empty;
}
else
{
return;
}
}
}
FileInfo fi = null;
if (File.Exists(tbImagePath.Text))
{
fi = new FileInfo(tbImagePath.Text);
string ext = fi.Extension.ToLower();
if (ext != ".png" && ext != ".jpg" && ext != ".jpeg")
{
if (errorMessages.Count != 0)
{
errorMessages.Add("-| Invalid Logo Extension!");
}
else
{
if (MessageBox.Show("Invalid Logo Extension!" + "\n" + "Use default Logo instead?", "Add Custom Runtime", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
{
EntryToAdd.ImagePath = string.Empty;
}
else
{
return;
}
}
}
else
{
EntryToAdd.ImagePath = tbImagePath.Text;
}
}
if (errorMessages.Count > 0)
{
MessageBox.Show("Cannot Add Runtime!\n\n\n" + string.Join("\n\n", errorMessages));
return;
}
EntryToAdd.Name = tbName.Text;
EntryToAdd.JsonPath = tbPath.Text;
this.DialogResult = DialogResult.OK;
this.Close();
}
private void openFileDialogLogo_FileOk(object sender, CancelEventArgs e)
{
tbImagePath.Text = openFileDialogLogo.FileName;
}
private void openFileDialogJsonPath_FileOk(object sender, CancelEventArgs e)
{
tbPath.Text = openFileDialogJsonPath.FileName;
}
}
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,67 @@
<?xml version="1.0" encoding="utf-8" ?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<!-- -->
<!-- ILMerge project-specific settings. Almost never need to be set explicitly. -->
<!-- for details, see http://research.microsoft.com/en-us/people/mbarnett/ilmerge.aspx -->
<!-- -->
<!-- *** set this file to Type=None, CopyToOutput=Never *** -->
<!-- If True, all copy local dependencies will also be merged from referenced projects whether they are referenced in the current project explicitly or not -->
<ILMergeTransitive>true</ILMergeTransitive>
<!-- Extra ILMerge library paths (semicolon-separated). Dont put your package dependencies here, they will be added automagically -->
<ILMergeLibraryPath></ILMergeLibraryPath>
<!-- The solution NuGet package directory if not standard 'SOLUTION\packages' -->
<ILMergePackagesPath></ILMergePackagesPath>
<!-- The merge order file name if differs from standard 'ILMergeOrder.txt' -->
<ILMergeOrderFile></ILMergeOrderFile>
<!-- The strong key file name if not specified in the project -->
<ILMergeKeyFile></ILMergeKeyFile>
<!-- The assembly version if differs for the version of the main assembly -->
<ILMergeAssemblyVersion></ILMergeAssemblyVersion>
<!-- added in Version 1.0.4 -->
<ILMergeFileAlignment></ILMergeFileAlignment>
<!-- added in Version 1.0.4, default=none -->
<ILMergeAllowDuplicateType></ILMergeAllowDuplicateType>
<!-- If the <see cref="CopyAttributes"/> is also set, any assembly-level attributes names that have the same type are copied over into the target assembly -->
<ILMergeAllowMultipleAssemblyLevelAttributes></ILMergeAllowMultipleAssemblyLevelAttributes>
<!-- See ILMerge documentation -->
<ILMergeAllowZeroPeKind></ILMergeAllowZeroPeKind>
<!-- The assembly level attributes of each input assembly are copied over into the target assembly -->
<ILMergeCopyAttributes></ILMergeCopyAttributes>
<!-- Creates a .pdb file for the output assembly and merges into it any .pdb files found for input assemblies, default=true -->
<ILMergeDebugInfo></ILMergeDebugInfo>
<!-- Target assembly will be delay signed -->
<ILMergeDelaySign></ILMergeDelaySign>
<!-- Types in assemblies other than the primary assembly have their visibility modified -->
<ILMergeInternalize></ILMergeInternalize>
<!-- The path name of the file that will be used to identify types that are not to have their visibility modified -->
<ILMergeInternalizeExcludeFile></ILMergeInternalizeExcludeFile>
<!-- XML documentation files are merged to produce an XML documentation file for the target assembly -->
<ILMergeXmlDocumentation></ILMergeXmlDocumentation>
<!-- External assembly references in the manifest of the target assembly will use full public keys (false) or public key tokens (true, default value) -->
<ILMergePublicKeyTokens></ILMergePublicKeyTokens>
<!-- Types with the same name are all merged into a single type in the target assembly -->
<ILMergeUnionMerge></ILMergeUnionMerge>
<!-- The version of the target framework, default 40 (works for 45 too) -->
<ILTargetPlatform></ILTargetPlatform>
</PropertyGroup>
</Project>

View file

@ -0,0 +1,4 @@
# this file contains the partial list of the merged assemblies in the merge order
# you can fill it from the obj\CONFIG\PROJECT.ilmerge generated on every build
# and finetune merge order to your satisfaction

View file

@ -0,0 +1,260 @@

namespace OpenXR_Runtime_Switcher
{
partial class MainForm
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm));
this.flowLayoutPanelPresets = new System.Windows.Forms.FlowLayoutPanel();
this.menuStrip1 = new System.Windows.Forms.MenuStrip();
this.menuToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.WebsiteToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.label1 = new System.Windows.Forms.Label();
this.flowLayoutPanelCustoms = new System.Windows.Forms.FlowLayoutPanel();
this.btnRefreshAll = new System.Windows.Forms.Button();
this.label2 = new System.Windows.Forms.Label();
this.btnAddCustom = new System.Windows.Forms.Button();
this.btnRemoveCustom = new System.Windows.Forms.Button();
this.panelSplash = new System.Windows.Forms.Panel();
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.timerSplash = new System.Windows.Forms.Timer(this.components);
this.checkForUpdateToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.menuStrip1.SuspendLayout();
this.panelSplash.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
this.SuspendLayout();
//
// flowLayoutPanelPresets
//
this.flowLayoutPanelPresets.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)));
this.flowLayoutPanelPresets.AutoScroll = true;
this.flowLayoutPanelPresets.BackColor = System.Drawing.SystemColors.ControlDarkDark;
this.flowLayoutPanelPresets.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.flowLayoutPanelPresets.Location = new System.Drawing.Point(2, 27);
this.flowLayoutPanelPresets.Name = "flowLayoutPanelPresets";
this.flowLayoutPanelPresets.Size = new System.Drawing.Size(375, 427);
this.flowLayoutPanelPresets.TabIndex = 1;
//
// menuStrip1
//
this.menuStrip1.BackColor = System.Drawing.SystemColors.ControlDark;
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.menuToolStripMenuItem});
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
this.menuStrip1.Name = "menuStrip1";
this.menuStrip1.Size = new System.Drawing.Size(763, 24);
this.menuStrip1.TabIndex = 6;
this.menuStrip1.Text = "menuStrip1";
//
// menuToolStripMenuItem
//
this.menuToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.WebsiteToolStripMenuItem,
this.checkForUpdateToolStripMenuItem});
this.menuToolStripMenuItem.Name = "menuToolStripMenuItem";
this.menuToolStripMenuItem.Size = new System.Drawing.Size(50, 20);
this.menuToolStripMenuItem.Text = "Menu";
this.menuToolStripMenuItem.MouseLeave += new System.EventHandler(this.ToolStripMenuItem_MouseLeave);
this.menuToolStripMenuItem.MouseMove += new System.Windows.Forms.MouseEventHandler(this.ToolStripMenuItem_MouseMove);
//
// WebsiteToolStripMenuItem
//
this.WebsiteToolStripMenuItem.Name = "WebsiteToolStripMenuItem";
this.WebsiteToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.WebsiteToolStripMenuItem.Text = "Website";
this.WebsiteToolStripMenuItem.Click += new System.EventHandler(this.WebsiteStripMenuItem_Click);
this.WebsiteToolStripMenuItem.MouseLeave += new System.EventHandler(this.ToolStripMenuItem_MouseLeave);
this.WebsiteToolStripMenuItem.MouseMove += new System.Windows.Forms.MouseEventHandler(this.ToolStripMenuItem_MouseMove);
//
// label1
//
this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)));
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(274, 480);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(0, 13);
this.label1.TabIndex = 0;
//
// flowLayoutPanelCustoms
//
this.flowLayoutPanelCustoms.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)));
this.flowLayoutPanelCustoms.AutoScroll = true;
this.flowLayoutPanelCustoms.BackColor = System.Drawing.SystemColors.ControlDarkDark;
this.flowLayoutPanelCustoms.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.flowLayoutPanelCustoms.Location = new System.Drawing.Point(383, 133);
this.flowLayoutPanelCustoms.Name = "flowLayoutPanelCustoms";
this.flowLayoutPanelCustoms.Size = new System.Drawing.Size(375, 321);
this.flowLayoutPanelCustoms.TabIndex = 7;
this.flowLayoutPanelCustoms.Click += new System.EventHandler(this.MainForm_Click);
//
// btnRefreshAll
//
this.btnRefreshAll.BackColor = System.Drawing.SystemColors.ActiveBorder;
this.btnRefreshAll.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnRefreshAll.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnRefreshAll.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.btnRefreshAll.Location = new System.Drawing.Point(383, 27);
this.btnRefreshAll.Name = "btnRefreshAll";
this.btnRefreshAll.Size = new System.Drawing.Size(375, 34);
this.btnRefreshAll.TabIndex = 51;
this.btnRefreshAll.Text = "REFRESH ALL";
this.btnRefreshAll.UseVisualStyleBackColor = false;
this.btnRefreshAll.Click += new System.EventHandler(this.btnRefreshAll_Click);
//
// label2
//
this.label2.AutoSize = true;
this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 21.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label2.Location = new System.Drawing.Point(383, 68);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(263, 33);
this.label2.TabIndex = 52;
this.label2.Text = "Custom Runtimes";
this.label2.Click += new System.EventHandler(this.MainForm_Click);
//
// btnAddCustom
//
this.btnAddCustom.BackColor = System.Drawing.Color.Green;
this.btnAddCustom.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnAddCustom.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnAddCustom.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.btnAddCustom.Location = new System.Drawing.Point(383, 104);
this.btnAddCustom.Name = "btnAddCustom";
this.btnAddCustom.Size = new System.Drawing.Size(75, 23);
this.btnAddCustom.TabIndex = 53;
this.btnAddCustom.Text = "Add";
this.btnAddCustom.UseVisualStyleBackColor = false;
this.btnAddCustom.Click += new System.EventHandler(this.btnAddCustom_Click);
//
// btnRemoveCustom
//
this.btnRemoveCustom.BackColor = System.Drawing.Color.DarkRed;
this.btnRemoveCustom.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnRemoveCustom.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnRemoveCustom.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.btnRemoveCustom.Location = new System.Drawing.Point(464, 104);
this.btnRemoveCustom.Name = "btnRemoveCustom";
this.btnRemoveCustom.Size = new System.Drawing.Size(75, 23);
this.btnRemoveCustom.TabIndex = 54;
this.btnRemoveCustom.Text = "Remove";
this.btnRemoveCustom.UseVisualStyleBackColor = false;
this.btnRemoveCustom.Click += new System.EventHandler(this.btnRemoveCustom_Click);
//
// panelSplash
//
this.panelSplash.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.panelSplash.Controls.Add(this.pictureBox1);
this.panelSplash.Location = new System.Drawing.Point(0, 0);
this.panelSplash.Name = "panelSplash";
this.panelSplash.Size = new System.Drawing.Size(763, 466);
this.panelSplash.TabIndex = 56;
//
// pictureBox1
//
this.pictureBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.pictureBox1.Image = global::OpenXR_Runtime_Switcher.Properties.Resources.AppLogo;
this.pictureBox1.Location = new System.Drawing.Point(12, 12);
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(739, 442);
this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
this.pictureBox1.TabIndex = 0;
this.pictureBox1.TabStop = false;
//
// timerSplash
//
this.timerSplash.Enabled = true;
this.timerSplash.Interval = 1000;
this.timerSplash.Tick += new System.EventHandler(this.timerSplash_Tick);
//
// checkForUpdateToolStripMenuItem
//
this.checkForUpdateToolStripMenuItem.Name = "checkForUpdateToolStripMenuItem";
this.checkForUpdateToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.checkForUpdateToolStripMenuItem.Text = "Check for Update";
this.checkForUpdateToolStripMenuItem.Click += new System.EventHandler(this.checkForUpdateToolStripMenuItem_Click);
this.checkForUpdateToolStripMenuItem.MouseLeave += new System.EventHandler(this.ToolStripMenuItem_MouseLeave);
this.checkForUpdateToolStripMenuItem.MouseMove += new System.Windows.Forms.MouseEventHandler(this.ToolStripMenuItem_MouseMove);
//
// MainForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.SystemColors.ControlDarkDark;
this.ClientSize = new System.Drawing.Size(763, 466);
this.Controls.Add(this.panelSplash);
this.Controls.Add(this.btnRemoveCustom);
this.Controls.Add(this.btnAddCustom);
this.Controls.Add(this.label2);
this.Controls.Add(this.btnRefreshAll);
this.Controls.Add(this.flowLayoutPanelCustoms);
this.Controls.Add(this.label1);
this.Controls.Add(this.flowLayoutPanelPresets);
this.Controls.Add(this.menuStrip1);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MainMenuStrip = this.menuStrip1;
this.MaximumSize = new System.Drawing.Size(779, 99999999);
this.MinimumSize = new System.Drawing.Size(779, 295);
this.Name = "MainForm";
this.Text = "OpenXR Runtime-Switcher";
this.Click += new System.EventHandler(this.MainForm_Click);
this.KeyUp += new System.Windows.Forms.KeyEventHandler(this.MainForm_KeyUp);
this.menuStrip1.ResumeLayout(false);
this.menuStrip1.PerformLayout();
this.panelSplash.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanelPresets;
private System.Windows.Forms.MenuStrip menuStrip1;
private System.Windows.Forms.ToolStripMenuItem menuToolStripMenuItem;
private System.Windows.Forms.Button btnRefreshAll;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Button btnAddCustom;
private System.Windows.Forms.ToolStripMenuItem WebsiteToolStripMenuItem;
public System.Windows.Forms.Label label1;
public System.Windows.Forms.Button btnRemoveCustom;
public System.Windows.Forms.FlowLayoutPanel flowLayoutPanelCustoms;
private System.Windows.Forms.Panel panelSplash;
private System.Windows.Forms.PictureBox pictureBox1;
private System.Windows.Forms.Timer timerSplash;
private System.Windows.Forms.ToolStripMenuItem checkForUpdateToolStripMenuItem;
}
}

View file

@ -0,0 +1,391 @@
using Microsoft.Win32;
using OpenXR_Runtime_Switcher.Runtimes;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System.Reflection;
using System.Diagnostics;
using System.Net.Http;
namespace OpenXR_Runtime_Switcher
{
public partial class MainForm : Form
{
private List<RuntimeEntryControl> PresetUCControls = new List<RuntimeEntryControl>();
private List<RuntimeEntryControl> CustomUCControls = new List<RuntimeEntryControl>();
public RuntimeManager rtm;
public List<CustomRuntimeSaveListEntry> customRuntimeSaveListEntries = new List<CustomRuntimeSaveListEntry>();
public bool RemoveCustomModeOn = false;
public MainForm()
{
InitializeComponent();
string version = Assembly.GetExecutingAssembly().GetName().Version.ToString();
this.Text = "OpenXR Runtime-Switcher | v" + TrimTheEnd(version, ".0");
Application.EnableVisualStyles();
if (Properties.Settings.Default.UpgradeRequired)
{
Properties.Settings.Default.Upgrade();
Properties.Settings.Default.UpgradeRequired = false;
Properties.Settings.Default.Save();
}
// ########### Desirialize Settings ###########
// Custom Runtimes
customRuntimeSaveListEntries = JsonConvert.DeserializeObject<List<CustomRuntimeSaveListEntry>>(Properties.Settings.Default.CustomRuntimes);
// ############################################
rtm = new RuntimeManager(this);
RefreshPanels();
// Fake Label Focus to get rid of initially focusing the first entries path textbox
//this.ActiveControl = label1;
//label1.Focus();
}
public static string FirstLetterToUpperCaseOrConvertNullToEmptyString(string s)
{
if (string.IsNullOrEmpty(s))
return string.Empty;
char[] a = s.ToCharArray();
a[0] = char.ToUpper(a[0]);
return new string(a);
}
public void RefreshPanels()
{
Properties.Settings.Default.Reload();
customRuntimeSaveListEntries = JsonConvert.DeserializeObject<List<CustomRuntimeSaveListEntry>>(Properties.Settings.Default.CustomRuntimes);
if (rtm != null)
{
rtm.Refresh();
// Presets
flowLayoutPanelPresets.Controls.Clear();
PresetUCControls = new List<RuntimeEntryControl>();
foreach (RuntimeEntryControl REC in rtm.GetEntryListPresets())
{
PresetUCControls.Add(REC);
}
foreach (RuntimeEntryControl REC in PresetUCControls)
{
flowLayoutPanelPresets.Controls.Add(REC);
}
// Customs
flowLayoutPanelCustoms.Controls.Clear();
CustomUCControls = new List<RuntimeEntryControl>();
foreach (RuntimeEntryControl REC in rtm.GetEntryListCustoms())
{
CustomUCControls.Add(REC);
}
foreach (RuntimeEntryControl REC in CustomUCControls)
{
flowLayoutPanelCustoms.Controls.Add(REC);
}
// Fake Label Focus to get rid of initially focusing the first entries path textbox
this.ActiveControl = label1;
label1.Focus();
}
}
private void button1_Click(object sender, EventArgs e)
{
Properties.Settings.Default.Reload();
var xxx = JsonConvert.DeserializeObject<List<CustomRuntimeSaveListEntry>>(Properties.Settings.Default.CustomRuntimes); ;
var yyy = new CustomRuntimeSaveListEntry($"Test {customRuntimeSaveListEntries.Count + 1}", @"C:\TestPath\test.json", @"C:\Users\Taki\Pictures\crowlchling.png");
xxx.Add(yyy);
Properties.Settings.Default.CustomRuntimes = JsonConvert.SerializeObject(xxx);
Properties.Settings.Default.Save();
RefreshPanels();
//if (rtm != null)
//{
// //rtm.Refresh();
// flowLayoutPanel1.Controls.Clear();
// UCControls = new List<RuntimeEntryControl>();
// foreach (RuntimeEntryControl REC in rtm.GetEntryList())
// {
// UCControls.Add(REC);
// }
// foreach (RuntimeEntryControl REC in UCControls)
// {
// flowLayoutPanel1.Controls.Add(REC);
// }
}
private void button2_Click(object sender, EventArgs e)
{
//MessageBox.Show(rtm.CustomRuntimes[0].JsonPath);
//CustomRuntimeSaveListEntry ce = new CustomRuntimeSaveListEntry();
}
private void button3_Click(object sender, EventArgs e)
{
try
{
RuntimeManager.TrySetActiveRuntimeJsonPath(rtm.FoundRuntimes.Where(runtime => runtime.Name == "SteamVR").Select(runtime => runtime.JsonPath).ToList()[0]);
}
catch (UnauthorizedAccessException)
{
MessageBox.Show("You need to run this Program as Administrator, in order to set a Runtime!");
return;
}
catch (Exception ex)
{
MessageBox.Show("Error when attempting to edit the Registry:\n" + ex.Message);
}
}
private void button4_Click(object sender, EventArgs e)
{
try
{
RuntimeManager.TrySetActiveRuntimeJsonPath(rtm.FoundRuntimes.Where(runtime => runtime.Name == "Oculus").Select(runtime => runtime.JsonPath).ToList()[0]);
}
catch (UnauthorizedAccessException)
{
MessageBox.Show("You need to run this Program as Administrator, in order to set a Runtime!");
return;
}
catch (Exception ex)
{
MessageBox.Show("Error when attempting to edit the Registry:\n" + ex.Message);
}
}
public bool SamePaths(string p1, string p2)
{
string path1 = p1;
string path2 = p2;
if (Path.IsPathRooted(path1) && Path.IsPathRooted(path2))
{
path1 = FirstLetterToUpperCaseOrConvertNullToEmptyString(p1);
path2 = FirstLetterToUpperCaseOrConvertNullToEmptyString(p2);
//MessageBox.Show("XXXXXXXXXXXXXXXX\n" + path1 + "\n" + path2 + "\nXXXXXXXXXXXXXXXX");
}
if (path1 == path2)
{
return true;
}
return false;
}
public string TrimTheEnd(string target, string trimString)
{
if (string.IsNullOrEmpty(trimString)) return target;
string result = target;
if (result.EndsWith(trimString))
{
result = result.Substring(0, result.Length - trimString.Length);
}
return result;
}
private void ToolStripMenuItem_MouseMove(object sender, MouseEventArgs e)
{
this.Cursor = Cursors.Hand;
}
private void ToolStripMenuItem_MouseLeave(object sender, EventArgs e)
{
this.Cursor = Cursors.Default;
}
private void btnRefreshAll_Click(object sender, EventArgs e)
{
RefreshPanels();
}
private void btnRemoveCustom_Click(object sender, EventArgs e)
{
if (flowLayoutPanelCustoms.Controls.Count < 1)
{
MessageBox.Show("There are no Custom Runtimes in the List to delete one of them.");
return;
}
RemoveCustomModeOn = !RemoveCustomModeOn;
if (RemoveCustomModeOn)
{
this.KeyPreview = true;
btnRemoveCustom.Text = "Cancel";
btnRemoveCustom.BackColor = Color.DarkOrange;
}
else
{
this.KeyPreview = false;
btnRemoveCustom.Text = "Remove";
btnRemoveCustom.BackColor = Color.DarkRed;
}
}
private void btnAddCustom_Click(object sender, EventArgs e)
{
using (Form_AddCustomRuntime addCustomFrm = new Form_AddCustomRuntime(this))
{
var result = addCustomFrm.ShowDialog();
if (result == DialogResult.OK)
{
//MessageBox.Show("OK From Add Custom Runtime Form");
//List<CustomRuntimeSaveListEntry> tmpList = JsonConvert.DeserializeObject<List<CustomRuntimeSaveListEntry>>(Properties.Settings.Default.CustomRuntimes);
customRuntimeSaveListEntries.Add(addCustomFrm.EntryToAdd);
Properties.Settings.Default.CustomRuntimes = JsonConvert.SerializeObject(customRuntimeSaveListEntries);
Properties.Settings.Default.Save();
RefreshPanels();
}
}
}
private void WebsiteStripMenuItem_Click(object sender, EventArgs e)
{
Process.Start("https://github.com/WaGi-Coding/OpenXR-Runtime-Switcher/releases");
}
private void button5_Click(object sender, EventArgs e)
{
Properties.Settings.Default.Reload();
customRuntimeSaveListEntries = JsonConvert.DeserializeObject<List<CustomRuntimeSaveListEntry>>(Properties.Settings.Default.CustomRuntimes);
foreach (var item in customRuntimeSaveListEntries)
{
MessageBox.Show($"Name: {item.Name}\nJsonPath: {item.JsonPath}\nImagePath: {item.ImagePath}");
}
}
private void MainForm_KeyUp(object sender, KeyEventArgs e)
{
if (RemoveCustomModeOn && e.KeyCode == Keys.Escape)
{
RemoveCustomModeOn = false;
btnRemoveCustom.Text = "Remove";
btnRemoveCustom.BackColor = Color.DarkRed;
}
}
private void MainForm_Click(object sender, EventArgs e)
{
if (RemoveCustomModeOn)
{
RemoveCustomModeOn = false;
btnRemoveCustom.Text = "Remove";
btnRemoveCustom.BackColor = Color.DarkRed;
}
this.ActiveControl = label1;
label1.Focus();
}
private void timerSplash_Tick(object sender, EventArgs e)
{
timerSplash.Enabled = false;
this.Controls.Remove(panelSplash);
}
private void checkForUpdateToolStripMenuItem_Click(object sender, EventArgs e)
{
CheckForUpdate(true);
}
public async void CheckForUpdate(bool showError)
{
try
{
long timestamp = DateTimeOffset.Now.ToUnixTimeSeconds();
using (HttpClient client = new HttpClient())
{
client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json"));
client.DefaultRequestHeaders.UserAgent.TryParseAdd("request");//Set the User Agent to "request"
using (HttpResponseMessage response = client.GetAsync("https://api.github.com/repos/WaGi-Coding/OpenXR-Runtime-Switcher/releases/latest?ts=" + timestamp.ToString()).Result)
{
response.EnsureSuccessStatusCode();
string responseBody = await response.Content.ReadAsStringAsync();
string verStr = JObject.Parse(responseBody)["tag_name"].ToString();
Version ver = new Version(verStr);
string appVerStr = Application.ProductVersion;
Version appVer = new Version(appVerStr);
bool needUpdate = ver.CompareTo(appVer) > 0;
if (MessageBox.Show($"There is an Update available!\n\n\nNew Version: {ver}\n\nYour Version: {appVer}\n\n\nDo you want to visit the Download Page?", "Update available!", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
{
Process.Start("https://github.com/WaGi-Coding/OpenXR-Runtime-Switcher/releases/latest");
}
else
{
return;
}
//MessageBox.Show(needUpdate.ToString());
}
}
}
catch (Exception)
{
if (showError)
{
MessageBox.Show("Error when checking for Update!");
}
// Ignore any errors on update check for the "on start update check"
}
}
}
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,209 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\MSBuild.ILMerge.Task.1.1.3\build\MSBuild.ILMerge.Task.props" Condition="Exists('..\packages\MSBuild.ILMerge.Task.1.1.3\build\MSBuild.ILMerge.Task.props')" />
<Import Project="..\packages\ILMerge.3.0.29\build\ILMerge.props" Condition="Exists('..\packages\ILMerge.3.0.29\build\ILMerge.props')" />
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{EF8C31E1-DDE3-4DEC-A36D-D9475EA703D4}</ProjectGuid>
<OutputType>WinExe</OutputType>
<RootNamespace>OpenXR_Runtime_Switcher</RootNamespace>
<AssemblyName>OpenXR-Runtime-Switcher</AssemblyName>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
<IsWebBootstrapper>false</IsWebBootstrapper>
<TargetFrameworkProfile />
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>x64</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>x64</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<LangVersion>7.3</LangVersion>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>bin\x64\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget>
<LangVersion>7.3</LangVersion>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<PropertyGroup>
<ApplicationManifest>app.manifest</ApplicationManifest>
</PropertyGroup>
<PropertyGroup>
<ApplicationIcon>icon.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.ServiceProcess" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="CustomRuntimeSaveListEntry.cs" />
<Compile Include="Form_AddCustomRuntime.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Form_AddCustomRuntime.Designer.cs">
<DependentUpon>Form_AddCustomRuntime.cs</DependentUpon>
</Compile>
<Compile Include="Runtimes\Runtime_Custom.cs" />
<Compile Include="StatusTypes.cs" />
<Compile Include="MainForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="MainForm.Designer.cs">
<DependentUpon>MainForm.cs</DependentUpon>
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="RuntimeManager.cs" />
<Compile Include="Runtimes\IOpenXRRuntime.cs" />
<Compile Include="Runtimes\Runtime_Oculus.cs" />
<Compile Include="Runtimes\Runtime_SteamVR.cs" />
<Compile Include="Runtimes\Runtime_Varjo.cs" />
<Compile Include="Runtimes\Runtime_ViveVR.cs" />
<Compile Include="Runtimes\Runtime_WMR.cs" />
<Compile Include="RuntimeEntryControl.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="RuntimeEntryControl.Designer.cs">
<DependentUpon>RuntimeEntryControl.cs</DependentUpon>
</Compile>
<EmbeddedResource Include="Form_AddCustomRuntime.resx">
<DependentUpon>Form_AddCustomRuntime.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="MainForm.resx">
<DependentUpon>MainForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
<EmbeddedResource Include="RuntimeEntryControl.resx">
<DependentUpon>RuntimeEntryControl.cs</DependentUpon>
</EmbeddedResource>
<None Include="app.manifest" />
<None Include="ILMerge.props" />
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include=".NETFramework,Version=v4.8">
<Visible>False</Visible>
<ProductName>Microsoft .NET Framework 4.8 %28x86 and x64%29</ProductName>
<Install>true</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1</ProductName>
<Install>false</Install>
</BootstrapperPackage>
</ItemGroup>
<ItemGroup>
<None Include="Resources\SteamVR.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\Varjo.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\Vive.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\WMR.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\Oculus.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\NoLogo.png" />
</ItemGroup>
<ItemGroup>
<Content Include="icon.ico" />
<Content Include="ILMergeOrder.txt" />
<None Include="Resources\icon.png" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\ILMerge.3.0.29\build\ILMerge.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\ILMerge.3.0.29\build\ILMerge.props'))" />
<Error Condition="!Exists('..\packages\MSBuild.ILMerge.Task.1.1.3\build\MSBuild.ILMerge.Task.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MSBuild.ILMerge.Task.1.1.3\build\MSBuild.ILMerge.Task.props'))" />
<Error Condition="!Exists('..\packages\MSBuild.ILMerge.Task.1.1.3\build\MSBuild.ILMerge.Task.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MSBuild.ILMerge.Task.1.1.3\build\MSBuild.ILMerge.Task.targets'))" />
</Target>
<Import Project="..\packages\MSBuild.ILMerge.Task.1.1.3\build\MSBuild.ILMerge.Task.targets" Condition="Exists('..\packages\MSBuild.ILMerge.Task.1.1.3\build\MSBuild.ILMerge.Task.targets')" />
</Project>

View file

@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace OpenXR_Runtime_Switcher
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new MainForm());
//Application.Run(new Form_AddCustomRuntime(new MainForm()));
}
}
}

View file

@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("OpenXR Runtime-Switcher")]
[assembly: AssemblyDescription("OpenXR Runtime-Switcher for Windows")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("WaGi-Coding")]
[assembly: AssemblyProduct("Taki7o7's OpenXR Runtime-Switcher")]
[assembly: AssemblyCopyright("Copyright © WaGi-Coding 2022")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("ef8c31e1-dde3-4dec-a36d-d9475ea703d4")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// 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("1.0.0")]
[assembly: AssemblyFileVersion("1.0.0")]

View file

@ -0,0 +1,133 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace OpenXR_Runtime_Switcher.Properties {
using System;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("OpenXR_Runtime_Switcher.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap AppLogo {
get {
object obj = ResourceManager.GetObject("AppLogo", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap Logo_NoLogo {
get {
object obj = ResourceManager.GetObject("Logo_NoLogo", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap Logo_Oculus {
get {
object obj = ResourceManager.GetObject("Logo_Oculus", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap Logo_SteamVR {
get {
object obj = ResourceManager.GetObject("Logo_SteamVR", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap Logo_Varjo {
get {
object obj = ResourceManager.GetObject("Logo_Varjo", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap Logo_Vive {
get {
object obj = ResourceManager.GetObject("Logo_Vive", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap Logo_WMR {
get {
object obj = ResourceManager.GetObject("Logo_WMR", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
}
}

View file

@ -0,0 +1,142 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="AppLogo" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icon.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Logo_NoLogo" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\NoLogo.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Logo_Oculus" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Oculus.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Logo_SteamVR" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\SteamVR.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Logo_Varjo" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Varjo.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Logo_Vive" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Vive.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Logo_WMR" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\WMR.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>

View file

@ -0,0 +1,50 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace OpenXR_Runtime_Switcher.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.10.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default {
get {
return defaultInstance;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("True")]
public bool UpgradeRequired {
get {
return ((bool)(this["UpgradeRequired"]));
}
set {
this["UpgradeRequired"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("[]")]
public string CustomRuntimes {
get {
return ((string)(this["CustomRuntimes"]));
}
set {
this["CustomRuntimes"] = value;
}
}
}
}

View file

@ -0,0 +1,12 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="OpenXR_Runtime_Switcher.Properties" GeneratedClassName="Settings">
<Profiles />
<Settings>
<Setting Name="UpgradeRequired" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
</Setting>
<Setting Name="CustomRuntimes" Type="System.String" Scope="User">
<Value Profile="(Default)">[]</Value>
</Setting>
</Settings>
</SettingsFile>

Binary file not shown.

After

Width:  |  Height:  |  Size: 4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

View file

@ -0,0 +1,156 @@

namespace OpenXR_Runtime_Switcher
{
partial class RuntimeEntryControl
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.lblRuntimeName = new System.Windows.Forms.Label();
this.tbPath = new System.Windows.Forms.TextBox();
this.labelPath = new System.Windows.Forms.Label();
this.btnCopyPath = new System.Windows.Forms.Button();
this.toolTipUC = new System.Windows.Forms.ToolTip(this.components);
this.btnHandle = new System.Windows.Forms.Button();
this.pictureBox_RuntimeLogo = new System.Windows.Forms.PictureBox();
((System.ComponentModel.ISupportInitialize)(this.pictureBox_RuntimeLogo)).BeginInit();
this.SuspendLayout();
//
// lblRuntimeName
//
this.lblRuntimeName.Font = new System.Drawing.Font("Microsoft Sans Serif", 11.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lblRuntimeName.Location = new System.Drawing.Point(103, 3);
this.lblRuntimeName.Name = "lblRuntimeName";
this.lblRuntimeName.Size = new System.Drawing.Size(244, 38);
this.lblRuntimeName.TabIndex = 9999;
this.lblRuntimeName.Text = "No Runtime Name Defined for this Entry";
this.lblRuntimeName.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
this.lblRuntimeName.Click += new System.EventHandler(this.RuntimeEntryControl_Click);
this.lblRuntimeName.MouseLeave += new System.EventHandler(this.RuntimeEntryControl_MouseLeave);
this.lblRuntimeName.MouseMove += new System.Windows.Forms.MouseEventHandler(this.RuntimeEntryControl_MouseMove);
//
// tbPath
//
this.tbPath.Enabled = false;
this.tbPath.Location = new System.Drawing.Point(132, 77);
this.tbPath.Name = "tbPath";
this.tbPath.ReadOnly = true;
this.tbPath.Size = new System.Drawing.Size(161, 20);
this.tbPath.TabIndex = 2;
this.tbPath.DoubleClick += new System.EventHandler(this.tbPath_DoubleClick);
this.tbPath.KeyDown += new System.Windows.Forms.KeyEventHandler(this.tbPath_KeyDown);
//
// labelPath
//
this.labelPath.Location = new System.Drawing.Point(100, 75);
this.labelPath.Name = "labelPath";
this.labelPath.Size = new System.Drawing.Size(32, 23);
this.labelPath.TabIndex = 9999;
this.labelPath.Text = "Path:";
this.labelPath.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// btnCopyPath
//
this.btnCopyPath.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnCopyPath.Enabled = false;
this.btnCopyPath.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnCopyPath.Font = new System.Drawing.Font("Arial", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.btnCopyPath.ImageAlign = System.Drawing.ContentAlignment.TopCenter;
this.btnCopyPath.Location = new System.Drawing.Point(299, 77);
this.btnCopyPath.Name = "btnCopyPath";
this.btnCopyPath.Size = new System.Drawing.Size(48, 20);
this.btnCopyPath.TabIndex = 3;
this.btnCopyPath.Text = "COPY";
this.btnCopyPath.TextAlign = System.Drawing.ContentAlignment.TopCenter;
this.toolTipUC.SetToolTip(this.btnCopyPath, "Copy Path to Clipboard");
this.btnCopyPath.UseMnemonic = false;
this.btnCopyPath.UseVisualStyleBackColor = true;
this.btnCopyPath.Click += new System.EventHandler(this.btnCopyPath_Click);
//
// btnHandle
//
this.btnHandle.BackColor = System.Drawing.Color.DarkRed;
this.btnHandle.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnHandle.Enabled = false;
this.btnHandle.FlatAppearance.BorderSize = 2;
this.btnHandle.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnHandle.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.btnHandle.Location = new System.Drawing.Point(103, 44);
this.btnHandle.Name = "btnHandle";
this.btnHandle.Size = new System.Drawing.Size(244, 27);
this.btnHandle.TabIndex = 1;
this.btnHandle.Text = "Error in determining the Status";
this.btnHandle.TextAlign = System.Drawing.ContentAlignment.TopCenter;
this.btnHandle.UseVisualStyleBackColor = false;
this.btnHandle.Click += new System.EventHandler(this.btnHandle_Click);
//
// pictureBox_RuntimeLogo
//
this.pictureBox_RuntimeLogo.Image = global::OpenXR_Runtime_Switcher.Properties.Resources.Logo_NoLogo;
this.pictureBox_RuntimeLogo.Location = new System.Drawing.Point(3, 3);
this.pictureBox_RuntimeLogo.Name = "pictureBox_RuntimeLogo";
this.pictureBox_RuntimeLogo.Size = new System.Drawing.Size(94, 94);
this.pictureBox_RuntimeLogo.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
this.pictureBox_RuntimeLogo.TabIndex = 0;
this.pictureBox_RuntimeLogo.TabStop = false;
this.pictureBox_RuntimeLogo.Click += new System.EventHandler(this.RuntimeEntryControl_Click);
this.pictureBox_RuntimeLogo.MouseLeave += new System.EventHandler(this.RuntimeEntryControl_MouseLeave);
this.pictureBox_RuntimeLogo.MouseMove += new System.Windows.Forms.MouseEventHandler(this.RuntimeEntryControl_MouseMove);
//
// RuntimeEntryControl
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.DarkGray;
this.Controls.Add(this.btnHandle);
this.Controls.Add(this.btnCopyPath);
this.Controls.Add(this.labelPath);
this.Controls.Add(this.tbPath);
this.Controls.Add(this.lblRuntimeName);
this.Controls.Add(this.pictureBox_RuntimeLogo);
this.Name = "RuntimeEntryControl";
this.Size = new System.Drawing.Size(350, 100);
this.Click += new System.EventHandler(this.RuntimeEntryControl_Click);
this.MouseLeave += new System.EventHandler(this.RuntimeEntryControl_MouseLeave);
this.MouseMove += new System.Windows.Forms.MouseEventHandler(this.RuntimeEntryControl_MouseMove);
((System.ComponentModel.ISupportInitialize)(this.pictureBox_RuntimeLogo)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.PictureBox pictureBox_RuntimeLogo;
private System.Windows.Forms.Label lblRuntimeName;
private System.Windows.Forms.TextBox tbPath;
private System.Windows.Forms.Label labelPath;
private System.Windows.Forms.Button btnCopyPath;
private System.Windows.Forms.ToolTip toolTipUC;
private System.Windows.Forms.Button btnHandle;
}
}

View file

@ -0,0 +1,227 @@
using Newtonsoft.Json;
using OpenXR_Runtime_Switcher.Runtimes;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace OpenXR_Runtime_Switcher
{
public partial class RuntimeEntryControl : UserControl
{
public IOpenXRRuntime UCRuntime = null;
private MainForm mainForm = null;
private bool isCustom = false;
public RuntimeEntryControl()
{
MessageBox.Show("This Component is not meant to be initialized without parameters");
InitializeComponent();
InitializeUC(null);
}
public RuntimeEntryControl(MainForm mainForm, IOpenXRRuntime runtime, bool isCustom)
{
InitializeComponent();
this.mainForm = mainForm;
UCRuntime = runtime;
this.isCustom = isCustom;
InitializeUC(UCRuntime);
}
private void InitializeUC(IOpenXRRuntime runtime)
{
if (runtime == null)
{
pictureBox_RuntimeLogo.Image = Properties.Resources.Logo_NoLogo;
btnHandle.Text = "Error in determining the Status";
btnHandle.BackColor = Color.Red;
btnHandle.Enabled = false;
btnCopyPath.Enabled = false;
tbPath.Enabled = false;
return;
}
switch (runtime.Status)
{
case ControlStatusType.NotInstalled:
pictureBox_RuntimeLogo.Image = runtime.Logo;
lblRuntimeName.Text = runtime.Name;
tbPath.Text = runtime.JsonPath;
btnHandle.Text = "Runtime not installed or found";
btnHandle.BackColor = Color.DarkRed;
btnHandle.Enabled = false;
if (isCustom)
{
btnCopyPath.Enabled = true;
tbPath.Enabled = true;
}
else
{
btnCopyPath.Enabled = false;
tbPath.Enabled = false;
}
break;
case ControlStatusType.Installed:
pictureBox_RuntimeLogo.Image = runtime.Logo;
lblRuntimeName.Text = runtime.Name;
tbPath.Text = runtime.JsonPath;
btnHandle.Text = "Switch to this Runtime";
btnHandle.BackColor = Color.DarkOrange;
btnHandle.Enabled = true;
btnCopyPath.Enabled = true;
tbPath.Enabled = true;
break;
case ControlStatusType.Active:
pictureBox_RuntimeLogo.Image = runtime.Logo;
lblRuntimeName.Text = runtime.Name;
tbPath.Text = runtime.JsonPath;
btnHandle.Text = "This is the ACTIVE Runtime";
btnHandle.BackColor = Color.Green;
btnHandle.Enabled = false;
btnCopyPath.Enabled = true;
tbPath.Enabled = true;
break;
default:
pictureBox_RuntimeLogo.Image = runtime.Logo;
lblRuntimeName.Text = "No Name";
tbPath.Text = String.Empty;
btnHandle.Text = "Error in determining the Status";
btnHandle.BackColor = Color.DarkRed;
btnHandle.Enabled = false;
if (isCustom)
{
btnCopyPath.Enabled = true;
tbPath.Enabled = true;
}
else
{
btnCopyPath.Enabled = false;
tbPath.Enabled = false;
}
break;
}
}
private void btnCopyPath_Click(object sender, EventArgs e)
{
if (!String.IsNullOrWhiteSpace(tbPath.Text))
{
Clipboard.SetDataObject(tbPath.Text);
}
}
private void btnHandle_Click(object sender, EventArgs e)
{
try
{
RuntimeManager.TrySetActiveRuntimeJsonPath(UCRuntime.JsonPath);
this.mainForm.RefreshPanels();
}
catch (UnauthorizedAccessException)
{
MessageBox.Show("You need to run this Program as Administrator, in order to set a Runtime!");
return;
}
catch (Exception ex)
{
MessageBox.Show("Error when attempting to edit the Registry:\n" + ex.Message);
}
}
private void tbPath_KeyDown(object sender, KeyEventArgs e)
{
if (e.Control && e.KeyCode == Keys.A)
{
tbPath.SelectAll();
}
}
private void tbPath_DoubleClick(object sender, EventArgs e)
{
tbPath.SelectAll();
}
private void RuntimeEntryControl_MouseMove(object sender, MouseEventArgs e)
{
if (isCustom && mainForm.RemoveCustomModeOn && UCRuntime.Status != ControlStatusType.Active)
{
this.BackColor = Color.Red;
Cursor.Current = Cursors.Hand;
}
else
{
this.BackColor = Color.DarkGray;
Cursor.Current = Cursors.Default;
}
}
private void RuntimeEntryControl_MouseLeave(object sender, EventArgs e)
{
if (isCustom)
{
this.BackColor = Color.DarkGray;
Cursor.Current = Cursors.Default;
}
}
private void RuntimeEntryControl_Click(object sender, EventArgs e)
{
if (isCustom && mainForm.RemoveCustomModeOn && UCRuntime.Status != ControlStatusType.Active)
{
Properties.Settings.Default.Reload();
mainForm.customRuntimeSaveListEntries = JsonConvert.DeserializeObject<List<CustomRuntimeSaveListEntry>>(Properties.Settings.Default.CustomRuntimes);
var entriesToRemove = mainForm.customRuntimeSaveListEntries.Where(x => x.Name == UCRuntime.Name && x.JsonPath == UCRuntime.JsonPath).ToList();
if (entriesToRemove != null && entriesToRemove.Count() == 1)
{
mainForm.customRuntimeSaveListEntries.Remove(entriesToRemove[0]);
Properties.Settings.Default.CustomRuntimes = JsonConvert.SerializeObject(mainForm.customRuntimeSaveListEntries);
Properties.Settings.Default.Save();
Cursor.Current = Cursors.Default;
mainForm.RemoveCustomModeOn = false;
mainForm.btnRemoveCustom.Text = "Remove";
mainForm.btnRemoveCustom.BackColor = Color.DarkRed;
mainForm.RefreshPanels();
//mainForm.flowLayoutPanelCustoms.Controls.Remove(this);
}
else
{
MessageBox.Show("Error:\nCannot Remove!");
}
}
}
}
}

View file

@ -0,0 +1,123 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="toolTipUC.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>

View file

@ -0,0 +1,197 @@
using Microsoft.Win32;
using OpenXR_Runtime_Switcher.Runtimes;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace OpenXR_Runtime_Switcher
{
public class RuntimeManager
{
private const string OpenXRMajorApiVersion = "1";
private const string OpenXRKey = @"HKEY_LOCAL_MACHINE\SOFTWARE\Khronos\OpenXR\" + OpenXRMajorApiVersion;
private const string OpenXRValue = "ActiveRuntime";
private MainForm MainForm_Ref;
// Presets
public List<IOpenXRRuntime> PresetRuntimes;
public List<IOpenXRRuntime> FoundRuntimes;
// Customs
public List<IOpenXRRuntime> CustomRuntimes;
public List<IOpenXRRuntime> FoundCustomRuntimes;
public IOpenXRRuntime ActiveRuntime = null;
private string activeRuntimePath = String.Empty;
public RuntimeManager(MainForm mainForm)
{
MainForm_Ref = mainForm;
Refresh();
}
public List<RuntimeEntryControl> GetEntryListPresets()
{
List<RuntimeEntryControl> PresetControlsList = new List<RuntimeEntryControl>();
foreach (IOpenXRRuntime runtime in PresetRuntimes)
{
PresetControlsList.Add(new RuntimeEntryControl(MainForm_Ref, runtime, false));
}
PresetControlsList = PresetControlsList.OrderBy(x => x.UCRuntime.Status).ThenBy(x => x.UCRuntime.Name).ToList();
return PresetControlsList;
}
public List<RuntimeEntryControl> GetEntryListCustoms()
{
List<RuntimeEntryControl> CustomControlsList = new List<RuntimeEntryControl>();
foreach (IOpenXRRuntime runtime in CustomRuntimes)
{
CustomControlsList.Add(new RuntimeEntryControl(MainForm_Ref, runtime, true));
}
CustomControlsList = CustomControlsList.OrderBy(x => x.UCRuntime.Status).ThenBy(x => x.UCRuntime.Name).ToList();
return CustomControlsList;
}
public void Refresh()
{
activeRuntimePath = GetActiveRuntimeJsonPath();
// ############### Presets ###############
PresetRuntimes = new List<IOpenXRRuntime>
{
new Runtime_WMR(),
new Runtime_SteamVR(),
new Runtime_Oculus(),
new Runtime_ViveVR(),
new Runtime_Varjo(),
};
FoundRuntimes = PresetRuntimes
.Select(FindRuntime)
.Where(e => e.result)
.Select(e => e.runtime)
.ToList();
// Update UC for all Preset Runtimes
foreach (IOpenXRRuntime runtime in PresetRuntimes)
{
// Update Status
if (FoundRuntimes.Contains(runtime))
{
if (runtime.JsonPath.ToLower() == activeRuntimePath.ToLower())
{
runtime.Status = ControlStatusType.Active;
}
else
{
runtime.Status = ControlStatusType.Installed;
}
}
else
{
runtime.Status = ControlStatusType.NotInstalled;
}
}
// ############### Customs ###############
CustomRuntimes = new List<IOpenXRRuntime>();
foreach (CustomRuntimeSaveListEntry entry in MainForm_Ref.customRuntimeSaveListEntries)
{
Image img;
if (String.IsNullOrWhiteSpace(entry.ImagePath))
{
img = Properties.Resources.Logo_NoLogo;
}
else
{
try
{
img = Image.FromFile(entry.ImagePath);
}
catch (Exception)
{
img = Properties.Resources.Logo_NoLogo;
}
}
Runtime_Custom cstmRuntime = new Runtime_Custom() { Name=entry.Name, JsonPath=entry.JsonPath, Logo=img, Status=ControlStatusType.NotInstalled };
CustomRuntimes.Add(cstmRuntime);
}
FoundCustomRuntimes = CustomRuntimes
.Select(FindRuntime)
.Where(e => e.result)
.Select(e => e.runtime)
.ToList();
// Update UC for all Custom Runtimes
foreach (IOpenXRRuntime runtime in CustomRuntimes)
{
// Update Status
if (FoundCustomRuntimes.Contains(runtime))
{
if (runtime.JsonPath.ToLower() == activeRuntimePath.ToLower())
{
runtime.Status = ControlStatusType.Active;
}
else
{
runtime.Status = ControlStatusType.Installed;
}
}
else
{
runtime.Status = ControlStatusType.NotInstalled;
}
}
}
private static (bool result, string path, IOpenXRRuntime runtime) FindRuntime(IOpenXRRuntime e)
{
bool result = e.TryGetJsonPath(out var path);
return (result, path, e);
}
public string GetActiveRuntimeJsonPath()
{
var pathValue = Registry.GetValue(OpenXRKey, OpenXRValue, string.Empty);
if (pathValue is string path && !string.IsNullOrWhiteSpace(path))
{
if (File.Exists(path))
{
return Path.GetFullPath(path);
}
}
return String.Empty;
}
// Needs Administrator rights!
public static void TrySetActiveRuntimeJsonPath(string jsonPath)
{
Registry.SetValue(OpenXRKey, OpenXRValue, jsonPath, RegistryValueKind.ExpandString);
}
}
}

View file

@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OpenXR_Runtime_Switcher.Runtimes
{
public interface IOpenXRRuntime
{
string Name { get; set; }
string JsonPath { get; set; }
ControlStatusType? Status { get; set; }
Image Logo { get; set; }
bool TryGetJsonPath(out string jsonPath);
}
}

View file

@ -0,0 +1,69 @@
using Microsoft.Win32;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
namespace OpenXR_Runtime_Switcher.Runtimes
{
internal class Runtime_Custom : IOpenXRRuntime
{
private string name = "Custom Runtime";
private string jsonPath = String.Empty;
private ControlStatusType? status = ControlStatusType.NotInstalled;
private Image logo = Properties.Resources.Logo_NoLogo;
public string Name
{
get => this.name;
set
{
this.name = value;
}
}
public string JsonPath
{
get => this.jsonPath;
set
{
this.jsonPath = value;
}
}
public ControlStatusType? Status
{
get => this.status;
set
{
this.status = value;
}
}
public Image Logo
{
get => this.logo;
set
{
this.logo = value;
}
}
public bool TryGetJsonPath(out string jsonPath)
{
string path = this.jsonPath;
if (File.Exists(Path.Combine(path)))
{
jsonPath = Path.GetFullPath(path);
JsonPath = jsonPath;
return true;
}
jsonPath = Path.GetFullPath(path);
return false;
}
}
}

View file

@ -0,0 +1,79 @@
using Microsoft.Win32;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
namespace OpenXR_Runtime_Switcher.Runtimes
{
internal class Runtime_Oculus : IOpenXRRuntime
{
private string name = "Oculus";
private string jsonPath = String.Empty;
private ControlStatusType? status = ControlStatusType.NotInstalled;
private Image logo = Properties.Resources.Logo_Oculus;
private const string InstallLocKey = @"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Oculus";
private const string InstallLocValue = "InstallLocation";
private const string JsonName = @"Support\oculus-runtime\oculus_openxr_64.json";
public string Name
{
get => name;
set
{
this.name = value;
}
}
public string JsonPath
{
get => this.jsonPath;
set
{
this.jsonPath = value;
}
}
public ControlStatusType? Status
{
get => this.status;
set
{
this.status = value;
}
}
public Image Logo
{
get => this.logo;
set
{
this.logo = value;
}
}
public bool TryGetJsonPath(out string jsonPath)
{
var oculusPathValue = Registry.GetValue(InstallLocKey, InstallLocValue, string.Empty);
if (oculusPathValue is string oculusPath && !string.IsNullOrWhiteSpace(oculusPath))
{
var path = Path.Combine(oculusPath, JsonName);
if (File.Exists(path))
{
jsonPath = Path.GetFullPath(path);
JsonPath = jsonPath;
return true;
}
}
jsonPath = String.Empty;
JsonPath = jsonPath;
return false;
}
}
}

View file

@ -0,0 +1,126 @@
using Microsoft.Win32;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
namespace OpenXR_Runtime_Switcher.Runtimes
{
internal class Runtime_SteamVR : IOpenXRRuntime
{
private string name = "SteamVR";
private string jsonPath = String.Empty;
private ControlStatusType? status = ControlStatusType.NotInstalled;
private Image logo = Properties.Resources.Logo_SteamVR;
private const string SteamPathKey = @"HKEY_CURRENT_USER\SOFTWARE\Valve\Steam";
private const string SteamPathValue = "SteamPath";
private const string LibraryFoldersVdf = "steamapps/libraryfolders.vdf";
private const string LibraryFoldersKey = "\"LibraryFolders\"";
private const string JsonName = @"steamapps/common/SteamVR/steamxr_win64.json";
private static readonly Regex RxKeyValue = new Regex(@"^[0-9]+$");
public string Name
{
get => name;
set
{
this.name = value;
}
}
public string JsonPath
{
get => jsonPath;
set
{
this.jsonPath = value;
}
}
public ControlStatusType? Status
{
get => this.status;
set
{
this.status = value;
}
}
public Image Logo
{
get => this.logo;
set
{
this.logo = value;
}
}
public bool TryGetJsonPath(out string jsonPath)
{
jsonPath = String.Empty;
this.jsonPath = jsonPath;
var steamPathValue = Registry.GetValue(SteamPathKey, SteamPathValue, string.Empty);
if (!(steamPathValue is string steamPath))
{
return false;
}
if (string.IsNullOrWhiteSpace(steamPath))
{
return false;
}
var libraryFolders = Path.Combine(steamPath, LibraryFoldersVdf);
if (!File.Exists(libraryFolders))
{
return false;
}
var folders = new List<string> { steamPath };
using (var sr = new StreamReader(libraryFolders))
{
var line = sr.ReadLine()?.Trim();
if (string.Compare(line, LibraryFoldersKey, StringComparison.OrdinalIgnoreCase) != 0)
{
return false;
}
line = sr.ReadLine()?.Trim();
if (line != "{")
{
return false;
}
line = sr.ReadLine()?.Trim();
while (line != null && line != "{")
{
var m = RxKeyValue.Match(line);
if (m.Success)
{
folders.Add(m.Groups[1].Value.Replace(@"\\", @"\"));
}
line = sr.ReadLine()?.Trim();
}
}
foreach (var folder in folders)
{
var path = Path.Combine(folder, JsonName);
if (File.Exists(path))
{
jsonPath = Path.GetFullPath(path);
this.jsonPath = jsonPath;
return true;
}
}
return false;
}
}
}

View file

@ -0,0 +1,87 @@
using Microsoft.Win32;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
namespace OpenXR_Runtime_Switcher.Runtimes
{
internal class Runtime_Varjo : IOpenXRRuntime
{
private string name = "Varjo";
private string jsonPath = String.Empty;
private ControlStatusType? status = ControlStatusType.NotInstalled;
private Image logo = Properties.Resources.Logo_Varjo;
private const string VarjoRuntimeKey = @"HKEY_LOCAL_MACHINE\SOFTWARE\Varjo\Runtime";
private const string InstallDirKey = "InstallDir";
private const string JsonName = @"varjo-openxr/VarjoOpenXR.json";
public string Name
{
get => name;
set
{
this.name = value;
}
}
public string JsonPath
{
get => jsonPath;
set
{
this.jsonPath = value;
}
}
public ControlStatusType? Status
{
get => this.status;
set
{
this.status = value;
}
}
public Image Logo
{
get => this.logo;
set
{
this.logo = value;
}
}
public bool TryGetJsonPath(out string jsonPath)
{
jsonPath = String.Empty;
this.jsonPath = jsonPath;
var varjoPathValue = Registry.GetValue(VarjoRuntimeKey, InstallDirKey, string.Empty);
if (!(varjoPathValue is string vivePath))
{
return false;
}
if (string.IsNullOrWhiteSpace(vivePath))
{
return false;
}
var path = Path.Combine(vivePath, JsonName);
if (File.Exists(path))
{
jsonPath = Path.GetFullPath(path);
this.jsonPath = jsonPath;
return true;
}
return false;
}
}
}

View file

@ -0,0 +1,87 @@
using Microsoft.Win32;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
namespace OpenXR_Runtime_Switcher.Runtimes
{
internal class Runtime_ViveVR : IOpenXRRuntime
{
private string name = "ViveVR";
private string jsonPath = String.Empty;
private ControlStatusType? status = ControlStatusType.NotInstalled;
private Image logo = Properties.Resources.Logo_Vive;
private const string VivePathKey = @"HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\HtcVive\Updater";
private const string AppPathKey = "AppPath";
private const string JsonName = @"App/ViveVRRuntime/ViveVR_openxr/ViveOpenXR.json";
public string Name
{
get => name;
set
{
this.name = value;
}
}
public string JsonPath
{
get => jsonPath;
set
{
this.jsonPath = value;
}
}
public ControlStatusType? Status
{
get => this.status;
set
{
this.status = value;
}
}
public Image Logo
{
get => this.logo;
set
{
this.logo = value;
}
}
public bool TryGetJsonPath(out string jsonPath)
{
jsonPath = String.Empty;
this.jsonPath = jsonPath;
var vivePathValue = Registry.GetValue(VivePathKey, AppPathKey, string.Empty);
if (!(vivePathValue is string vivePath))
{
return false;
}
if (string.IsNullOrWhiteSpace(vivePath))
{
return false;
}
var path = Path.Combine(vivePath, JsonName);
if (File.Exists(path))
{
jsonPath = Path.GetFullPath(path);
this.jsonPath = jsonPath;
return true;
}
return false;
}
}
}

View file

@ -0,0 +1,75 @@
using Microsoft.Win32;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
namespace OpenXR_Runtime_Switcher.Runtimes
{
internal class Runtime_WMR : IOpenXRRuntime
{
private string name = "Windows Mixed Reality";
private string jsonPath = String.Empty;
private ControlStatusType? status = ControlStatusType.NotInstalled;
private Image logo = Properties.Resources.Logo_WMR;
private const string JsonName = "MixedRealityRuntime.json";
public string Name
{
get => name;
set
{
this.name = value;
}
}
public string JsonPath
{
get => jsonPath;
set
{
this.jsonPath = value;
}
}
public ControlStatusType? Status
{
get => this.status;
set
{
this.status = value;
}
}
public Image Logo
{
get => this.logo;
set
{
this.logo = value;
}
}
public bool TryGetJsonPath(out string jsonPath)
{
var systemPath = Environment.GetFolderPath(Environment.SpecialFolder.System);
var path = Path.Combine(systemPath, JsonName);
if (File.Exists(path))
{
jsonPath = Path.GetFullPath(path);
this.jsonPath = jsonPath;
return true;
}
jsonPath = String.Empty;
this.jsonPath = jsonPath;
return false;
}
}
}

View file

@ -0,0 +1,9 @@
namespace OpenXR_Runtime_Switcher
{
public enum ControlStatusType
{
Active,
Installed,
NotInstalled,
}
}

View file

@ -0,0 +1,80 @@
<?xml version="1.0" encoding="utf-8"?>
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
<assemblyIdentity version="1.0.0.0" name="MyApplication.app"/>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
<!-- UAC Manifest Options
If you want to change the Windows User Account Control level replace the
requestedExecutionLevel node with one of the following.
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
<requestedExecutionLevel level="highestAvailable" uiAccess="false" />
Specifying requestedExecutionLevel element will disable file and registry virtualization.
Remove this element if your application requires this virtualization for backwards
compatibility.
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
-->
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
</requestedPrivileges>
</security>
</trustInfo>
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<!-- A list of the Windows versions that this application has been tested on
and is designed to work with. Uncomment the appropriate elements
and Windows will automatically select the most compatible environment. -->
<!-- Windows Vista -->
<!--<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}" />-->
<!-- Windows 7 -->
<!--<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" />-->
<!-- Windows 8 -->
<!--<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}" />-->
<!-- Windows 8.1 -->
<!--<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}" />-->
<!-- Windows 10 -->
<!--<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />-->
</application>
</compatibility>
<!-- Indicates that the application is DPI-aware and will not be automatically scaled by Windows at higher
DPIs. Windows Presentation Foundation (WPF) applications are automatically DPI-aware and do not need
to opt in. Windows Forms applications targeting .NET Framework 4.6 that opt into this setting, should
also set the 'EnableWindowsFormsHighDpiAutoResizing' setting to 'true' in their app.config.
Makes the application long-path aware. See https://docs.microsoft.com/windows/win32/fileio/maximum-file-path-limitation -->
<!--
<application xmlns="urn:schemas-microsoft-com:asm.v3">
<windowsSettings>
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
<longPathAware xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">true</longPathAware>
</windowsSettings>
</application>
-->
<!-- Enable themes for Windows common controls and dialogs (Windows XP and later) -->
<!--
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="*"
publicKeyToken="6595b64144ccf1df"
language="*"
/>
</dependentAssembly>
</dependency>
-->
</assembly>

View file

@ -0,0 +1,31 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="refresh" content="0; url=https://github.com/WaGi-Coding/OpenXR-Runtime-Switcher" />
<meta name="viewport" content="width=device-width">
<title>OpenXR Runtime-Switcher | by WaGi-Coding aka. Taki7o7</title>
<meta name="description" content="OpenXR Runtime-Switcher for Windows">
<link rel="search" type="application/opensearchdescription+xml" href="/opensearch.xml" title="Taki7o7">
<link rel="fluid-icon" href="https://github.com/fluidicon.png" title="Taki7o7">
<meta name="twitter:image:src" content="https://imgur.com/a/fpV20YV" />
<meta name="twitter:site" content="@Taki7o7" />
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:title" content="OpenXR Runtime-Switcher" />
<meta name="twitter:description" content="OpenXR Runtime-Switcher for Windows" />
<meta property="og:image" content="https://imgur.com/a/fpV20YV" />
<meta property="og:site_name" content="WaGi-Coding aka. Taki7o7" />
<meta property="og:type" content="object" />
<meta property="og:title" content="OpenXR Runtime-Switcher" />
<meta property="og:url" content="https://wagi-coding.github.io/OpenXR-Runtime-Switcher" />
<meta property="og:description" content="OpenXR Runtime-Switcher for Windows" />
</head>
<body style="background-color: black;">
</body>
</html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 194 KiB

View file

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="ILMerge" version="3.0.29" targetFramework="net48" />
<package id="MSBuild.ILMerge.Task" version="1.1.3" targetFramework="net48" />
<package id="Newtonsoft.Json" version="13.0.1" targetFramework="net48" />
</packages>

29
README.md Normal file
View file

@ -0,0 +1,29 @@
# Taki7o7's OpenXR Runtime-Switcher
![GitHub release (latest by date)](https://img.shields.io/github/v/release/WaGi-Coding/OpenXR-Runtime-Switcher?label=latest%20release&style=for-the-badge)
![GitHub all releases](https://img.shields.io/github/downloads/WaGi-Coding/OpenXR-Runtime-Switcher/total?label=Github%20Release%20Downloads&style=for-the-badge)
![GitHub Repo stars](https://img.shields.io/github/stars/WaGi-Coding/OpenXR-Runtime-Switcher?style=social)
<p align="center">
<a href="https://github.com/WaGi-Coding/OpenXR-Runtime-Switcher/releases/">DOWNLOAD HERE</a>
</p>
<p align="center">
Allows you to quickly switch your System Default OpenXR Runtime between existing ones (currently SteamVR, Oculus/Meta, ViveVR, Windows Mixed Reality & Varjo) if installed & custom ones, which you can add manually to the program.
</p>
<p align="center">
Let me know if you find any bugs or if you have any questions. Here in Issues tab, or via Discord: Taki7o7#0860
</p>
<p align="center">
<img src="https://i.imgur.com/hBm4O18.png">
</p>
<p align="center">
<img src="https://i.imgur.com/9RtXsTt.png">
</p>
<p align="center">
I've made this because for example SteamVR only gives you the option to set it's Runtime as System Default OXR Runtime via the Developer Tab, when you've a Headset connected to it - which is/was annoying.
</p>