Skip to content

Commit

Permalink
Minor changes
Browse files Browse the repository at this point in the history
More info, cleaned with
  • Loading branch information
RobethX committed Feb 27, 2018
1 parent f68439a commit e4e394f
Show file tree
Hide file tree
Showing 6 changed files with 86 additions and 77 deletions.
6 changes: 3 additions & 3 deletions Patcher/Patcher/App.config
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
</startup>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
</startup>
</configuration>
3 changes: 1 addition & 2 deletions Patcher/Patcher/App.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,5 @@
xmlns:local="clr-namespace:Patcher"
StartupUri="MainWindow.xaml">
<Application.Resources>

</Application.Resources>
</Application>
</Application>
10 changes: 2 additions & 8 deletions Patcher/Patcher/App.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;
using System.Windows;

namespace Patcher
{
Expand All @@ -14,4 +8,4 @@ namespace Patcher
public partial class App : Application
{
}
}
}
60 changes: 32 additions & 28 deletions Patcher/Patcher/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,48 +10,52 @@
<Style TargetType="{x:Type Rectangle}" />
</Window.Resources>
<Window.TaskbarItemInfo>
<TaskbarItemInfo x:Name="taskbarInfo" Overlay="Icon.ico" ProgressState="None" Description="Robeth's Borderlands COOP Patcher" ProgressValue="0"/>
<TaskbarItemInfo x:Name="taskbarInfo" Overlay="Icon.ico" ProgressState="None" Description="Robeth's Borderlands COOP Patcher" ProgressValue="0">
<TaskbarItemInfo.ThumbButtonInfos>
<ThumbButtonInfo IsInteractive="False" IsEnabled="True" Visibility="Hidden" />
</TaskbarItemInfo.ThumbButtonInfos>
</TaskbarItemInfo>
</Window.TaskbarItemInfo>
<Grid>
<DockPanel>
<Menu DockPanel.Dock="Top">
<MenuItem Header="_Patcher">
<MenuItem x:Name="menuClose" Header="_Close" Click="menuClose_Click"/>
<MenuItem x:Name="menuClose" Header="_Close" Click="menuClose_Click" />
</MenuItem>
<MenuItem Header="_Help">
<MenuItem x:Name="menuAbout" Header="_About" Click="menuAbout_Click"/>
<MenuItem x:Name="menuAbout" Header="_About" Click="menuAbout_Click" />
<MenuItem x:Name="menuReportBug" Header="_Report a bug" Click="menuReportBug_Click" />
<MenuItem x:Name="menuHelp" Header="_Need more help?" Click="menuHelp_Click"/>
<MenuItem x:Name="menuLFG" Header="_Find players" Click="menuLFG_Click"/>
<Separator/>
<MenuItem x:Name="menuDebug" Header="_Debug Mode" IsCheckable="True"/>
<MenuItem x:Name="menuHelp" Header="_Need more help?" Click="menuHelp_Click" />
<MenuItem x:Name="menuLFG" Header="_Find players" Click="menuLFG_Click" />
<Separator />
<MenuItem x:Name="menuDebug" Header="_Debug Mode" IsCheckable="True" />
</MenuItem>
</Menu>
</DockPanel>
<ComboBox x:Name="comboBoxGame" Margin="10,25,10,0" Height="20" VerticalAlignment="Top" SelectionChanged="comboBoxGame_SelectionChanged">
<ComboBoxItem Content="Borderlands 1" IsEnabled="True"/>
<ComboBoxItem Content="Borderlands 2" IsSelected="True" IsEnabled="True"/>
<ComboBoxItem Content="Borderlands: The Pre-Sequel" IsEnabled="True"/>
<ComboBoxItem Content="Borderlands 1" IsEnabled="True" />
<ComboBoxItem Content="Borderlands 2" IsSelected="True" IsEnabled="True" />
<ComboBoxItem Content="Borderlands: The Pre-Sequel" IsEnabled="True" />
</ComboBox>
<ProgressBar x:Name="progressBar" Height="20" VerticalAlignment="Top" Margin="10,25,10,0" Visibility="Hidden" ToolTip="This takes a while; please be patient!"/>
<Button x:Name="buttonPatch" Content="Patch Borderlands" Margin="10,110,10,0" Click="button_Click" Height="20" VerticalAlignment="Top" Visibility="Visible" RenderTransformOrigin="0.502,0"/>
<ProgressBar x:Name="progressBar" Height="20" VerticalAlignment="Top" Margin="10,25,10,0" Visibility="Hidden" ToolTip="This takes a while; please be patient!" />
<Button x:Name="buttonPatch" Content="Patch Borderlands" Margin="10,110,10,0" Click="button_Click" Height="20" VerticalAlignment="Top" Visibility="Visible" RenderTransformOrigin="0.502,0" />
<ComboBox x:Name="comboBoxConsoleKey" Margin="10,55,88,0" VerticalAlignment="Top">
<ComboBoxItem Content="Tilde" IsSelected="True" IsEnabled="True"/>
<ComboBoxItem Content="F1" IsEnabled="True"/>
<ComboBoxItem Content="F2" IsEnabled="True"/>
<ComboBoxItem Content="F3" IsEnabled="True"/>
<ComboBoxItem Content="F4" IsEnabled="True"/>
<ComboBoxItem Content="F5" IsEnabled="True"/>
<ComboBoxItem Content="F6" IsEnabled="True"/>
<ComboBoxItem Content="F7" IsEnabled="True"/>
<ComboBoxItem Content="F8" IsEnabled="True"/>
<ComboBoxItem Content="F9" IsEnabled="True"/>
<ComboBoxItem Content="F10" IsEnabled="True"/>
<ComboBoxItem Content="F11" IsEnabled="True"/>
<ComboBoxItem Content="F12" IsEnabled="True"/>
<ComboBoxItem Content="Tilde" IsSelected="True" IsEnabled="True" />
<ComboBoxItem Content="F1" IsEnabled="True" />
<ComboBoxItem Content="F2" IsEnabled="True" />
<ComboBoxItem Content="F3" IsEnabled="True" />
<ComboBoxItem Content="F4" IsEnabled="True" />
<ComboBoxItem Content="F5" IsEnabled="True" />
<ComboBoxItem Content="F6" IsEnabled="True" />
<ComboBoxItem Content="F7" IsEnabled="True" />
<ComboBoxItem Content="F8" IsEnabled="True" />
<ComboBoxItem Content="F9" IsEnabled="True" />
<ComboBoxItem Content="F10" IsEnabled="True" />
<ComboBoxItem Content="F11" IsEnabled="True" />
<ComboBoxItem Content="F12" IsEnabled="True" />
</ComboBox>
<CheckBox x:Name="checkBoxCommunityPatch" Content="Enable Community Patch" Margin="10,85,10,0" VerticalAlignment="Top" Height="15"/>
<Label x:Name="labelConsoleKey" Content="Console Key" Margin="0,52,10,0" Height="25" VerticalAlignment="Top" HorizontalAlignment="Right" Width="78" VerticalContentAlignment="Center" HorizontalContentAlignment="Center"/>
<Label x:Name="labelProgressText" Visibility="Hidden" Content="Looking for Borderlands" Margin="10,45,10,0" Height="30" VerticalAlignment="Top" HorizontalContentAlignment="Center" VerticalContentAlignment="Center"/>
<CheckBox x:Name="checkBoxCommunityPatch" Content="Enable Community Patch" Margin="10,85,10,0" VerticalAlignment="Top" Height="15" />
<Label x:Name="labelConsoleKey" Content="Console Key" Margin="0,52,10,0" Height="25" VerticalAlignment="Top" HorizontalAlignment="Right" Width="78" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" />
<Label x:Name="labelProgressText" Visibility="Hidden" Content="Looking for Borderlands" Margin="10,45,10,0" Height="30" VerticalAlignment="Top" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" />
</Grid>
</Window>
62 changes: 39 additions & 23 deletions Patcher/Patcher/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Shell;
using IWshRuntimeLibrary;
using System.Net;
using System.IO;
using System.Threading;
using System.Threading.Tasks;
using IWshRuntimeLibrary;
using System;
using System.Collections;
using System.ComponentModel;
using System.Diagnostics;
using System.IO;
using System.Net;
using System.Reflection;
using System.Security.Principal;
using System.Collections;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Shell;
using Popup = System.Windows.MessageBox;

