Skip to content

Commit

Permalink
.Net Framework & Rebuild to better code
Browse files Browse the repository at this point in the history
  • Loading branch information
KrisIsBackAU committed Oct 27, 2022
1 parent 7873408 commit 742c783
Show file tree
Hide file tree
Showing 34 changed files with 1,580 additions and 644 deletions.
41 changes: 29 additions & 12 deletions Oculus VR Dash Manager/Dashes/Dash Manager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,36 @@ public static void PassMainForm(MainWindow Form)
MainForm = Form;
}

public static void FocusMainForm()
public static void MainForm_FixTaskViewIssue()
{
if (MainForm != null)
Functions.DoAction(MainForm, new Action(delegate () { MainForm.Cancel_TaskView_And_Focus(); }));
Functions_Old.DoAction(MainForm, new Action(delegate () { MainForm.Cancel_TaskView_And_Focus(); }));
}

public static void MainForm_CheckRunTime()
{
if (MainForm != null)
Functions_Old.DoAction(MainForm, new Action(delegate () { MainForm.CheckRunTime(); }));
}

public static bool EmulateReleaseMode()
{
if (MainForm != null)
return MainForm.Debug_EmulateReleaseMode;
else
return false;
}

public static void GenerateDashes()
{
Oculus_Software.Check_Is_Installed();
Software.Oculus.Check_Current_Dash();

Oculus_Dash = new OVR_Dash("Offical Oculus Dash", "OculusDash_Normal.exe", ProcessToStop: "vrmonitor");
SteamVR_Dash = new OVR_Dash("ItsKaitlyn03 - Oculus Killer", "ItsKaitlyn03_Oculus_Killer.exe", "Oculus Killer", "ItsKaitlyn03", "OculusKiller", "OculusDash.exe");

Software.Oculus.Setup();
Software.Oculus.Check_Oculus_Is_Installed();

CheckInstalled();
}

Expand All @@ -41,28 +58,28 @@ private static void CheckInstalled()
if (!SteamVR_Dash.Installed)
SteamVR_Dash.Download();

Oculus_Software.Check_Current_Dash();
Software.Oculus.Check_Current_Dash();

