Skip to content

Commit

Permalink
Created
Browse files Browse the repository at this point in the history
  • Loading branch information
JackBailey committed Jul 23, 2021
1 parent 054d447 commit ddfd4f2
Show file tree
Hide file tree
Showing 62 changed files with 876 additions and 0 deletions.
Binary file added .vs/GTA Suspend/v16/.suo
Binary file not shown.
140 changes: 140 additions & 0 deletions Form1.Designer.cs

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

98 changes: 98 additions & 0 deletions Form1.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
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 GTA_Suspend
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void durationBox_TextChanged(object sender, EventArgs e)
{
Properties.Settings.Default.duration = durationBox.Text;
Properties.Settings.Default.Save();
}

private void Form1_Load(object sender, EventArgs e)
{
closeRadioButton.Checked = Properties.Settings.Default.closeAfter;
programToSuspend.Text = Properties.Settings.Default.program;
durationBox.Text = Properties.Settings.Default.duration;
}

private void runButton_Click(object sender, EventArgs e)
{
var durationString = durationBox.Text;
bool canConvert = long.TryParse(durationString, out _);
bool closeAfter = closeRadioButton.Checked;

string program = programToSuspend.Text;

if (program == "" || program == " ")
{
MessageBox.Show("Invalid Program Name\nMake sure you just wrote the program name - don't include .exe");
}
else
{
if (canConvert)
{
var duration = int.Parse(durationString);
// Suspend GTA
System.Diagnostics.Process.Start("pssuspend.exe", program);
// Pause for duration specified
System.Threading.Thread.Sleep(duration * 1000);
// Resume GTA
program += " -r";
System.Diagnostics.Process.Start("pssuspend.exe", program);

if (closeAfter)
{
System.Windows.Forms.Application.Exit();
}
}
else
{
MessageBox.Show("Duration is not a number");
}
}



}

private void label2_Click(object sender, EventArgs e)
{

}

private void button1_Click(object sender, EventArgs e)
{
string url = "http://github.com/jack-bailey/gta-suspend";
System.Diagnostics.Process.Start("explorer.exe", url);
}

private void programToSuspend_TextChanged(object sender, EventArgs e)

{
Properties.Settings.Default.program = programToSuspend.Text;
Properties.Settings.Default.Save();
}

private void closeRadioButton_CheckedChanged(object sender, EventArgs e)
{
Properties.Settings.Default.closeAfter = closeRadioButton.Checked;
Properties.Settings.Default.Save();
}
}
}
60 changes: 60 additions & 0 deletions Form1.resx
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<root>
<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>
</root>
25 changes: 25 additions & 0 deletions GTA Suspend.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">

<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<RootNamespace>GTA_Suspend</RootNamespace>
<UseWindowsForms>true</UseWindowsForms>
</PropertyGroup>

<ItemGroup>
<Compile Update="Properties\Settings.Designer.cs">
<DesignTimeSharedInput>True</DesignTimeSharedInput>
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
</Compile>
</ItemGroup>

<ItemGroup>
<None Update="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
</ItemGroup>

</Project>
11 changes: 11 additions & 0 deletions GTA Suspend.csproj.user
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<_LastSelectedProfileId>C:\Users\jack\OneDrive\Tech Stuff\GTAV\GTA Suspend\Properties\PublishProfiles\FolderProfile.pubxml</_LastSelectedProfileId>
</PropertyGroup>
<ItemGroup>
<Compile Update="Form1.cs">
<SubType>Form</SubType>
</Compile>
</ItemGroup>
</Project>
25 changes: 25 additions & 0 deletions GTA Suspend.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.31410.357
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GTA Suspend", "GTA Suspend.csproj", "{0D099FBE-7CED-494C-B227-A7C8D7E67388}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{0D099FBE-7CED-494C-B227-A7C8D7E67388}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0D099FBE-7CED-494C-B227-A7C8D7E67388}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0D099FBE-7CED-494C-B227-A7C8D7E67388}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0D099FBE-7CED-494C-B227-A7C8D7E67388}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {EC6E0DA9-42BB-45E6-B2A8-351503B4E5AE}
EndGlobalSection
EndGlobal
23 changes: 23 additions & 0 deletions Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace GTA_Suspend
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.SetHighDpiMode(HighDpiMode.SystemAware);
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
}
}
Loading

0 comments on commit ddfd4f2

Please sign in to comment.