namespace Patcher
Expand All @@ -29,8 +27,8 @@ public partial class MainWindow : Window
private volatile string fileCopying = "files..."; //current file copying
private volatile int gameID; //init game id
private volatile ArrayList mods = new ArrayList();
readonly double heightDefault = 180;
readonly double heightLoading = 115;
private readonly double heightDefault = 180;
private readonly double heightLoading = 115;

public MainWindow()
{
Expand Down Expand Up @@ -125,6 +123,7 @@ private void comboBoxGame_SelectionChanged(object sender, SelectionChangedEventA
case 2: //borderlands 2
checkBoxCommunityPatch.IsEnabled = true; //enable option for community patch
break;

default: //other game
checkBoxCommunityPatch.IsEnabled = false; //disable community patch option
checkBoxCommunityPatch.IsChecked = false; //uncheck
Expand Down Expand Up @@ -154,11 +153,13 @@ public void button_Click(object sender, RoutedEventArgs e) // patch borderlands2
gameDir = "BorderlandsPreSequel";
cooppatchFile = "cooppatch.txt";
break;

case 1: ///Borderlands 1
gameExec = "Borderlands.exe";
gameDir = "Borderlands";
cooppatchFile = "cooppatch.txt";
break;

default: //2 or incase some how there isnt a variable
gameExec = "Borderlands2.exe";
gameDir = "Borderlands 2";
Expand All @@ -178,6 +179,7 @@ public void button_Click(object sender, RoutedEventArgs e) // patch borderlands2
case System.Windows.Forms.DialogResult.OK:
path = fileDialog.FileName;
break;

case System.Windows.Forms.DialogResult.Cancel:
default:
break;
Expand All @@ -192,15 +194,16 @@ private void menuClose_Click(object sender, RoutedEventArgs e)
try
{
Close(); //close program
} catch (Exception)
}
catch (Exception)
{
//log
}
}

