Initial commit (2011)

This commit is contained in:
Melissa 2020-04-28 16:27:59 +02:00
commit 06dab98771
44 changed files with 13780 additions and 0 deletions

6
.gitignore vendored Normal file
View File

@ -0,0 +1,6 @@
bin/
obj/
*.suo
*.docstates
*.user

26
GamerServices.sln Normal file
View File

@ -0,0 +1,26 @@

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GamerServices", "GamerServices\GamerServices.csproj", "{1A78C7ED-D117-45EA-9E7B-C9278474D68E}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MrAG", "..\MrAG\MrAG\MrAG.csproj", "{48B30584-0795-4FDA-9561-61B2381F8656}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x86 = Debug|x86
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{1A78C7ED-D117-45EA-9E7B-C9278474D68E}.Debug|x86.ActiveCfg = Debug|x86
{1A78C7ED-D117-45EA-9E7B-C9278474D68E}.Debug|x86.Build.0 = Debug|x86
{1A78C7ED-D117-45EA-9E7B-C9278474D68E}.Release|x86.ActiveCfg = Release|x86
{1A78C7ED-D117-45EA-9E7B-C9278474D68E}.Release|x86.Build.0 = Release|x86
{48B30584-0795-4FDA-9561-61B2381F8656}.Debug|x86.ActiveCfg = Debug|x86
{48B30584-0795-4FDA-9561-61B2381F8656}.Debug|x86.Build.0 = Debug|x86
{48B30584-0795-4FDA-9561-61B2381F8656}.Release|x86.ActiveCfg = Release|x86
{48B30584-0795-4FDA-9561-61B2381F8656}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@ -0,0 +1,226 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{1A78C7ED-D117-45EA-9E7B-C9278474D68E}</ProjectGuid>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>GamerServices</RootNamespace>
<AssemblyName>GamerServices</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
<FileAlignment>512</FileAlignment>
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<PlatformTarget>x86</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<PlatformTarget>x86</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<StartupObject>GamerServices.Program</StartupObject>
</PropertyGroup>
<PropertyGroup>
<ApplicationIcon>wireless_mouse.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
<Reference Include="ICSharpCode.SharpZipLib">
<HintPath>.\ICSharpCode.SharpZipLib.dll</HintPath>
</Reference>
<Reference Include="PresentationFramework" />
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xaml" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="WindowsBase" />
</ItemGroup>
<ItemGroup>
<Compile Include="Systems\Forms\FormChecksum.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Systems\Forms\FormChecksum.Designer.cs">
<DependentUpon>FormChecksum.cs</DependentUpon>
</Compile>
<Compile Include="Systems\Forms\FormDevUpdate.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Systems\Forms\FormDevUpdate.Designer.cs">
<DependentUpon>FormDevUpdate.cs</DependentUpon>
</Compile>
<Compile Include="Systems\Forms\FormGameDev.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Systems\Forms\FormGameDev.Designer.cs">
<DependentUpon>FormGameDev.cs</DependentUpon>
</Compile>
<Compile Include="Systems\Downloader.cs" />
<Compile Include="Systems\Forms\FormAddFriend.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Systems\Forms\FormAddFriend.Designer.cs">
<DependentUpon>FormAddFriend.cs</DependentUpon>
</Compile>
<Compile Include="Systems\Forms\FormChat.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Systems\Forms\FormChat.Designer.cs">
<DependentUpon>FormChat.cs</DependentUpon>
</Compile>
<Compile Include="Systems\Forms\FormAbout.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Systems\Forms\FormAbout.Designer.cs">
<DependentUpon>FormAbout.cs</DependentUpon>
</Compile>
<Compile Include="Systems\Forms\FormLogin.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Systems\Forms\FormLogin.Designer.cs">
<DependentUpon>FormLogin.cs</DependentUpon>
</Compile>
<Compile Include="Systems\Forms\FormMain.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Systems\Forms\FormMain.Designer.cs">
<DependentUpon>FormMain.cs</DependentUpon>
</Compile>
<Compile Include="Systems\Forms\FormFileDownloader.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Systems\Forms\FormFileDownloader.Designer.cs">
<DependentUpon>FormFileDownloader.cs</DependentUpon>
</Compile>
<Compile Include="Systems\Friend.cs" />
<Compile Include="Systems\Game.cs" />
<Compile Include="Systems\Networker.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="Systems\Forms\FormChecksum.resx">
<DependentUpon>FormChecksum.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Systems\Forms\FormDevUpdate.resx">
<DependentUpon>FormDevUpdate.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Systems\Forms\FormGameDev.resx">
<DependentUpon>FormGameDev.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Systems\Forms\FormAbout.resx">
<DependentUpon>FormAbout.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Systems\Forms\FormAddFriend.resx">
<DependentUpon>FormAddFriend.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Systems\Forms\FormChat.resx">
<DependentUpon>FormChat.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Systems\Forms\FormLogin.resx">
<DependentUpon>FormLogin.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Systems\Forms\FormMain.resx">
<DependentUpon>FormMain.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
<EmbeddedResource Include="Systems\Forms\FormFileDownloader.resx">
<DependentUpon>FormFileDownloader.cs</DependentUpon>
</EmbeddedResource>
<None Include="app.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<ItemGroup>
<None Include="Resources\Gamerservices_Small.png" />
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include=".NETFramework,Version=v4.0,Profile=Client">
<Visible>False</Visible>
<ProductName>Microsoft .NET Framework 4 Client Profile %28x86 and x64%29</ProductName>
<Install>true</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
<Install>false</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1</ProductName>
<Install>false</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Windows.Installer.3.1">
<Visible>False</Visible>
<ProductName>Windows Installer 3.1</ProductName>
<Install>true</Install>
</BootstrapperPackage>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\MrAG\MrAG\MrAG.csproj">
<Project>{48B30584-0795-4FDA-9561-61B2381F8656}</Project>
<Name>MrAG</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Content Include="wireless_mouse.ico" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

Binary file not shown.

19
GamerServices/Program.cs Normal file
View File

@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using System.Diagnostics;
namespace GamerServices
{
static class Program
{
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new FormLogin());
}
}
}

View File

