Skip to content

Commit dfaaaae

Browse files
Merge pull request #23 from Mr-Technician/develop-1.0
Merge changes for version 1.3.0
2 parents 3b5599b + cf91c28 commit dfaaaae

File tree

12 files changed

+852
-275
lines changed

12 files changed

+852
-275
lines changed

BorderlessMinecraft/App.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<configuration>
33
<startup>
4-
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2"/>
4+
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/>
55
</startup>
66
</configuration>

BorderlessMinecraft/BorderlessMinecraft.csproj

Lines changed: 52 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,26 @@
88
<OutputType>WinExe</OutputType>
99
<RootNamespace>BorderlessMinecraft</RootNamespace>
1010
<AssemblyName>BorderlessMinecraft</AssemblyName>
11-
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
11+
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
1212
<FileAlignment>512</FileAlignment>
1313
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
1414
<TargetFrameworkProfile />
15+
<IsWebBootstrapper>false</IsWebBootstrapper>
16+
<PublishUrl>publish\</PublishUrl>
17+
<Install>true</Install>
18+
<InstallFrom>Disk</InstallFrom>
19+
<UpdateEnabled>false</UpdateEnabled>
20+
<UpdateMode>Foreground</UpdateMode>
21+
<UpdateInterval>7</UpdateInterval>
22+
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
23+
<UpdatePeriodically>false</UpdatePeriodically>
24+
<UpdateRequired>false</UpdateRequired>
25+
<MapFileExtensions>true</MapFileExtensions>
26+
<ApplicationRevision>1</ApplicationRevision>
27+
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
28+
<UseApplicationTrust>false</UseApplicationTrust>
29+
<PublishWizardCompleted>true</PublishWizardCompleted>
30+
<BootstrapperEnabled>true</BootstrapperEnabled>
1531
</PropertyGroup>
1632
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
1733
<PlatformTarget>AnyCPU</PlatformTarget>
@@ -35,9 +51,25 @@
3551
<PropertyGroup>
3652
<ApplicationIcon>barrier.ico</ApplicationIcon>
3753
</PropertyGroup>
54+
<PropertyGroup>
55+
<ManifestCertificateThumbprint>F0BB6B4AB81DCB530A46721FAE58938516286746</ManifestCertificateThumbprint>
56+
</PropertyGroup>
57+
<PropertyGroup>
58+
<ManifestKeyFile>BorderlessMinecraft_TemporaryKey.pfx</ManifestKeyFile>
59+
</PropertyGroup>
60+
<PropertyGroup>
61+
<GenerateManifests>true</GenerateManifests>
62+
</PropertyGroup>
63+
<PropertyGroup>
64+
<SignManifests>true</SignManifests>
65+
</PropertyGroup>
3866
<ItemGroup>
3967
<Reference Include="System" />
68+
<Reference Include="System.CodeDom, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
69+
<HintPath>..\packages\System.CodeDom.6.0.0\lib\net461\System.CodeDom.dll</HintPath>
70+
</Reference>
4071
<Reference Include="System.Core" />
72+
<Reference Include="System.Management" />
4173
<Reference Include="System.Xml.Linq" />
4274
<Reference Include="System.Data.DataSetExtensions" />
4375
<Reference Include="Microsoft.CSharp" />
@@ -49,12 +81,17 @@
4981
<Reference Include="System.Xml" />
5082
</ItemGroup>
5183
<ItemGroup>
84+
<Compile Include="Configuration\AutoStartup.cs" />
85+
<Compile Include="Configuration\RegistryEditor.cs" />
86+
<Compile Include="Configuration\Config.cs" />
87+
<Compile Include="DLLInterop.cs" />
5288
<Compile Include="Form1.cs">
5389
<SubType>Form</SubType>
5490
</Compile>
5591
<Compile Include="Form1.Designer.cs">
5692
<DependentUpon>Form1.cs</DependentUpon>
5793
</Compile>
94+
<Compile Include="Processes\ProcessMonitor.cs" />
5895
<Compile Include="Program.cs" />
5996
<Compile Include="Properties\AssemblyInfo.cs" />
6097
<EmbeddedResource Include="Form1.resx">
@@ -70,6 +107,8 @@
70107
<DependentUpon>Resources.resx</DependentUpon>
71108
<DesignTime>True</DesignTime>
72109
</Compile>
110+
<None Include="BorderlessMinecraft_TemporaryKey.pfx" />
111+
<None Include="packages.config" />
73112
<None Include="Properties\Settings.settings">
74113
<Generator>SettingsSingleFileGenerator</Generator>
75114
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
@@ -86,5 +125,17 @@
86125
<ItemGroup>
87126
<Content Include="barrier.ico" />
88127
</ItemGroup>
128+
<ItemGroup>
129+
<BootstrapperPackage Include=".NETFramework,Version=v4.7.2">
130+
<Visible>False</Visible>
131+
<ProductName>Microsoft .NET Framework 4.7.2 %28x86 and x64%29</ProductName>
132+
<Install>true</Install>
133+
</BootstrapperPackage>
134+
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
135+
<Visible>False</Visible>
136+
<ProductName>.NET Framework 3.5 SP1</ProductName>
137+
<Install>false</Install>
138+
</BootstrapperPackage>
139+
</ItemGroup>
89140
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
90141
</Project>
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
using Microsoft.Win32;
2+
using System;
3+
using System.Collections.Generic;
4+
using System.Linq;
5+
using System.Text;
6+
using System.Threading.Tasks;
7+
8+
namespace BorderlessMinecraft.Configuration
9+
{
10+
static class AutoStartup
11+
{
12+
/// <summary>
13+
/// Sets the auto startup location for borderless minecraft
14+
/// </summary>
15+
/// <param name="enabled"></param>
16+
internal static void SetStartup(bool enabled)
17+
{
18+
RegistryKey key = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true);
19+
20+
if (enabled)
21+
key.SetValue(nameof(BorderlessMinecraft), System.Reflection.Assembly.GetEntryAssembly().Location + " -autoStart"); //set the key value and append the flag
22+
else
23+
key.DeleteValue(nameof(BorderlessMinecraft), false); //remove the startup entry
24+
25+
}
26+
}
27+
}
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Threading.Tasks;
6+
7+
namespace BorderlessMinecraft.Configuration
8+
{
9+
/// <summary>
10+
/// Exposes configuration properties that will be automatically saved to and retrieved from the registry
11+
/// </summary>
12+
class Config
13+
{
14+
private RegistryEditor Registry { get; }
15+
public Config()
16+
{
17+
Registry = new RegistryEditor(@"SOFTWARE\BorderlessMinecraft"); //open the registry in this location
18+
19+
if (bool.TryParse((string)Registry.GetKeyValue(nameof(StartOnBoot)), out bool value1))
20+
_startOnBoot = value1;
21+
if (bool.TryParse((string)Registry.GetKeyValue(nameof(StartMinimized)), out bool value2))
22+
_startMinimized = value2;
23+
if (bool.TryParse((string)Registry.GetKeyValue(nameof(MinimizeToTray)), out bool value3))
24+
_minimizeToTray = value3;
25+
if (bool.TryParse((string)Registry.GetKeyValue(nameof(AutomaticBorderless)), out bool value4))
26+
_automaticBorderless = value4;
27+
if (bool.TryParse((string)Registry.GetKeyValue(nameof(PreserveTaskBar)), out bool value5))
28+
_preserveTaskBar = value5;
29+
if (bool.TryParse((string)Registry.GetKeyValue(nameof(ShowAllClients)), out bool value6))
30+
_showAllClients = value6;
31+
}
32+
33+
public bool StartOnBoot
34+
{
35+
get => _startOnBoot;
36+
set
37+
{
38+
_startOnBoot = value;
39+
Registry.SetKeyValue(nameof(StartOnBoot), value);
40+
AutoStartup.SetStartup(value);
41+
}
42+
}
43+
private bool _startOnBoot;
44+
45+
public bool StartMinimized
46+
{
47+
get => _startMinimized;
48+
set
49+
{
50+
_startMinimized = value;
51+
Registry.SetKeyValue(nameof(StartMinimized), value);
52+
}
53+
}
54+
private bool _startMinimized;
55+
public bool MinimizeToTray
56+
{
57+
get => _minimizeToTray; set
58+
{
59+
_minimizeToTray = value;
60+
Registry.SetKeyValue(nameof(MinimizeToTray), value);
61+
}
62+
}
63+
private bool _minimizeToTray;
64+
public bool AutomaticBorderless
65+
{
66+
get => _automaticBorderless; set
67+
{
68+
_automaticBorderless = value;
69+
Registry.SetKeyValue(nameof(AutomaticBorderless), value);
70+
}
71+
}
72+
private bool _automaticBorderless;
73+
public bool PreserveTaskBar
74+
{
75+
get => _preserveTaskBar; set
76+
{
77+
_preserveTaskBar = value;
78+
Registry.SetKeyValue(nameof(PreserveTaskBar), value);
79+
}
80+
}
81+
private bool _preserveTaskBar;
82+
public bool ShowAllClients
83+
{
84+
get => _showAllClients; set
85+
{
86+
_showAllClients = value;
87+
Registry.SetKeyValue(nameof(ShowAllClients), value);
88+
}
89+
}
90+
private bool _showAllClients;
91+
}
92+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
using Microsoft.Win32;
2+
using System;
3+
using System.Collections.Generic;
4+
using System.Linq;
5+
using System.Text;
6+
using System.Threading.Tasks;
7+
8+
namespace BorderlessMinecraft.Configuration
9+
{
10+
class RegistryEditor
11+
{
12+
private string SubKeyName { get; }
13+
internal RegistryEditor(string subkeyName = @"SOFTWARE\TestSettings")
14+
{
15+
SubKeyName = subkeyName;
16+
}
17+
18+
internal object GetKeyValue(string key)
19+
{
20+
RegistryKey regKey = Registry.CurrentUser.OpenSubKey(SubKeyName);
21+
22+
//if it does exist, retrieve the stored values
23+
if (regKey != null)
24+
{
25+
var value = regKey.GetValue(key);
26+
regKey.Close();
27+
return value;
28+
}
29+
return null;
30+
}
31+
32+
internal void SetKeyValue(string key, object value)
33+
{
34+
RegistryKey regKey = Registry.CurrentUser.CreateSubKey(SubKeyName);
35+
regKey.SetValue(key, value);
36+
regKey.Close();
37+
}
38+
}
39+
}

0 commit comments

Comments
 (0)