Skip to content

Commit

Permalink
Update the proxies.
Browse files Browse the repository at this point in the history
Flag regexes as ECMAScript compatible so JSIL won't choke on them.
  • Loading branch information
kg committed Apr 11, 2012
1 parent 9d38146 commit 3df8893
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 22 deletions.
22 changes: 22 additions & 0 deletions Examples/Sully/Proxies/File.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using JSIL.Meta;
using JSIL.Proxy;

namespace Sully.Proxies {
[JSProxy(
"XNAVERGE.Utility",
memberPolicy: JSProxyMemberPolicy.ReplaceDeclared,
attributePolicy: JSProxyAttributePolicy.ReplaceDeclared,
inheritable: true
)]
public static class UtilityProxy {
[JSReplacement("System.IO.File.ReadAllText($filepath)")]
[JSIsPure]
public static String read_file_text (String filepath) {
throw new NotImplementedException();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@
using System.Text;
using JSIL.Meta;
using JSIL.Proxy;
using fastJSON;

namespace Sully.Proxies {
[JSProxy(
typeof(fastJSON.JSON),
"Newtonsoft.Json.JsonConvert",
memberPolicy: JSProxyMemberPolicy.ReplaceDeclared,
attributePolicy: JSProxyAttributePolicy.ReplaceDeclared
attributePolicy: JSProxyAttributePolicy.ReplaceDeclared,
inheritable: true
)]
public class FastJSONProxy {
[JSReplacement("JSIL.JSON.Parse($json)")]
public static class NewtonsoftJSONProxy {
[JSReplacement("JSIL.JSON.Parse($value)")]
[JSIsPure]
public object Parse (string json) {
public static T DeserializeObject<T> (string value, params AnyType[] converters) {
throw new InvalidOperationException();
}
}
Expand Down
10 changes: 2 additions & 8 deletions Examples/Sully/Proxies/Proxies.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,10 @@
<Reference Include="System.Core" />
</ItemGroup>
<ItemGroup>
<Compile Include="FastJSON.cs" />
<Compile Include="File.cs" />
<Compile Include="JSON.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\Upstream\fastJSON\fastJSON\fastJSON.csproj">
<Project>{207E91B1-C9F8-4913-88E1-3549EF5F3273}</Project>
<Name>fastJSON</Name>
<Private>False</Private>
</ProjectReference>
</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.
Expand Down
5 changes: 0 additions & 5 deletions Sully.sln
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sully", "Examples\Sully\Sul
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SullyContent", "Examples\Sully\SullyContent\SullyContent.contentproj", "{BE4DABF9-B23E-45E7-8DF9-2D6E882AEC5A}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "fastJSON", "Upstream\fastJSON\fastJSON\fastJSON.csproj", "{207E91B1-C9F8-4913-88E1-3549EF5F3273}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Proxies", "Examples\Sully\Proxies\Proxies.csproj", "{12DBCC9A-50FE-43B1-BAD1-8029D4AD60CA}"
EndProject
Global
Expand All @@ -38,9 +36,6 @@ Global
{354DAF82-D6AF-4310-870C-4D5EF870344F}.Release|x86.Build.0 = Release|x86
{BE4DABF9-B23E-45E7-8DF9-2D6E882AEC5A}.Debug|x86.ActiveCfg = Debug|x86
{BE4DABF9-B23E-45E7-8DF9-2D6E882AEC5A}.Release|x86.ActiveCfg = Release|x86
{207E91B1-C9F8-4913-88E1-3549EF5F3273}.Debug|x86.ActiveCfg = Debug|Any CPU
{207E91B1-C9F8-4913-88E1-3549EF5F3273}.Debug|x86.Build.0 = Debug|Any CPU
{207E91B1-C9F8-4913-88E1-3549EF5F3273}.Release|x86.ActiveCfg = Release|Any CPU
{12DBCC9A-50FE-43B1-BAD1-8029D4AD60CA}.Debug|x86.ActiveCfg = Debug|Any CPU
{12DBCC9A-50FE-43B1-BAD1-8029D4AD60CA}.Debug|x86.Build.0 = Debug|Any CPU
{12DBCC9A-50FE-43B1-BAD1-8029D4AD60CA}.Release|x86.ActiveCfg = Release|Any CPU
Expand Down
4 changes: 2 additions & 2 deletions XNAVERGE/Utility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using System.Linq;
using System.Text;
using System.IO;

using System.Text.RegularExpressions;
using Microsoft.Xna.Framework;
using Newtonsoft.Json;

Expand Down Expand Up @@ -139,7 +139,7 @@ public static String read_known_length_string(StreamReader reader, int len) {

private const String WHITESPACE = @"\s";
public static String strip_whitespace(String str) {
return System.Text.RegularExpressions.Regex.Replace(str, WHITESPACE, "");
return Regex.Replace(str, WHITESPACE, "", RegexOptions.ECMAScript);
}

// Returns a Direction based on the signs of the x and y values given. ++ is DownRight, -0 is Left, etc.
Expand Down
3 changes: 2 additions & 1 deletion XNAVERGE/sprite/Movestring.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ public class Movestring {

public static Regex regex = new Regex(
@"([ulrdxyptzwfb])\s*(\d*)",
RegexOptions.IgnoreCase | RegexOptions.Compiled | RegexOptions.CultureInvariant);
RegexOptions.IgnoreCase | RegexOptions.Compiled | RegexOptions.CultureInvariant | RegexOptions.ECMAScript
);


public MovestringCommand[] commands;
Expand Down
1 change: 1 addition & 0 deletions XNAVERGE/sprite/Sprite_Loader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public static SpriteBasis _load_basis_by_asset_name(string asset_name) {
cur = (i == 0 ? CHR_LOCATION : "") + (j == 0 ? asset_name : naked_name);
if (File.Exists(@"content\" + cur + ".xnb")) {
spr = VERGEGame.game.MapContent.Load<SpriteBasis>(cur);
spr.name = cur;
i = 999;
j = 999;
}
Expand Down

0 comments on commit 3df8893

Please sign in to comment.