@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("GamerServices")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyProduct("GamerServices")]
[assembly: AssemblyCopyright("Copyright © Microsoft 2011")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("2fe501d9-2b43-415b-b922-4351f0771d25")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@ -0,0 +1,70 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.208
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace GamerServices.Properties {
using System;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("GamerServices.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
internal static System.Drawing.Bitmap Gamerservices_Small {
get {
object obj = ResourceManager.GetObject("Gamerservices_Small", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
}
}

View File

@ -0,0 +1,124 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<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>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="Gamerservices_Small" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Gamerservices_Small.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>

View File

@ -0,0 +1,62 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.208
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace GamerServices.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default {
get {
return defaultInstance;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("")]
public string Username {
get {
return ((string)(this["Username"]));
}
set {
this["Username"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("")]
public string Password {
get {
return ((string)(this["Password"]));
}
set {
this["Password"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("False")]
public bool RememberMe {
get {
return ((bool)(this["RememberMe"]));
}
set {
this["RememberMe"] = value;
}
}
}
}

View File

@ -0,0 +1,15 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="GamerServices.Properties" GeneratedClassName="Settings">
<Profiles />
<Settings>
<Setting Name="Username" Type="System.String" Scope="User">
<Value Profile="(Default)" />
</Setting>
<Setting Name="Password" Type="System.String" Scope="User">
<Value Profile="(Default)" />
</Setting>
<Setting Name="RememberMe" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value>
</Setting>
</Settings>
</SettingsFile>

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

View File

@ -0,0 +1,316 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using System.Net;
using System.IO;
namespace GamerServices {
public class Downloader {
public class DownloadInfo {
public string Path;
public string URL;
public string Version;
public int GameID;
public int TotalActions;
public byte Action;
}
public FormMain Main;
public List<DownloadInfo> FilesToDownload;
public System.Threading.Thread DownloadThread;
private static System.Net.WebClient DownloadClient;
public Downloader(FormMain main) {
Main = main;
FilesToDownload = new List<DownloadInfo>();
if (DownloadThread != null && DownloadThread.IsAlive)
DownloadThread.Abort();
DownloadThread = new System.Threading.Thread(new System.Threading.ThreadStart(Update));
DownloadThread.Start();
}
private static int CurrentGameUpdateing = -1;
private void Update() {
DownloadClient = new WebClient();
DownloadClient.Proxy = null;
DownloadClient.DownloadFileCompleted += new System.ComponentModel.AsyncCompletedEventHandler(DownloadFinished);
DownloadClient.DownloadProgressChanged += new DownloadProgressChangedEventHandler(DownloadBusy);
while (true) {
if (Main.Games != null && Main.Games.Length > 0) {
lock(Main.Games){
foreach (Game g in Main.Games) {
if (g != null) {
if (g.Status == Game.GameStatus.DOWNLOADING) {
bool isdownloading = false;
lock (FilesToDownload) {
for (int i = 0; i < FilesToDownload.Count; i++) {
if (FilesToDownload[i].GameID == g.GameID) {
isdownloading = true;
break;
}
}
}
if (!isdownloading) {
Main.Popup("Download finished!", g.Name, 0);
g.Status = Game.GameStatus.INSTALLED;
Main.SetGameData(g.GameID, g.Name, g.Status);
}
}
}
}
}
}
if (FilesToDownload.Count > 0 && CurrentGameUpdateing == -1) {
DownloadInfo info = null;
lock (FilesToDownload) {
info = FilesToDownload[0];
try {
CurrentGameUpdateing = -1;
switch (info.Action) {
case 0:
if (File.Exists("Games/" + info.GameID + "/" + info.Path))
File.Delete("Games/" + info.GameID + "/" + info.Path);
DownloadClient.DownloadFileAsync(new Uri(info.URL.Replace("\\", "/")), "Games/" + info.GameID + "/" + info.Path, null);
CurrentGameUpdateing = info.GameID;
break;
case 1:
if (File.Exists("Games/" + info.GameID + "/" + info.Path))
File.Delete("Games/" + info.GameID + "/" + info.Path);
File.Create("Games/" + info.GameID + "/" + info.Path);
UpdateText((short)info.GameID, "");
SafeDownloadList(true);
break;
case 2:
if (Directory.Exists("Games/" + info.GameID + "/" + info.Path))
Directory.Delete("Games/" + info.GameID + "/" + info.Path, true);
if (File.Exists("Games/" + info.GameID + "/" + info.Path))
File.Delete("Games/" + info.GameID + "/" + info.Path);
UpdateText((short)info.GameID, "");
SafeDownloadList(true);
break;
case 3:
if (Directory.Exists("Games/" + info.GameID + "/" + info.Path))
Directory.Delete("Games/" + info.GameID + "/" + info.Path, true);
Directory.CreateDirectory("Games/" + info.GameID + "/" + info.Path);
UpdateText((short)info.GameID, "");
SafeDownloadList(true);
break;
}
} catch(Exception e) {
CurrentGameUpdateing = -1;
SafeDownloadList(true);
}
}
}
System.Threading.Thread.Sleep(200);
}
}
public void SafeDownloadList(bool del){
if (del && FilesToDownload.Count > 0) {
lock(FilesToDownload){
FilesToDownload.RemoveAt(0);
}
}
if (FilesToDownload.Count > 0) {
string data = "";
DownloadInfo[] sort = null;
lock (FilesToDownload) {
sort = FilesToDownload.OrderBy(DownloadInfo => DownloadInfo.GameID).ToArray<DownloadInfo>();
}
short lastID = -1;
foreach (DownloadInfo info in sort) {
if (info.GameID != lastID) {
data += "}\n\n" + info.GameID + " " + info.Version + "\n{\n";
lastID = (short)info.GameID;
}
data += "\t" + info.Path + "\n";
data += "\t" + info.Action + "\n";
}
if (data.Length > 0) {
data = data.Substring(3) + (lastID != -1 ? "}" : "");
try {
File.WriteAllText("downloading.txt", data);
} catch {
}
}
} else {
try {
File.WriteAllText("downloading.txt", "");
} catch {
}
}
}
private void UpdateText(short gameID, string add) {
if (Main.Games == null || Main.Games.Length == 0)
return;
lock (Main.Games) {
int res = 0;
int totalfiles = 0;
lock (FilesToDownload) {
for (int i = 0; i < FilesToDownload.Count; i++) {
if (FilesToDownload[i].GameID == gameID) {
res++;
if (FilesToDownload[i].TotalActions > totalfiles)
totalfiles = FilesToDownload[i].TotalActions;
}
}
}
Game g = Main.GetGame(gameID);
if (g != null) {
g.Status = res > 0 ? Game.GameStatus.DOWNLOADING : Game.GameStatus.INSTALLED;
if (res > 0) {
double per = 100.0 - ((double)res / (double)totalfiles * 100.0);
per = per - per % 0.1;
Main.SetGameData(gameID, g.Name + " " + per + "%" + add, g.Status);
} else {
Main.Popup("Download finished!", g.Name, 0);
Main.SetGameData(gameID, g.Name, g.Status);
}
} else {
}
}
}
private void DownloadFinished(object sender, System.ComponentModel.AsyncCompletedEventArgs e) {
UpdateText((short)CurrentGameUpdateing, "");
SafeDownloadList(true);
for (int i = 0; i < FilesToDownload.Count; i++) {
if (FilesToDownload[i].GameID == CurrentGameUpdateing) {
CurrentGameUpdateing = -1;
return;
}
}
Game g = Main.GetGame((short)CurrentGameUpdateing);
if (g != null) {
Main.Popup("Download finished!", g.Name, 0);
g.Status = Game.GameStatus.INSTALLED;
Main.SetGameData(g.GameID, g.Name, g.Status);
CurrentGameUpdateing = -1;
}
}
private void DownloadBusy(object sender, DownloadProgressChangedEventArgs e) {
UpdateText((short)CurrentGameUpdateing, " " + e.ProgressPercentage.ToString() + "%");
}
public bool UpdateParser(int GameID, string curver){
System.Net.WebClient client = new WebClient();
client.Proxy = null;
string[] FileData = null;
int actions = 0;
try {
FileData = new StreamReader(client.OpenRead("http://" + "gs.mrag.nl/download.php?gid=" + GameID + "&file=updates.txt")).ReadToEnd().Replace("\r", "").Split('\n');
} catch(Exception e) {
return false;
}
lock (FilesToDownload) {
string currenthandelingrev = "";
List<string> filesdone = new List<string>();
foreach (string line in FileData){
if (line.Length > 0) {
string[] args = null;
if (line.Contains("=")) args = line.Split('=');
if (line.TrimStart('\t', ' ').StartsWith("#")){
}else if (args[0] == "VER"){
if (currenthandelingrev.Length == 0){
currenthandelingrev = args[1];
File.WriteAllText("Games/" + GameID + "/version.txt", currenthandelingrev);
Game g = Main.GetGame((short)GameID);
if (g != null)
g.Version = currenthandelingrev;
}
if (args[1] == curver) {
break;
}
}else{
if (!filesdone.Contains(args[1])) {
filesdone.Add(args[1]);
DownloadInfo info = new DownloadInfo();
info.Action = 0;
info.GameID = GameID;
info.URL = "http://" + "gs.mrag.nl/download.php?gid=" + GameID + "&file=" + args[1];
info.Path = args[1];
info.Version = currenthandelingrev;
switch (args[0]) {
case "ADD":
info.Action = 0;
break;
case "MNF":
info.Action = 1;
break;
case "DEL":
info.Action = 2;
break;
case "MDR":
info.Action = 3;
break;
}
FilesToDownload.Add(info);
actions++;
}
}
}
}
for (int i = FilesToDownload.Count - 1; i > 0; i--) {
if (FilesToDownload[i].GameID == GameID) {
Game g = Main.GetGame((short)GameID);
if (g != null)
g.Status = Game.GameStatus.DOWNLOADING;
FilesToDownload[i].TotalActions += actions;
}
}
for (int i = 0; i < FilesToDownload.Count; i++) {
System.Diagnostics.Debug.Print(FilesToDownload[i].Action + " = " + FilesToDownload[i].Path);
}
}
return true;
}
}
}

View File

@ -0,0 +1,120 @@
namespace GamerServices
{
partial class FormAbout
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FormAbout));
this.buttonClose = new System.Windows.Forms.Button();
this.Stage = new System.Windows.Forms.PictureBox();
this.timerUpdate = new System.Windows.Forms.Timer(this.components);
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.fontLabel = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.Stage)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
this.SuspendLayout();
//
// buttonClose
//
this.buttonClose.Location = new System.Drawing.Point(238, 364);
this.buttonClose.Name = "buttonClose";
this.buttonClose.Size = new System.Drawing.Size(75, 23);
this.buttonClose.TabIndex = 1;
this.buttonClose.Text = "Close";
this.buttonClose.UseVisualStyleBackColor = true;
this.buttonClose.Click += new System.EventHandler(this.buttonClose_Click);
//
// Stage
//
this.Stage.Location = new System.Drawing.Point(12, 84);
this.Stage.Name = "Stage";
this.Stage.Size = new System.Drawing.Size(301, 274);
this.Stage.TabIndex = 0;
this.Stage.TabStop = false;
this.Stage.Paint += new System.Windows.Forms.PaintEventHandler(this.Stage_Paint);
//
// timerUpdate
//
this.timerUpdate.Enabled = true;
this.timerUpdate.Interval = 10;
this.timerUpdate.Tick += new System.EventHandler(this.timerUpdate_Tick);
//
// pictureBox1
//
this.pictureBox1.Image = global::GamerServices.Properties.Resources.Gamerservices_Small;
this.pictureBox1.Location = new System.Drawing.Point(12, 12);
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(301, 66);
this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage;
this.pictureBox1.TabIndex = 2;
this.pictureBox1.TabStop = false;
//
// fontLabel
//
this.fontLabel.AutoSize = true;
this.fontLabel.Font = new System.Drawing.Font("Calibri", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.fontLabel.Location = new System.Drawing.Point(12, 366);
this.fontLabel.Name = "fontLabel";
this.fontLabel.Size = new System.Drawing.Size(67, 18);
this.fontLabel.TabIndex = 3;
this.fontLabel.Text = "fontLabel";
this.fontLabel.Visible = false;
//
// FormAbout
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(325, 399);
this.Controls.Add(this.fontLabel);
this.Controls.Add(this.pictureBox1);
this.Controls.Add(this.buttonClose);
this.Controls.Add(this.Stage);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "FormAbout";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "About GamerServices";
this.Load += new System.EventHandler(this.FormAbout_Load);
((System.ComponentModel.ISupportInitialize)(this.Stage)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.PictureBox Stage;
private System.Windows.Forms.Button buttonClose;
private System.Windows.Forms.Timer timerUpdate;
private System.Windows.Forms.PictureBox pictureBox1;
private System.Windows.Forms.Label fontLabel;
}
}

View File

@ -0,0 +1,73 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
namespace GamerServices
{
public partial class FormAbout : Form
{
public float TextHeight;
public String[] TextLines;
public FormAbout()
{
InitializeComponent();
this.TextHeight = Stage.Height + 6;
this.TextLines = File.ReadAllText("Media/Credits.txt").Split('\n');
}
private void buttonClose_Click(object sender, EventArgs e)
{
this.Close();
}
private void FormAbout_Load(object sender, EventArgs e)
{
this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
this.SetStyle(ControlStyles.UserPaint, true);
this.SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
}
private void Stage_Paint(object sender, PaintEventArgs e)
{
Graphics g = e.Graphics;
g.Clear(this.BackColor);
g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias;
for (int i = 0; i < this.TextLines.Length; i++)
{
Font font = this.fontLabel.Font;
if (this.TextLines[i].StartsWith("[B]"))
font = new Font(font, FontStyle.Bold);
if (this.TextLines[i].StartsWith("[H1]"))
font = new Font(font.FontFamily, 20, FontStyle.Bold);
if (this.TextLines[i].StartsWith("[H2]"))
font = new Font(font.FontFamily, 16, FontStyle.Bold);
g.DrawString(this.TextLines[i].Replace("[B]", "").Replace("[H1]", "").Replace("[H2]", ""), font, Brushes.Black, new PointF(Stage.Width / 2f, (this.fontLabel.Font.Size + 2) * i + this.TextHeight), new StringFormat() { Alignment = StringAlignment.Center, LineAlignment = StringAlignment.Center });
}
}
private void timerUpdate_Tick(object sender, EventArgs e)
{
this.TextHeight -= 0.5f;
if (this.TextHeight < -((this.fontLabel.Font.Size + 2) * this.TextLines.Length))
this.TextHeight = Stage.Height + 6;
Stage.Invalidate();
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,79 @@
namespace GamerServices {
partial class FormAddFriend {
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing) {
if (disposing && (components != null)) {
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent() {
this.textBox1 = new System.Windows.Forms.TextBox();
this.button1 = new System.Windows.Forms.Button();
this.label1 = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(76, 12);
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(277, 20);
this.textBox1.TabIndex = 0;
//
// button1
//
this.button1.Location = new System.Drawing.Point(12, 38);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(341, 23);
this.button1.TabIndex = 1;
this.button1.Text = "Add";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(12, 15);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(58, 13);
this.label1.TabIndex = 2;
this.label1.Text = "Username:";
//
// FormAddFriend
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(365, 67);
this.Controls.Add(this.label1);
this.Controls.Add(this.button1);
this.Controls.Add(this.textBox1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
this.Name = "FormAddFriend";
this.Text = "Add User";
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Label label1;
}
}

View File

@ -0,0 +1,29 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace GamerServices {
public partial class FormAddFriend : Form {
private FormMain Main;
public FormAddFriend(FormMain main) {
Main = main;
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e) {
if (textBox1.Text.Length == 0)
return;
if (Main.GetFriend(textBox1.Text) == null) {
Main.Networker.Connection.Send(7, textBox1.Text.Length + 5, textBox1.Text);
Close();
}
}
}
}

View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<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>

View File

@ -0,0 +1,161 @@
namespace GamerServices {
partial class FormChat {
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing) {
if (disposing && (components != null)) {
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent() {
this.button1 = new System.Windows.Forms.Button();
this.textBox1 = new System.Windows.Forms.TextBox();
this.textBox2 = new System.Windows.Forms.TextBox();
this.panel1 = new System.Windows.Forms.Panel();
this.label2 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.panel2 = new System.Windows.Forms.Panel();
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.panel1.SuspendLayout();
this.panel2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
this.SuspendLayout();
//
// button1
//
this.button1.Location = new System.Drawing.Point(501, 383);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(134, 30);
this.button1.TabIndex = 1;
this.button1.Text = "Send";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(0, 82);
this.textBox1.Multiline = true;
this.textBox1.Name = "textBox1";
this.textBox1.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
this.textBox1.Size = new System.Drawing.Size(634, 298);
this.textBox1.TabIndex = 2;
this.textBox1.Text = "Do not give away your password to anybody!";
this.textBox1.TextChanged += new System.EventHandler(this.textBox1_TextChanged);
//
// textBox2
//
this.textBox2.Location = new System.Drawing.Point(12, 387);
this.textBox2.MaxLength = 500;
this.textBox2.Name = "textBox2";
this.textBox2.Size = new System.Drawing.Size(482, 20);
this.textBox2.TabIndex = 3;
this.textBox2.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.textBox2_KeyPress);
//
// panel1
//
this.panel1.BackColor = System.Drawing.SystemColors.ControlDarkDark;
this.panel1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.panel1.Controls.Add(this.label2);
this.panel1.Controls.Add(this.label1);
this.panel1.Controls.Add(this.panel2);
this.panel1.Location = new System.Drawing.Point(0, 0);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(634, 76);
this.panel1.TabIndex = 4;
this.panel1.Click += new System.EventHandler(this.panel1_Click);
this.panel1.MouseClick += new System.Windows.Forms.MouseEventHandler(this.panel1_MouseClick);
//
// label2
//
this.label2.AutoSize = true;
this.label2.BackColor = System.Drawing.Color.Transparent;
this.label2.Font = new System.Drawing.Font("Comic Sans MS", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label2.ForeColor = System.Drawing.SystemColors.MenuText;
this.label2.Location = new System.Drawing.Point(79, 42);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(0, 17);
this.label2.TabIndex = 3;
this.label2.Click += new System.EventHandler(this.label2_Click);
//
// label1
//
this.label1.AutoSize = true;
this.label1.BackColor = System.Drawing.Color.Transparent;
this.label1.Font = new System.Drawing.Font("Calibri", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label1.ForeColor = System.Drawing.Color.LightSalmon;
this.label1.Location = new System.Drawing.Point(78, 8);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(69, 23);
this.label1.TabIndex = 2;
this.label1.Text = "Default";
this.label1.Click += new System.EventHandler(this.label1_Click);
//
// panel2
//
this.panel2.BackColor = System.Drawing.Color.Black;
this.panel2.Controls.Add(this.pictureBox1);
this.panel2.Location = new System.Drawing.Point(2, 2);
this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(70, 70);
this.panel2.TabIndex = 1;
//
// pictureBox1
//
this.pictureBox1.Location = new System.Drawing.Point(3, 3);
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(64, 64);
this.pictureBox1.TabIndex = 4;
this.pictureBox1.TabStop = false;
//
// FormChat
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(635, 412);
this.Controls.Add(this.panel1);
this.Controls.Add(this.textBox2);
this.Controls.Add(this.textBox1);
this.Controls.Add(this.button1);
this.MinimumSize = new System.Drawing.Size(396, 250);
this.Name = "FormChat";
this.Text = "Chat";
this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.FormChat_FormClosed);
this.Load += new System.EventHandler(this.FormChat_Load);
this.MouseClick += new System.Windows.Forms.MouseEventHandler(this.FormChat_MouseClick);
this.Resize += new System.EventHandler(this.FormChat_Resize);
this.panel1.ResumeLayout(false);
this.panel1.PerformLayout();
this.panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
public System.Windows.Forms.Button button1;
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.TextBox textBox2;
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Panel panel2;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.PictureBox pictureBox1;
}
}

View File

@ -0,0 +1,192 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Web;
using System.Net;
using System.IO;
using System.Windows.Forms;
using System.Runtime.InteropServices;
namespace GamerServices {
public partial class FormChat : Form {
private bool _CanChat = true;
public Friend ChattingWith;
public bool CanChat{
get {
return _CanChat;
}
set {
_CanChat = value;
this.button1.Enabled = _CanChat;
}
}
[DllImport("user32.dll")]
static extern bool FlashWindow(IntPtr hwnd, bool bInvert);
public FormMain Main;
private bool Editing = false;
public FormChat(FormMain main) {
Main = main;
InitializeComponent();
oldtext = textBox1.Text;
}
public void UpdateStatus() {
Game g = null;
if (this.ChattingWith.GameID != -1) {
g = this.Main.GetGame(this.ChattingWith.GameID);
}
label2.Text = this.ChattingWith.GameID < 1 ? "" : "Is playing: " + g.Name;
}
public void AddMessage(string user, string msg) {
Editing = true;
textBox1.Text += "\r\n" + String.Format("[{0:HH:mm:ss}] ", DateTime.Now) + user + ": " + msg;
Editing = false;
textBox1.SelectionStart = textBox1.Text.Length;
textBox1.ScrollToCaret();
textBox1.Refresh();
}
public void AddMessage(string msg) {
Editing = true;
textBox1.Text += "\r\n" + msg;
Editing = false;
textBox1.SelectionStart = textBox1.Text.Length;
textBox1.ScrollToCaret();
textBox1.Refresh();
}
private string oldtext = "";
private void textBox1_TextChanged(object sender, EventArgs e) {
int selstart = textBox1.SelectionStart;
int sellen = textBox1.SelectionLength;
if (!Editing) {
textBox1.Text = oldtext;
textBox1.Select(selstart, sellen);
return;
}
oldtext = textBox1.Text;
if (!this.ContainsFocus)
FlashWindow(this.Handle, true);
}
public void Flash() {
if (!this.ContainsFocus)
FlashWindow(this.Handle, true);
}
private void FormChat_Load(object sender, EventArgs e) {
this.Focus();
label1.Text = this.ChattingWith.Username;
label1.Focus();
WebClient wc = new WebClient();
wc.Proxy = null;
MemoryStream ms = new MemoryStream(wc.DownloadData("http://" + "www.gravatar.com/avatar/" + ChattingWith.AvatarURL + "?s=64"));
pictureBox1.Image = Image.FromStream(ms);
FlashWindow(this.Handle, true);
textBox1.Font = ChattingWith.Main.GetFont("Chat");
label1.Font = ChattingWith.Main.GetFont("Chat_Header");
label2.Font = ChattingWith.Main.GetFont("Chat_Sub");
this.UpdateStatus();
}
private void button1_Click(object sender, EventArgs e) {
if (!button1.Enabled)
return;
textBox2.Focus();
if (!CanChat)
return;
if (textBox2.Text.Length == 0)
return;
Editing = true;
textBox1.Text += "\r\n" + String.Format("[{0:HH:mm:ss}] ", DateTime.Now) + Main.Username + ": " + textBox2.Text;
Main.Networker.Connection.Send(5, textBox2.Text.Length + 9, ChattingWith.UserID, textBox2.Text);
textBox2.Text = "";
Editing = false;
textBox1.SelectionStart = textBox1.Text.Length;
textBox1.ScrollToCaret();
textBox1.Refresh();
}
private void textBox2_KeyPress(object sender, KeyPressEventArgs e) {
if (!CanChat)
return;
if (e.KeyChar == 13) {
button1_Click(null, null);
}
}
private void FormChat_FormClosed(object sender, FormClosedEventArgs e) {
this.ChattingWith.ChatWindow = null;
}
private void FormChat_Resize(object sender, EventArgs e) {
this.panel1.Size = new Size(this.Size.Width - 16, 76);
this.textBox1.Size = new Size(this.Size.Width - 16, this.Size.Height - 82 - 70);
this.textBox2.Size = new Size(this.Size.Width - 168, 20);
this.textBox2.Location = new Point(12, this.Size.Height - 63);
this.button1.Location = new Point(this.Size.Width - 149, this.Size.Height - 67);
}
private void FormChat_MouseClick(object sender, MouseEventArgs e) {
textBox2.Focus();
}
private void panel1_MouseClick(object sender, MouseEventArgs e) {
textBox2.Focus();
}
private void label1_Click(object sender, EventArgs e) {
textBox2.Focus();
}
private void label2_Click(object sender, EventArgs e) {
textBox2.Focus();
}
private void panel1_Click(object sender, EventArgs e) {
textBox2.Focus();
}
public void FocusTextBar() {
textBox2.Focus();
}
private void button2_Click(object sender, EventArgs e) {
}
}
}

View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<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>

View File

@ -0,0 +1,272 @@
namespace GamerServices
{
partial class FormChecksum
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FormChecksum));
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.textLastWriteTime = new System.Windows.Forms.TextBox();
this.label8 = new System.Windows.Forms.Label();
this.label7 = new System.Windows.Forms.Label();
this.textLastAccessTime = new System.Windows.Forms.TextBox();
this.label6 = new System.Windows.Forms.Label();
this.textCreationTime = new System.Windows.Forms.TextBox();
this.label5 = new System.Windows.Forms.Label();
this.textFileHash = new System.Windows.Forms.TextBox();
this.textFileSize = new System.Windows.Forms.TextBox();
this.label4 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.buttonView = new System.Windows.Forms.Button();
this.comboBox1 = new System.Windows.Forms.ComboBox();
this.groupBox1.SuspendLayout();
this.SuspendLayout();
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(12, 15);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(26, 13);
this.label1.TabIndex = 1;
this.label1.Text = "File:";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(41, 35);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(259, 13);
this.label2.TabIndex = 2;
this.label2.Text = "(The filename is relative to the Games/AppID/ folder.)";
//
// groupBox1
//
this.groupBox1.Controls.Add(this.textLastWriteTime);
this.groupBox1.Controls.Add(this.label8);
this.groupBox1.Controls.Add(this.label7);
this.groupBox1.Controls.Add(this.textLastAccessTime);
this.groupBox1.Controls.Add(this.label6);
this.groupBox1.Controls.Add(this.textCreationTime);
this.groupBox1.Controls.Add(this.label5);
this.groupBox1.Controls.Add(this.textFileHash);
this.groupBox1.Controls.Add(this.textFileSize);
this.groupBox1.Controls.Add(this.label4);
this.groupBox1.Controls.Add(this.label3);
this.groupBox1.Location = new System.Drawing.Point(12, 63);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(443, 147);
this.groupBox1.TabIndex = 3;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "File information";
//
// textLastWriteTime
//
this.textLastWriteTime.BackColor = System.Drawing.SystemColors.Control;
this.textLastWriteTime.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.textLastWriteTime.Enabled = false;
this.textLastWriteTime.HideSelection = false;
this.textLastWriteTime.Location = new System.Drawing.Point(111, 108);
this.textLastWriteTime.Name = "textLastWriteTime";
this.textLastWriteTime.ReadOnly = true;
this.textLastWriteTime.Size = new System.Drawing.Size(251, 13);
this.textLastWriteTime.TabIndex = 11;
this.textLastWriteTime.Text = "Never";
//
// label8
//
this.label8.AutoSize = true;
this.label8.Location = new System.Drawing.Point(28, 108);
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(77, 13);
this.label8.TabIndex = 10;
this.label8.Text = "Last write time:";
//
// label7
//
this.label7.AutoSize = true;
this.label7.Location = new System.Drawing.Point(108, 126);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(105, 13);
this.label7.TabIndex = 9;
this.label7.Text = "(All times are in UTC)";
//
// textLastAccessTime
//
this.textLastAccessTime.BackColor = System.Drawing.SystemColors.Control;
this.textLastAccessTime.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.textLastAccessTime.Enabled = false;
this.textLastAccessTime.HideSelection = false;
this.textLastAccessTime.Location = new System.Drawing.Point(111, 89);
this.textLastAccessTime.Name = "textLastAccessTime";
this.textLastAccessTime.ReadOnly = true;
this.textLastAccessTime.Size = new System.Drawing.Size(251, 13);
this.textLastAccessTime.TabIndex = 8;
this.textLastAccessTime.Text = "Never";
//
// label6
//
this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(16, 89);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(89, 13);
this.label6.TabIndex = 7;
this.label6.Text = "Last access time:";
//
// textCreationTime
//
this.textCreationTime.BackColor = System.Drawing.SystemColors.Control;
this.textCreationTime.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.textCreationTime.Enabled = false;
this.textCreationTime.HideSelection = false;
this.textCreationTime.Location = new System.Drawing.Point(111, 70);
this.textCreationTime.Name = "textCreationTime";
this.textCreationTime.ReadOnly = true;
this.textCreationTime.Size = new System.Drawing.Size(251, 13);
this.textCreationTime.TabIndex = 6;
this.textCreationTime.Text = "Never";
//
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(34, 70);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(71, 13);
this.label5.TabIndex = 5;
this.label5.Text = "Creation time:";
//
// textFileHash
//
this.textFileHash.BackColor = System.Drawing.SystemColors.Control;
this.textFileHash.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.textFileHash.Enabled = false;
this.textFileHash.HideSelection = false;
this.textFileHash.Location = new System.Drawing.Point(111, 38);
this.textFileHash.Name = "textFileHash";
this.textFileHash.ReadOnly = true;
this.textFileHash.Size = new System.Drawing.Size(251, 13);
this.textFileHash.TabIndex = 4;
this.textFileHash.Text = "00000000000000000000000000000000";
//
// textFileSize
//
this.textFileSize.BackColor = System.Drawing.SystemColors.Control;
this.textFileSize.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.textFileSize.Enabled = false;
this.textFileSize.HideSelection = false;
this.textFileSize.Location = new System.Drawing.Point(111, 19);
this.textFileSize.Name = "textFileSize";
this.textFileSize.ReadOnly = true;
this.textFileSize.Size = new System.Drawing.Size(251, 13);
this.textFileSize.TabIndex = 3;
this.textFileSize.Text = "0 bytes";
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(46, 38);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(59, 13);
this.label4.TabIndex = 2;
this.label4.Text = "MD5 hash:";
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(61, 19);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(44, 13);
this.label3.TabIndex = 0;
this.label3.Text = "Filesize:";
//
// buttonView
//
this.buttonView.Location = new System.Drawing.Point(380, 10);
this.buttonView.Name = "buttonView";
this.buttonView.Size = new System.Drawing.Size(75, 21);
this.buttonView.TabIndex = 4;
this.buttonView.Text = "Refresh";
this.buttonView.UseVisualStyleBackColor = true;
this.buttonView.Click += new System.EventHandler(this.buttonView_Click);
//
// comboBox1
//
this.comboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboBox1.FormattingEnabled = true;
this.comboBox1.Location = new System.Drawing.Point(43, 10);
this.comboBox1.Name = "comboBox1";
this.comboBox1.Size = new System.Drawing.Size(331, 21);
this.comboBox1.TabIndex = 5;
this.comboBox1.SelectedValueChanged += new System.EventHandler(this.comboBox1_SelectedValueChanged);
//
// FormChecksum
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(467, 217);
this.Controls.Add(this.comboBox1);
this.Controls.Add(this.buttonView);
this.Controls.Add(this.groupBox1);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "FormChecksum";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Checksum";
this.Load += new System.EventHandler(this.FormChecksum_Load);
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.TextBox textFileSize;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.TextBox textFileHash;
private System.Windows.Forms.Button buttonView;
private System.Windows.Forms.TextBox textCreationTime;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.TextBox textLastWriteTime;
private System.Windows.Forms.Label label8;
private System.Windows.Forms.Label label7;
private System.Windows.Forms.TextBox textLastAccessTime;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.ComboBox comboBox1;
}
}

View File

@ -0,0 +1,72 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
namespace GamerServices
{
public partial class FormChecksum : Form
{
public int GameID = 0;
public FormChecksum()
{
InitializeComponent();
}
private void buttonView_Click(object sender, EventArgs e)
{
comboBox1.Items.Clear();
adddir("");
}
private void FormChecksum_Load(object sender, EventArgs e)
{
adddir("");
}
private void comboBox1_SelectedValueChanged(object sender, EventArgs e) {
String Filename = "Games/" + this.GameID.ToString() + "/" + this.comboBox1.Text;
if (File.Exists(Filename))
{
MrAG.Checksum.FileInfo Checksum = MrAG.Checksum.GetInfo(Filename);
this.textFileSize.Text = Checksum.Size + " bytes";
this.textFileHash.Text = Checksum.Hash;
this.textCreationTime.Text = Checksum.DateCreated;
this.textLastAccessTime.Text = Checksum.LastAccessed;
this.textLastWriteTime.Text = Checksum.LastWritten;
}
}
private void adddir(string addpath) {
string startdir = Directory.GetCurrentDirectory() + "/Games/" + GameID + addpath;
string reppath = Directory.GetCurrentDirectory() + "/Games/" + GameID;
int startpos = reppath.Length;
foreach (string file in Directory.GetFiles(startdir)) {
string f = file.Substring(startpos + 1);
if (f != "version.txt")
comboBox1.Items.Add(f);
}
foreach (string dir in Directory.GetDirectories(startdir)) {
adddir(dir.Substring(startpos));
}
if (comboBox1.Text == "") {
comboBox1.SelectedIndex = 0;
}
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,636 @@
namespace GamerServices {
partial class FormDevUpdate {
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing) {
if (disposing && (components != null)) {
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent() {
this.components = new System.ComponentModel.Container();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.button6 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.button1 = new System.Windows.Forms.Button();
this.listBox2 = new System.Windows.Forms.ListBox();
this.listBox1 = new System.Windows.Forms.ListBox();
this.button3 = new System.Windows.Forms.Button();
this.progressBar1 = new System.Windows.Forms.ProgressBar();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.button4 = new System.Windows.Forms.Button();
this.labelHelp = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.textPath = new System.Windows.Forms.TextBox();
this.comboCommand = new System.Windows.Forms.ComboBox();
this.label1 = new System.Windows.Forms.Label();
this.labelInfo = new System.Windows.Forms.Label();
this.radioButton1 = new System.Windows.Forms.RadioButton();
this.radioButton2 = new System.Windows.Forms.RadioButton();
this.radioButton3 = new System.Windows.Forms.RadioButton();
this.radioButton4 = new System.Windows.Forms.RadioButton();
this.radioButton5 = new System.Windows.Forms.RadioButton();
this.radioButton6 = new System.Windows.Forms.RadioButton();
this.radioButton7 = new System.Windows.Forms.RadioButton();
this.radioButton8 = new System.Windows.Forms.RadioButton();
this.radioButton9 = new System.Windows.Forms.RadioButton();
this.radioButton10 = new System.Windows.Forms.RadioButton();
this.radioButton11 = new System.Windows.Forms.RadioButton();
this.radioButton12 = new System.Windows.Forms.RadioButton();
this.radioButton13 = new System.Windows.Forms.RadioButton();
this.radioButton14 = new System.Windows.Forms.RadioButton();
this.radioButton15 = new System.Windows.Forms.RadioButton();
this.radioButton16 = new System.Windows.Forms.RadioButton();
this.radioButton17 = new System.Windows.Forms.RadioButton();
this.radioButton18 = new System.Windows.Forms.RadioButton();
this.radioButton19 = new System.Windows.Forms.RadioButton();
this.radioButton20 = new System.Windows.Forms.RadioButton();
this.radioButton21 = new System.Windows.Forms.RadioButton();
this.radioButton22 = new System.Windows.Forms.RadioButton();
this.radioButton23 = new System.Windows.Forms.RadioButton();
this.radioButton24 = new System.Windows.Forms.RadioButton();
this.radioButton25 = new System.Windows.Forms.RadioButton();
this.radioButton26 = new System.Windows.Forms.RadioButton();
this.timer1 = new System.Windows.Forms.Timer(this.components);
this.groupBox1.SuspendLayout();
this.groupBox2.SuspendLayout();
this.SuspendLayout();
//
// groupBox1
//
this.groupBox1.Controls.Add(this.button6);
this.groupBox1.Controls.Add(this.button2);
this.groupBox1.Controls.Add(this.button1);
this.groupBox1.Controls.Add(this.listBox2);
this.groupBox1.Controls.Add(this.listBox1);
this.groupBox1.Location = new System.Drawing.Point(12, 12);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(480, 292);
this.groupBox1.TabIndex = 0;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "Files";
//
// button6
//
this.button6.Location = new System.Drawing.Point(247, 263);
this.button6.Name = "button6";
this.button6.Size = new System.Drawing.Size(111, 23);
this.button6.TabIndex = 4;
this.button6.Text = "Add Empty";
this.button6.UseVisualStyleBackColor = true;
this.button6.Click += new System.EventHandler(this.button6_Click);
//
// button2
//
this.button2.Location = new System.Drawing.Point(364, 263);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(111, 23);
this.button2.TabIndex = 3;
this.button2.Text = "Remove";
this.button2.UseVisualStyleBackColor = true;
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// button1
//
this.button1.Location = new System.Drawing.Point(6, 263);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(235, 23);
this.button1.TabIndex = 2;
this.button1.Text = "Add";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// listBox2
//
this.listBox2.FormattingEnabled = true;
this.listBox2.Location = new System.Drawing.Point(247, 19);
this.listBox2.Name = "listBox2";
this.listBox2.SelectionMode = System.Windows.Forms.SelectionMode.MultiExtended;
this.listBox2.Size = new System.Drawing.Size(228, 238);
this.listBox2.TabIndex = 1;
this.listBox2.SelectedIndexChanged += new System.EventHandler(this.listBox2_SelectedIndexChanged);
//
// listBox1
//
this.listBox1.FormattingEnabled = true;
this.listBox1.Location = new System.Drawing.Point(6, 19);
this.listBox1.Name = "listBox1";
this.listBox1.SelectionMode = System.Windows.Forms.SelectionMode.MultiExtended;
this.listBox1.Size = new System.Drawing.Size(235, 238);
this.listBox1.TabIndex = 0;
this.listBox1.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.listBox1_MouseDoubleClick);
//
// button3
//
this.button3.Enabled = false;
this.button3.Location = new System.Drawing.Point(689, 242);
this.button3.Name = "button3";
this.button3.Size = new System.Drawing.Size(120, 62);
this.button3.TabIndex = 4;
this.button3.Text = "Create patch";
this.button3.UseVisualStyleBackColor = true;
this.button3.Click += new System.EventHandler(this.button3_Click);
//
// progressBar1
//
this.progressBar1.Location = new System.Drawing.Point(498, 242);
this.progressBar1.Name = "progressBar1";
this.progressBar1.Size = new System.Drawing.Size(182, 27);
this.progressBar1.TabIndex = 1;
//
// groupBox2
//
this.groupBox2.Controls.Add(this.button4);
this.groupBox2.Controls.Add(this.labelHelp);
this.groupBox2.Controls.Add(this.label3);
this.groupBox2.Controls.Add(this.label2);
this.groupBox2.Controls.Add(this.textPath);
this.groupBox2.Controls.Add(this.comboCommand);
this.groupBox2.Controls.Add(this.label1);
this.groupBox2.Enabled = false;
this.groupBox2.Location = new System.Drawing.Point(498, 12);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(313, 182);
this.groupBox2.TabIndex = 5;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "Special Propreties";
//
// button4
//
this.button4.Location = new System.Drawing.Point(6, 152);
this.button4.Name = "button4";
this.button4.Size = new System.Drawing.Size(292, 23);
this.button4.TabIndex = 6;
this.button4.Text = "Save path change";
this.button4.UseVisualStyleBackColor = true;
this.button4.Click += new System.EventHandler(this.button4_Click);
//
// labelHelp
//
this.labelHelp.Location = new System.Drawing.Point(145, 45);
this.labelHelp.Name = "labelHelp";
this.labelHelp.Size = new System.Drawing.Size(153, 70);
this.labelHelp.TabIndex = 5;
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(38, 40);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(32, 13);
this.label3.TabIndex = 4;
this.label3.Text = "Help:";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(13, 129);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(29, 13);
this.label2.TabIndex = 3;
this.label2.Text = "Path";
//
// textPath
//
this.textPath.Location = new System.Drawing.Point(70, 126);
this.textPath.Name = "textPath";
this.textPath.Size = new System.Drawing.Size(228, 20);
this.textPath.TabIndex = 2;
//
// comboCommand
//
this.comboCommand.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboCommand.FormattingEnabled = true;
this.comboCommand.Items.AddRange(new object[] {
"ADD",
"DEL",
"MDR",
"MNF"});
this.comboCommand.Location = new System.Drawing.Point(145, 16);
this.comboCommand.Name = "comboCommand";
this.comboCommand.Size = new System.Drawing.Size(153, 21);
this.comboCommand.TabIndex = 1;
this.comboCommand.SelectedIndexChanged += new System.EventHandler(this.comboCommand_SelectedIndexChanged);
this.comboCommand.SelectionChangeCommitted += new System.EventHandler(this.comboCommand_SelectionChangeCommitted);
this.comboCommand.SelectedValueChanged += new System.EventHandler(this.comboCommand_SelectedValueChanged);
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(21, 19);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(54, 13);
this.label1.TabIndex = 0;
this.label1.Text = "Command";
//
// labelInfo
//
this.labelInfo.AutoSize = true;
this.labelInfo.Location = new System.Drawing.Point(496, 217);
this.labelInfo.Name = "labelInfo";
this.labelInfo.Size = new System.Drawing.Size(0, 13);
this.labelInfo.TabIndex = 6;
//
// radioButton1
//
this.radioButton1.AutoSize = true;
this.radioButton1.Enabled = false;
this.radioButton1.Location = new System.Drawing.Point(498, 275);
this.radioButton1.Name = "radioButton1";
this.radioButton1.Size = new System.Drawing.Size(14, 13);
this.radioButton1.TabIndex = 9;
this.radioButton1.TabStop = true;
this.radioButton1.UseVisualStyleBackColor = true;
//
// radioButton2
//
this.radioButton2.AutoSize = true;
this.radioButton2.Enabled = false;
this.radioButton2.Location = new System.Drawing.Point(512, 275);
this.radioButton2.Name = "radioButton2";
this.radioButton2.Size = new System.Drawing.Size(14, 13);
this.radioButton2.TabIndex = 10;
this.radioButton2.TabStop = true;
this.radioButton2.UseVisualStyleBackColor = true;
//
// radioButton3
//
this.radioButton3.AutoSize = true;
this.radioButton3.Enabled = false;
this.radioButton3.Location = new System.Drawing.Point(526, 275);
this.radioButton3.Name = "radioButton3";
this.radioButton3.Size = new System.Drawing.Size(14, 13);
this.radioButton3.TabIndex = 11;
this.radioButton3.TabStop = true;
this.radioButton3.UseVisualStyleBackColor = true;
//
// radioButton4
//
this.radioButton4.AutoSize = true;
this.radioButton4.Enabled = false;
this.radioButton4.Location = new System.Drawing.Point(540, 275);
this.radioButton4.Name = "radioButton4";
this.radioButton4.Size = new System.Drawing.Size(14, 13);
this.radioButton4.TabIndex = 12;
this.radioButton4.TabStop = true;
this.radioButton4.UseVisualStyleBackColor = true;
//
// radioButton5
//
this.radioButton5.AutoSize = true;
this.radioButton5.Enabled = false;
this.radioButton5.Location = new System.Drawing.Point(554, 275);
this.radioButton5.Name = "radioButton5";
this.radioButton5.Size = new System.Drawing.Size(14, 13);
this.radioButton5.TabIndex = 13;
this.radioButton5.TabStop = true;
this.radioButton5.UseVisualStyleBackColor = true;
//
// radioButton6
//
this.radioButton6.AutoSize = true;
this.radioButton6.Enabled = false;
this.radioButton6.Location = new System.Drawing.Point(568, 275);
this.radioButton6.Name = "radioButton6";
this.radioButton6.Size = new System.Drawing.Size(14, 13);
this.radioButton6.TabIndex = 14;
this.radioButton6.TabStop = true;
this.radioButton6.UseVisualStyleBackColor = true;
//
// radioButton7
//
this.radioButton7.AutoSize = true;
this.radioButton7.Enabled = false;
this.radioButton7.Location = new System.Drawing.Point(582, 275);
this.radioButton7.Name = "radioButton7";
this.radioButton7.Size = new System.Drawing.Size(14, 13);
this.radioButton7.TabIndex = 15;
this.radioButton7.TabStop = true;
this.radioButton7.UseVisualStyleBackColor = true;
//
// radioButton8
//
this.radioButton8.AutoSize = true;
this.radioButton8.Enabled = false;
this.radioButton8.Location = new System.Drawing.Point(596, 275);
this.radioButton8.Name = "radioButton8";
this.radioButton8.Size = new System.Drawing.Size(14, 13);
this.radioButton8.TabIndex = 16;
this.radioButton8.TabStop = true;
this.radioButton8.UseVisualStyleBackColor = true;
//
// radioButton9
//
this.radioButton9.AutoSize = true;
this.radioButton9.Enabled = false;
this.radioButton9.Location = new System.Drawing.Point(610, 275);
this.radioButton9.Name = "radioButton9";
this.radioButton9.Size = new System.Drawing.Size(14, 13);
this.radioButton9.TabIndex = 17;
this.radioButton9.TabStop = true;
this.radioButton9.UseVisualStyleBackColor = true;
//
// radioButton10
//
this.radioButton10.AutoSize = true;
this.radioButton10.Enabled = false;
this.radioButton10.Location = new System.Drawing.Point(624, 275);
this.radioButton10.Name = "radioButton10";
this.radioButton10.Size = new System.Drawing.Size(14, 13);
this.radioButton10.TabIndex = 18;
this.radioButton10.TabStop = true;
this.radioButton10.UseVisualStyleBackColor = true;
//
// radioButton11
//
this.radioButton11.AutoSize = true;
this.radioButton11.Enabled = false;
this.radioButton11.Location = new System.Drawing.Point(638, 275);
this.radioButton11.Name = "radioButton11";
this.radioButton11.Size = new System.Drawing.Size(14, 13);
this.radioButton11.TabIndex = 19;
this.radioButton11.TabStop = true;
this.radioButton11.UseVisualStyleBackColor = true;
//
// radioButton12
//
this.radioButton12.AutoSize = true;
this.radioButton12.Enabled = false;
this.radioButton12.Location = new System.Drawing.Point(652, 275);
this.radioButton12.Name = "radioButton12";
this.radioButton12.Size = new System.Drawing.Size(14, 13);
this.radioButton12.TabIndex = 20;
this.radioButton12.TabStop = true;
this.radioButton12.UseVisualStyleBackColor = true;
//
// radioButton13
//
this.radioButton13.AutoSize = true;
this.radioButton13.Enabled = false;
this.radioButton13.Location = new System.Drawing.Point(666, 275);
this.radioButton13.Name = "radioButton13";
this.radioButton13.Size = new System.Drawing.Size(14, 13);
this.radioButton13.TabIndex = 21;
this.radioButton13.TabStop = true;
this.radioButton13.UseVisualStyleBackColor = true;
//
// radioButton14
//
this.radioButton14.AutoSize = true;
this.radioButton14.Enabled = false;
this.radioButton14.Location = new System.Drawing.Point(666, 291);
this.radioButton14.Name = "radioButton14";
this.radioButton14.Size = new System.Drawing.Size(14, 13);
this.radioButton14.TabIndex = 34;
this.radioButton14.TabStop = true;
this.radioButton14.UseVisualStyleBackColor = true;
//
// radioButton15
//
this.radioButton15.AutoSize = true;
this.radioButton15.Enabled = false;
this.radioButton15.Location = new System.Drawing.Point(652, 291);
this.radioButton15.Name = "radioButton15";
this.radioButton15.Size = new System.Drawing.Size(14, 13);
this.radioButton15.TabIndex = 33;
this.radioButton15.TabStop = true;
this.radioButton15.UseVisualStyleBackColor = true;
//
// radioButton16
//
this.radioButton16.AutoSize = true;
this.radioButton16.Enabled = false;
this.radioButton16.Location = new System.Drawing.Point(638, 291);
this.radioButton16.Name = "radioButton16";
this.radioButton16.Size = new System.Drawing.Size(14, 13);
this.radioButton16.TabIndex = 32;
this.radioButton16.TabStop = true;
this.radioButton16.UseVisualStyleBackColor = true;
//
// radioButton17
//
this.radioButton17.AutoSize = true;
this.radioButton17.Enabled = false;
this.radioButton17.Location = new System.Drawing.Point(624, 291);
this.radioButton17.Name = "radioButton17";
this.radioButton17.Size = new System.Drawing.Size(14, 13);
this.radioButton17.TabIndex = 31;
this.radioButton17.TabStop = true;
this.radioButton17.UseVisualStyleBackColor = true;
//
// radioButton18
//
this.radioButton18.AutoSize = true;
this.radioButton18.Enabled = false;
this.radioButton18.Location = new System.Drawing.Point(610, 291);
this.radioButton18.Name = "radioButton18";
this.radioButton18.Size = new System.Drawing.Size(14, 13);
this.radioButton18.TabIndex = 30;
this.radioButton18.TabStop = true;
this.radioButton18.UseVisualStyleBackColor = true;
//
// radioButton19
//
this.radioButton19.AutoSize = true;
this.radioButton19.Enabled = false;
this.radioButton19.Location = new System.Drawing.Point(596, 291);
this.radioButton19.Name = "radioButton19";
this.radioButton19.Size = new System.Drawing.Size(14, 13);
this.radioButton19.TabIndex = 29;
this.radioButton19.TabStop = true;
this.radioButton19.UseVisualStyleBackColor = true;
//
// radioButton20
//
this.radioButton20.AutoSize = true;
this.radioButton20.Enabled = false;
this.radioButton20.Location = new System.Drawing.Point(582, 291);
this.radioButton20.Name = "radioButton20";
this.radioButton20.Size = new System.Drawing.Size(14, 13);
this.radioButton20.TabIndex = 28;
this.radioButton20.TabStop = true;
this.radioButton20.UseVisualStyleBackColor = true;
//
// radioButton21
//
this.radioButton21.AutoSize = true;
this.radioButton21.Enabled = false;
this.radioButton21.Location = new System.Drawing.Point(568, 291);
this.radioButton21.Name = "radioButton21";
this.radioButton21.Size = new System.Drawing.Size(14, 13);
this.radioButton21.TabIndex = 27;
this.radioButton21.TabStop = true;
this.radioButton21.UseVisualStyleBackColor = true;
//
// radioButton22
//
this.radioButton22.AutoSize = true;
this.radioButton22.Enabled = false;
this.radioButton22.Location = new System.Drawing.Point(554, 291);
this.radioButton22.Name = "radioButton22";
this.radioButton22.Size = new System.Drawing.Size(14, 13);
this.radioButton22.TabIndex = 26;
this.radioButton22.TabStop = true;
this.radioButton22.UseVisualStyleBackColor = true;
//
// radioButton23
//
this.radioButton23.AutoSize = true;
this.radioButton23.Enabled = false;
this.radioButton23.Location = new System.Drawing.Point(540, 291);
this.radioButton23.Name = "radioButton23";
this.radioButton23.Size = new System.Drawing.Size(14, 13);
this.radioButton23.TabIndex = 25;
this.radioButton23.TabStop = true;
this.radioButton23.UseVisualStyleBackColor = true;
//
// radioButton24
//
this.radioButton24.AutoSize = true;
this.radioButton24.Enabled = false;
this.radioButton24.Location = new System.Drawing.Point(526, 291);
this.radioButton24.Name = "radioButton24";
this.radioButton24.Size = new System.Drawing.Size(14, 13);
this.radioButton24.TabIndex = 24;
this.radioButton24.TabStop = true;
this.radioButton24.UseVisualStyleBackColor = true;
//
// radioButton25
//
this.radioButton25.AutoSize = true;
this.radioButton25.Enabled = false;
this.radioButton25.Location = new System.Drawing.Point(512, 291);
this.radioButton25.Name = "radioButton25";
this.radioButton25.Size = new System.Drawing.Size(14, 13);
this.radioButton25.TabIndex = 23;
this.radioButton25.TabStop = true;
this.radioButton25.UseVisualStyleBackColor = true;
//
// radioButton26
//
this.radioButton26.AutoSize = true;
this.radioButton26.Enabled = false;
this.radioButton26.Location = new System.Drawing.Point(498, 291);
this.radioButton26.Name = "radioButton26";
this.radioButton26.Size = new System.Drawing.Size(14, 13);
this.radioButton26.TabIndex = 22;
this.radioButton26.TabStop = true;
this.radioButton26.UseVisualStyleBackColor = true;
//
// timer1
//
this.timer1.Interval = 75;
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
//
// FormDevUpdate
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(823, 312);
this.Controls.Add(this.radioButton14);
this.Controls.Add(this.radioButton15);
this.Controls.Add(this.radioButton16);
this.Controls.Add(this.radioButton17);
this.Controls.Add(this.radioButton18);
this.Controls.Add(this.radioButton19);
this.Controls.Add(this.radioButton20);
this.Controls.Add(this.radioButton21);
this.Controls.Add(this.radioButton22);
this.Controls.Add(this.radioButton23);
this.Controls.Add(this.radioButton24);
this.Controls.Add(this.radioButton25);
this.Controls.Add(this.radioButton26);
this.Controls.Add(this.radioButton13);
this.Controls.Add(this.radioButton12);
this.Controls.Add(this.radioButton11);
this.Controls.Add(this.radioButton10);
this.Controls.Add(this.radioButton9);
this.Controls.Add(this.radioButton8);
this.Controls.Add(this.radioButton7);
this.Controls.Add(this.radioButton6);
this.Controls.Add(this.radioButton5);
this.Controls.Add(this.radioButton4);
this.Controls.Add(this.radioButton3);
this.Controls.Add(this.radioButton2);
this.Controls.Add(this.radioButton1);
this.Controls.Add(this.labelInfo);
this.Controls.Add(this.groupBox2);
this.Controls.Add(this.button3);
this.Controls.Add(this.progressBar1);
this.Controls.Add(this.groupBox1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
this.Name = "FormDevUpdate";
this.Text = "Update manager";
this.Load += new System.EventHandler(this.FormDevUpdate_Load);
this.groupBox1.ResumeLayout(false);
this.groupBox2.ResumeLayout(false);
this.groupBox2.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.Button button3;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.ListBox listBox2;
private System.Windows.Forms.ListBox listBox1;
private System.Windows.Forms.ProgressBar progressBar1;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.Button button6;
private System.Windows.Forms.Button button4;
private System.Windows.Forms.Label labelHelp;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.TextBox textPath;
private System.Windows.Forms.ComboBox comboCommand;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label labelInfo;
private System.Windows.Forms.RadioButton radioButton1;
private System.Windows.Forms.RadioButton radioButton2;
private System.Windows.Forms.RadioButton radioButton3;
private System.Windows.Forms.RadioButton radioButton4;
private System.Windows.Forms.RadioButton radioButton5;
private System.Windows.Forms.RadioButton radioButton6;
private System.Windows.Forms.RadioButton radioButton7;
private System.Windows.Forms.RadioButton radioButton8;
private System.Windows.Forms.RadioButton radioButton9;
private System.Windows.Forms.RadioButton radioButton10;
private System.Windows.Forms.RadioButton radioButton11;
private System.Windows.Forms.RadioButton radioButton12;
private System.Windows.Forms.RadioButton radioButton13;
private System.Windows.Forms.RadioButton radioButton14;
private System.Windows.Forms.RadioButton radioButton15;
private System.Windows.Forms.RadioButton radioButton16;
private System.Windows.Forms.RadioButton radioButton17;
private System.Windows.Forms.RadioButton radioButton18;
private System.Windows.Forms.RadioButton radioButton19;
private System.Windows.Forms.RadioButton radioButton20;
private System.Windows.Forms.RadioButton radioButton21;
private System.Windows.Forms.RadioButton radioButton22;
private System.Windows.Forms.RadioButton radioButton23;
private System.Windows.Forms.RadioButton radioButton24;
private System.Windows.Forms.RadioButton radioButton25;
private System.Windows.Forms.RadioButton radioButton26;
private System.Windows.Forms.Timer timer1;
}
}

View File

@ -0,0 +1,867 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.IO;
using System.Windows.Forms;
using System.IO.Compression;
using ICSharpCode.SharpZipLib.Tar;
using System.Net;
using System.Collections.Specialized;
namespace GamerServices {
public partial class FormDevUpdate : Form {
class Prop{
public String Path;
public String Action;
}
private Game G;
private String CurPath = "";
private List<Prop> Props = new List<Prop>();
public FormDevUpdate(Game g) {
G = g;
CurPath = "";
CheckForIllegalCrossThreadCalls = false;
this.Icon = G.Main.Icon;
InitializeComponent();
}
private void FormDevUpdate_Load(object sender, EventArgs e) {
listBox1.Items.Clear();
listBox2.Items.Clear();
Browse();
}
private void Browse() {
try {
string startdir = Directory.GetCurrentDirectory() + "/Games/" + G.GameID + "/";
int startpos = startdir.Length;
listBox1.Items.Clear();
int slashes = 0;
int lastshalsh = CurPath.IndexOf("/");
while(lastshalsh > -1){
slashes++;
lastshalsh = CurPath.IndexOf("/", lastshalsh + 1);
}
if (slashes > 0) {
listBox1.Items.Add("...");
}
foreach (string dir in Directory.GetDirectories(startdir + CurPath)) {
listBox1.Items.Add(dir.Substring(startpos + CurPath.Length));
}
foreach (string file in Directory.GetFiles(startdir + CurPath)) {
if (!(CurPath == "" && file.Substring(startpos + CurPath.Length) == "version.txt")) {
listBox1.Items.Add(file.Substring(startpos + CurPath.Length));
}
}
} catch(Exception e) {
}
}
private void listBox1_MouseDoubleClick(object sender, MouseEventArgs e) {
if ((string)listBox1.SelectedItem == "...") {
string[] splited = CurPath.Split('/');
CurPath = "";
if (splited.Length > 1) {
for (int i = 0; i < splited.Length - 2; i++ ) {
CurPath += splited[i] + "/";
}
}
} else {
if (Directory.Exists(Directory.GetCurrentDirectory() + "/Games/" + G.GameID + "/" + CurPath + (string)listBox1.SelectedItem))
CurPath += (string)listBox1.SelectedItem + "/";
else
additem(CurPath + (string)listBox1.SelectedItem);
}
Browse();
}
private void button3_Click(object sender, EventArgs e) {
groupBox1.Enabled = false;
groupBox2.Enabled = false;
button3.Enabled = false;
timer1.Enabled = true;
new System.Threading.Thread(new System.Threading.ThreadStart(TarMaker)).Start();
}
private void TarMaker() {
progressBar1.Value = 0;
string updatedata = "";
string root = Directory.GetCurrentDirectory() + "/Games/" + G.GameID + "/";
string newver = "";
labelInfo.Text = "Recieving latest version info...";
try {
System.Net.WebClient client = new System.Net.WebClient();
client.Proxy = null;
string[] verdata = new StreamReader(client.OpenRead("http://" + "gs.mrag.nl/download.php?gid=" + G.GameID + "&file=updates.txt")).ReadToEnd().Replace("\r", "").Split('\n');
foreach (string line in verdata){
if (line.Length > 0) {
string[] args = null;
if (line.Contains("=")) args = line.Split('=');
if (line.TrimStart('\t', ' ').StartsWith("#")){
}else if (args[0] == "VER"){
short[] splitver = new short[4];
string[] tmp = args[1].Split('.');
for (int i = 0; i < tmp.Length; i++)
splitver[i] = byte.Parse(tmp[i]);
splitver[3]++;
for (int i = 2; i > -1; i--) {
if (splitver[i + 1] > 255) {
splitver[i]++;
splitver[i + 1] = 0;
}
}
newver = splitver[0] + "." + splitver[1] + "." + splitver[2] + "." + splitver[3];
break;
}
}
}
} catch {
newver = "0.0.0.0";
}
labelInfo.Text = "Initializing version " + newver;
string newverfile = root + "update-" + newver.Replace('.', '_');
updatedata = "VER=" + newver;
labelInfo.Text = "Removing old files...";
while (true) {
try {
if (File.Exists(newverfile + ".tar"))
File.Delete(newverfile + ".tar");
if (File.Exists(newverfile + ".txt"))
File.Delete(newverfile + ".txt");
break;
} catch (Exception e){
if (MessageBox.Show(e.Message, "Error while removing old version files!", MessageBoxButtons.RetryCancel, MessageBoxIcon.Error) != DialogResult.Retry) {
break;
}
}
}
labelInfo.Text = "Counting total file size...";
int totalsize = 0;
for (int i = 0; i < Props.Count; i++) {
if (Props[i].Action == "ADD") {
while (true) {
try {
totalsize += (int)new FileInfo(root + (string)listBox2.Items[i]).Length;
updatedata += "\r\n" + Props[i].Action + "=" + Props[i].Path;
break;
} catch(Exception e) {
if (MessageBox.Show(e.Message, "Error while reading filesize!", MessageBoxButtons.RetryCancel, MessageBoxIcon.Error) != DialogResult.Retry) {
break;
}
}
}
}else
updatedata += "\r\n" + Props[i].Action + "=" + Props[i].Path;
}
progressBar1.Minimum = 0;
progressBar1.Maximum = totalsize;
using (TarOutputStream tarOutputStream = new TarOutputStream(File.Create(newverfile + ".tar"))) {
while (Props.Count > 0) {
labelInfo.Text = "Writing tar file... " + Props[0].Path;
listBox2.ClearSelected();
listBox2.SetSelected(0, true);
listBox2.SetSelected(0, false);
if (Props[0].Action == "ADD") {
while (true) {
try {
FileInfo info = new FileInfo(root + Props[0].Path);
using (Stream inputStream = File.OpenRead(root + Props[0].Path)) {
long fileSize = inputStream.Length;
TarEntry entry = TarEntry.CreateTarEntry(Props[0].Path.Replace("\\", "/"));
entry.Size = fileSize;
tarOutputStream.PutNextEntry(entry);
byte[ ] localBuffer = new byte[32 * 1024];
while (true) {
int numRead = inputStream.Read(localBuffer, 0, localBuffer.Length);
if (numRead <= 0) {
break;
}
tarOutputStream.Write(localBuffer, 0, numRead);
}
}
tarOutputStream.CloseEntry();
progressBar1.Increment((int)info.Length);
break;
} catch(Exception e) {
if (MessageBox.Show(e.Message, "Error while parsing file!", MessageBoxButtons.RetryCancel, MessageBoxIcon.Error) != DialogResult.Retry) {
break;
}
}
}
}
listBox2.Items.RemoveAt(0);
Props.RemoveAt(0);
}
labelInfo.Text = "Saving tar file... ";
}
labelInfo.Text = "Writing patch config...";
File.WriteAllText(newverfile + ".txt", updatedata);
labelInfo.Text = "Initializing upload...";
button2.Tag = Math.Round((double)new FileInfo(newverfile + ".tar").Length / 1024 / 1024, 3).ToString();
button3.Tag = newver;
new System.Threading.Thread(new System.Threading.ThreadStart(Upload)).Start();
}
private void button2_Click(object sender, EventArgs e) {
for (int i = 0; i < listBox2.SelectedItems.Count; i++){
for (int i2 = 0; i2 < Props.Count; i2++) {
if (Props[i2].Path == (string)listBox2.SelectedItems[i]){
Props.RemoveAt(i2);
break;
}
}
listBox2.Items.Remove((string)listBox2.SelectedItems[i]);
i--;
}
if (listBox2.Items.Count == 0)
button3.Enabled = false;
}
private void button1_Click(object sender, EventArgs e) {
foreach (object obj in listBox1.SelectedItems) {
additem(CurPath + (string)obj);
if (Directory.Exists(Directory.GetCurrentDirectory() + "/Games/" + G.GameID + "/" + CurPath + (string)obj)) {
adddir(CurPath + (string)obj);
}
}
}
private void adddir(string addpath) {
string startdir = Directory.GetCurrentDirectory() + "/Games/" + G.GameID + "/" + addpath;
string reppath = Directory.GetCurrentDirectory() + "/Games/" + G.GameID + "/";
int startpos = reppath.Length;
foreach (string dir in Directory.GetDirectories(startdir)) {
additem(dir.Substring(startpos));
adddir(dir.Substring(startpos));
}
foreach (string file in Directory.GetFiles(startdir)) {
additem(file.Substring(startpos));
}
}
private void additem(string item) {
if (!listBox2.Items.Contains(item)) {
string itempath = Directory.GetCurrentDirectory() + "/Games/" + G.GameID + "/" + item;
Prop p = new Prop();
p.Path = item;
p.Action = Directory.Exists(itempath) ? "MDR" : File.Exists(itempath) ? "ADD" : "MNF";
Props.Add(p);
listBox2.Items.Add(item);
listBox2.ClearSelected();
listBox2.SetSelected(listBox2.Items.Count - 1, true);
listBox2.SetSelected(listBox2.Items.Count - 1, false);
button3.Enabled = true;
}
}
private void listBox2_SelectedIndexChanged(object sender, EventArgs e) {
if (listBox2.SelectedItems.Count > 0){
string defcmd = "";
foreach (Prop p in Props) {
if ((string)listBox2.SelectedItems[0] == p.Path) {
defcmd = p.Action;
break;
}
}
if (listBox2.SelectedItems.Count > 1) {
foreach (string itm in listBox2.SelectedItems) {
foreach (Prop p in Props) {
if (itm == p.Path) {
if (p.Action != defcmd) {
defcmd = "*";
break;
}
}
}
if (defcmd == "*")
break;
}
comboCommand.Text = defcmd;
textPath.Text = "*";
} else {
comboCommand.Text = Props[listBox2.Items.IndexOf((string)listBox2.SelectedItems[0])].Action;
textPath.Text = (string)listBox2.SelectedItems[0];
}
switch (comboCommand.Text) {
case "ADD":
labelHelp.Text = "Adds a new file to the folder, if it already exists it wil be overwritten.";
break;
case "DEL":
labelHelp.Text = "Deletes a file/folder.";
break;
case "MNF":
labelHelp.Text = "Creates a new empty file.";
break;
case "MDR":
labelHelp.Text = "Creates an folder.";
break;
}
groupBox2.Enabled = true;
}else
groupBox2.Enabled = false;
}
private void button6_Click(object sender, EventArgs e) {
additem("Empty");
}
private void button4_Click(object sender, EventArgs e) {
Props[listBox2.SelectedIndex].Action = comboCommand.Text;
Props[listBox2.SelectedIndex].Path = textPath.Text;
listBox2.Items[listBox2.SelectedIndex] = textPath.Text;
}
private void comboCommand_SelectionChangeCommitted(object sender, EventArgs e) {
foreach (string itm in listBox2.SelectedItems) {
foreach (Prop p in Props) {
if (itm == p.Path) {
p.Action = comboCommand.Text;
break;
}
}
}
}
private void comboCommand_SelectedIndexChanged(object sender, EventArgs e) {
}
private void Upload(){
WebClient wClient = new WebClient();
wClient.Proxy = null;
labelInfo.Text = "Uploading new version file...";
string[] txt = null;
int failsafe = 0;
while (failsafe < 3) {
try {
txt = MyUploader(Directory.GetCurrentDirectory() + "/Games/" + G.GameID + "/" + "update-" + (button3.Tag as string).Replace('.', '_') + ".txt", "http://" + "gs.mrag.nl/api/" + G.Main.Sessionkey + "/txt/" + G.GameID).Split('\n');
break;
} catch {
failsafe++;
}
}
if (failsafe > 2) {
G.Main.Error(txt[1]);
labelInfo.Text = "Failed to upload new patch, the WebRequest was rejected by the server.";
groupBox1.Enabled = true;
groupBox2.Enabled = true;
timer1.Enabled = false;
timeranimation = 0;
radioButton1.Checked = false;
radioButton2.Checked = false;
radioButton3.Checked = false;
radioButton4.Checked = false;
radioButton5.Checked = false;
radioButton6.Checked = false;
radioButton7.Checked = false;
radioButton8.Checked = false;
radioButton9.Checked = false;
radioButton10.Checked = false;
radioButton11.Checked = false;
radioButton12.Checked = false;
radioButton13.Checked = false;
radioButton14.Checked = false;
radioButton15.Checked = false;
radioButton16.Checked = false;
radioButton17.Checked = false;
radioButton18.Checked = false;
radioButton19.Checked = false;
radioButton20.Checked = false;
radioButton21.Checked = false;
radioButton22.Checked = false;
radioButton23.Checked = false;
radioButton24.Checked = false;
radioButton25.Checked = false;
radioButton26.Checked = false;
return;
}
if (txt[0] == "no") {
G.Main.Error(txt[1]);
labelInfo.Text = "Failed!";
groupBox1.Enabled = true;
groupBox2.Enabled = true;
timer1.Enabled = false;
timeranimation = 0;
radioButton1.Checked = false;
radioButton2.Checked = false;
radioButton3.Checked = false;
radioButton4.Checked = false;
radioButton5.Checked = false;
radioButton6.Checked = false;
radioButton7.Checked = false;
radioButton8.Checked = false;
radioButton9.Checked = false;
radioButton10.Checked = false;
radioButton11.Checked = false;
radioButton12.Checked = false;
radioButton13.Checked = false;
radioButton14.Checked = false;
radioButton15.Checked = false;
radioButton16.Checked = false;
radioButton17.Checked = false;
radioButton18.Checked = false;
radioButton19.Checked = false;
radioButton20.Checked = false;
radioButton21.Checked = false;
radioButton22.Checked = false;
radioButton23.Checked = false;
radioButton24.Checked = false;
radioButton25.Checked = false;
radioButton26.Checked = false;
return;
}
labelInfo.Text = "Uploading new patch...";
string[] tar = null;
failsafe = 0;
while (failsafe < 3) {
try {
tar = MyUploader(Directory.GetCurrentDirectory() + "/Games/" + G.GameID + "/" + "update-" + (button3.Tag as string).Replace('.', '_') + ".tar", "http://" + "gs.mrag.nl/api/" + G.Main.Sessionkey + "/tar/" + G.GameID).Split('\n');
break;
} catch {
failsafe++;
}
}
if (failsafe > 2) {
G.Main.Error(txt[1]);
labelInfo.Text = "Failed to upload new patch, the WebRequest was rejected by the server.";
groupBox1.Enabled = true;
groupBox2.Enabled = true;
timer1.Enabled = false;
timeranimation = 0;
radioButton1.Checked = false;
radioButton2.Checked = false;
radioButton3.Checked = false;
radioButton4.Checked = false;
radioButton5.Checked = false;
radioButton6.Checked = false;
radioButton7.Checked = false;
radioButton8.Checked = false;
radioButton9.Checked = false;
radioButton10.Checked = false;
radioButton11.Checked = false;
radioButton12.Checked = false;
radioButton13.Checked = false;
radioButton14.Checked = false;
radioButton15.Checked = false;
radioButton16.Checked = false;
radioButton17.Checked = false;
radioButton18.Checked = false;
radioButton19.Checked = false;
radioButton20.Checked = false;
radioButton21.Checked = false;
radioButton22.Checked = false;
radioButton23.Checked = false;
radioButton24.Checked = false;
radioButton25.Checked = false;
radioButton26.Checked = false;
return;
}
if (tar[0] == "no") {
G.Main.Error(txt[1]);
labelInfo.Text = "Failed!";
groupBox1.Enabled = true;
groupBox2.Enabled = true;
timer1.Enabled = false;
timeranimation = 0;
radioButton1.Checked = false;
radioButton2.Checked = false;
radioButton3.Checked = false;
radioButton4.Checked = false;
radioButton5.Checked = false;
radioButton6.Checked = false;
radioButton7.Checked = false;
radioButton8.Checked = false;
radioButton9.Checked = false;
radioButton10.Checked = false;
radioButton11.Checked = false;
radioButton12.Checked = false;
radioButton13.Checked = false;
radioButton14.Checked = false;
radioButton15.Checked = false;
radioButton16.Checked = false;
radioButton17.Checked = false;
radioButton18.Checked = false;
radioButton19.Checked = false;
radioButton20.Checked = false;
radioButton21.Checked = false;
radioButton22.Checked = false;
radioButton23.Checked = false;
radioButton24.Checked = false;
radioButton25.Checked = false;
radioButton26.Checked = false;
return;
}
labelInfo.Text = "Removing temp update files...";
while (true) {
try {
File.Delete(Directory.GetCurrentDirectory() + "/Games/" + G.GameID + "/" + "update-" + (button3.Tag as string).Replace('.', '_') + ".tar");
break;
} catch (Exception e) {
if (MessageBox.Show(e.Message, "Error while removing temp files!", MessageBoxButtons.RetryCancel, MessageBoxIcon.Error) != DialogResult.Retry) {
break;
}
}
}
while (true) {
try {
File.Delete(Directory.GetCurrentDirectory() + "/Games/" + G.GameID + "/" + "update-" + (button3.Tag as string).Replace('.', '_') + ".txt");
break;
} catch (Exception e) {
if (MessageBox.Show(e.Message, "Error while removing temp files!", MessageBoxButtons.RetryCancel, MessageBoxIcon.Error) != DialogResult.Retry) {
break;
}
}
}
labelInfo.Text = "Updateing local version file...";
while (true) {
try {
File.WriteAllText(Directory.GetCurrentDirectory() + "/Games/" + G.GameID + "/version.txt", (string)button3.Tag);
break;
} catch (Exception e) {
if (MessageBox.Show(e.Message, "Error while writing local version file!", MessageBoxButtons.RetryCancel, MessageBoxIcon.Error) != DialogResult.Retry) {
break;
}
}
}
labelInfo.Text = "Done!";
groupBox1.Enabled = true;
groupBox2.Enabled = true;
timer1.Enabled = false;
timeranimation = 0;
radioButton1.Checked = false;
radioButton2.Checked = false;
radioButton3.Checked = false;
radioButton4.Checked = false;
radioButton5.Checked = false;
radioButton6.Checked = false;
radioButton7.Checked = false;
radioButton8.Checked = false;
radioButton9.Checked = false;
radioButton10.Checked = false;
radioButton11.Checked = false;
radioButton12.Checked = false;
radioButton13.Checked = false;
radioButton14.Checked = false;
radioButton15.Checked = false;
radioButton16.Checked = false;
radioButton17.Checked = false;
radioButton18.Checked = false;
radioButton19.Checked = false;
radioButton20.Checked = false;
radioButton21.Checked = false;
radioButton22.Checked = false;
radioButton23.Checked = false;
radioButton24.Checked = false;
radioButton25.Checked = false;
radioButton26.Checked = false;
MessageBox.Show("Uploaded patch for version " + button3.Tag + "!\nFile size: " + button2.Tag + " MB", "Done!", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
public static string MyUploader(string strFileToUpload, string strUrl)
{
string strFileFormName = "file";
Uri oUri = new Uri(strUrl);
string strBoundary = "----------" + DateTime.Now.Ticks.ToString("x");
// The trailing boundary string
byte[] boundaryBytes = Encoding.ASCII.GetBytes("\r\n--" + strBoundary + "\r\n");
// The post message header
StringBuilder sb = new StringBuilder();
sb.Append("--");
sb.Append(strBoundary);
sb.Append("\r\n");
sb.Append("Content-Disposition: form-data; name=\"");
sb.Append(strFileFormName);
sb.Append("\"; filename=\"");
sb.Append(Path.GetFileName(strFileToUpload));
sb.Append("\"");
sb.Append("\r\n");
sb.Append("Content-Type: ");
sb.Append("application/octet-stream");
sb.Append("\r\n");
sb.Append("\r\n");
string strPostHeader = sb.ToString();
byte[] postHeaderBytes = Encoding.UTF8.GetBytes(strPostHeader);
// The WebRequest
HttpWebRequest oWebrequest = (HttpWebRequest)WebRequest.Create(oUri);
oWebrequest.ContentType = "multipart/form-data; boundary=" + strBoundary;
oWebrequest.Method = "POST";
// This is important, otherwise the whole file will be read to memory anyway...
oWebrequest.AllowWriteStreamBuffering = false;
// Get a FileStream and set the final properties of the WebRequest
FileStream oFileStream = new FileStream(strFileToUpload, FileMode.Open, FileAccess.Read);
long length = postHeaderBytes.Length + oFileStream.Length + boundaryBytes.Length;
oWebrequest.ContentLength = length;
Stream oRequestStream = oWebrequest.GetRequestStream();
// Write the post header
oRequestStream.Write(postHeaderBytes, 0, postHeaderBytes.Length);
// Stream the file contents in small pieces (4096 bytes, max).
byte[] buffer = new Byte[checked((uint)Math.Min(4096, (int)oFileStream.Length))];
int bytesRead = 0;
while ((bytesRead = oFileStream.Read(buffer, 0, buffer.Length)) != 0)
oRequestStream.Write(buffer, 0, bytesRead);
oFileStream.Close();
// Add the trailing boundary
oRequestStream.Write(boundaryBytes, 0, boundaryBytes.Length);
WebResponse oWResponse = oWebrequest.GetResponse();
Stream s = oWResponse.GetResponseStream();
StreamReader sr = new StreamReader(s);
String sReturnString = sr.ReadToEnd();
// Clean up
oFileStream.Close();
oRequestStream.Close();
s.Close();
sr.Close();
return sReturnString;
}
private byte timeranimation = 0;
private void timer1_Tick(object sender, EventArgs e) {
switch (timeranimation) {
case 0:
radioButton1.Checked = false;
radioButton2.Checked = true;
break;
case 1:
radioButton2.Checked = false;
radioButton3.Checked = true;
break;
case 2:
radioButton3.Checked = false;
radioButton4.Checked = true;
break;
case 3:
radioButton4.Checked = false;
radioButton5.Checked = true;
break;
case 4:
radioButton5.Checked = false;
radioButton6.Checked = true;
break;
case 5:
radioButton6.Checked = false;
radioButton7.Checked = true;
break;
case 6:
radioButton7.Checked = false;
radioButton8.Checked = true;
break;
case 7:
radioButton8.Checked = false;
radioButton9.Checked = true;
break;
case 8:
radioButton9.Checked = false;
radioButton10.Checked = true;
break;
case 9:
radioButton11.Checked = false;
radioButton12.Checked = true;
break;
case 10:
radioButton12.Checked = false;
radioButton13.Checked = true;
break;
case 11:
radioButton13.Checked = false;
radioButton14.Checked = true;
break;
case 12:
radioButton14.Checked = false;
radioButton15.Checked = true;
break;
case 13:
radioButton15.Checked = false;
radioButton16.Checked = true;
break;
case 14:
radioButton16.Checked = false;
radioButton17.Checked = true;
break;
case 15:
radioButton17.Checked = false;
radioButton18.Checked = true;
break;
case 16:
radioButton18.Checked = false;
radioButton19.Checked = true;
break;
case 17:
radioButton19.Checked = false;
radioButton20.Checked = true;
break;
case 18:
radioButton20.Checked = false;
radioButton21.Checked = true;
break;
case 19:
radioButton21.Checked = false;
radioButton22.Checked = true;
break;
case 20:
radioButton22.Checked = false;
radioButton23.Checked = true;
break;
case 21:
radioButton23.Checked = false;
radioButton24.Checked = true;
break;
case 22:
radioButton24.Checked = false;
radioButton25.Checked = true;
break;
case 23:
radioButton25.Checked = false;
radioButton26.Checked = true;
break;
case 24:
radioButton26.Checked = false;
radioButton1.Checked = true;
break;
}
timeranimation++;
if (timeranimation > 24)
timeranimation = 0;
}
private void comboCommand_SelectedValueChanged(object sender, EventArgs e) {
switch (comboCommand.Text) {
case "ADD":
labelHelp.Text = "Adds a new file to the folder, if it already exists it wil be overwritten.";
break;
case "DEL":
labelHelp.Text = "Deletes an file/folder.";
break;
case "MNF":
labelHelp.Text = "Creates an new empty file.";
break;
case "MDR":
labelHelp.Text = "Creates an folder.";
break;
}
}
}
}

View File

@ -0,0 +1,123 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<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>
<metadata name="timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>15, 17</value>
</metadata>
</root>

View File

@ -0,0 +1,53 @@
namespace GamerServices {
partial class FormFileDownloader {
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing) {
if (disposing && (components != null)) {
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent() {
this.progressBar1 = new System.Windows.Forms.ProgressBar();
this.SuspendLayout();
//
// progressBar1
//
this.progressBar1.Location = new System.Drawing.Point(0, 0);
this.progressBar1.Name = "progressBar1";
this.progressBar1.Size = new System.Drawing.Size(392, 23);
this.progressBar1.TabIndex = 0;
//
// FormXNADownloader
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(392, 24);
this.Controls.Add(this.progressBar1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
this.Name = "FormXNADownloader";
this.Text = "File Downloader";
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.ProgressBar progressBar1;
}
}

View File

@ -0,0 +1,51 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Net;
using System.Windows.Forms;
namespace GamerServices {
public partial class FormFileDownloader : Form {
public string URL = "";
public string FilePath = "";
public bool AutoExec = false;
public bool Completed = false;
public FormFileDownloader() {
InitializeComponent();
}
public void StartDownload() {
WebClient c = new WebClient();
c.Proxy = null;
c.DownloadProgressChanged += new DownloadProgressChangedEventHandler(c_DownloadProgressChanged);
c.DownloadFileCompleted += new AsyncCompletedEventHandler(c_DownloadFileCompleted);
c.DownloadFileAsync(new Uri(URL), FilePath);
}
void c_DownloadFileCompleted(object sender, AsyncCompletedEventArgs e) {
this.Completed = true;
if (e.Cancelled) {
MessageBox.Show("Error while downloading file: \"" + URL + "\" to \"" + FilePath + "\"");
return;
}
if (this.AutoExec)
System.Diagnostics.Process.Start(FilePath);
this.Close();
}
void c_DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e) {
if (e.ProgressPercentage > -1 && e.ProgressPercentage < 101)
this.progressBar1.Value = e.ProgressPercentage;
}
}
}

View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<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>

View File

@ -0,0 +1,386 @@
namespace GamerServices {
partial class FormGameDev {
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing) {
if (disposing && (components != null)) {
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent() {
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FormGameDev));
this.label1 = new System.Windows.Forms.Label();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.label_proc_threads = new System.Windows.Forms.Label();
this.label_proc_RAM = new System.Windows.Forms.Label();
this.label_proc_cpu = new System.Windows.Forms.Label();
this.label_proc_name = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.label_traf_avo = new System.Windows.Forms.Label();
this.label_traf_avi = new System.Windows.Forms.Label();
this.label_traf_toto = new System.Windows.Forms.Label();
this.label_traf_totin = new System.Windows.Forms.Label();
this.label8 = new System.Windows.Forms.Label();
this.label7 = new System.Windows.Forms.Label();
this.label6 = new System.Windows.Forms.Label();
this.label5 = new System.Windows.Forms.Label();
this.button1 = new System.Windows.Forms.Button();
this.textlog = new System.Windows.Forms.TextBox();
this.button2 = new System.Windows.Forms.Button();
this.groupBox3 = new System.Windows.Forms.GroupBox();
this.label9 = new System.Windows.Forms.Label();
this.checkBox1 = new System.Windows.Forms.CheckBox();
this.comboBox1 = new System.Windows.Forms.ComboBox();
this.button4 = new System.Windows.Forms.Button();
this.textBox1 = new System.Windows.Forms.TextBox();
this.groupBox1.SuspendLayout();
this.groupBox2.SuspendLayout();
this.groupBox3.SuspendLayout();
this.SuspendLayout();
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(15, 16);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(41, 13);
this.label1.TabIndex = 0;
this.label1.Text = "Name: ";
//
// groupBox1
//
this.groupBox1.Controls.Add(this.label_proc_threads);
this.groupBox1.Controls.Add(this.label_proc_RAM);
this.groupBox1.Controls.Add(this.label_proc_cpu);
this.groupBox1.Controls.Add(this.label_proc_name);
this.groupBox1.Controls.Add(this.label4);
this.groupBox1.Controls.Add(this.label3);
this.groupBox1.Controls.Add(this.label2);
this.groupBox1.Controls.Add(this.label1);
this.groupBox1.Location = new System.Drawing.Point(12, 12);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(172, 108);
this.groupBox1.TabIndex = 1;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "Process";
//
// label_proc_threads
//
this.label_proc_threads.AutoSize = true;
this.label_proc_threads.Location = new System.Drawing.Point(70, 87);
this.label_proc_threads.Name = "label_proc_threads";
this.label_proc_threads.Size = new System.Drawing.Size(47, 13);
this.label_proc_threads.TabIndex = 7;
this.label_proc_threads.Text = "Dancing";
//
// label_proc_RAM
//
this.label_proc_RAM.AutoSize = true;
this.label_proc_RAM.Location = new System.Drawing.Point(70, 63);
this.label_proc_RAM.Name = "label_proc_RAM";
this.label_proc_RAM.Size = new System.Drawing.Size(49, 13);
this.label_proc_RAM.TabIndex = 6;
this.label_proc_RAM.Text = "Unicorns";
//
// label_proc_cpu
//
this.label_proc_cpu.AutoSize = true;
this.label_proc_cpu.Location = new System.Drawing.Point(70, 39);
this.label_proc_cpu.Name = "label_proc_cpu";
this.label_proc_cpu.Size = new System.Drawing.Size(32, 13);
this.label_proc_cpu.TabIndex = 5;
this.label_proc_cpu.Text = "Fluffy";
//
// label_proc_name
//
this.label_proc_name.AutoSize = true;
this.label_proc_name.Location = new System.Drawing.Point(70, 16);
this.label_proc_name.Name = "label_proc_name";
this.label_proc_name.Size = new System.Drawing.Size(28, 13);
this.label_proc_name.TabIndex = 4;
this.label_proc_name.Text = "Pink";
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(15, 87);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(49, 13);
this.label4.TabIndex = 3;
this.label4.Text = "Threads:";
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(15, 63);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(34, 13);
this.label3.TabIndex = 2;
this.label3.Text = "RAM:";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(15, 39);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(32, 13);
this.label2.TabIndex = 1;
this.label2.Text = "CPU:";
//
// groupBox2
//
this.groupBox2.Controls.Add(this.label_traf_avo);
this.groupBox2.Controls.Add(this.label_traf_avi);
this.groupBox2.Controls.Add(this.label_traf_toto);
this.groupBox2.Controls.Add(this.label_traf_totin);
this.groupBox2.Controls.Add(this.label8);
this.groupBox2.Controls.Add(this.label7);
this.groupBox2.Controls.Add(this.label6);
this.groupBox2.Controls.Add(this.label5);
this.groupBox2.Location = new System.Drawing.Point(190, 12);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(188, 109);
this.groupBox2.TabIndex = 2;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "Trafic";
//
// label_traf_avo
//
this.label_traf_avo.AutoSize = true;
this.label_traf_avo.Location = new System.Drawing.Point(92, 87);
this.label_traf_avo.Name = "label_traf_avo";
this.label_traf_avo.Size = new System.Drawing.Size(32, 13);
this.label_traf_avo.TabIndex = 11;
this.label_traf_avo.Text = "Night";
//
// label_traf_avi
//
this.label_traf_avi.AutoSize = true;
this.label_traf_avi.Location = new System.Drawing.Point(92, 63);
this.label_traf_avi.Name = "label_traf_avi";
this.label_traf_avi.Size = new System.Drawing.Size(34, 13);
this.label_traf_avi.TabIndex = 10;
this.label_traf_avi.Text = "Every";
//
// label_traf_toto
//
this.label_traf_toto.AutoSize = true;
this.label_traf_toto.Location = new System.Drawing.Point(92, 39);
this.label_traf_toto.Name = "label_traf_toto";
this.label_traf_toto.Size = new System.Drawing.Size(54, 13);
this.label_traf_toto.TabIndex = 9;
this.label_traf_toto.Text = "Rainbows";
//
// label_traf_totin
//
this.label_traf_totin.AutoSize = true;
this.label_traf_totin.Location = new System.Drawing.Point(92, 16);
this.label_traf_totin.Name = "label_traf_totin";
this.label_traf_totin.Size = new System.Drawing.Size(21, 13);
this.label_traf_totin.TabIndex = 8;
this.label_traf_totin.Text = "On";
//
// label8
//
this.label8.AutoSize = true;
this.label8.Location = new System.Drawing.Point(15, 87);
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(43, 13);
this.label8.TabIndex = 3;
this.label8.Text = "Av Out:";
//
// label7
//
this.label7.AutoSize = true;
this.label7.Location = new System.Drawing.Point(15, 63);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(35, 13);
this.label7.TabIndex = 2;
this.label7.Text = "Av In:";
//
// label6
//
this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(15, 39);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(54, 13);
this.label6.TabIndex = 1;
this.label6.Text = "Total Out:";
//
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(15, 16);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(46, 13);
this.label5.TabIndex = 0;
this.label5.Text = "Total In:";
//
// button1
//
this.button1.Location = new System.Drawing.Point(190, 293);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(188, 29);
this.button1.TabIndex = 3;
this.button1.Text = "Stop Game Developer service";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// textlog
//
this.textlog.Location = new System.Drawing.Point(12, 126);
this.textlog.Multiline = true;
this.textlog.Name = "textlog";
this.textlog.ScrollBars = System.Windows.Forms.ScrollBars.Both;
this.textlog.Size = new System.Drawing.Size(366, 161);
this.textlog.TabIndex = 4;
//
// button2
//
this.button2.Location = new System.Drawing.Point(13, 293);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(171, 29);
this.button2.TabIndex = 5;
this.button2.Text = "Reset recorded data";
this.button2.UseVisualStyleBackColor = true;
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// groupBox3
//
this.groupBox3.Controls.Add(this.label9);
this.groupBox3.Controls.Add(this.checkBox1);
this.groupBox3.Controls.Add(this.comboBox1);
this.groupBox3.Controls.Add(this.button4);
this.groupBox3.Controls.Add(this.textBox1);
this.groupBox3.Location = new System.Drawing.Point(384, 12);
this.groupBox3.Name = "groupBox3";
this.groupBox3.Size = new System.Drawing.Size(258, 310);
this.groupBox3.TabIndex = 6;
this.groupBox3.TabStop = false;
this.groupBox3.Text = "Advanced Packet Sender";
//
// label9
//
this.label9.AutoSize = true;
this.label9.Location = new System.Drawing.Point(7, 20);
this.label9.Name = "label9";
this.label9.Size = new System.Drawing.Size(225, 13);
this.label9.TabIndex = 7;
this.label9.Text = "Using this wrongly can freeze your application!";
//
// checkBox1
//
this.checkBox1.AutoSize = true;
this.checkBox1.Location = new System.Drawing.Point(10, 36);
this.checkBox1.Name = "checkBox1";
this.checkBox1.Size = new System.Drawing.Size(85, 17);
this.checkBox1.TabIndex = 6;
this.checkBox1.Text = "I understand";
this.checkBox1.UseVisualStyleBackColor = true;
this.checkBox1.CheckedChanged += new System.EventHandler(this.checkBox1_CheckedChanged);
//
// comboBox1
//
this.comboBox1.FormattingEnabled = true;
this.comboBox1.Location = new System.Drawing.Point(6, 283);
this.comboBox1.Name = "comboBox1";
this.comboBox1.Size = new System.Drawing.Size(84, 21);
this.comboBox1.TabIndex = 5;
this.comboBox1.Text = "Examples";
this.comboBox1.SelectedIndexChanged += new System.EventHandler(this.comboBox1_SelectedIndexChanged);
//
// button4
//
this.button4.Location = new System.Drawing.Point(177, 283);
this.button4.Name = "button4";
this.button4.Size = new System.Drawing.Size(75, 23);
this.button4.TabIndex = 4;
this.button4.Text = "Send";
this.button4.UseVisualStyleBackColor = true;
this.button4.Click += new System.EventHandler(this.button4_Click);
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(6, 55);
this.textBox1.Multiline = true;
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(246, 222);
this.textBox1.TabIndex = 0;
this.textBox1.Text = resources.GetString("textBox1.Text");
//
// FormGameDev
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(649, 334);
this.ControlBox = false;
this.Controls.Add(this.groupBox3);
this.Controls.Add(this.button2);
this.Controls.Add(this.textlog);
this.Controls.Add(this.button1);
this.Controls.Add(this.groupBox2);
this.Controls.Add(this.groupBox1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
this.Name = "FormGameDev";
this.Text = "Developer Tool (SADWTPBDR)";
this.Load += new System.EventHandler(this.FormGameDev_Load);
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
this.groupBox2.ResumeLayout(false);
this.groupBox2.PerformLayout();
this.groupBox3.ResumeLayout(false);
this.groupBox3.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Label label1;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Label label_proc_threads;
private System.Windows.Forms.Label label_proc_RAM;
private System.Windows.Forms.Label label_proc_cpu;
private System.Windows.Forms.Label label_proc_name;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label_traf_avo;
private System.Windows.Forms.Label label_traf_avi;
private System.Windows.Forms.Label label_traf_toto;
private System.Windows.Forms.Label label_traf_totin;
private System.Windows.Forms.Label label8;
private System.Windows.Forms.Label label7;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.TextBox textlog;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.GroupBox groupBox3;
private System.Windows.Forms.ComboBox comboBox1;
private System.Windows.Forms.Button button4;
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.Label label9;
private System.Windows.Forms.CheckBox checkBox1;
}
}

View File

@ -0,0 +1,266 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Diagnostics;
namespace GamerServices {
public partial class FormGameDev : Form {
private int TotalIn = 0;
private int TotalOut = 0;
private double[] AvIn = new double[30];
private double[] AvOut = new double[30];
private int curin = 0;
private int curout = 0;
private Game G;
private PerformanceCounter prefcounter;
private PerformanceCounter memcounter;
public FormGameDev(Game g) {
G = g;
CheckForIllegalCrossThreadCalls = false;
this.Icon = G.Main.Icon;
InitializeComponent();
}
public void AddIn(int val) {
TotalIn += val;
curin += val;
this.label_traf_totin.Text = TotalIn.ToString();
}
public void AddOut(int val) {
TotalOut += val;
curout += val;
this.label_traf_toto.Text = TotalOut.ToString();
}
public void UpdateAv() {
if (G.ForceStop){
this.Close();
return;
}
double curavin = 0;
double curavout = 0;
for (int i = 1; i < AvIn.Length; i++) {
curavin += AvIn[i];
curavout += AvOut[i];
AvIn[i - 1] = AvIn[i];
AvOut[i - 1] = AvOut[i];
}
AvIn[AvIn.Length - 1] = curin;
AvOut[AvOut.Length - 1] = curout;
curavin += curin;
curavout += curout;
curin = 0;
curout = 0;
bool foundproc = false;
Process[] procs = Process.GetProcessesByName(G.MainExe.Substring(0, G.MainExe.Length - 4));
foreach (Process proc in procs) {
foundproc = true;
if (prefcounter == null){
prefcounter = new PerformanceCounter("Process", "% Processor Time", proc.ProcessName);
memcounter = new PerformanceCounter("Process", "Working Set", proc.ProcessName);
AddMessage("Starting process monitor");
}else{
this.label_proc_cpu.Text = (prefcounter.NextValue() / 100).ToString() + "%";
this.label_proc_RAM.Text = ((memcounter.NextValue() / 1024) / 1024).ToString() + " MB";
}
if (this.label_proc_name.Text != proc.ProcessName) this.label_proc_name.Text = proc.ProcessName;
if (this.label_proc_threads.Text != proc.Threads.Count.ToString()) this.label_proc_threads.Text = proc.Threads.Count.ToString();
break;
}
if (!foundproc) {
if (prefcounter != null)
AddMessage("Lost game proccess.");
prefcounter = null;
memcounter = null;
this.label_proc_name.Text = "";
this.label_proc_cpu.Text = "";
this.label_proc_RAM.Text = "";
this.label_proc_threads.Text = "";
}
curavin /= AvIn.Length;
curavout /= AvOut.Length;
curavin = curavin - curavin % 0.1;
curavout = curavout - curavout % 0.1;
this.label_traf_avi.Text = curavin.ToString();
this.label_traf_avo.Text = curavout.ToString();
}
public void AddMessage(string msg) {
textlog.Text += msg + "\r\n";
textlog.SelectionStart = textlog.Text.Length;
textlog.ScrollToCaret();
textlog.Refresh();
}
private void button2_Click(object sender, EventArgs e) {
TotalIn = 0;
TotalOut = 0;
this.label_traf_totin.Text = "0";
this.label_traf_toto.Text = "0";
this.label_traf_avi.Text = "0";
this.label_traf_avo.Text = "0";
AvIn = new double[30];
AvOut = new double[30];
curin = 0;
curout = 0;
textlog.Text = "";
}
private void button1_Click(object sender, EventArgs e) {
G.DevStop();
}
private void FormGameDev_Load(object sender, EventArgs e) {
button2_Click(null, null);
checkBox1.Checked = false;
button4.Enabled = checkBox1.Checked;
textBox1.Enabled = checkBox1.Checked;
comboBox1.Enabled = checkBox1.Checked;
comboBox1.Items.Add("Notice");
comboBox1.Items.Add("General");
}
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) {
switch(comboBox1.Text){
case "Notice":
textBox1.Text = "# Example of a notice popup\r\n\r\n# The byte 5 is for the inital packet type, leave it alone\r\n(byte)5\r\n(string)Title\r\n(string)Message\r\n\r\n# This is the icon type wich should be displayed whit the message!\r\n(byte)0";
break;
case "General":
textBox1.Text = "# Example of a packet\r\n# This is extremely useful for debugging purposes\r\n# If your game hooks into MrAG.Gamerservices.IncomingTCPPacket,\r\n# you can use this to manually send packets to trigger events for debugging results\r\n# Available packets are 6-254, below 5 are reservated for the tunneling service\r\n(byte)6\r\n";
break;
}
comboBox1.Text = "Examples";
}
private void checkBox1_CheckedChanged(object sender, EventArgs e) {
button4.Enabled = checkBox1.Checked;
textBox1.Enabled = checkBox1.Checked;
comboBox1.Enabled = checkBox1.Checked;
}
private void button4_Click(object sender, EventArgs e) {
string[] tosend = textBox1.Text.Replace("\r", "").Split('\n');
MrAG.Networking.TCPClient c = G.GetAPIConnection();
if (c == null) {
MessageBox.Show("No connection yet!", "Error");
return;
}
bool packetIDSend = false;
c.Connection.Start_Send();
foreach(string line in tosend){
if (line.StartsWith("#")) {
} else if (line.Length > 0) {
string type = line.Substring(1, line.IndexOf(")") - 1);
string data = line.Substring(type.Length + 2);
switch (type) {
case "string":
if (!packetIDSend) {
MessageBox.Show("Error, must send packetID (a byte) first!", "Error");
c.Connection.Finish_Send();
return;
}
c.Connection.AddString(data);
break;
case "byte":
byte byettosend = byte.Parse(data);
if (!packetIDSend && (byettosend < 5 || byettosend == 6)) {
MessageBox.Show("Error, Packet 0-6 is reserved for internal use!", "Error");
c.Connection.Finish_Send();
return;
}
packetIDSend = true;
c.Connection.AddByte(byettosend);
break;
case "short":
if (!packetIDSend) {
MessageBox.Show("Error, must send packetID (a byte) first!", "Error");
c.Connection.Finish_Send();
return;
}
c.Connection.AddByte(short.Parse(data));
break;
case "int":
if (!packetIDSend) {
MessageBox.Show("Error, must send packetID (a byte) first!", "Error");
c.Connection.Finish_Send();
return;
}
c.Connection.AddInt(int.Parse(data));
break;
case "float":
if (!packetIDSend) {
MessageBox.Show("Error, must send packetID (a byte) first!", "Error");
c.Connection.Finish_Send();
return;
}
c.Connection.AddFloat(float.Parse(data));
break;
case "long":
if (!packetIDSend) {
MessageBox.Show("Error, must send packetID (a byte) first!", "Error");
c.Connection.Finish_Send();
return;
}
c.Connection.AddLong(long.Parse(data));
break;
case "double":
if (!packetIDSend) {
MessageBox.Show("Error, must send packetID (a byte) first!", "Error");
c.Connection.Finish_Send();
return;
}
c.Connection.AddDouble(double.Parse(data));
break;
}
}
}
c.Connection.Finish_Send();
MessageBox.Show("Sent!", "Packet has been sent.");
}
}
}

View File

@ -0,0 +1,134 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<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>
<data name="textBox1.Text" xml:space="preserve">
<value>#These are comments.
# empty lines wil be ignored
#Format: (type)value
#Types: string, byte, short, int, float, long, double
#For example, if you press Send now,
#I'm quite sure you crash your game.
(string)Hello World
(byte)254
(string)Some more text
(int)1234</value>
</data>
</root>

View File

@ -0,0 +1,188 @@
namespace GamerServices
{
partial class FormLogin
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FormLogin));
this.buttonLogin = new System.Windows.Forms.Button();
this.buttonCancel = new System.Windows.Forms.Button();
this.checkRememberMe = new System.Windows.Forms.CheckBox();
this.textUsername = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.textPassword = new System.Windows.Forms.TextBox();
this.label2 = new System.Windows.Forms.Label();
this.buttonSignup = new System.Windows.Forms.Button();
this.label3 = new System.Windows.Forms.Label();
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.timer1 = new System.Windows.Forms.Timer(this.components);
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
this.SuspendLayout();
//
// buttonLogin
//
this.buttonLogin.Location = new System.Drawing.Point(127, 171);
this.buttonLogin.Name = "buttonLogin";
this.buttonLogin.Size = new System.Drawing.Size(124, 23);
this.buttonLogin.TabIndex = 3;
this.buttonLogin.Text = "Login";
this.buttonLogin.UseVisualStyleBackColor = true;
this.buttonLogin.Click += new System.EventHandler(this.button1_Click);
//
// buttonCancel
//
this.buttonCancel.Location = new System.Drawing.Point(257, 171);
this.buttonCancel.Name = "buttonCancel";
this.buttonCancel.Size = new System.Drawing.Size(75, 23);
this.buttonCancel.TabIndex = 4;
this.buttonCancel.Text = "Cancel";
this.buttonCancel.UseVisualStyleBackColor = true;
this.buttonCancel.Click += new System.EventHandler(this.button2_Click);
//
// checkRememberMe
//
this.checkRememberMe.AutoSize = true;
this.checkRememberMe.CheckAlign = System.Drawing.ContentAlignment.MiddleRight;
this.checkRememberMe.Location = new System.Drawing.Point(127, 148);
this.checkRememberMe.Name = "checkRememberMe";
this.checkRememberMe.Size = new System.Drawing.Size(15, 14);
this.checkRememberMe.TabIndex = 2;
this.checkRememberMe.UseVisualStyleBackColor = true;
//
// textUsername
//
this.textUsername.Location = new System.Drawing.Point(128, 96);
this.textUsername.Name = "textUsername";
this.textUsername.Size = new System.Drawing.Size(205, 20);
this.textUsername.TabIndex = 0;
this.textUsername.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.textUsername_KeyPress);
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(46, 99);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(76, 13);
this.label1.TabIndex = 7;
this.label1.Text = "Account name";
//
// textPassword
//
this.textPassword.Location = new System.Drawing.Point(128, 122);
this.textPassword.Name = "textPassword";
this.textPassword.Size = new System.Drawing.Size(205, 20);
this.textPassword.TabIndex = 1;
this.textPassword.UseSystemPasswordChar = true;
this.textPassword.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.textPassword_KeyPress);
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(69, 125);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(53, 13);
this.label2.TabIndex = 6;
this.label2.Text = "Password";
//
// buttonSignup
//
this.buttonSignup.Location = new System.Drawing.Point(127, 200);
this.buttonSignup.Name = "buttonSignup";
this.buttonSignup.Size = new System.Drawing.Size(205, 23);
this.buttonSignup.TabIndex = 5;
this.buttonSignup.Text = "Signup";
this.buttonSignup.UseVisualStyleBackColor = true;
this.buttonSignup.Click += new System.EventHandler(this.button3_Click);
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(47, 149);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(75, 13);
this.label3.TabIndex = 8;
this.label3.Text = "Remember me";
//
// pictureBox1
//
this.pictureBox1.Image = global::GamerServices.Properties.Resources.Gamerservices_Small;
this.pictureBox1.Location = new System.Drawing.Point(0, 0);
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(388, 77);
this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage;
this.pictureBox1.TabIndex = 9;
this.pictureBox1.TabStop = false;
//
// timer1
//
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
//
// FormLogin
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(388, 255);
this.ControlBox = false;
this.Controls.Add(this.pictureBox1);
this.Controls.Add(this.label3);
this.Controls.Add(this.buttonSignup);
this.Controls.Add(this.label2);
this.Controls.Add(this.textPassword);
this.Controls.Add(this.label1);
this.Controls.Add(this.textUsername);
this.Controls.Add(this.checkRememberMe);
this.Controls.Add(this.buttonCancel);
this.Controls.Add(this.buttonLogin);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MaximizeBox = false;
this.Name = "FormLogin";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Login";
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Button buttonLogin;
private System.Windows.Forms.Button buttonCancel;
public System.Windows.Forms.CheckBox checkRememberMe;
public System.Windows.Forms.TextBox textUsername;
private System.Windows.Forms.Label label1;
public System.Windows.Forms.TextBox textPassword;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Button buttonSignup;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.PictureBox pictureBox1;
private System.Windows.Forms.Timer timer1;
}
}

View File

@ -0,0 +1,161 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Diagnostics;
namespace GamerServices
{
public partial class FormLogin : Form
{
public FormMain Main;
public FormLogin()
{
InitializeComponent();
bool hasXNA = true;
try {
MrAG.Gamerservices.GetUser();
} catch {
hasXNA = false;
}
if (!hasXNA) {
if (MessageBox.Show("Missing XNA Framework redistributables shal we download it for you?", "Missing XNA", MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes) {
FormFileDownloader ffd = new FormFileDownloader();
ffd.URL = "http://" + "gs.mrag.nl/download.php?gid=-1&file=XNA_4.0_redist.msi";
ffd.FilePath = "XNA_4.0_redist.msi";
ffd.AutoExec = true;
ffd.Show();
ffd.StartDownload();
timer1.Tag = ffd;
}
timer1.Enabled = true;
return;
}
this.Main = new FormMain(this);
this.textUsername.Focus();
if (Main.Settings_Username.Length > 0) {
this.textUsername.Text = Main.Settings_Username;
}
if (Main.Settings_Password.Length > 0) {
checkRememberMe.Checked = true;
this.textPassword.Text = Main.Settings_Password;
}
if (this.textPassword.Text.Length > 0){
this.Enabled = false;
conn();
if (Main.Connected) {
this.Main.Networker.Login(this.textUsername.Text, this.textPassword.Text);
} else {
this.textPassword.Text = "";
}
}
}
public FormLogin(FormMain MainForm)
{
this.Main = MainForm;
InitializeComponent();
this.textUsername.Focus();
if (Main.Settings_Username.Length > 0) {
this.textUsername.Text = Main.Settings_Username;
}
if (Main.Settings_Password.Length > 0) {
checkRememberMe.Checked = true;
this.textPassword.Text = Main.Settings_Password;
}
if (this.textPassword.Text.Length > 0){
this.Enabled = false;
conn();
if (Main.Connected) {
this.Main.Networker.Login(this.textUsername.Text, this.textPassword.Text);
} else {
this.textPassword.Text = "";
}
}
}
private void button2_Click(object sender, EventArgs e)
{
System.Diagnostics.Process.GetCurrentProcess().Kill();
}
private void button3_Click(object sender, EventArgs e)
{
Process.Start("http://" + "gs.mrag.nl/signup");
}
private void button1_Click(object sender, EventArgs e)
{
this.Enabled = false;
conn();
if (Main.Connected) {
this.textPassword.Text = this.Main.Networker.MD5(this.textPassword.Text + "MrAG.Gameservices" + "http://" + "gs.mrag.nl/");
this.Main.Networker.Login(this.textUsername.Text, this.textPassword.Text);
} else {
Enabled = true;
}
}
public bool connected = false;
private void conn() {
if (connected)
return;
connected = true;
if (!this.Main.Networker.Initialize()) {
Main.Error("Can't connect to the GamerServices server! The server might be offline. Check http://" + "gs.mrag.nl/status for the server status. Otherwise, check your internet connection.");
Enabled = true;
connected = false;
}
}
private void textUsername_KeyPress(object sender, KeyPressEventArgs e) {
if (e.KeyChar == 13) {
textPassword.Focus();
}
}
private void textPassword_KeyPress(object sender, KeyPressEventArgs e) {
if (e.KeyChar == 13) {
button1_Click(null, null);
}
}
private void timer1_Tick(object sender, EventArgs e) {
if (timer1.Tag == null){
this.Close();
Application.Exit();
return;
}
this.Hide();
if ((timer1.Tag as FormFileDownloader).Completed) {
this.Close();
Application.Exit();
}
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,543 @@
namespace GamerServices
{
partial class FormMain
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FormMain));
this.menuStrip = new System.Windows.Forms.MenuStrip();
this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.settingsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
this.logoutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.helpToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.aboutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.friendsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.onlineToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.offlineToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.requestsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.addToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.trayIcon = new System.Windows.Forms.NotifyIcon(this.components);
this.timerUpdate = new System.Windows.Forms.Timer(this.components);
this.listGames = new System.Windows.Forms.ListView();
this.columnHeader1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.gameIconList = new System.Windows.Forms.ImageList(this.components);
this.labelGameDescription = new System.Windows.Forms.Label();
this.labelGameName = new System.Windows.Forms.Label();
this.PingTimer = new System.Windows.Forms.Timer(this.components);
this.tabControl1 = new System.Windows.Forms.TabControl();
this.tabPage1 = new System.Windows.Forms.TabPage();
this.buttonUninstall = new System.Windows.Forms.Button();
this.buttonUpdate = new System.Windows.Forms.Button();
this.buttonPlay = new System.Windows.Forms.Button();
this.groupDeveloperToolBox = new System.Windows.Forms.GroupBox();
this.groupBox3 = new System.Windows.Forms.GroupBox();
this.buttonChecksumTool = new System.Windows.Forms.Button();
this.textExecuteblePath = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.labelVersion = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.picGameIcon = new System.Windows.Forms.PictureBox();
this.tabPage2 = new System.Windows.Forms.TabPage();
this.listAchievements = new System.Windows.Forms.ListView();
this.columnHeader2 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.columnHeader3 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.columnHeader5 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.tabPage3 = new System.Windows.Forms.TabPage();
this.menuStrip.SuspendLayout();
this.tabControl1.SuspendLayout();
this.tabPage1.SuspendLayout();
this.groupDeveloperToolBox.SuspendLayout();
this.groupBox3.SuspendLayout();
this.groupBox2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.picGameIcon)).BeginInit();
this.tabPage2.SuspendLayout();
this.SuspendLayout();
//
// menuStrip
//
this.menuStrip.BackColor = System.Drawing.SystemColors.Control;
this.menuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.fileToolStripMenuItem,
this.helpToolStripMenuItem,
this.friendsToolStripMenuItem});
this.menuStrip.Location = new System.Drawing.Point(0, 0);
this.menuStrip.Name = "menuStrip";
this.menuStrip.Size = new System.Drawing.Size(846, 24);
this.menuStrip.TabIndex = 0;
this.menuStrip.Text = "menuStrip1";
//
// fileToolStripMenuItem
//
this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.settingsToolStripMenuItem,
this.toolStripSeparator1,
this.logoutToolStripMenuItem,
this.exitToolStripMenuItem});
this.fileToolStripMenuItem.Name = "fileToolStripMenuItem";
this.fileToolStripMenuItem.Size = new System.Drawing.Size(37, 20);
this.fileToolStripMenuItem.Text = "File";
//
// settingsToolStripMenuItem
//
this.settingsToolStripMenuItem.Name = "settingsToolStripMenuItem";
this.settingsToolStripMenuItem.Size = new System.Drawing.Size(116, 22);
this.settingsToolStripMenuItem.Text = "Settings";
//
// toolStripSeparator1
//
this.toolStripSeparator1.Name = "toolStripSeparator1";
this.toolStripSeparator1.Size = new System.Drawing.Size(113, 6);
//
// logoutToolStripMenuItem
//
this.logoutToolStripMenuItem.Name = "logoutToolStripMenuItem";
this.logoutToolStripMenuItem.Size = new System.Drawing.Size(116, 22);
this.logoutToolStripMenuItem.Text = "Logout";
this.logoutToolStripMenuItem.Click += new System.EventHandler(this.logoutToolStripMenuItem_Click);
//
// exitToolStripMenuItem
//
this.exitToolStripMenuItem.Name = "exitToolStripMenuItem";
this.exitToolStripMenuItem.Size = new System.Drawing.Size(116, 22);
this.exitToolStripMenuItem.Text = "Exit";
this.exitToolStripMenuItem.Click += new System.EventHandler(this.exitToolStripMenuItem_Click);
//
// helpToolStripMenuItem
//
this.helpToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.aboutToolStripMenuItem});
this.helpToolStripMenuItem.Name = "helpToolStripMenuItem";
this.helpToolStripMenuItem.Size = new System.Drawing.Size(44, 20);
this.helpToolStripMenuItem.Text = "Help";
//
// aboutToolStripMenuItem
//
this.aboutToolStripMenuItem.Name = "aboutToolStripMenuItem";
this.aboutToolStripMenuItem.Size = new System.Drawing.Size(187, 22);
this.aboutToolStripMenuItem.Text = "About GamerServices";
this.aboutToolStripMenuItem.Click += new System.EventHandler(this.aboutToolStripMenuItem_Click);
//
// friendsToolStripMenuItem
//
this.friendsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.onlineToolStripMenuItem,
this.offlineToolStripMenuItem,
this.requestsToolStripMenuItem,
this.addToolStripMenuItem});
this.friendsToolStripMenuItem.Name = "friendsToolStripMenuItem";
this.friendsToolStripMenuItem.Size = new System.Drawing.Size(57, 20);
this.friendsToolStripMenuItem.Text = "Friends";
//
// onlineToolStripMenuItem
//
this.onlineToolStripMenuItem.Name = "onlineToolStripMenuItem";
this.onlineToolStripMenuItem.Size = new System.Drawing.Size(130, 22);
this.onlineToolStripMenuItem.Text = "Online";
//
// offlineToolStripMenuItem
//
this.offlineToolStripMenuItem.Name = "offlineToolStripMenuItem";
this.offlineToolStripMenuItem.Size = new System.Drawing.Size(130, 22);
this.offlineToolStripMenuItem.Text = "Offline";
//
// requestsToolStripMenuItem
//
this.requestsToolStripMenuItem.Name = "requestsToolStripMenuItem";
this.requestsToolStripMenuItem.Size = new System.Drawing.Size(130, 22);
this.requestsToolStripMenuItem.Text = "Requests";
//
// addToolStripMenuItem
//
this.addToolStripMenuItem.Name = "addToolStripMenuItem";
this.addToolStripMenuItem.Size = new System.Drawing.Size(130, 22);
this.addToolStripMenuItem.Text = "Add friend";
this.addToolStripMenuItem.Click += new System.EventHandler(this.addToolStripMenuItem_Click);
//
// trayIcon
//
this.trayIcon.Icon = ((System.Drawing.Icon)(resources.GetObject("trayIcon.Icon")));
this.trayIcon.Text = "GamerServices";
this.trayIcon.BalloonTipClicked += new System.EventHandler(this.trayIcon_BalloonTipClicked);
this.trayIcon.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.trayIcon_MouseDoubleClick);
//
// timerUpdate
//
this.timerUpdate.Enabled = true;
this.timerUpdate.Interval = 10;
this.timerUpdate.Tick += new System.EventHandler(this.timerUpdate_Tick);
//
// listGames
//
this.listGames.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)));
this.listGames.BackColor = System.Drawing.Color.White;
this.listGames.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.columnHeader1});
this.listGames.FullRowSelect = true;
this.listGames.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.None;
this.listGames.HideSelection = false;
this.listGames.LabelWrap = false;
this.listGames.Location = new System.Drawing.Point(12, 33);
this.listGames.MultiSelect = false;
this.listGames.Name = "listGames";
this.listGames.Size = new System.Drawing.Size(193, 484);
this.listGames.SmallImageList = this.gameIconList;
this.listGames.TabIndex = 1;
this.listGames.UseCompatibleStateImageBehavior = false;
this.listGames.View = System.Windows.Forms.View.List;
this.listGames.SelectedIndexChanged += new System.EventHandler(this.listGames_SelectedIndexChanged);
this.listGames.MouseClick += new System.Windows.Forms.MouseEventHandler(this.listGames_MouseClick);
//
// columnHeader1
//
this.columnHeader1.Text = "";
this.columnHeader1.Width = 193;
//
// gameIconList
//
this.gameIconList.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("gameIconList.ImageStream")));
this.gameIconList.TransparentColor = System.Drawing.Color.Transparent;
this.gameIconList.Images.SetKeyName(0, "wireless_mouse.ico");
this.gameIconList.Images.SetKeyName(1, "wireless_mouse.png");
this.gameIconList.Images.SetKeyName(2, "wireless_mouse_grayed.png");
this.gameIconList.Images.SetKeyName(3, "wireless_mouse_yellow.png");
//
// labelGameDescription
//
this.labelGameDescription.BackColor = System.Drawing.SystemColors.Control;
this.labelGameDescription.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
this.labelGameDescription.Font = new System.Drawing.Font("Calibri", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.labelGameDescription.Location = new System.Drawing.Point(6, 70);
this.labelGameDescription.Name = "labelGameDescription";
this.labelGameDescription.Size = new System.Drawing.Size(610, 161);
this.labelGameDescription.TabIndex = 1;
this.labelGameDescription.Text = "labelGameDescription";
//
// labelGameName
//
this.labelGameName.AutoSize = true;
this.labelGameName.Font = new System.Drawing.Font("Calibri", 21.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.labelGameName.Location = new System.Drawing.Point(44, 3);
this.labelGameName.Name = "labelGameName";
this.labelGameName.Size = new System.Drawing.Size(211, 36);
this.labelGameName.TabIndex = 0;
this.labelGameName.Text = "labelGameName";
//
// PingTimer
//
this.PingTimer.Enabled = true;
this.PingTimer.Interval = 30000;
this.PingTimer.Tick += new System.EventHandler(this.PingTimer_Tick);
//
// tabControl1
//
this.tabControl1.Appearance = System.Windows.Forms.TabAppearance.FlatButtons;
this.tabControl1.Controls.Add(this.tabPage1);
this.tabControl1.Controls.Add(this.tabPage2);
this.tabControl1.Controls.Add(this.tabPage3);
this.tabControl1.Location = new System.Drawing.Point(208, 33);
this.tabControl1.Margin = new System.Windows.Forms.Padding(0);
this.tabControl1.Name = "tabControl1";
this.tabControl1.SelectedIndex = 0;
this.tabControl1.Size = new System.Drawing.Size(630, 484);
this.tabControl1.TabIndex = 3;
//
// tabPage1
//
this.tabPage1.BackColor = System.Drawing.SystemColors.Control;
this.tabPage1.Controls.Add(this.buttonUninstall);
this.tabPage1.Controls.Add(this.buttonUpdate);
this.tabPage1.Controls.Add(this.buttonPlay);
this.tabPage1.Controls.Add(this.groupDeveloperToolBox);
this.tabPage1.Controls.Add(this.picGameIcon);
this.tabPage1.Controls.Add(this.labelGameName);
this.tabPage1.Controls.Add(this.labelGameDescription);
this.tabPage1.Location = new System.Drawing.Point(4, 25);
this.tabPage1.Name = "tabPage1";
this.tabPage1.Padding = new System.Windows.Forms.Padding(3);
this.tabPage1.Size = new System.Drawing.Size(622, 455);
this.tabPage1.TabIndex = 0;
this.tabPage1.Text = "Info";
//
// buttonUninstall
//
this.buttonUninstall.Location = new System.Drawing.Point(168, 44);
this.buttonUninstall.Name = "buttonUninstall";
this.buttonUninstall.Size = new System.Drawing.Size(75, 23);
this.buttonUninstall.TabIndex = 6;
this.buttonUninstall.Text = "Uninstall";
this.buttonUninstall.UseVisualStyleBackColor = true;
this.buttonUninstall.Visible = false;
this.buttonUninstall.Click += new System.EventHandler(this.buttonUninstall_Click);
//
// buttonUpdate
//
this.buttonUpdate.Location = new System.Drawing.Point(87, 44);
this.buttonUpdate.Name = "buttonUpdate";
this.buttonUpdate.Size = new System.Drawing.Size(75, 23);
this.buttonUpdate.TabIndex = 5;
this.buttonUpdate.Text = "Update";
this.buttonUpdate.UseVisualStyleBackColor = true;
this.buttonUpdate.Visible = false;
this.buttonUpdate.Click += new System.EventHandler(this.buttonUpdate_Click);
//
// buttonPlay
//
this.buttonPlay.Location = new System.Drawing.Point(6, 44);
this.buttonPlay.Name = "buttonPlay";
this.buttonPlay.Size = new System.Drawing.Size(75, 23);
this.buttonPlay.TabIndex = 4;
this.buttonPlay.Text = "Play";
this.buttonPlay.UseVisualStyleBackColor = true;
this.buttonPlay.Visible = false;
this.buttonPlay.Click += new System.EventHandler(this.buttonPlay_Click);
//
// groupDeveloperToolBox
//
this.groupDeveloperToolBox.BackColor = System.Drawing.SystemColors.Control;
this.groupDeveloperToolBox.Controls.Add(this.groupBox3);
this.groupDeveloperToolBox.Controls.Add(this.groupBox2);
this.groupDeveloperToolBox.Location = new System.Drawing.Point(6, 234);
this.groupDeveloperToolBox.Name = "groupDeveloperToolBox";
this.groupDeveloperToolBox.Size = new System.Drawing.Size(610, 215);
this.groupDeveloperToolBox.TabIndex = 3;
this.groupDeveloperToolBox.TabStop = false;
this.groupDeveloperToolBox.Text = "Developer Settings";
this.groupDeveloperToolBox.Visible = false;
//
// groupBox3
//
this.groupBox3.BackColor = System.Drawing.SystemColors.Control;
this.groupBox3.Controls.Add(this.buttonChecksumTool);
this.groupBox3.Controls.Add(this.textExecuteblePath);
this.groupBox3.Controls.Add(this.label1);
this.groupBox3.Location = new System.Drawing.Point(6, 19);
this.groupBox3.Name = "groupBox3";
this.groupBox3.Size = new System.Drawing.Size(383, 190);
this.groupBox3.TabIndex = 4;
this.groupBox3.TabStop = false;
this.groupBox3.Text = "Settings";
//
// buttonChecksumTool
//
this.buttonChecksumTool.Location = new System.Drawing.Point(9, 161);
this.buttonChecksumTool.Name = "buttonChecksumTool";
this.buttonChecksumTool.Size = new System.Drawing.Size(112, 23);
this.buttonChecksumTool.TabIndex = 4;
this.buttonChecksumTool.Text = "Checksum tool";
this.buttonChecksumTool.UseVisualStyleBackColor = true;
this.buttonChecksumTool.Click += new System.EventHandler(this.buttonChecksumTool_Click);
//
// textExecuteblePath
//
this.textExecuteblePath.Location = new System.Drawing.Point(221, 13);
this.textExecuteblePath.Name = "textExecuteblePath";
this.textExecuteblePath.Size = new System.Drawing.Size(156, 20);
this.textExecuteblePath.TabIndex = 3;
this.textExecuteblePath.TextChanged += new System.EventHandler(this.textExecuteblePath_TextChanged);
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(6, 16);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(126, 13);
this.label1.TabIndex = 0;
this.label1.Text = "Current executeble path: ";
//
// groupBox2
//
this.groupBox2.BackColor = System.Drawing.SystemColors.Control;
this.groupBox2.Controls.Add(this.labelVersion);
this.groupBox2.Controls.Add(this.label3);
this.groupBox2.Location = new System.Drawing.Point(404, 19);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(200, 190);
this.groupBox2.TabIndex = 3;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "Updating";
//
// labelVersion
//
this.labelVersion.Location = new System.Drawing.Point(103, 16);
this.labelVersion.Name = "labelVersion";
this.labelVersion.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
this.labelVersion.Size = new System.Drawing.Size(91, 13);
this.labelVersion.TabIndex = 3;
this.labelVersion.Text = "0.0.0.0";
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(6, 16);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(76, 13);
this.label3.TabIndex = 2;
this.label3.Text = "Local version: ";
//
// picGameIcon
//
this.picGameIcon.Location = new System.Drawing.Point(6, 6);
this.picGameIcon.Name = "picGameIcon";
this.picGameIcon.Size = new System.Drawing.Size(32, 32);
this.picGameIcon.TabIndex = 2;
this.picGameIcon.TabStop = false;
//
// tabPage2
//
this.tabPage2.BackColor = System.Drawing.SystemColors.Control;
this.tabPage2.Controls.Add(this.listAchievements);
this.tabPage2.Location = new System.Drawing.Point(4, 25);
this.tabPage2.Name = "tabPage2";
this.tabPage2.Padding = new System.Windows.Forms.Padding(3);
this.tabPage2.Size = new System.Drawing.Size(622, 455);
this.tabPage2.TabIndex = 1;
this.tabPage2.Text = "Achievements";
//
// listAchievements
//
this.listAchievements.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.columnHeader2,
this.columnHeader3,
this.columnHeader5});
this.listAchievements.FullRowSelect = true;
this.listAchievements.LabelWrap = false;
this.listAchievements.Location = new System.Drawing.Point(6, 6);
this.listAchievements.Name = "listAchievements";
this.listAchievements.Size = new System.Drawing.Size(610, 443);
this.listAchievements.TabIndex = 0;
this.listAchievements.UseCompatibleStateImageBehavior = false;
this.listAchievements.View = System.Windows.Forms.View.Details;
this.listAchievements.SelectedIndexChanged += new System.EventHandler(this.listAchievements_SelectedIndexChanged);
//
// columnHeader2
//
this.columnHeader2.Text = "Name";
this.columnHeader2.Width = 200;
//
// columnHeader3
//
this.columnHeader3.Text = "Points";
//
// columnHeader5
//
this.columnHeader5.Text = "Description";
this.columnHeader5.Width = 224;
//
// tabPage3
//
this.tabPage3.BackColor = System.Drawing.SystemColors.Control;
this.tabPage3.Location = new System.Drawing.Point(4, 25);
this.tabPage3.Name = "tabPage3";
this.tabPage3.Size = new System.Drawing.Size(622, 455);
this.tabPage3.TabIndex = 2;
this.tabPage3.Text = "Leaderboard";
//
// FormMain
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.SystemColors.Control;
this.ClientSize = new System.Drawing.Size(846, 523);
this.Controls.Add(this.tabControl1);
this.Controls.Add(this.listGames);
this.Controls.Add(this.menuStrip);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MainMenuStrip = this.menuStrip;
this.MaximizeBox = false;
this.Name = "FormMain";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "GamerServices";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FormMain_FormClosing);
this.Load += new System.EventHandler(this.FormMain_Load);
this.menuStrip.ResumeLayout(false);
this.menuStrip.PerformLayout();
this.tabControl1.ResumeLayout(false);
this.tabPage1.ResumeLayout(false);
this.tabPage1.PerformLayout();
this.groupDeveloperToolBox.ResumeLayout(false);
this.groupBox3.ResumeLayout(false);
this.groupBox3.PerformLayout();
this.groupBox2.ResumeLayout(false);
this.groupBox2.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.picGameIcon)).EndInit();
this.tabPage2.ResumeLayout(false);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.MenuStrip menuStrip;
private System.Windows.Forms.ToolStripMenuItem fileToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem settingsToolStripMenuItem;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator1;
private System.Windows.Forms.ToolStripMenuItem exitToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem helpToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem aboutToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem friendsToolStripMenuItem;
public System.Windows.Forms.NotifyIcon trayIcon;
private System.Windows.Forms.Timer timerUpdate;
private System.Windows.Forms.ListView listGames;
private System.Windows.Forms.ImageList gameIconList;
private System.Windows.Forms.Label labelGameName;
private System.Windows.Forms.Label labelGameDescription;
private System.Windows.Forms.PictureBox picGameIcon;
private System.Windows.Forms.Timer PingTimer;
private System.Windows.Forms.ColumnHeader columnHeader1;
private System.Windows.Forms.ToolStripMenuItem onlineToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem offlineToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem requestsToolStripMenuItem;
private System.Windows.Forms.TabControl tabControl1;
private System.Windows.Forms.TabPage tabPage1;
private System.Windows.Forms.TabPage tabPage2;
private System.Windows.Forms.TabPage tabPage3;
private System.Windows.Forms.ListView listAchievements;
private System.Windows.Forms.ColumnHeader columnHeader2;
private System.Windows.Forms.ColumnHeader columnHeader3;
private System.Windows.Forms.ColumnHeader columnHeader5;
private System.Windows.Forms.ToolStripMenuItem logoutToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem addToolStripMenuItem;
private System.Windows.Forms.GroupBox groupDeveloperToolBox;
private System.Windows.Forms.GroupBox groupBox3;
private System.Windows.Forms.TextBox textExecuteblePath;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label labelVersion;
private System.Windows.Forms.Button buttonPlay;
private System.Windows.Forms.Button buttonUninstall;
private System.Windows.Forms.Button buttonUpdate;
private System.Windows.Forms.Button buttonChecksumTool;
}
}

