Widescreen Gaming Forum

[-noun] Web community dedicated to ensuring PC games run properly on your tablet, netbook, personal computer, HDTV and multi-monitor gaming rig.
It is currently 04 Jun 2026, 20:54

All times are UTC [ DST ]




Post new topic Reply to topic  [ 1 post ] 
Author Message
PostPosted: 23 May 2013, 21:53 
Offline
User avatar

Joined: 27 Feb 2013, 16:25
Posts: 163
Location: Gloucester, UK
So here we are 8 days later and I'm still here, back for another update. Last week I told you why I'm here, how I ended up on WSGF and a little project I'm working on with the Steam Library Compare application. Well it's been a busy week so I haven't done much, the task at the moment is to get the Steam IDs I've managed to match into the WSGF database. On my initial run through I managed to match 537 games and we are almost there. From the 537 I have S and T to do, all others are in there.

To extend the blog a little I'm going to do a show and tell of the code it took to get the matches. Bare in mind when I started this project I had to copy all Games from the master games list manually.

When I get a little further down the line I'm going to be contacting the "dev" guys at WSGF for their help (CrackerJackMack & Brett) I'm hoping to get a dynamic xml off all games in WSGF rather than the current cut down version which only shows those games with Steam IDs. If you're reading this guys :) PLEASE!!

Anyway back to the code sorry it's pretty shoddy and but it was written quickly, oh and C# !!


public static XDocument GetSteamGamesList()
{
return XDocument.Load("http://api.steampowered.com/ISteamApps/GetAppList/v0001/?format=xml");
}


public static XDocument GetAllWSGFGamesList()
{
return XDocument.Load(@"d:\andy\documents\visual studio 2012\Projects\WSGFSteamGameComparer\WSGFnew.xml");

}


protected void generateXML()
{

var wsgf = GetAllWSGFGamesList();
var steam = GetSteamGamesList();

var matches = new Dictionary();
var match = 0;
foreach (var wsgfGame in wsgf.Descendants("node"))
{
var name = new string(wsgfGame.Element("Title").Value.Where(c => !char.IsPunctuation(c)).ToArray());
if (steam.Descendants("name").Select(s => s.Value).Contains(wsgfGame.Element("Title").Value))
{
var theMatch = steam.Descendants("app").First(s => s.Element("name").Value == wsgfGame.Element("Title").Value);
matches.Add(wsgfGame.Element("Title").Value, theMatch.Element("appid").Value);
match++;
}
else if (steam.Descendants("name").Select(s => new string(s.Value.Where(c => !char.IsPunctuation(c)).ToArray())).Contains(name))
{
var theMatch = steam.Descendants("app").First(s => new string(s.Element("name").Value.Where(c => !char.IsPunctuation(c)).ToArray()) == name);
matches.Add(wsgfGame.Element("Title").Value, theMatch.Element("appid").Value);
match++;
}
}

var matchbulder = new StringBuilder();

foreach (var item in matches)
{
matchbulder.AppendLine(string.Format("{0}\t{1}",item.Key,item.Value));
}

var sw = new StreamWriter(@"d:\andy\documents\visual studio 2012\Projects\WSGFSteamGameComparer\AllWSGFMatched.tsv",false);
sw.Write(matchbulder.ToString());
sw.Close();

var builder = new StringBuilder();

builder.AppendLine("");

builder.AppendLine("");

foreach (var wsgfGame in wsgf.Descendants("node"))
{
builder.AppendLine("");

builder.AppendLine(string.Format("{0}", wsgfGame.Element("Title").Value));
builder.AppendLine(string.Format("{0}", wsgfGame.Element("WideScreenGrade").Value));
builder.AppendLine(string.Format("{0}", wsgfGame.Element("MultiMonitorGrade").Value));

if (matches.ContainsKey(wsgfGame.Element("Title").Value))
builder.AppendLine(string.Format("{0}", matches[wsgfGame.Element("Title").Value]));

builder.AppendLine("
");
}
builder.AppendLine("
");

builder.Replace("&", "&");

var finalDoc = XDocument.Parse(builder.ToString());

finalDoc.Save(@"d:\andy\documents\visual studio 2012\Projects\WSGFSteamGameComparer\AllWSGFMatched.xml");

}


Now it's not elegant but this goes through all WSGF games and matches against the title of the steam game library. To match more I removed punctuation from both steam and WSGF game names.

So I guess that's it for now, I'll finish the steamIDs I have and then see if I can try something else.

S7evin

_________________
i7 3770K (Ivy bridge) | Corsair Dominator 32GB | Asus P8Z77-V LE Plus Intel Z77 | Corsair H100i | 2 x Gigabyte ATi Radeon HD 7950 in crossfire | NXZT Phantom case | OCZ 1000W Powersupply | Samsung 840 PRO 256GB | 2x OCZ agility 3 60GB SSDs | 2x 1TB HDDs |


Last edited by LuckyNoS7evin on 23 May 2013, 22:38, edited 1 time in total.
Edit


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron




Powered by phpBB® Forum Software © phpBB Group