if (!Oculus_Dash.Installed)
{
if (Oculus_Software.NormalDash)
if (Software.Oculus.Normal_Dash)
{
// Copy Default Oculus Dash if not already done
File.Copy(Oculus_Software.OculusDashFile, Path.Combine(Oculus_Software.OculusDashDirectory, Oculus_Dash.DashFileName), true);
File.Copy(Software.Oculus.Oculus_Dash_File, Path.Combine(Software.Oculus.Oculus_Dash_Directory, Oculus_Dash.DashFileName), true);
Oculus_Dash.CheckInstalled();
}
}
else
{
// Check if Oculus Updated and check is Oculus Dash has changed by "Length"
if (Oculus_Software.NormalDash)
if (Software.Oculus.Normal_Dash)
{
FileInfo CurrentDash = new FileInfo(Path.Combine(Oculus_Software.OculusDashDirectory, Oculus_Dash.DashFileName));
FileInfo OculusDashFile = new FileInfo(Oculus_Software.OculusDashFile);
FileInfo CurrentDash = new FileInfo(Path.Combine(Software.Oculus.Oculus_Dash_Directory, Oculus_Dash.DashFileName));
FileInfo OculusDashFile = new FileInfo(Software.Oculus.Oculus_Dash_File);

// Update File
if (CurrentDash.Length != OculusDashFile.Length)
File.Copy(Oculus_Software.OculusDashFile, Path.Combine(Oculus_Software.OculusDashDirectory, Oculus_Dash.DashFileName), true);
File.Copy(Software.Oculus.Oculus_Dash_File, Path.Combine(Software.Oculus.Oculus_Dash_Directory, Oculus_Dash.DashFileName), true);
}
}
}
Expand All @@ -89,7 +106,7 @@ private static bool SetActiveDash(Dash_Type Dash)
switch (Dash)
{
case Dash_Type.Normal:
SteamVR.ManagerCalledExit = true;
Software.Steam.ManagerCalledExit = true;
if (!Properties.Settings.Default.FastSwitch)
Activated = Oculus_Dash.Activate_Dash();
else
Expand Down Expand Up @@ -199,7 +216,7 @@ public static Boolean Activate(Dash_Type Dash)
try
{
Debug.WriteLine("Stopping OVRService");
SteamVR.ManagerCalledExit = true;
Software.Steam.ManagerCalledExit = true;
Service_Manager.StopService("OVRService");
}
catch (Exception ex)
Expand Down
46 changes: 23 additions & 23 deletions Oculus VR Dash Manager/Dashes/OVR_Dash.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,9 @@ public bool IsThisYourDash(String Dash_ProductName)

public void CheckInstalled()
{
if (Directory.Exists(Oculus_Software.OculusDashDirectory))
if (Directory.Exists(Software.Oculus.Oculus_Dash_Directory))
{
String DashPath = Path.Combine(Oculus_Software.OculusDashDirectory, DashFileName);
String DashPath = Path.Combine(Software.Oculus.Oculus_Dash_Directory, DashFileName);

if (File.Exists(DashPath))
_Installed = true;
Expand All @@ -91,7 +91,7 @@ public void CheckUpdate()
{
if (!String.IsNullOrEmpty(RepoName) && !String.IsNullOrEmpty(ProjectName) && !String.IsNullOrEmpty(AssetName))
{
String DashPath = Path.Combine(Oculus_Software.OculusDashDirectory, DashFileName);
String DashPath = Path.Combine(Software.Oculus.Oculus_Dash_Directory, DashFileName);
FileInfo CurrentDash = new FileInfo(DashPath);
_Size = CurrentDash.Length;

Expand All @@ -106,8 +106,8 @@ public void CheckUpdate()

public void Download()
{
String Temp_DashPath = Path.Combine(Oculus_Software.OculusDashDirectory, DashFileName + ".tmp");
String DashPath = Path.Combine(Oculus_Software.OculusDashDirectory, DashFileName);
String Temp_DashPath = Path.Combine(Software.Oculus.Oculus_Dash_Directory, DashFileName + ".tmp");
String DashPath = Path.Combine(Software.Oculus.Oculus_Dash_Directory, DashFileName);
Boolean Active_NeedUpdateTo = false;
Boolean ShouldUpdate = true;

Expand All @@ -116,7 +116,7 @@ public void Download()
try
{
// try and remove live version of this dash (we always have our backup incase)
File.Delete(Oculus_Software.OculusDashFile);
File.Delete(Software.Oculus.Oculus_Dash_File);
Active_NeedUpdateTo = true;
}
catch (Exception)
Expand All @@ -140,11 +140,11 @@ public void Download()
{
try
{
File.Move(Temp_DashPath, DashPath, true);
File.Move(Temp_DashPath, DashPath);
_Installed = true;

if (Active_NeedUpdateTo)
File.Copy(DashPath, Oculus_Software.OculusDashFile, true);
File.Copy(DashPath, Software.Oculus.Oculus_Dash_File, true);
}
catch (Exception ex)
{
Expand All @@ -156,8 +156,8 @@ public void Download()

if (_DashActive)
{
if (!File.Exists(Oculus_Software.OculusDashFile))
File.Copy(DashPath, Oculus_Software.OculusDashFile, true); // Copy backup file back incase something failed above
if (!File.Exists(Software.Oculus.Oculus_Dash_File))
File.Copy(DashPath, Software.Oculus.Oculus_Dash_File, true); // Copy backup file back incase something failed above
}
}

Expand All @@ -182,11 +182,11 @@ public bool Activate_Dash()
throw;
}

String DashPath = Path.Combine(Oculus_Software.OculusDashDirectory, DashFileName);
String DashPath = Path.Combine(Software.Oculus.Oculus_Dash_Directory, DashFileName);

try
{
Activated = SwitchFiles(DashPath, Oculus_Software.OculusDashFile);
Activated = SwitchFiles(DashPath, Software.Oculus.Oculus_Dash_File);
}
catch (Exception ex)
{
Expand Down Expand Up @@ -217,11 +217,11 @@ public bool Activate_Dash_Fast()
}
}

String DashPath = Path.Combine(Oculus_Software.OculusDashDirectory, DashFileName);
String DashPath = Path.Combine(Software.Oculus.Oculus_Dash_Directory, DashFileName);

try
{
Activated = SwitchFiles(DashPath, Oculus_Software.OculusDashFile);
Activated = SwitchFiles(DashPath, Software.Oculus.Oculus_Dash_File);
}
catch (Exception ex)
{
Expand Down Expand Up @@ -255,19 +255,19 @@ public bool Activate_Dash_Fast_v2()

if (Installed)
{
String DashPath = Path.Combine(Oculus_Software.OculusDashDirectory, DashFileName);
String DashPath = Path.Combine(Software.Oculus.Oculus_Dash_Directory, DashFileName);

try
{
if (File.Exists(Oculus_Software.OculusDashFile))
if (File.Exists(Software.Oculus.Oculus_Dash_File))
{
Debug.WriteLine("Moving Active Dash");

File.Move(Oculus_Software.OculusDashFile, $"{Oculus_Software.OculusDashFile}.delete", true);
File.Move(Software.Oculus.Oculus_Dash_File, $"{Software.Oculus.Oculus_Dash_File}.delete");
}

Debug.WriteLine("Switching in New Dash");
Activated = SwitchFiles(DashPath, Oculus_Software.OculusDashFile);
Activated = SwitchFiles(DashPath, Software.Oculus.Oculus_Dash_File);
}
catch (Exception ex)
{
Expand All @@ -286,20 +286,20 @@ public bool Activate_Dash_Fast_v2()
Debug.WriteLine("Killing Dash: " + RunningDash.Id);
RunningDash.Kill();

if (File.Exists($"{Oculus_Software.OculusDashFile}.delete"))
if (File.Exists($"{Software.Oculus.Oculus_Dash_File}.delete"))
{
RunningDash.WaitForExit();
File.Delete($"{Oculus_Software.OculusDashFile}.delete");
File.Delete($"{Software.Oculus.Oculus_Dash_File}.delete");
Debug.WriteLine("Removed Old Dash File");
}
}
}

try
{
if (File.Exists($"{Oculus_Software.OculusDashFile}.delete"))
if (File.Exists($"{Software.Oculus.Oculus_Dash_File}.delete"))
{
File.Delete($"{Oculus_Software.OculusDashFile}.delete");
File.Delete($"{Software.Oculus.Oculus_Dash_File}.delete");
Debug.WriteLine("Removed Old Dash File");
}
}
Expand Down Expand Up @@ -330,7 +330,7 @@ private bool SwitchFiles(String NewFile, String OldFile)
{
bool Activated = false;

String DashPath = Path.Combine(Oculus_Software.OculusDashDirectory, DashFileName);
String DashPath = Path.Combine(Software.Oculus.Oculus_Dash_Directory, DashFileName);
if (File.Exists(NewFile))
{
File.Copy(NewFile, OldFile, true);
Expand Down
48 changes: 48 additions & 0 deletions Oculus VR Dash Manager/Forms/Settings/frm_Settings_v2.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<Window x:Class="OVR_Dash_Manager.Forms.Settings.frm_Settings_v2"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:OVR_Dash_Manager.Forms.Settings"
mc:Ignorable="d"
Title="Settings" Width="863" Height="547" ResizeMode="CanMinimize" WindowStartupLocation="CenterScreen">

<Window.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="../../Theme/MetroDark.MSControls.Core.Implicit.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Window.Resources>

<Grid x:Name="gd_Settings" Background="#FF212121">
<GroupBox Header="Dash Manager Settings" Margin="10,10,10,0" Height="136" VerticalAlignment="Top">
<Grid Margin="0">
<local:uc_Setting Setting="AlwaysOnTop" Margin="10,3,0,0" HorizontalAlignment="Left" Width="150" Height="30" VerticalAlignment="Top" />
<Label Content="Keep Dash Manager On Top" Margin="166,3,10,0" VerticalAlignment="Top" Height="30" />
<local:uc_Setting Setting="FastSwitch" Margin="10,41,0,0" HorizontalAlignment="Left" Width="150" Height="30" VerticalAlignment="Top" />
<Label Content="Switch Dashes with out Stopping Link (Cable &amp; Air Link Supported)" HorizontalAlignment="Left" Margin="166,41,0,0" VerticalAlignment="Top" Height="30" />
</Grid>
</GroupBox>
<GroupBox Header="Oculus Settings" Margin="10,151,10,0" Height="210" VerticalAlignment="Top">
<Grid Margin="0">
<local:uc_Setting Setting="RunOculusClientOnStartup" Margin="10,8,0,0" HorizontalAlignment="Left" Width="150" Height="30" VerticalAlignment="Top" />
<Label Content="Start Oculus Client Software - When Dash Manager Launches" Margin="165,8,10,0" VerticalAlignment="Top" Height="30" />
<local:uc_Setting Setting="Minimize_Oculus_Client_OnClientStart" Margin="10,46,0,0" HorizontalAlignment="Left" Width="150" Height="30" VerticalAlignment="Top" />
<Label Content="Minimize Oculus Client - When Oculus Client Starts &amp; Launched by Dash Manager" Margin="165,46,10,0" VerticalAlignment="Top" Height="30" />
<local:uc_Setting Setting="CloseOculusClientOnExit" Margin="10,84,0,0" HorizontalAlignment="Left" Width="150" Height="30" VerticalAlignment="Top" />
<Label Content="Close Oculus Client - When Dash Manager Exits" Margin="165,84,10,0" VerticalAlignment="Top" Height="30" />
<local:uc_Setting Setting="CloseOculusServicesOnExit" Margin="10,122,0,0" HorizontalAlignment="Left" Width="150" Height="30" VerticalAlignment="Top" />
<Label Content="Stop Oculus Services - When Manager Exits (When Oculus Services set to Manual Startup)" Margin="165,122,10,0" VerticalAlignment="Top" Height="30" />
</Grid>
</GroupBox>
<GroupBox Header="Steam / SteamVR Settings" Margin="10,366,10,0" Height="135" VerticalAlignment="Top">
<Grid Margin="0">
<local:uc_Setting Setting="SteamVRFocusFix" Margin="10,3,0,0" HorizontalAlignment="Left" Width="150" Height="30" VerticalAlignment="Top" />
<Label Content="Fix SteamVR Admin Program Focus Issue When it Occurs (Task View Glitch)" Margin="166,3,10,0" VerticalAlignment="Top" Height="30" />
<local:uc_Setting Setting="ExitLinkOn_UserExit_SteamVR" Margin="10,41,0,0" HorizontalAlignment="Left" Width="150" Height="30" VerticalAlignment="Top" />
<Label Content="Exit Oculus Link when User Closes Steam VR (Stable Link Connection Recommended)" HorizontalAlignment="Left" Margin="166,41,0,0" VerticalAlignment="Top" Height="30" />
</Grid>
</GroupBox>
</Grid>
</Window>
15 changes: 15 additions & 0 deletions Oculus VR Dash Manager/Forms/Settings/frm_Settings_v2.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using System.Windows;

namespace OVR_Dash_Manager.Forms.Settings
{
/// <summary>
/// Interaction logic for frm_Settings_v2.xaml
/// </summary>
public partial class frm_Settings_v2 : Window
{
public frm_Settings_v2()
{
InitializeComponent();
}
}
}
26 changes: 26 additions & 0 deletions Oculus VR Dash Manager/Forms/Settings/uc_Setting.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<UserControl x:Class="OVR_Dash_Manager.Forms.Settings.uc_Setting"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:OVR_Dash_Manager.Forms.Settings"
mc:Ignorable="d" d:Height="40" d:Width="200" Loaded="UserControl_Loaded">

<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="../../Theme/MetroDark.MSControls.Core.Implicit.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</UserControl.Resources>

<Grid x:Name="gd_Settings" Background="#FF212121">
<UniformGrid Rows="1" Margin="0">
<UniformGrid.Resources>
<Style TargetType="RadioButton" BasedOn="{StaticResource {x:Type ToggleButton}}"/>
</UniformGrid.Resources>
<RadioButton x:Name="btn_Disabled" Content="Disabled" Checked="btn_Disabled_Checked" VerticalContentAlignment="Center" FontSize="13" HorizontalContentAlignment="Center" />
<RadioButton x:Name="btn_Enabled" Content="Enabled" Checked="btn_Enabled_Checked" VerticalContentAlignment="Center" FontSize="13" HorizontalContentAlignment="Center" />
</UniformGrid>
</Grid>
</UserControl>
Loading

0 comments on commit 742c783

Please sign in to comment.