View File

@ -0,0 +1,777 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
using System.Windows.Shell;
namespace GamerServices
{
public partial class FormMain : Form {
#region Varibles
public String GamerServicesVersion;
public Networker Networker;
public Downloader Downloader;
public FormLogin FormLogin;
public String Username = "Bromvlieg";
public String Sessionkey = "";
public bool Connected = false;
public byte PopupAction = 0;
public Game[] Games;
public Game CurrentPlayingGame;
public List<Friend> Friends = new List<Friend>();
public Font DefaultFont;
Properties.Settings settings = new Properties.Settings();
public String Settings_Username {
get { return settings.Username; }
set { settings.Username = value; }
}
public String Settings_Password {
get { return settings.Password; }
set { settings.Password = value; }
}
#endregion
public FormMain(FormLogin log)
{
InitializeComponent();
Networker = new GamerServices.Networker(this);
Downloader = new Downloader(this);
FormLogin = log;
bool changed = false;
MrAG.Config.Read("config.gs");
if (!MrAG.Config.Section_Exists("Main")) {
System.Collections.Hashtable maintbl = new System.Collections.Hashtable();
maintbl["Version"] = "0.0.0.0";
maintbl["Language"] = "English";
MrAG.Config.Section_Set("Main", maintbl);
changed = true;
}
if (!MrAG.Config.Section_Exists("Fonts")) {
System.Collections.Hashtable maintbl = new System.Collections.Hashtable();
maintbl["General"] = "Microsoft Sans Serif";
maintbl["General_Size"] = "8.25";
maintbl["General_Style"] = "Regular";
maintbl["GameDesc"] = "Calibri";
maintbl["GameDesc_Size"] = "9.75";
maintbl["GameDesc_Style"] = "Regular";
maintbl["Chat"] = "Microsoft Sans Serif";
maintbl["Chat_Size"] = "8.25";
maintbl["Chat_Style"] = "Regular";
maintbl["Chat_Header"] = "Calibri";
maintbl["Chat_Header_Size"] = "14.25";
maintbl["Chat_Header_Style"] = "Bold";
maintbl["Chat_Sub"] = "Calibri";
maintbl["Chat_Sub_Size"] = "9";
maintbl["Chat_Sub_Style"] = "Regular";
MrAG.Config.Section_Set("Fonts", maintbl);
changed = true;
}
if (!MrAG.Config.Section_Exists("Settings")) {
System.Collections.Hashtable maintbl = new System.Collections.Hashtable();
maintbl["ChatSound"] = "true";
maintbl["ChatPopup"] = "true";
maintbl["ChatPopupIngame"] = "true";
maintbl["ChatFlash"] = "true";
maintbl["IngamePopups"] = "true";
MrAG.Config.Section_Set("Settings", maintbl);
changed = true;
}
if (!MrAG.Config.Section_Exists("Friends_Blocked")) {
MrAG.Config.Section_Set("Friends_Blocked", new System.Collections.Hashtable());
changed = true;
}
if (!MrAG.Config.Section_Exists("Friends_Renamed")) {
MrAG.Config.Section_Set("Friends_Renamed", new System.Collections.Hashtable());
changed = true;
}
if (changed)
MrAG.Config.Write("config.gs");
this.GamerServicesVersion = MrAG.Config.Value_Get("Main", "Version");
DefaultFont = GetFont("General");
labelGameDescription.Font = GetFont("GameDesc");
fileToolStripMenuItem.Font = DefaultFont;
helpToolStripMenuItem.Font = DefaultFont;
friendsToolStripMenuItem.Font = DefaultFont;
tabControl1.Font = DefaultFont;
listAchievements.Font = DefaultFont;
listGames.Font = DefaultFont;
}
public Font GetFont(string configname) {
string name = MrAG.Config.Value_Get("Fonts", configname, "Calibri");
float size = float.Parse(MrAG.Config.Value_Get("Fonts", configname + "_Size", "8.5"), System.Globalization.CultureInfo.InvariantCulture.NumberFormat);
FontStyle style = FontStyle.Regular;
switch(MrAG.Config.Value_Get("Fonts", configname + "_Style", "Regular")){
case "Bold":
style = FontStyle.Bold;
break;
case "Italic":
style = FontStyle.Italic;
break;
case "Regular":
style = FontStyle.Regular;
break;
case "Strikeout":
style = FontStyle.Strikeout;
break;
case "Underline":
style = FontStyle.Underline;
break;
}
return new Font(name, size, style);
}
#region Public functions
public void Die(String Reason)
{
if (Sessionkey != "")
Networker.Logout();
this.trayIcon.Dispose();
MessageBox.Show(Reason, "Fatal error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
System.Diagnostics.Process.GetCurrentProcess().Kill();
}
public void Error(String Reason)
{
MessageBox.Show(Reason, "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
public void Error(String title, String Reason, MessageBoxIcon icon)
{
MessageBox.Show(Reason, title, MessageBoxButtons.OK, icon);
}
public void PlaceholderText()
{
picGameIcon.Image = new Bitmap(32, 32);
labelGameName.Text = "...";
labelGameDescription.Text = "...";
}
public Game GetGame(short ID) {
foreach (Game g in Games) {
if (g.GameID == ID)
return g;
}
return null;
}
public Friend GetFriend(string username) {
foreach (Friend f in Friends) {
if (f.Username == username)
return f;
}
return null;
}
public Friend GetFriend(int userID) {
foreach (Friend f in Friends) {
if (f.UserID == userID)
return f;
}
return null;
}
public void Popup(string title, string msg, byte action) {
if (this.CurrentPlayingGame != null && this.CurrentPlayingGame.GetAPIConnection() != null) {
this.CurrentPlayingGame.GetAPIConnection().Send(5, 9 + msg.Length + title.Length, title, msg, (byte)0);
} else {
this.PopupAction = action;
this.trayIcon.BalloonTipTitle = title;
this.trayIcon.ShowBalloonTip(2000, title, msg, ToolTipIcon.Info);
}
}
public void Popup(string title, string msg, byte action, byte msgtype) {
if (this.CurrentPlayingGame != null && this.CurrentPlayingGame.GetAPIConnection() != null) {
if (msgtype == 1) {
Friend f = GetFriend(title);
if (f != null){
string url = "http://" + "www.gravatar.com/avatar/" + f.AvatarURL + "?s=64";
this.CurrentPlayingGame.GetAPIConnection().Send(6, 9 + url.Length + title.Length, title, url);
}
}
this.CurrentPlayingGame.GetAPIConnection().Send(5, 9 + msg.Length + title.Length, title, msg, msgtype);
} else {
this.PopupAction = action;
this.trayIcon.BalloonTipTitle = title;
this.trayIcon.ShowBalloonTip(2000, title, msg, ToolTipIcon.Info);
}
}
public void SetGameData(short gameID, string text, Game.GameStatus status) {
for (int i = 0; i < this.listGames.Items.Count; i++) {
if ((short)this.listGames.Items[i].Tag == gameID) {
this.listGames.Items[i].Text = text;
this.listGames.Items[i].ImageIndex = (int)status;
break;
}
}
}
public void SortGames() {
lock (Games) {
Games = Games.OrderBy(Game => Game.Status).ToArray<Game>();
UpdateGamesList();
}
}
public void LoadRemainingDownloads() {
if (!File.Exists("downloading.txt"))
return;
string[] data = File.ReadAllText("downloading.txt").Replace("\t", "").Split('\n');
if (data.Length > 0 && data[0].Length > 0) {
lock (Downloader.FilesToDownload) {
for (int i = 0; i < data.Length; i++) {
string[] verngameid = data[i].Split(' ');
short GameID = short.Parse(verngameid[0]);
int actions = 0;
Game g = GetGame(GameID);
g.Status = Game.GameStatus.DOWNLOADING;
g.Version = verngameid[1];
if (data[i + 1] == "{") {
i += 2;
while (data[i] != "}") {
Downloader.DownloadInfo info = new Downloader.DownloadInfo();
info.Path = data[i + 0];
info.URL = "http://" + "gs.mrag.nl/download.php?gid=" + GameID + "&file=" + data[i + 0];
info.Action = byte.Parse(data[i + 1]);
info.GameID = GameID;
info.Version = g.Version;
Downloader.FilesToDownload.Add(info);
actions++;
i += 2;
}
}
for (int i2 = 0; i2 < Downloader.FilesToDownload.Count; i2++) {
if (Downloader.FilesToDownload[i2].GameID == GameID) {
Downloader.FilesToDownload[i2].TotalActions = actions;
}
}
}
}
}
}
public void UpdateGamesList()
{
lock (this.listGames) {
this.listGames.Items.Clear();
for (int i = 0; i < this.Games.Length; i++) {
ListViewItem lvi = new ListViewItem(this.Games[i].Name);
lvi.ImageIndex = (int)this.Games[i].Status;
this.listGames.Items.Add(lvi);
lvi.Tag = this.Games[i].GameID;
}
}
}
public void AddFriend(string name, int userID, bool online, string avatar, short curgame) {
Friend f = new Friend(this);
f.Username = name;
f.Online = online;
f.UserID = userID;
f.AvatarURL = avatar;
f.GameID = curgame;
Friends.Add(f);
UpdateFriendList();
}
public void AddFriendRequest(string username) {
ToolStripMenuItem itm = new ToolStripMenuItem();
itm.Text = username;
itm.Click += new EventHandler(OpenChat);
ToolStripMenuItem y = new ToolStripMenuItem();
y.Text = "Accept";
y.Tag = username;
y.Click += new EventHandler(AcceptFriendRequest);
ToolStripMenuItem n = new ToolStripMenuItem();
n.Text = "Decline";
n.Tag = username;
n.Click += new EventHandler(RefuseFriendRequest);
itm.DropDownItems.Add(y);
itm.DropDownItems.Add(n);
requestsToolStripMenuItem.DropDownItems.Add(itm);
}
public void UpdateFriendList() {
onlineToolStripMenuItem.DropDownItems.Clear();
offlineToolStripMenuItem.DropDownItems.Clear();
foreach (Friend f in Friends) {
ToolStripMenuItem itm = new ToolStripMenuItem();
itm.Text = f.Username;
itm.Enabled = f.Online;
itm.Click += new EventHandler(OpenChat);
if (f.Online) onlineToolStripMenuItem.DropDownItems.Add(itm);
else offlineToolStripMenuItem.DropDownItems.Add(itm);
}
onlineToolStripMenuItem.Text = "Online" + (onlineToolStripMenuItem.DropDownItems.Count > 0 ? " (" + onlineToolStripMenuItem.DropDownItems.Count + ")" : "");
offlineToolStripMenuItem.Text = "Offline" + (offlineToolStripMenuItem.DropDownItems.Count > 0 ? " (" + offlineToolStripMenuItem.DropDownItems.Count + ")" : "");
}
public void SetFriendOnline(int userID, bool online) {
GetFriend(userID).SetOnline(online);
UpdateFriendList();
}
public void AcceptFriendRequest(object sender, EventArgs e) {
Networker.Connection.Send(6, 0, (string)(sender as ToolStripMenuItem).Tag, true);
requestsToolStripMenuItem.DropDownItems.Remove((sender as ToolStripMenuItem).OwnerItem);
}
public void RefuseFriendRequest(object sender, EventArgs e) {
Networker.Connection.Send(6, 0, (string)(sender as ToolStripMenuItem).Tag, false);
requestsToolStripMenuItem.DropDownItems.Remove((sender as ToolStripMenuItem).OwnerItem);
}
public void OpenChat(object sender, EventArgs e) {
string name = (sender as ToolStripMenuItem).Text;
foreach (Friend f in Friends) {
if (f.Username == name) {
f.OpenChat();
break;
}
}
}
#endregion
#region Form Functions
private void buttonUninstall_Click(object sender, EventArgs e) {
if (listGames.SelectedItems.Count == 0)
return;
Game_Uninstall(null, null);
buttonPlay.Text = "Install";
buttonPlay.Visible = true;
buttonUpdate.Visible = false;
buttonUninstall.Visible = false;
}
private void buttonUpdate_Click(object sender, EventArgs e) {
if (listGames.SelectedItems.Count == 0)
return;
Game_Update(null, null);
buttonPlay.Visible = false;
buttonUpdate.Visible = false;
buttonUninstall.Visible = false;
}
private void buttonPlay_Click(object sender, EventArgs e) {
if (listGames.SelectedItems.Count == 0)
return;
short id = (short)listGames.SelectedItems[0].Tag;
if (buttonPlay.Text == "Play") {
Game_Start(null, null);
} else {
Game_Install(null, null);
}
Game Game = GetGame(id);
if (Game == null)
return;
buttonPlay.Text = Game.Status == GamerServices.Game.GameStatus.INSTALLED ? "Play" : Game.Status == GamerServices.Game.GameStatus.UNINSTALLED ? "Install" : "";
buttonPlay.Visible = Game.Status != GamerServices.Game.GameStatus.DOWNLOADING;
buttonUpdate.Visible = Game.Status == GamerServices.Game.GameStatus.INSTALLED;
buttonUninstall.Visible = Game.Status == GamerServices.Game.GameStatus.INSTALLED;
}
private void exitToolStripMenuItem_Click(object sender, EventArgs e)
{
settings.Save();
Networker.Logout();
foreach (Friend f in Friends) {
if (f.ChatWindow != null) f.ChatWindow.Close();
}
foreach (Game g in Games) {
g.ForceStop = true;
}
this.Close();
FormLogin.Close();
}
private void FormMain_Load(object sender, EventArgs e)
{
CheckForIllegalCrossThreadCalls = false;
PlaceholderText();
LoadRemainingDownloads();
}
private void timerUpdate_Tick(object sender, EventArgs e)
{
if (this.Connected) {
Networker.Update();
}
}
private void listGames_SelectedIndexChanged(object sender, EventArgs e)
{
PlaceholderText();
if (listGames.SelectedItems.Count == 1) {
ListViewItem lvi = listGames.SelectedItems[0];
Game Game = GetGame((short)lvi.Tag);
if (Game != null) {
labelGameName.Text = Game.Name;
labelGameDescription.Text = Game.Description;
buttonPlay.Text = Game.Status == GamerServices.Game.GameStatus.INSTALLED ? "Play" : Game.Status == GamerServices.Game.GameStatus.UNINSTALLED ? "Install" : "";
buttonPlay.Visible = Game.Status != GamerServices.Game.GameStatus.DOWNLOADING;
buttonUpdate.Visible = Game.Status == GamerServices.Game.GameStatus.INSTALLED;
buttonUninstall.Visible = Game.Status == GamerServices.Game.GameStatus.INSTALLED;
if (Game.Status == GamerServices.Game.GameStatus.INSTALLED && File.Exists("Games/" + Game.GameID.ToString() + "/GameIcon.png"))
{
picGameIcon.Image = Image.FromFile("Games/" + Game.GameID.ToString() + "/GameIcon.png");
}
else
{
if (File.Exists("Media/DefaultGameIcon.png"))
picGameIcon.Image = Image.FromFile("Media/DefaultGameIcon.png");
else
picGameIcon.Image = new Bitmap(32, 32);
}
groupDeveloperToolBox.Visible = Game.IsDevUser;
if (Game.IsDevUser) {
groupDeveloperToolBox.Text = "Developer Settings - " + Game.Name;
textExecuteblePath.Text = Game.MainExe;
labelVersion.Text = Game.Version;
}
listAchievements.Items.Clear();
foreach (Game.Achievement a in Game.Achievements) {
ListViewItem itm = new ListViewItem();
itm.Text = a.Name;
itm.BackColor = Color.GreenYellow;
itm.SubItems.Add(a.Points.ToString());
if (a.CurProg < a.TargetProg) {
itm.BackColor = Color.OrangeRed;
}
itm.SubItems.Add(a.Desc);
listAchievements.Items.Add(itm);
}
}
} else {
labelGameName.Text = "...";
labelGameDescription.Text = "";
buttonPlay.Visible = false;
buttonUpdate.Visible = false;
buttonUninstall.Visible = false;
groupDeveloperToolBox.Visible = false;
listAchievements.Items.Clear();
}
}
private string GetSub(string line, string find_start, string find_end) {
int start = line.IndexOf(find_start) + find_start.Length;
int end = line.IndexOf(find_end, start) - start;
return line.Substring(start, end);
}
private void textExecuteblePath_TextChanged(object sender, EventArgs e) {
if (listGames.SelectedItems.Count == 1) {
Game Game = GetGame((short)listGames.SelectedItems[0].Tag);
Game.MainExe = textExecuteblePath.Text;
}
}
private void listGames_MouseClick(object sender, MouseEventArgs e)
{
if (listGames.SelectedItems.Count == 0)
return;
if (e.Button == MouseButtons.Right)
{
Game Game = GetGame((short)listGames.SelectedItems[0].Tag);
ContextMenu context = new ContextMenu();
if (Game.Status == Game.GameStatus.UNINSTALLED) {
MenuItem InstallItem = new MenuItem("Install");
InstallItem.Click += new EventHandler(Game_Install);
context.MenuItems.Add(InstallItem);
}else if (Game.Status == Game.GameStatus.INSTALLED) {
if (Game.IsDevUser) {
MenuItem item8 = new MenuItem("Normal Options");
item8.Enabled = false;
context.MenuItems.Add(item8);
}
MenuItem item1 = new MenuItem("Start");
item1.Click += new EventHandler(Game_Start);
item1.Enabled = CurrentPlayingGame == null;
context.MenuItems.Add(item1);
MenuItem item3 = new MenuItem("Update");
item3.Click += new EventHandler(Game_Update);
item3.Enabled = CurrentPlayingGame != Game;
context.MenuItems.Add(item3);
MenuItem item2 = new MenuItem("Uninstall");
item2.Click += new EventHandler(Game_Uninstall);
item2.Enabled = CurrentPlayingGame != Game;
context.MenuItems.Add(item2);
if (Game.IsDevUser) {
MenuItem item7 = new MenuItem("Developer Options");
item7.BarBreak = true;
item7.Enabled = false;
context.MenuItems.Add(item7);
MenuItem item5 = new MenuItem("Push update");
item5.Click += new EventHandler(Game_DevUpdate);
item5.Enabled = CurrentPlayingGame != Game;
context.MenuItems.Add(item5);
MenuItem item4 = new MenuItem("Start");
item4.Click += new EventHandler(Game_DevStart);
item4.Enabled = CurrentPlayingGame == null;
context.MenuItems.Add(item4);
MenuItem item6 = new MenuItem("Stop");
item6.Click += new EventHandler(Game_DevStop);
item6.Enabled = CurrentPlayingGame == Game && Game.Devmode;
context.MenuItems.Add(item6);
}
}
context.Show(listGames, new Point(e.X, e.Y));
}
}
void Game_Start(object sender, EventArgs e) {
GetGame((short)listGames.SelectedItems[0].Tag).Start();
}
void Game_DevStart(object sender, EventArgs e) {
GetGame((short)listGames.SelectedItems[0].Tag).DevStart();
}
void Game_Update(object sender, EventArgs e) {
GetGame((short)listGames.SelectedItems[0].Tag).Update();
}
void Game_Install(object sender, EventArgs e)
{
GetGame((short)listGames.SelectedItems[0].Tag).Install();
}
void Game_DevStop(object sender, EventArgs e) {
GetGame((short)listGames.SelectedItems[0].Tag).DevStop();
}
void Game_DevUpdate(object sender, EventArgs e) {
GetGame((short)listGames.SelectedItems[0].Tag).DevUpdate();
}
void Game_Uninstall(object sender, EventArgs e)
{
if (MessageBox.Show("Are you sure you want to uninstall?", "Uninstall", MessageBoxButtons.YesNo, MessageBoxIcon.Error) != DialogResult.Yes) {
return;
}
GetGame((short)listGames.SelectedItems[0].Tag).Uninstall();
}
private void aboutToolStripMenuItem_Click(object sender, EventArgs e)
{
new FormAbout().ShowDialog();
}
private void PingTimer_Tick(object sender, EventArgs e) {
if (this.Connected) {
Networker.Connection.Send(2, 0);
}
}
private void FormMain_FormClosing(object sender, FormClosingEventArgs e) {
Networker.Logout();
settings.Save();
this.trayIcon.Dispose();
FormLogin.Close();
if (Downloader != null && Downloader.DownloadThread != null)
Downloader.DownloadThread.Abort();
}
private void trayIcon_MouseDoubleClick(object sender, MouseEventArgs e) {
this.Show();
}
private void listAchievements_SelectedIndexChanged(object sender, EventArgs e) {
foreach (ListViewItem itm in listAchievements.SelectedItems) {
itm.Selected = false;
}
listAchievements.SelectedIndices.Clear();
}
private void logoutToolStripMenuItem_Click(object sender, EventArgs e) {
Logout();
}
public void Logout() {
Networker.Connection.Send(1, 0);
Networker.Connection.Connection.Close();
Networker.Connection = null;
Connected = false;
settings.Username = "";
settings.Password = "";
settings.Save();
Username = "";
Sessionkey = "";
foreach (Friend f in Friends) {
if (f.ChatWindow != null) f.ChatWindow.Close();
}
Friends.Clear();
foreach (Game g in Games) {
g.ForceStop = true;
}
Games = new Game[0];
this.CurrentPlayingGame = null;
FormLogin.Enabled = true;
FormLogin.textUsername.Text = "";
FormLogin.textPassword.Text = "";
FormLogin.connected = false;
FormLogin.Show();
Hide();
}
private void addToolStripMenuItem_Click(object sender, EventArgs e) {
FormAddFriend f = new FormAddFriend(this);
f.ShowDialog(this);
}
void trayIcon_BalloonTipClicked(object sender, EventArgs e) {
switch (this.PopupAction) {
case 0:
break;
case 1:
foreach(Friend f in this.Friends){
if (f.Username == trayIcon.BalloonTipTitle) {
if (f.ChatWindow != null && !f.ChatWindow.IsDisposed) {
f.ChatWindow.FocusTextBar();
f.ChatWindow.BringToFront();
} else {
f.OpenChat();
}
break;
}
}
break;
case 2:
foreach(Friend f in this.Friends){
if (f.Username == trayIcon.BalloonTipTitle) {
if (f.ChatWindow != null && !f.ChatWindow.IsDisposed) {
f.ChatWindow.FocusTextBar();
f.ChatWindow.BringToFront();
} else {
f.OpenChat();
}
break;
}
}
break;
}
}
private void buttonChecksumTool_Click(object sender, EventArgs e)
{
new FormChecksum()
{
GameID = (short)listGames.SelectedItems[0].Tag
}.Show();
}
#endregion
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,59 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace GamerServices {
public class Friend {
public String Username;
public String AvatarURL;
public FormChat ChatWindow;
public bool Online;
public short GameID;
public int UserID;
public FormMain Main;
public Friend(FormMain mainform) {
Main = mainform;
}
public void OpenChat() {
if (ChatWindow != null && !ChatWindow.IsDisposed)
return;
ChatWindow = new FormChat(Main);
ChatWindow.ChattingWith = this;
ChatWindow.Icon = Main.Icon;
ChatWindow.Text = "Chat - " + Username;
ChatWindow.Show();
}
public void ChatMessage(string msg) {
if (ChatWindow == null)
OpenChat();
ChatWindow.AddMessage(Username, msg);
}
public void SetPlaying(short id) {
GameID = id;
if (ChatWindow != null)
ChatWindow.UpdateStatus();
}
public void SetOnline(bool online) {
Online = online;
Main.Popup(Username, online ? "Is now online!" : "Is now offline!", online ? (byte)1 : (byte)0, 1);
if (ChatWindow != null){
ChatWindow.AddMessage(online ? Username + " is now online!" : Username + " is now offline!");
ChatWindow.button1.Enabled = online;
}
Main.UpdateFriendList();
}
}
}

View File

@ -0,0 +1,524 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Diagnostics;
using System.IO;
using System.Net;
using System.Net.Sockets;
namespace GamerServices
{
public class Game {
#region Enums & classes
public enum GameStatus : byte {
INSTALLED = 0,
DOWNLOADING = 1,
UNINSTALLED = 2,
NONE = 254
}
public enum GameAPIReturn : byte {
NONE = 0,
YES = 1,
NO = 2,
}
public class Achievement {
public String Name;
public String Desc;
public String Hash;
public int CurProg;
public int TargetProg;
public int ID;
public short Points;
}
public class LeaderboardRow {
public String Username;
public int Pos;
public int Score;
}
public class Leaderboard {
public String Name;
public String Desc;
public String Identifier;
public int ID;
public int SelfRow;
public LeaderboardRow[] Rows;
public LeaderboardRow GetRow(string user) {
foreach (LeaderboardRow r in Rows) {
if (r.Username == user)
return r;
}
return null;
}
}
#endregion
#region Varibles
public String Identifier = "tetris";
public String MainExe = "";
public String Name = "";
public String Description = "";
public String Version = "0";
public GameAPIReturn APIStatus = GameAPIReturn.NONE;
public GameStatus Status = GameStatus.NONE;
public List<Achievement> Achievements = new List<Achievement>();
public Dictionary<String, bool> AvatarsSend = new Dictionary<string, bool>();
public Leaderboard[] LeaderBoards;
public short GameID = -1;
public byte GamePort = 1;
public bool ForceStop;
public bool Devmode;
public bool IsDevUser;
public FormMain Main;
private TcpListener APIListener;
private MrAG.Networking.TCPClient APIConnection;
private Process GameProc;
private Thread GameAPIThread;
private FormGameDev FormDev;
private FormDevUpdate FormDevUpdater;
private String GameAPISessID;
#endregion
public Game(FormMain main)
{
Main = main;
}
public Achievement GetAchievement(string hash) {
foreach (Achievement a in Achievements) {
if (a.Hash == hash)
return a;
}
return null;
}
public Leaderboard GetLeaderboard(string boardname) {
foreach (Leaderboard board in LeaderBoards) {
if (board.Identifier == boardname) {
return board;
}
}
return null;
}
#region Dev functions
public void DevUpdate() {
FormDevUpdater = new FormDevUpdate(this);
FormDevUpdater.Show();
}
public void DevStop() {
Devmode = false;
FormDev.Close();
Stop();
}
public void DevStart() {
if (Main.CurrentPlayingGame != null) {
Main.Error("Humans are bad at multi-tasking!");
return;
}
Devmode = true;
APIListener = new TcpListener(IPAddress.Any, 17000 + GamePort);
APIListener.Start();
GameAPIThread = new Thread(new ThreadStart(APIThink));
GameAPIThread.Start();
Main.CurrentPlayingGame = this;
System.Windows.Forms.MessageBox.Show("Go to your Visual studio, then project properties\nDebug > Start options > Command line arguments\nSet that to: \"None " + (17000 + GamePort) + "\" whitout the quotes", "Developer Debug mode", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information);
FormDev = new FormGameDev(this);
FormDev.Show();
FormDev.Location = new System.Drawing.Point(Main.Location.X + ((Main.Size.Width / 2) - (FormDev.Size.Width / 2)), Main.Location.Y + ((Main.Size.Height / 2) - (FormDev.Size.Height / 2)));
}
#endregion
#region Default functions
public void Stop() {
if ((!Devmode || ForceStop) && GameProc != null && !GameProc.HasExited) {
GameProc.Kill();
GameProc = null;
}
if (APIListener != null && (!Devmode || ForceStop)) {
APIListener.Stop();
APIListener = null;
}
if (APIConnection != null) {
APIConnection.Connection.Close();
APIConnection = null;
}
if (ForceStop)
if (this.FormDev != null && !this.FormDev.IsDisposed)
this.FormDev.Close();
ForceStop = false;
if (Main.CurrentPlayingGame == this && !Devmode) Main.CurrentPlayingGame = null;
if (!Devmode && GameAPISessID != "") {
if (Main.Networker.Connection != null)
Main.Networker.Connection.Send(14, 0, false, GameID);
}
AvatarsSend = new Dictionary<string, bool>();
if (GameAPIThread != null) {
APIConnection = null;
if (Devmode) {
GameAPIThread = new Thread(new ThreadStart(APIThink));
GameAPIThread.Start();
} else {
GameAPIThread.Abort();
}
}
}
public MrAG.Networking.TCPClient GetAPIConnection() {
return APIConnection;
}
public void Start() {
Devmode = false;
if (Main.CurrentPlayingGame != null) {
if (System.Windows.Forms.MessageBox.Show("Already ingame, want to force exit " + Main.CurrentPlayingGame.Name + " and startup " + this.Name + "?", "Already ingame", System.Windows.Forms.MessageBoxButtons.YesNo, System.Windows.Forms.MessageBoxIcon.Warning) != System.Windows.Forms.DialogResult.Yes) {
return;
} else if(Main.CurrentPlayingGame != null) {
if (Main.CurrentPlayingGame.Devmode)
Main.CurrentPlayingGame.DevStop();
else
Main.CurrentPlayingGame.Stop();
}
}
GameAPISessID = "";
Stop();
GameAPISessID = Main.Networker.MD5(Main.Sessionkey + Main.Username);
APIListener = new TcpListener(IPAddress.Any, 17000 + GamePort);
APIListener.Start();
GameProc = new System.Diagnostics.Process();
GameProc.StartInfo.Arguments = GameAPISessID + " " + (17000 + GamePort);
GameProc.StartInfo.WorkingDirectory = System.IO.Directory.GetCurrentDirectory() + "/Games/" + GameID;
GameProc.StartInfo.FileName = "\"" + GameProc.StartInfo.WorkingDirectory + "/" + MainExe + "\"";
try {
GameProc.Start();
}catch(Exception e) {
Main.Error("Could not find " + MainExe);
APIListener.Stop();
APIListener = null;
GameProc = null;
GameAPISessID = "";
return;
}
GameAPIThread = new Thread(new ThreadStart(APIThink));
GameAPIThread.Start();
Main.CurrentPlayingGame = this;
}
public void Install() {
System.IO.Directory.CreateDirectory("Games/" + GameID);
System.IO.File.WriteAllText("Games/" + GameID + "/version.txt", "0.0.0");
Status = Game.GameStatus.DOWNLOADING;
Version = "";
if (!Main.Downloader.UpdateParser(GameID, Version)) {
if (IsDevUser) {
System.Windows.Forms.MessageBox.Show("Could not find download list, however becouse your the developer of this game, im going to ignore it and send an team of highly trained unicorns to create it.", "Error while looking for online game files", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
Main.SortGames();
} else {
Status = Game.GameStatus.UNINSTALLED;
System.Windows.Forms.MessageBox.Show("Could not find download list", "Error while instaling", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
}
}else
Main.SortGames();
Main.Networker.Connection.Send(12, 3, GameID);
Main.Networker.Connection.Send(13, 3, GameID);
}
public void Uninstall() {
System.IO.Directory.Delete("Games/" + GameID, true);
Status = Game.GameStatus.UNINSTALLED;
Main.SortGames();
}
public void Update() {
Main.Networker.Connection.Send(11, 3, GameID);
}
#endregion
#region The dark corner of API crap
private void APIThink() {
double lastping = DateTime.Now.TimeOfDay.TotalMilliseconds;
double lastDevUpdate = DateTime.Now.TimeOfDay.TotalMilliseconds;
while (true) {
if (APIListener != null) {
if (APIListener.Pending()) {
APIConnection = new MrAG.Networking.TCPClient(APIListener.AcceptTcpClient());
APIConnection.DebugMode = false;
APIConnection.Packets[0] = new Action<MrAG.Networking.Packet>(Packet_00); // Main Connection
APIConnection.Packets[1] = new Action<MrAG.Networking.Packet>(Packet_01); // Ping
APIConnection.Packets[2] = new Action<MrAG.Networking.Packet>(Packet_02); // Achievements
APIConnection.Packets[3] = new Action<MrAG.Networking.Packet>(Packet_03); // Leaderboard
APIConnection.Packets[4] = new Action<MrAG.Networking.Packet>(Packet_04); // Logout for some reason
APIConnection.Packets[5] = new Action<MrAG.Networking.Packet>(Packet_05); // Remote print
APIConnection.Packets[6] = new Action<MrAG.Networking.Packet>(Packet_06); // Avatar
APIConnection.Packets[7] = new Action<MrAG.Networking.Packet>(Packet_07); // ServerList
if (FormDev != null) FormDev.AddMessage("Game logged in");
if (!Devmode){
APIListener.Stop();
APIListener = null;
}
}
}
if (APIConnection != null){
try {
APIConnection.Update();
} catch {
if (!Devmode)
Main.Error("The api session for " + Name + " has crashed!");
Stop();
return;
}
}
if (Main == null || Main.IsDisposed || ForceStop || (!Devmode && GameProc != null && GameProc.HasExited)) {
Stop();
return;
}
if (Math.Abs(lastping - DateTime.Now.TimeOfDay.TotalMilliseconds) > 5000){
if (APIConnection != null) APIConnection.Send(1, 1);
lastping = DateTime.Now.TimeOfDay.TotalMilliseconds;
}
if (FormDev != null && Math.Abs(lastDevUpdate - DateTime.Now.TimeOfDay.TotalMilliseconds) > 1000){
try { FormDev.UpdateAv(); } catch { }
lastDevUpdate = DateTime.Now.TimeOfDay.TotalMilliseconds;
}
Thread.Sleep(50);
}
}
private void Packet_00(MrAG.Networking.Packet p){
string SessID = p.ReadString();
string APIKey = p.ReadString();
string Identifier = p.ReadString();
APIStatus = GameAPIReturn.YES;
if (SessID == "None" && Devmode) {
} else {
Main.Networker.Connection.Send(14, 0, true, GameID);
}
while (APIStatus == GameAPIReturn.NONE) {
Thread.Sleep(100);
}
if (APIStatus == GameAPIReturn.YES) {
APIConnection.Send(0, Main.Username.Length + 5, Main.Username);
} else {
Main.Error("Failed to start " + Name);
Stop();
}
if (FormDev != null) {
FormDev.AddIn(SessID.Length + APIKey.Length + Identifier.Length + 13);
FormDev.AddOut(Main.Username.Length + 5);
}
}
private void Packet_01(MrAG.Networking.Packet p){
if (FormDev != null) FormDev.AddMessage("Pinged!");
if (FormDev != null) {
FormDev.AddIn(1);
FormDev.AddOut(1);
}
}
private void Packet_02(MrAG.Networking.Packet p){
byte type = p.ReadByte();
string ach_hash;
int addin = 1;
int addout = 0;
switch (type) {
case 0: // list
p.Start_Send();
p.AddByte(2);
p.AddByte(0);
p.AddShort((short)Achievements.Count);
foreach (Achievement a in Achievements) {
p.AddString(a.Name);
p.AddString(a.Hash);
p.AddString(a.Desc);
p.AddInt(a.CurProg);
p.AddInt(a.TargetProg);
p.AddByte(a.Points);
addout += a.Name.Length + a.Hash.Length + a.Desc.Length + 22;
}
p.Finish_Send();
if (FormDev != null) FormDev.AddMessage(this.Achievements.Count +" achievements sent to game " + this.Name);
break;
case 1: // add
ach_hash = p.ReadString();
int toadd = p.ReadInt();
Achievement ach = GetAchievement(ach_hash);
if (ach != null) {
ach.CurProg += toadd;
Main.Networker.Connection.Send(40, 9, ach.ID, toadd);
if (FormDev != null) FormDev.AddMessage("Achievement Added " + toadd + " for " + ach.Name);
}
addin += ach_hash.Length + 9;
break;
case 2: // set
ach_hash = p.ReadString();
int toset = p.ReadInt();
Achievement ach2 = GetAchievement(ach_hash);
if (ach2 != null){
ach2.CurProg = toset;
Main.Networker.Connection.Send(41, 9, ach2.ID, toset);
if (FormDev != null) FormDev.AddMessage("Achievement set " + ach2.Name+ " to " + toset);
}
addin += ach_hash.Length + 9;
break;
}
if (FormDev != null) {
FormDev.AddIn(addin);
FormDev.AddOut(addout);
}
}
private void Packet_03(MrAG.Networking.Packet p){
int addin = 1;
int addout = 0;
byte type = p.ReadByte();
switch (type) {
case 0: // list
break;
case 1: // Submit
double startime = DateTime.Now.TimeOfDay.TotalMilliseconds;
string boardname = p.ReadString();
int score = p.ReadInt();
Main.Networker.Connection.Send(42, 9, GetLeaderboard(boardname).ID, score);
if (FormDev != null) FormDev.AddMessage("Leaderboard submit " + boardname + " with " + score + " score, took " + (DateTime.Now.TimeOfDay.TotalMilliseconds - startime) + "MS");
addin += boardname.Length + 9;
addout += 5;
break;
case 2: // Get
string user = p.ReadString();
string board = p.ReadString();
Leaderboard l = GetLeaderboard(board);
LeaderboardRow row = l.GetRow(user);
p.Start_Send();
p.AddInt(row.Pos);
p.AddInt(row.Score);
p.Finish_Send();
if (FormDev != null) FormDev.AddMessage("Leaderboard get " + board + " for " + row.Username);
addin += user.Length + board.Length + 9;
addout += 9;
break;
}
if (FormDev != null) {
FormDev.AddIn(addin);
FormDev.AddOut(addout);
}
}
private void Packet_04(MrAG.Networking.Packet p){
if (FormDev != null) FormDev.AddMessage("Game logged out");
if (FormDev != null) FormDev.AddIn(1);
}
private void Packet_05(MrAG.Networking.Packet p){
string msg = p.ReadString();
if (FormDev != null) FormDev.AddMessage("GAME: " + msg);
if (FormDev != null) FormDev.AddIn(msg.Length + 5);
}
private void Packet_06(MrAG.Networking.Packet p){
string user = p.ReadString();
if (AvatarsSend.ContainsKey(user))
return;
AvatarsSend[user] = true;
Friend f = this.Main.GetFriend(user);
if (f == null){
if (FormDev != null) FormDev.AddMessage("Requested avatar for " + user);
this.Main.Networker.Connection.Connection.Send(31, 0, user);
}else {
if (FormDev != null) FormDev.AddMessage("Ninja'd avatar for " + user);
string url = "http://" + "www.gravatar.com/avatar/" + f.AvatarURL + "?s=64";
p.Send(6, 9 + url.Length + user.Length, user, url);
}
if (FormDev != null) FormDev.AddIn(user.Length + 5);
if (FormDev != null) FormDev.AddOut(user.Length + 5);
}
private void Packet_07(MrAG.Networking.Packet p){
string id = p.ReadString();
this.Main.Networker.Connection.Send(15, id.Length + 3, id);
if (FormDev != null) FormDev.AddMessage("Requested serverlist");
if (FormDev != null) FormDev.AddIn(id.Length + 3);
}
#endregion
}
}

View File

@ -0,0 +1,497 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace GamerServices
{
public class Networker
{
public MrAG.Networking.TCPClient Connection;
public FormMain Main;
public Networker(FormMain mainform){
Main = mainform;
}
public bool Initialize() {
if (!System.IO.Directory.Exists("Games"))
System.IO.Directory.CreateDirectory("Games");
try
{
Connection = MrAG.Serverlist.Connect("mrag.nl", 2222, false);
Connection.DebugMode = false;
Main.Connected = true;
#region packets
// 0-2: User related packets
Connection.Packets[0] = new Action<MrAG.Networking.Packet>(Packet_00); // Login
Connection.Packets[1] = new Action<MrAG.Networking.Packet>(Packet_01); // Logout
Connection.Packets[2] = new Action<MrAG.Networking.Packet>(Packet_02); // Ping/pong
// 3 - 9 Friends & chatting
Connection.Packets[3] = new Action<MrAG.Networking.Packet>(Packet_03); // List Friends
Connection.Packets[4] = new Action<MrAG.Networking.Packet>(Packet_04); // Friend online change
Connection.Packets[5] = new Action<MrAG.Networking.Packet>(Packet_05); // Friend Chatmessage
Connection.Packets[6] = new Action<MrAG.Networking.Packet>(Packet_06); // Friend request (server > client = username, client > server = username + bool)
Connection.Packets[7] = new Action<MrAG.Networking.Packet>(Packet_07); // Friend Add friend
Connection.Packets[8] = new Action<MrAG.Networking.Packet>(Packet_08); // Friend Start/exit game
// 10-29: Game related packets
Connection.Packets[10] = new Action<MrAG.Networking.Packet>(Packet_10); // List Games
Connection.Packets[11] = new Action<MrAG.Networking.Packet>(Packet_11); // Game Update (client > server = GameID)
Connection.Packets[12] = new Action<MrAG.Networking.Packet>(Packet_12); // Game Achievements (client > server = GameID)
Connection.Packets[13] = new Action<MrAG.Networking.Packet>(Packet_13); // Game Leaderboard (client > server = GameID)
Connection.Packets[14] = new Action<MrAG.Networking.Packet>(Packet_14); // Game Login (client > server = GameID, SessID, APIKey, Identifier)
Connection.Packets[15] = new Action<MrAG.Networking.Packet>(Packet_15); // Game ServerList
// 30 - 39: General
Connection.Packets[30] = new Action<MrAG.Networking.Packet>(Packet_30); // Message
Connection.Packets[31] = new Action<MrAG.Networking.Packet>(Packet_31); // Avatar request
// 40 - 9001: Returns
Connection.Packets[42] = new Action<MrAG.Networking.Packet>(Packet_42); // Game Leaderboard submit return
#endregion
}
catch(Exception e)
{
string text = "";
if (System.IO.File.Exists("error.txt")) {
text = System.IO.File.ReadAllText("error.txt");
}
text += "[" + e.Source + "] " + e.Message + "\r\n\tStacktrace: " + e.StackTrace + "\r\n\tHelpLink: " + e.HelpLink + "\r\n\tTargetsite: " + e.TargetSite + "\r\n\tType: " + e.GetType().FullName + "\r\n\r\n";
System.IO.File.WriteAllText("error.txt", text);
return false;
}
return true;
}
public void Update() {
try{
this.Connection.Update();
}catch(Exception e){
try {
Connection.Send(1, 0);
Connection.Connection.Close();
} catch {
}
Connection = null;
Main.Connected = false;
Main.Username = "";
Main.Sessionkey = "";
lock (Main.Friends) {
foreach (Friend f in Main.Friends) {
if (f.ChatWindow != null) f.ChatWindow.Close();
}
}
lock (Main.Games) {
foreach (Game g in Main.Games) {
g.ForceStop = true;
}
}
Main.Hide();
Main.FormLogin.Enabled = true;
Main.FormLogin.textPassword.Text = "";
Main.FormLogin.connected = false;
Main.FormLogin.Show();
Main.Error("Lost connection to GamerServices.\nPlease try reconnecting.");
}
}
public void Login(string user, string pass) {
Connection.Send(0, 0, user, pass);
}
public void Logout()
{
if (this.Main.Connected)
this.Connection.Send(1, 0);
}
public string MD5(string input)
{
System.Security.Cryptography.MD5CryptoServiceProvider x = new System.Security.Cryptography.MD5CryptoServiceProvider();
System.Text.StringBuilder s = new System.Text.StringBuilder();
byte[] bs = System.Text.Encoding.UTF8.GetBytes(input);
bs = x.ComputeHash(bs);
foreach (byte b in bs)
{
s.Append(b.ToString("x2"));
}
return s.ToString().ToLower();
}
#region User
public void Packet_00(MrAG.Networking.Packet p)
{
bool Success = p.ReadBool();
Main.FormLogin.Enabled = true;
if (Success) {
Main.Sessionkey = p.ReadString();
Main.Username = Main.FormLogin.textUsername.Text;
Main.Settings_Username = Main.Username;
if (Main.FormLogin.checkRememberMe.Checked) Main.Settings_Password = Main.FormLogin.textPassword.Text;
else Main.Settings_Password = "";
Main.FormLogin.Hide();
Main.Show();
Main.Focus();
Main.trayIcon.Visible = true;
this.Connection.Send(10, 0);
this.Connection.Send(3, 0);
} else {
Main.FormLogin.textPassword.Text = "";
}
this.Connection.Send(15, 0, "FOREVER ABLOM");
}
public void Packet_01(MrAG.Networking.Packet p)
{
}
public void Packet_02(MrAG.Networking.Packet p)
{
Connection.Send(2, 1);
}
#endregion
#region Friends
public void Packet_03(MrAG.Networking.Packet p)
{
short loops = p.ReadShort();
for (short i = 0; i < loops; i++) {
string name = p.ReadString();
int userID = p.ReadInt();
string avatar = p.ReadString();
bool online = p.ReadBool();
short gameid = online ? p.ReadShort() : (short)-1;
this.Main.AddFriend(name, userID, online, avatar, gameid);
if (online && gameid != 0) {
Game g = Main.GetGame(gameid);
if (g != null)
Main.Popup(name, "Is now playing " + g.Name, 0, 1);
}
}
}
public void Packet_04(MrAG.Networking.Packet p)
{
int userid = p.ReadInt();
bool on = p.ReadBool();
Friend f = Main.GetFriend(userid);
if (f != null)
f.SetOnline(on);
}
public void Packet_05(MrAG.Networking.Packet p)
{
int user = p.ReadInt();
string msg = p.ReadString();
Friend f = Main.GetFriend(user);
if (f == null)
return;
f.ChatMessage(msg);
f.ChatWindow.Flash();
if (!f.ChatWindow.ContainsFocus)
Main.Popup(f.Username, msg, 1, 1);
}
public void Packet_06(MrAG.Networking.Packet p)
{
string user = p.ReadString();
Main.AddFriendRequest(user);
}
public void Packet_07(MrAG.Networking.Packet p)
{
string name = p.ReadString();
int userID = p.ReadInt();
string avatar = p.ReadString();
bool online = p.ReadBool();
this.Main.AddFriend(name, userID, online, avatar, -1);
}
public void Packet_08(MrAG.Networking.Packet p)
{
int user = p.ReadInt();
bool ingame = p.ReadBool();
short gameid = ingame ? p.ReadShort() : (short)-1;
Friend f = Main.GetFriend(user);
if (f == null)
return;
if (ingame){
Game g = Main.GetGame(gameid);
f.GameID = g.GameID;
if (g != null)
Main.Popup(f.Username, "Is now playing " + g.Name, 0, 1);
}else{
Game g = Main.GetGame(f.GameID);
if (g != null)
Main.Popup(f.Username, "Stopped playing " + g.Name, 0, 1);
}
}
#endregion
#region Game
public void Packet_10(MrAG.Networking.Packet p)
{
int loops = p.ReadInt();
Main.Games = new Game[loops];
for (int i = 0; i < loops; i++) {
Game newGame = new Game(Main);
newGame.Identifier = p.ReadString();
newGame.Name = p.ReadString();
newGame.GameID = p.ReadShort();
newGame.Description = p.ReadString();
newGame.MainExe = p.ReadString();
newGame.IsDevUser = p.ReadBool();
short tmpport = newGame.GameID;
while (tmpport > 10)
tmpport -= 10;
newGame.GamePort = (byte)tmpport;
newGame.Status = System.IO.Directory.Exists("Games/" + newGame.GameID) ? Game.GameStatus.INSTALLED : Game.GameStatus.UNINSTALLED;
if (newGame.Status == Game.GameStatus.INSTALLED) {
if (System.IO.File.Exists("Games/" + newGame.GameID + "/version.txt"))
newGame.Version = System.IO.File.ReadAllText("Games/" + newGame.GameID + "/version.txt");
else
newGame.Version = "0.0.0";
Connection.Send(11, 3, newGame.GameID);
Connection.Send(12, 3, newGame.GameID);
Connection.Send(13, 3, newGame.GameID);
}
Main.Games[i] = newGame;
}
Main.SortGames();
}
public void Packet_11(MrAG.Networking.Packet p)
{
string serverver = p.ReadString();
short gameID = p.ReadShort();
string ownver = System.IO.File.ReadAllText("Games/" + gameID + "/version.txt");
//if (serverver != ownver)
if (!Main.Downloader.UpdateParser(gameID, ownver))
Main.Error("Could not update game " + Main.GetGame(gameID).Name + ", no version file found.");
}
public void Packet_12(MrAG.Networking.Packet p)
{
short GameID = p.ReadShort();
int loops = p.ReadInt();
Game g = Main.GetGame(GameID);
if (g == null) { // Lets still read out all the crap its sending >.>
for (int i = 0; i < loops; i++) {
p.ReadInt();
p.ReadString();
p.ReadString();
p.ReadShort();
p.ReadInt();
p.ReadInt();
}
} else {
g.Achievements.Clear();
for (int i = 0; i < loops; i++) {
Game.Achievement a = new Game.Achievement();
a.ID = p.ReadInt();
a.Name = p.ReadString();
a.Desc = p.ReadString();
a.Points = p.ReadShort();
a.CurProg = p.ReadInt();
a.TargetProg = p.ReadInt();
a.Hash = MD5(a.Name + a.Desc).Substring(0, 10);
g.Achievements.Add(a);
}
}
}
public void Packet_13(MrAG.Networking.Packet p)
{
short GameID = p.ReadShort();
int looperdieloops = p.ReadInt();
Game g = Main.GetGame(GameID);
if (g == null) {
for (int i = 0; i < looperdieloops; i++) {
p.ReadInt();
p.ReadString();
p.ReadString();
p.ReadString();
}
} else {
Main.GetGame(GameID).LeaderBoards = new Game.Leaderboard[looperdieloops];
for (int i = 0; i < looperdieloops; i++) {
g.LeaderBoards[i] = new Game.Leaderboard();
g.LeaderBoards[i].ID = p.ReadInt();
g.LeaderBoards[i].Name = p.ReadString();
g.LeaderBoards[i].Desc = p.ReadString();
g.LeaderBoards[i].Identifier = p.ReadString();
}
}
}
public void Packet_14(MrAG.Networking.Packet p)
{
short GameID = p.ReadShort();
Game g = Main.GetGame(GameID);
if (g == null) {
p.ReadBool();
return;
}
bool access = p.ReadBool();
if (access) {
g.APIStatus = Game.GameAPIReturn.YES;
} else {
g.APIStatus = Game.GameAPIReturn.NO;
}
}
public void Packet_15(MrAG.Networking.Packet p)
{
int count = p.ReadInt();
if (this.Main.CurrentPlayingGame != null && this.Main.CurrentPlayingGame.GetAPIConnection() != null && this.Main.CurrentPlayingGame.GetAPIConnection().Connected) {
MrAG.Networking.Packet gp = this.Main.CurrentPlayingGame.GetAPIConnection().Connection;
gp.Start_Send();
gp.AddByte(7);
gp.AddInt(count);
for (int i = 0; i < count; i++) {
gp.AddString(p.ReadString());
gp.AddInt(p.ReadInt());
gp.AddString(p.ReadString());
gp.AddString(p.ReadString());
gp.AddInt(p.ReadInt());
gp.AddInt(p.ReadInt());
}
gp.Finish_Send();
} else {
for (int i = 0; i < count; i++) {
p.ReadString();
p.ReadInt();
p.ReadString();
p.ReadString();
p.ReadInt();
p.ReadInt();
}
}
}
#endregion
#region General
public void Packet_30(MrAG.Networking.Packet p)
{
string title = p.ReadString();
string msg = p.ReadString();
byte type = p.ReadByte();
System.Windows.Forms.MessageBoxIcon icon = System.Windows.Forms.MessageBoxIcon.None;
switch (type) {
case 0:
icon = System.Windows.Forms.MessageBoxIcon.Asterisk;
break;
case 1:
icon = System.Windows.Forms.MessageBoxIcon.Error;
break;
case 2:
icon = System.Windows.Forms.MessageBoxIcon.Exclamation;
break;
case 3:
icon = System.Windows.Forms.MessageBoxIcon.Hand;
break;
case 4:
icon = System.Windows.Forms.MessageBoxIcon.Information;
break;
case 5:
icon = System.Windows.Forms.MessageBoxIcon.None;
break;
case 6:
icon = System.Windows.Forms.MessageBoxIcon.Question;
break;
case 7:
icon = System.Windows.Forms.MessageBoxIcon.Stop;
break;
case 8:
icon = System.Windows.Forms.MessageBoxIcon.Warning;
break;
}
Main.Error(title, msg, icon);
}
public void Packet_31(MrAG.Networking.Packet p)
{
string user = p.ReadString();
string url = "http://" + "www.gravatar.com/avatar/" + p.ReadString() + "?s=64";
Main.CurrentPlayingGame.GetAPIConnection().Connection.Send(6, 9 + url.Length + user.Length, user, url);
}
#endregion
#region Returns
public void Packet_42(MrAG.Networking.Packet p)
{
Main.CurrentPlayingGame.GetAPIConnection().Connection.Send(3, 0, p.ReadInt());
}
#endregion
}
}

18
GamerServices/app.config Normal file
View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="GamerServices.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
</sectionGroup>
</configSections>
<userSettings>
<GamerServices.Properties.Settings>
<setting name="Username" serializeAs="String">
<value />
</setting>
<setting name="Password" serializeAs="String">
<value />
</setting>
</GamerServices.Properties.Settings>
</userSettings>
</configuration>

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB