mirror of
https://github.com/mm201/GamestatsBase.git
synced 2026-09-08 02:25:23 -05:00
WIP of Tetris DS gamestats server
This commit is contained in:
@@ -12,5 +12,40 @@ namespace Sample
|
||||
protected void Application_Start(object sender, EventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
void Application_BeginRequest(object sender, EventArgs e)
|
||||
{
|
||||
String pathInfo, query;
|
||||
String targetUrl = RewriteUrl(Request.Url.PathAndQuery, out pathInfo, out query);
|
||||
|
||||
if (targetUrl != null)
|
||||
{
|
||||
Context.RewritePath(targetUrl, pathInfo, query, false);
|
||||
}
|
||||
}
|
||||
|
||||
public static String RewriteUrl(String url, out String pathInfo, out String query)
|
||||
{
|
||||
int q = url.IndexOf('?');
|
||||
String path;
|
||||
pathInfo = "";
|
||||
|
||||
if (q < 0)
|
||||
{
|
||||
path = url;
|
||||
query = "";
|
||||
}
|
||||
else
|
||||
{
|
||||
path = url.Substring(0, q);
|
||||
query = url.Substring(q + 1);
|
||||
}
|
||||
|
||||
// Since our handler is not ASP classic, we must rewrite .asp in
|
||||
// the URL so control will be transferred to it.
|
||||
if (path.Length < 4) return null;
|
||||
if (path.Substring(path.Length - 4).ToLowerInvariant() != ".asp") return null;
|
||||
return path.Substring(0, path.Length - 4) + ".ashx";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,6 +57,7 @@
|
||||
<Reference Include="System.EnterpriseServices" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="tetrisds\store.ashx" />
|
||||
<None Include="Web.Debug.config">
|
||||
<DependentUpon>Web.config</DependentUpon>
|
||||
</None>
|
||||
@@ -73,10 +74,18 @@
|
||||
<DependentUpon>Global.asax</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="tetrisds\store.ashx.cs">
|
||||
<DependentUpon>store.ashx</DependentUpon>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="App_Data\" />
|
||||
<Folder Include="Models\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\GamestatsBase\GamestatsBase.csproj">
|
||||
<Project>{2d667f5b-f10d-44e2-93f6-dd555d9ee7df}</Project>
|
||||
<Name>GamestatsBase</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<PropertyGroup>
|
||||
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
|
||||
|
||||
1
Sample/tetrisds/store.ashx
Normal file
1
Sample/tetrisds/store.ashx
Normal file
@@ -0,0 +1 @@
|
||||
<%@ WebHandler Language="C#" CodeBehind="store.ashx.cs" Class="Sample.tetrisds.store" %>
|
||||
26
Sample/tetrisds/store.ashx.cs
Normal file
26
Sample/tetrisds/store.ashx.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using GamestatsBase;
|
||||
|
||||
namespace Sample.tetrisds
|
||||
{
|
||||
/// <summary>
|
||||
/// Summary description for store
|
||||
/// </summary>
|
||||
public class store : GamestatsHandler
|
||||
{
|
||||
public store() : base("Wo3vqrDoL56sAdveYeC1", 0x00000000u, 0x00000000u, 0x00000000u, 0x00000000u, "tetrisds", GamestatsRequestVersions.Version1, GamestatsResponseVersions.Version1)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void ProcessGamestatsRequest(byte[] request, System.IO.MemoryStream response, string url, int pid, HttpContext context, GamestatsSession session)
|
||||
{
|
||||
byte[] nameBytes = FromUrlSafeBase64String(context.Request.QueryString["name"]);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user