Skip to content

Commit

Permalink
Copy project from private repo
Browse files Browse the repository at this point in the history
Copies the project from my private repo. Has been sanitized to
remove API Keys, etc (hopefully).
  • Loading branch information
Cody Jung committed Apr 17, 2016
1 parent 593fc4f commit d22fcda
Show file tree
Hide file tree
Showing 685 changed files with 518,833 additions and 0 deletions.
27 changes: 27 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
Thumbs.db
*.obj
*.exe
*.user
*.aps
*.pch
*.vspscc
*_i.c
*_p.c
*.ncb
*.suo
*.sln.docstates
*.tlb
*.tlh
*.bak
*.cache
*.ilk
*.log
[Bb]in
[Dd]ebug*/
*.sbr
obj/
[Rr]elease*/
_ReSharper*/
[Tt]est[Rr]esult*
*.mdf
*.ldf
Binary file added Externals/ICSharpCode.SharpZipLib.dll
Binary file not shown.
4 changes: 4 additions & 0 deletions Externals/SteamWebApi/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Discard binaries

obj/
bin/
36 changes: 36 additions & 0 deletions Externals/SteamWebApi/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -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( "SteamAPI" )]
[assembly: AssemblyDescription( "" )]
[assembly: AssemblyConfiguration( "" )]
[assembly: AssemblyCompany( "" )]
[assembly: AssemblyProduct( "SteamAPI" )]
[assembly: AssemblyCopyright( "Copyright © 2012" )]
[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( "8678fb2c-d7d6-42d3-8011-6190f0463716" )]

// 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" )]
300 changes: 300 additions & 0 deletions Externals/SteamWebApi/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,300 @@
Steam Web API library
========

#### Description ####

This is a .NET library that makes it easy to use the Steam Web API. It conveniently wraps around all of the JSON data and ugly API details with clean methods, structures and classes.
The primary goal of this project is to support Steam Friends functionality. Other possible functionality like purchasing games and item trading may follow later. In short, it will contain
everything needed to write a custom, cross-platform Steam Friends messenger in C#.

#### Reference ####

### Enumerations ###

**LoginStatus**

Enumeration of possible authentication results.

```c#
public enum LoginStatus
{
LoginFailed,
LoginSuccessful,
SteamGuard
}
```

**UserStatus**

Status of a user.

```c#
public enum UserStatus
{
Offline = 0,
Online = 1,
Busy = 2,
Away = 3,
Snooze = 4
}
```

**ProfileVisibility**

Visibility of a user's profile.

```c#
public enum ProfileVisibility
{
Private = 1,
Public = 3,
FriendsOnly = 8
}
```

**AvatarSize**

Available sizes of user avatars.

```c#
public enum AvatarSize
{
Small,
Medium,
Large
}
```

**UpdateType**

Available update types.

```c#
public enum UpdateType
{
UserUpdate,
Message,
Emote,
TypingNotification
}
```

### SteamAPISession ###

This is the main class you will be using. It manages the session of a single Steam user and all requests are issued through methods in this class.
Below follows a description of every method.

**LoginStatus Authenticate( String username, String password, String emailauthcode = "" )**

Authenticate with a username and password. Sends the SteamGuard e-mail if it has been set up and an e-mail code has not been passed.

**LoginStatus Authenticate( String accessToken )**

Authenticate with an access token previously retrieved with a username and password (and SteamGuard code).

**List<Friend> GetFriends( String steamId = null )**

Fetch basic info for all friends of a given user.

**List<User> GetUserInfo( List<String> steamids )**

**List<User> GetUserInfo( List<Friend> friends )**

**User GetUserInfo( String steamid = null )**

Retrieve information about the specified users. Pass null for self.

**Bitmap GetUserAvatar( User user, AvatarSize size = AvatarSize.Small )**

Retrieve the avatar of the specified user as bitmap.

**List<Group> GetGroups( String steamid = null )**

Fetch basic group info for a given user.

**List<GroupInfo> GetGroupInfo( List<String> steamids )**

**List<GroupInfo> GetGroupInfo( List<Group> groups )**

**GroupInfo GetGroupInfo( String steamid )**

Retrieve information about the specified groups.

**Bitmap GetGroupAvatar( Group group, AvatarSize size = AvatarSize.Small )**

Retrieve the avatar of the specified group as bitmap.

**bool SendTypingNotification( User user )**

Let a user know you're typing a message. Should be called periodically.

**bool SendMessage( User user, String message )**

Send a text message to the specified user.

**List<Update> Poll()**

Check for updates and new messages.

**ServerInfo GetServerInfo()**

Returns info about the server, as specified in the *ServerInfo* class. This is the only call besides *Authenticate* that does not require a valid user session.

### Subclasses ###

**Friend**

Structure containing basic friend info.

```c#
public class Friend
{
public String steamid;
public bool blocked;
public DateTime friendSince;
}
```

**User**

Structure containing extensive user info.

```c#
public class User
{
public String steamid;
public ProfileVisibility profileVisibility;
public int profileState;
public String nickname;
public DateTime lastLogoff;
public String profileUrl;
public String avatarUrl;
public UserStatus status;
public String realName;
public String primaryGroupId;
public DateTime joinDate;
public String locationCountryCode;
public String locationStateCode;
public int locationCityId;
}
```

*Note that some of these fields can be empty!*

**Group**

Basic group info.

```c#
public class Group
{
public String steamid;
public bool inviteonly;
}
```

**GroupInfo**

Structure containing extensive group info.

```c#
public class GroupInfo
{
public String steamid;
public DateTime creationDate;
public String name;
public String headline;
public String summary;
public String abbreviation;
public String profileUrl;
internal String avatarUrl;
public String locationCountryCode;
public String locationStateCode;
public int locationCityId;
public int favoriteAppId;
public int members;
public int usersOnline;
public int usersInChat;
public int usersInGame;
public String owner;
}
```

**Update**

Structure containing information about a single update.

```c#
public class Update
{
public DateTime timestamp;
public String origin;
public bool localMessage;
public UpdateType type;
public String message;
public UserStatus status;
public String nick;
}
```

**ServerInfo**

Structure containing server info.

```c#
public class ServerInfo
{
public DateTime serverTime;
public String serverTimeString;
}
```

### Example ###

Here's how to log in with a username and password, ask for the SteamGuard code if necessary and display the amount of friends the user has.

```c#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net;
using System.IO;
using SteamWebAPI;

namespace SteamWebAPI
{
class Program
{
static void Main( string[] args )
{
SteamAPISession session = new SteamAPISession();

Console.Write( "Username: " );
String username = Console.ReadLine();
Console.Write( "Password: " );
String password = Console.ReadLine();

SteamAPISession.LoginStatus status = session.Authenticate( username, password );
if ( status == SteamAPISession.LoginStatus.SteamGuard )
{
Console.Write( "SteamGuard code: " );
String code = Console.ReadLine();

status = session.Authenticate( username, password, code );
}

if ( status == SteamAPISession.LoginStatus.LoginSuccessful )
{
List<SteamAPISession.Friend> friends = session.GetFriends();
int blockedFriends = friends.Count( f => f.blocked == true );
Console.WriteLine( "You have " + ( friends.Count - blockedFriends ) + " friends and " + blockedFriends + " fiends!" );
}
else
{
Console.WriteLine( "Failed to log in!" );
}
}
}
}
```
Loading

2 comments on commit d22fcda

@Isaac-Clarke
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Simplified launcher stuff???

@CodyJung
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry? What do you mean?

Please sign in to comment.