Skip to content

Commit

Permalink
Finalize for first version
Browse files Browse the repository at this point in the history
  • Loading branch information
zokker13 committed May 24, 2017
1 parent c30f512 commit 4ac7ffb
Show file tree
Hide file tree
Showing 10 changed files with 81 additions and 94 deletions.
1 change: 1 addition & 0 deletions RatherWeird/DirtyInvocation/DirtyInvocation.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<AssemblyName>DirtyInvocation</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
Expand Down
6 changes: 3 additions & 3 deletions RatherWeird/RatherWeird/App.config
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2"/>
</startup>
</configuration>
</configuration>
25 changes: 16 additions & 9 deletions RatherWeird/RatherWeird/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,36 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:RatherWeird"
mc:Ignorable="d"
Title="MainWindow" Height="350" Width="525" Loaded="Window_Loaded" Closed="Window_Closed">
<Grid Loaded="Grid_Loaded">
<GroupBox x:Name="gpWindowBehavior" Header="Window Behavior" HorizontalAlignment="Left" Height="138" Margin="10,10,0,0" VerticalAlignment="Top" Width="170">
Title="MainWindow" Height="197" Width="534" Loaded="Window_Loaded" Closed="Window_Closed" ResizeMode="NoResize">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<GroupBox x:Name="gpWindowBehavior" Header="Window Behavior" HorizontalAlignment="Left" Margin="10,10,0,0" Width="170" Height="138" VerticalAlignment="Top">
<Grid Margin="0,0,-2,-12">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<CheckBox x:Name="chInvokeAltUp" Content="Invoke ALT UP" HorizontalAlignment="Left" Margin="10,10,0,0" VerticalAlignment="Top" Click="chInvokeAltUp_Click"/>
<CheckBox x:Name="chLockCursor" Content="Lock Cursor" HorizontalAlignment="Left" Margin="10,35,0,0" VerticalAlignment="Top" Click="chLockCursor_Click"/>
<CheckBox x:Name="chLaunchRa3Windowed" Content="Launch RA3 in Window" HorizontalAlignment="Left" Margin="10,58,0,0" VerticalAlignment="Top" Click="chLaunchRa3Windowed_Click"/>
<CheckBox x:Name="chRemoveBorders" Content="Remove Borders" HorizontalAlignment="Left" Margin="10,79,0,-19" VerticalAlignment="Top" Click="chRemoveBorders_Click"/>
<CheckBox x:Name="chLockCursor" Content="Lock Cursor" HorizontalAlignment="Left" Margin="10,31,0,0" VerticalAlignment="Top" Click="chLockCursor_Click"/>
<CheckBox x:Name="chLaunchRa3Windowed" Content="Launch RA3 in Window" HorizontalAlignment="Left" Margin="10,52,0,0" VerticalAlignment="Top" Click="chLaunchRa3Windowed_Click"/>
<CheckBox x:Name="chRemoveBorders" Content="Remove Borders" HorizontalAlignment="Left" Margin="10,73,0,-5" VerticalAlignment="Top" Click="chRemoveBorders_Click"/>
</Grid>
</GroupBox>
<GroupBox Header="Launch RA3" HorizontalAlignment="Left" Height="138" Margin="185,10,0,0" VerticalAlignment="Top" Width="322">
<GroupBox Header="Launch RA3" Margin="185,10,0,0" Height="138" VerticalAlignment="Top" HorizontalAlignment="Left" Width="322">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<CheckBox x:Name="chRefreshPathToRa3" Content="Refresh Path to RA3 automatically" HorizontalAlignment="Left" VerticalAlignment="Top" Click="chRefreshPathToRa3_Click" Margin="10,10,0,0"/>
<TextBox x:Name="txtRa3Path" HorizontalAlignment="Left" Height="23" Margin="10,15,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="290" TextChanged="txtRa3Path_TextChanged" IsEnabled="False" Grid.Row="1"/>
<Button x:Name="btnLaunchRa3" Content="Launch RA3" HorizontalAlignment="Left" Margin="10,1,0,0" VerticalAlignment="Top" Width="97" Cursor="" Height="34" Click="btnLaunchRa3_Click" Grid.Row="2"/>
<TextBox x:Name="txtRa3Path" HorizontalAlignment="Left" Height="23" Margin="10,9,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="290" TextChanged="txtRa3Path_TextChanged" IsEnabled="False" Grid.Row="1"/>
<Button x:Name="btnLaunchRa3" Content="Launch RA3" HorizontalAlignment="Left" Margin="10,1,0,0" Width="97" Cursor="" Click="btnLaunchRa3_Click" Grid.Row="2" Height="34" VerticalAlignment="Top"/>
<Label x:Name="lblVersion" Content="Version: 0.1.0" Margin="0,10,10,0" Grid.Row="2" IsEnabled="False" Height="26" VerticalAlignment="Top" HorizontalAlignment="Right" Width="80"/>
</Grid>
</GroupBox>
</Grid>
Expand Down
38 changes: 9 additions & 29 deletions RatherWeird/RatherWeird/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,7 @@ public partial class MainWindow : Window

public MainWindow()
{
InitializeComponent();


}

private void Grid_Loaded(object sender, RoutedEventArgs e)
{
_foregroundWatcher.HookForeground();
_keyboardWatcher.HookKeyboard();

_foregroundWatcher.ForegroundChanged += ForegroundWatcher_ForegroundChanged;

SetupControls();
InitializeComponent();
}

private void ForegroundWatcher_ForegroundChanged(object sender, ForegroundArgs e)
Expand Down Expand Up @@ -92,6 +80,12 @@ private void chInvokeAltUp_Click(object sender, RoutedEventArgs e)
private void Window_Loaded(object sender, RoutedEventArgs e)
{
settings = Preferences.Load();
SetupControls();

_foregroundWatcher.HookForeground();
_keyboardWatcher.HookKeyboard();

_foregroundWatcher.ForegroundChanged += ForegroundWatcher_ForegroundChanged;
}

private void Window_Closed(object sender, EventArgs e)
Expand Down Expand Up @@ -123,23 +117,9 @@ private bool CheckFileExistence(string fileToCheck)
{
try
{
using (FileStream fs = new FileStream(fileToCheck, FileMode.CreateNew, FileAccess.Write,
FileShare.None, bufferSize: 4096, useAsync: true))
{

}

// Nothing thrown.. File was created..
File.Delete(fileToCheck);

return false;
return File.Exists(fileToCheck);
}
catch (System.IO.IOException ex)
{
// Assuming the file already exists..
return true;
}
catch (Exception ex)
catch (Exception)
{
return false;
}
Expand Down
4 changes: 2 additions & 2 deletions RatherWeird/RatherWeird/Preferences.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ public static bool Write(SettingEntries settings)

result = true;
}
catch (IOException ex)
catch (IOException)
{
// TODO log or whatever
}
catch (Exception ex)
catch (Exception)
{
// TODO: Same
}
Expand Down
56 changes: 24 additions & 32 deletions RatherWeird/RatherWeird/Properties/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 13 additions & 17 deletions RatherWeird/RatherWeird/Properties/Settings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions RatherWeird/RatherWeird/RatherWeird.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
Expand All @@ -23,6 +24,7 @@
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
Expand All @@ -32,6 +34,11 @@
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup>
<ApplicationIcon>
</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
Expand Down Expand Up @@ -105,5 +112,8 @@
<Name>WindowHook</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Resource Include="hentie.ico" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
1 change: 0 additions & 1 deletion RatherWeird/WindowHook/KeyboardWatcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
using System.Diagnostics;
using System.Diagnostics.Eventing.Reader;
using System.Linq;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using System.Runtime.InteropServices;
Expand Down
4 changes: 3 additions & 1 deletion RatherWeird/WindowHook/WindowHook.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<AssemblyName>WindowHook</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
Expand All @@ -20,6 +21,7 @@
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
Expand All @@ -28,6 +30,7 @@
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
Expand All @@ -36,7 +39,6 @@
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
Expand Down

0 comments on commit 4ac7ffb

Please sign in to comment.