private void menuAbout_Click(object sender, RoutedEventArgs e)
{
Popup.Show("Made by Robeth");
Popup.Show("Robeth's Unlimited COOP Mod & Robeth's Unlimited COOP Patch made by Rob 'Robeth' Chiocchio.", "About");
}

private void menuReportBug_Click(object sender, RoutedEventArgs e)
Expand All @@ -223,39 +226,49 @@ private void patcherWorker_ProgressChanged(object sender, System.ComponentModel.
progressBar.Value = e.ProgressPercentage; //loading bar
taskbarInfo.ProgressValue = (double)e.ProgressPercentage / 100; //taskbar

switch(e.ProgressPercentage)
switch (e.ProgressPercentage)
{
case 5:
labelProgressText.Content = "Removing old files";
break;

case 10:
labelProgressText.Content = "Copying " + fileCopying; //current file copying
break;

case 40:
labelProgressText.Content = "Downloading patches";
break;

case 50:
labelProgressText.Content = "EXPLOSIONS?!?!?!?!";//"Hacking your Minecraft account";
break;

case 60:
labelProgressText.Content = "Decompressing some stuff";
break;

case 70:
labelProgressText.Content = "Making a sandwich";
break;

case 75:
labelProgressText.Content = "Norton sucks";//"Installing viruses";
break;

case 80:
labelProgressText.Content = "Recombobulation the flux capacitor";
break;

case 90:
labelProgressText.Content = "Climaxing";
break;

case 100:
labelProgressText.Content = "All done";
Popup.Show("Done! A Shortcut was placed on your desktop. Press '~' in game to open up console.");
Popup.Show("Done! A Shortcut was placed on your desktop. Press '~' in game to open up console.", "Info");
break;

default:
//default
break;
Expand Down Expand Up @@ -348,15 +361,16 @@ private void patcherWorker_DoWork(object sender, DoWorkEventArgs e) //the main f
outputDir.Delete(true); //delete the server folder recursively
patcherWorker.ReportProgress(10); //set loadingprogress to 10%
}
skipCopy = false ;//continue
skipCopy = false;//continue
break;

case System.Windows.Forms.DialogResult.No:
skipCopy = true;//skip the copy
break;
//case System.Windows.Forms.DialogResult.Cancel:
default:
patcherWorker.CancelAsync(); //cancel
patcherWorker.Dispose();
patcherWorker.Dispose();
//Close(); //terminate thread
break;
}
Expand All @@ -373,7 +387,7 @@ private void patcherWorker_DoWork(object sender, DoWorkEventArgs e) //the main f
}

patcherWorker.ReportProgress(40); //set loadingprogress to 40%
// -- COPY PATCHES TO BINARIES --
// -- COPY PATCHES TO BINARIES --
using (WebClient myWebClient = new WebClient()) //download file
{
try
Expand Down Expand Up @@ -427,7 +441,6 @@ private void patcherWorker_DoWork(object sender, DoWorkEventArgs e) //the main f
{
decompressedWillowGame.CopyTo(oWillowGame.FullName, true); //move upk to cookedpcconsole
decompressedEngine.CopyTo(oEngine.FullName, true); //move upk to cookedpcconsole

}
catch (IOException)
{
Expand Down Expand Up @@ -518,6 +531,7 @@ private void patcherWorker_DoWork(object sender, DoWorkEventArgs e) //the main f
Popup.Show("ERROR: Could not modify executable");
}
break;

case 2: //bl2
// -- HEX EDIT WILLOWGAME --
try
Expand Down Expand Up @@ -590,7 +604,7 @@ private void patcherWorker_DoWork(object sender, DoWorkEventArgs e) //the main f
*/
streamEngine2.Position = 0x003FC01A;
streamEngine2.WriteByte(0x1E);

streamEngine2.Close();
}
catch (IOException)
Expand Down Expand Up @@ -620,6 +634,7 @@ private void patcherWorker_DoWork(object sender, DoWorkEventArgs e) //the main f
Popup.Show("ERROR: Could not modify executable");
}
break;

case 1: //bl2
// -- HEX EDIT WILLOWGAME.U --
/*
Expand Down Expand Up @@ -678,6 +693,7 @@ private void patcherWorker_DoWork(object sender, DoWorkEventArgs e) //the main f
}
*/
break;

default: //if not bl2 or tps
//log
break;
Expand All @@ -688,7 +704,7 @@ private void patcherWorker_DoWork(object sender, DoWorkEventArgs e) //the main f
try
{
String execMods = "";
foreach(String mod in mods)
foreach (String mod in mods)
{
execMods = execMods + " -exec=" + mod;
}
Expand Down Expand Up @@ -741,4 +757,4 @@ private void patcherWorker_DoWork(object sender, DoWorkEventArgs e) //the main f
}
}
}
}
}
Loading

0 comments on commit e4e394f

Please sign in to comment.