Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added support for XBOX

  • Loading branch information...
commit a2ddfbbf3d2c292400e8b4560ee4b4ba06bdde20 1 parent 6a68495
@SteveDunn SteveDunn authored
View
34 src/ServiceStack.Text.XBox360/Properties/AssemblyInfo.cs
@@ -0,0 +1,34 @@
+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("ServiceStack.Text.XBox360")]
+[assembly: AssemblyProduct("ServiceStack.Text.XBox360")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyCompany("Microsoft")]
+[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. Only Windows
+// assemblies support COM.
+[assembly: ComVisible(false)]
+
+// On Windows, the following GUID is for the ID of the typelib if this
+// project is exposed to COM. On other platforms, it unique identifies the
+// title storage container when deploying this assembly to the device.
+[assembly: Guid("bec96c96-54be-440b-a791-2c0e1c12d6f7")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+[assembly: AssemblyVersion("1.0.0.0")]
View
78 src/ServiceStack.Text.XBox360/ServiceStack.Text.XBox360.csproj
@@ -0,0 +1,78 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <ProjectGuid>{E2B0C358-6CC5-4D15-AD73-41730FBF5530}</ProjectGuid>
+ <ProjectTypeGuids>{6D335F3A-9D43-41b4-9D22-F6F17C4BE596};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">Xbox 360</Platform>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>ServiceStack.Text.XBox360</RootNamespace>
+ <AssemblyName>ServiceStack.Text.XBox360</AssemblyName>
+ <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+ <TargetFrameworkProfile>Client</TargetFrameworkProfile>
+ <XnaFrameworkVersion>v4.0</XnaFrameworkVersion>
+ <XnaPlatform>Xbox 360</XnaPlatform>
+ <XnaProfile>HiDef</XnaProfile>
+ <XnaCrossPlatformGroupID>0ed135ea-1216-457e-bc3e-9a191a60dafa</XnaCrossPlatformGroupID>
+ <XnaOutputType>Library</XnaOutputType>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|Xbox 360' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>bin\Xbox 360\Debug</OutputPath>
+ <DefineConstants>DEBUG;TRACE;XBOX;XBOX360</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ <NoStdLib>true</NoStdLib>
+ <UseVSHostingProcess>false</UseVSHostingProcess>
+ <XnaCompressContent>true</XnaCompressContent>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|Xbox 360' ">
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>bin\Xbox 360\Release</OutputPath>
+ <DefineConstants>TRACE;XBOX;XBOX360</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ <NoStdLib>true</NoStdLib>
+ <UseVSHostingProcess>false</UseVSHostingProcess>
+ <XnaCompressContent>true</XnaCompressContent>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="Microsoft.Xna.Framework" />
+ <Reference Include="Microsoft.Xna.Framework.Game" />
+ <Reference Include="Microsoft.Xna.Framework.Graphics" />
+ <Reference Include="Microsoft.Xna.Framework.GamerServices" />
+ <Reference Include="Microsoft.Xna.Framework.Xact" />
+ <Reference Include="Microsoft.Xna.Framework.Video" />
+ <Reference Include="Microsoft.Xna.Framework.Avatar" />
+ <Reference Include="Microsoft.Xna.Framework.Net" />
+ <Reference Include="Microsoft.Xna.Framework.Storage" />
+ <Reference Include="mscorlib" />
+ <Reference Include="System" />
+ <Reference Include="System.Xml" />
+ <Reference Include="System.Core">
+ <RequiredTargetFramework>4.0</RequiredTargetFramework>
+ </Reference>
+ <Reference Include="System.Xml.Linq">
+ <RequiredTargetFramework>4.0</RequiredTargetFramework>
+ </Reference>
+ <Reference Include="System.Net" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="Class1.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ </ItemGroup>
+ <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+ <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\Microsoft.Xna.GameStudio.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>
View
49 src/ServiceStack.Text.sln
@@ -11,26 +11,68 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ServiceStack.Text", "Servic
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ServiceStack.Text.Tests", "..\tests\ServiceStack.Text.Tests\ServiceStack.Text.Tests.csproj", "{9770BD40-AA3B-4785-B5E0-F4C470F9F14E}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ServiceStack.Text.XBox360", "ServiceStack.Text\ServiceStack.Text.XBox360.csproj", "{E2B0C358-6CC5-4D15-AD73-41730FBF5530}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
- Release|Any CPU = Release|Any CPU
+ Debug|Mixed Platforms = Debug|Mixed Platforms
+ Debug|Xbox 360 = Debug|Xbox 360
MonoTouch|Any CPU = MonoTouch|Any CPU
+ MonoTouch|Mixed Platforms = MonoTouch|Mixed Platforms
+ MonoTouch|Xbox 360 = MonoTouch|Xbox 360
+ Release|Any CPU = Release|Any CPU
+ Release|Mixed Platforms = Release|Mixed Platforms
+ Release|Xbox 360 = Release|Xbox 360
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{579B3FDB-CDAD-44E1-8417-885C38E49A0E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{579B3FDB-CDAD-44E1-8417-885C38E49A0E}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {579B3FDB-CDAD-44E1-8417-885C38E49A0E}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
+ {579B3FDB-CDAD-44E1-8417-885C38E49A0E}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
+ {579B3FDB-CDAD-44E1-8417-885C38E49A0E}.Debug|Xbox 360.ActiveCfg = Debug|Any CPU
{579B3FDB-CDAD-44E1-8417-885C38E49A0E}.MonoTouch|Any CPU.ActiveCfg = MonoTouch|Any CPU
{579B3FDB-CDAD-44E1-8417-885C38E49A0E}.MonoTouch|Any CPU.Build.0 = MonoTouch|Any CPU
+ {579B3FDB-CDAD-44E1-8417-885C38E49A0E}.MonoTouch|Mixed Platforms.ActiveCfg = MonoTouch|Any CPU
+ {579B3FDB-CDAD-44E1-8417-885C38E49A0E}.MonoTouch|Mixed Platforms.Build.0 = MonoTouch|Any CPU
+ {579B3FDB-CDAD-44E1-8417-885C38E49A0E}.MonoTouch|Xbox 360.ActiveCfg = MonoTouch|Any CPU
{579B3FDB-CDAD-44E1-8417-885C38E49A0E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{579B3FDB-CDAD-44E1-8417-885C38E49A0E}.Release|Any CPU.Build.0 = Release|Any CPU
+ {579B3FDB-CDAD-44E1-8417-885C38E49A0E}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
+ {579B3FDB-CDAD-44E1-8417-885C38E49A0E}.Release|Mixed Platforms.Build.0 = Release|Any CPU
+ {579B3FDB-CDAD-44E1-8417-885C38E49A0E}.Release|Xbox 360.ActiveCfg = Release|Any CPU
{9770BD40-AA3B-4785-B5E0-F4C470F9F14E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9770BD40-AA3B-4785-B5E0-F4C470F9F14E}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {9770BD40-AA3B-4785-B5E0-F4C470F9F14E}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
+ {9770BD40-AA3B-4785-B5E0-F4C470F9F14E}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
+ {9770BD40-AA3B-4785-B5E0-F4C470F9F14E}.Debug|Xbox 360.ActiveCfg = Debug|Any CPU
{9770BD40-AA3B-4785-B5E0-F4C470F9F14E}.MonoTouch|Any CPU.ActiveCfg = MonoTouch|Any CPU
+ {9770BD40-AA3B-4785-B5E0-F4C470F9F14E}.MonoTouch|Mixed Platforms.ActiveCfg = MonoTouch|Any CPU
+ {9770BD40-AA3B-4785-B5E0-F4C470F9F14E}.MonoTouch|Mixed Platforms.Build.0 = MonoTouch|Any CPU
+ {9770BD40-AA3B-4785-B5E0-F4C470F9F14E}.MonoTouch|Xbox 360.ActiveCfg = MonoTouch|Any CPU
{9770BD40-AA3B-4785-B5E0-F4C470F9F14E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9770BD40-AA3B-4785-B5E0-F4C470F9F14E}.Release|Any CPU.Build.0 = Release|Any CPU
+ {9770BD40-AA3B-4785-B5E0-F4C470F9F14E}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
+ {9770BD40-AA3B-4785-B5E0-F4C470F9F14E}.Release|Mixed Platforms.Build.0 = Release|Any CPU
+ {9770BD40-AA3B-4785-B5E0-F4C470F9F14E}.Release|Xbox 360.ActiveCfg = Release|Any CPU
+ {E2B0C358-6CC5-4D15-AD73-41730FBF5530}.Debug|Any CPU.ActiveCfg = Debug|Xbox 360
+ {E2B0C358-6CC5-4D15-AD73-41730FBF5530}.Debug|Mixed Platforms.ActiveCfg = Debug|Xbox 360
+ {E2B0C358-6CC5-4D15-AD73-41730FBF5530}.Debug|Mixed Platforms.Build.0 = Debug|Xbox 360
+ {E2B0C358-6CC5-4D15-AD73-41730FBF5530}.Debug|Xbox 360.ActiveCfg = Debug|Xbox 360
+ {E2B0C358-6CC5-4D15-AD73-41730FBF5530}.Debug|Xbox 360.Build.0 = Debug|Xbox 360
+ {E2B0C358-6CC5-4D15-AD73-41730FBF5530}.MonoTouch|Any CPU.ActiveCfg = Release|Xbox 360
+ {E2B0C358-6CC5-4D15-AD73-41730FBF5530}.MonoTouch|Mixed Platforms.ActiveCfg = Release|Xbox 360
+ {E2B0C358-6CC5-4D15-AD73-41730FBF5530}.MonoTouch|Mixed Platforms.Build.0 = Release|Xbox 360
+ {E2B0C358-6CC5-4D15-AD73-41730FBF5530}.MonoTouch|Xbox 360.ActiveCfg = Release|Xbox 360
+ {E2B0C358-6CC5-4D15-AD73-41730FBF5530}.MonoTouch|Xbox 360.Build.0 = Release|Xbox 360
+ {E2B0C358-6CC5-4D15-AD73-41730FBF5530}.Release|Any CPU.ActiveCfg = Release|Xbox 360
+ {E2B0C358-6CC5-4D15-AD73-41730FBF5530}.Release|Mixed Platforms.ActiveCfg = Release|Xbox 360
+ {E2B0C358-6CC5-4D15-AD73-41730FBF5530}.Release|Mixed Platforms.Build.0 = Release|Xbox 360
+ {E2B0C358-6CC5-4D15-AD73-41730FBF5530}.Release|Xbox 360.ActiveCfg = Release|Xbox 360
+ {E2B0C358-6CC5-4D15-AD73-41730FBF5530}.Release|Xbox 360.Build.0 = Release|Xbox 360
EndGlobalSection
- GlobalSection(NestedProjects) = preSolution
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(MonoDevelopProperties) = preSolution
StartupItem = ServiceStack.Text\ServiceStack.Text.csproj
@@ -42,7 +84,4 @@ Global
$2.Text =
$2.IncludeInNewFiles = True
EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
EndGlobal
View
BIN  src/ServiceStack.Text.suo
Binary file not shown
View
8 src/ServiceStack.Text/AssemblyUtils.cs
@@ -15,6 +15,7 @@ public class AssemblyUtils
private const string ExeExt = "dll";
private const char UriSeperator = '/';
+#if !XBOX
/// <summary>
/// Find the type from the name supplied
/// </summary>
@@ -32,7 +33,9 @@ public static Type FindType(string typeName)
return FindTypeFromLoadedAssemblies(typeDef.TypeName);
}
}
+#endif
+#if !XBOX
/// <summary>
/// Find type if it exists
/// </summary>
@@ -60,7 +63,9 @@ public static Type FindType(string typeName, string assemblyName)
}
return assembly != null ? assembly.GetType(typeName) : null;
}
+#endif
+#if !XBOX
public static Type FindTypeFromLoadedAssemblies(string typeName)
{
foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies())
@@ -73,12 +78,14 @@ public static Type FindTypeFromLoadedAssemblies(string typeName)
}
return null;
}
+#endif
private static Assembly LoadAssembly(string assemblyPath)
{
return Assembly.LoadFrom(assemblyPath);
}
+#if !XBOX
public static string GetAssemblyBinPath(Assembly assembly)
{
var binPathPos = assembly.CodeBase.LastIndexOf(UriSeperator);
@@ -89,5 +96,6 @@ public static string GetAssemblyBinPath(Assembly assembly)
}
return assemblyPath;
}
+#endif
}
}
View
2  src/ServiceStack.Text/Common/DeserializeCollection.cs
@@ -73,8 +73,10 @@ private static ICollection<T> CreateAndPopulate<T>(Type ofCollectionType, T[] wi
if (ofCollectionType == null) return new List<T>(withItems);
var genericTypeDefinition = ofCollectionType.GetGenericTypeDefinition();
+#if !XBOX
if (genericTypeDefinition == typeof(HashSet<T>))
return new HashSet<T>(withItems);
+#endif
if (genericTypeDefinition == typeof(LinkedList<T>))
return new LinkedList<T>(withItems);
View
8 src/ServiceStack.Text/Common/DeserializeType.cs
@@ -10,12 +10,14 @@
// Licensed under the same terms of ServiceStack: new BSD license.
//
+#if !XBOX
+using System.Linq.Expressions ;
+#endif
+
using System;
using System.Collections.Generic;
-using System.Linq.Expressions;
using System.Reflection;
using System.Runtime.Serialization;
-using System.Text;
namespace ServiceStack.Text.Common
{
@@ -103,7 +105,7 @@ public static SetPropertyDelegate GetSetPropertyMethod(Type type, PropertyInfo p
var setMethodInfo = propertyInfo.GetSetMethod(true);
if (setMethodInfo == null) return null;
-#if SILVERLIGHT || MONOTOUCH
+#if SILVERLIGHT || MONOTOUCH || XBOX
return (instance, value) => setMethodInfo.Invoke(instance, new[] {value});
#else
var oInstanceParam = Expression.Parameter(typeof(object), "oInstanceParam");
View
2  src/ServiceStack.Text/Common/StaticParseMethod.cs
@@ -47,7 +47,7 @@ public static ParseStringDelegate GetParseFn()
{
parseDelegate = (ParseDelegate)Delegate.CreateDelegate(typeof(ParseDelegate), parseMethodInfo);
}
- catch (ArgumentException bindingException)
+ catch ( ArgumentException )
{
//Try wrapping strongly-typed return with wrapper fn.
var typedParseDelegate = (Func<string,T>)Delegate.CreateDelegate(typeof(Func<string,T>), parseMethodInfo);
View
4 src/ServiceStack.Text/Common/WriteType.cs
@@ -12,9 +12,9 @@
using System;
using System.IO;
-using System.Linq;
using ServiceStack.Text.Json;
-using ServiceStack.Text.Reflection;
+using ServiceStack.Text.Reflection ;
+
namespace ServiceStack.Text.Common
{
View
28 src/ServiceStack.Text/Reflection/StaticAccessors.cs
@@ -9,38 +9,35 @@
//
// Licensed under the same terms of ServiceStack: new BSD license.
//
-
using System;
-using System.Linq.Expressions;
using System.Reflection;
+#if !XBOX
+using System.Linq.Expressions ;
+#endif
namespace ServiceStack.Text.Reflection
{
public static class StaticAccessors
{
public static Func<object, object> GetValueGetter(this PropertyInfo propertyInfo, Type type)
{
- //if (type != propertyInfo.DeclaringType)
- //{
- // throw new ArgumentException();
- //}
+#if SILVERLIGHT || MONOTOUCH || XBOX
+ var getMethodInfo = propertyInfo.GetGetMethod();
+ if (getMethodInfo == null) return null;
+ return x => getMethodInfo.Invoke(x, new object[0]);
+#else
var instance = Expression.Parameter(typeof(object), "i");
var convertInstance = Expression.TypeAs(instance, propertyInfo.DeclaringType);
var property = Expression.Property(convertInstance, propertyInfo);
var convertProperty = Expression.TypeAs(property, typeof(object));
return Expression.Lambda<Func<object, object>>(convertProperty, instance).Compile();
+#endif
}
public static Func<T, object> GetValueGetter<T>(this PropertyInfo propertyInfo)
{
- //Not true for interface types
- //if (typeof(T) != propertyInfo.DeclaringType)
- //{
- // throw new ArgumentException();
- //}
-
-#if SILVERLIGHT || MONOTOUCH
+#if SILVERLIGHT || MONOTOUCH || XBOX
var getMethodInfo = propertyInfo.GetGetMethod();
if (getMethodInfo == null) return null;
return x => getMethodInfo.Invoke(x, new object[0]);
@@ -52,6 +49,7 @@ public static class StaticAccessors
#endif
}
+#if !XBOX
public static Action<T, object> GetValueSetter<T>(this PropertyInfo propertyInfo)
{
if (typeof(T) != propertyInfo.DeclaringType)
@@ -71,6 +69,8 @@ public static class StaticAccessors
setterCall, instance, argument
).Compile();
}
+#endif
}
-}
+}
+
View
15 src/ServiceStack.Text/ReflectionExtensions.cs
@@ -271,7 +271,7 @@ public static EmptyCtorDelegate GetConstructorMethodToCache(Type type)
if (emptyCtor != null)
{
-#if MONOTOUCH || SILVERLIGHT
+#if MONOTOUCH || SILVERLIGHT || XBOX
return () => Activator.CreateInstance(type);
#else
var dm = new System.Reflection.Emit.DynamicMethod("MyCtor", type, Type.EmptyTypes, typeof(ReflectionExtensions).Module, true);
@@ -284,7 +284,7 @@ public static EmptyCtorDelegate GetConstructorMethodToCache(Type type)
#endif
}
-#if SILVERLIGHT
+#if SILVERLIGHT || XBOX
return () => Activator.CreateInstance(type);
#else
//Anonymous types don't have empty constructors
@@ -294,15 +294,8 @@ public static EmptyCtorDelegate GetConstructorMethodToCache(Type type)
public static object CreateInstance(Type type)
{
- try
- {
- var ctorFn = GetConstructorMethod(type);
- return ctorFn();
- }
- catch (Exception ex)
- {
- throw;
- }
+ var ctorFn = GetConstructorMethod( type ) ;
+ return ctorFn( ) ;
}
public static PropertyInfo[] GetPublicProperties(this Type type)
View
138 src/ServiceStack.Text/ServiceStack.Text.XBox360.csproj
@@ -0,0 +1,138 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <ProjectGuid>{E2B0C358-6CC5-4D15-AD73-41730FBF5530}</ProjectGuid>
+ <ProjectTypeGuids>{6D335F3A-9D43-41b4-9D22-F6F17C4BE596};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">Xbox 360</Platform>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>ServiceStack.Text.XBox360</RootNamespace>
+ <AssemblyName>ServiceStack.Text.XBox360</AssemblyName>
+ <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+ <TargetFrameworkProfile>Client</TargetFrameworkProfile>
+ <XnaFrameworkVersion>v4.0</XnaFrameworkVersion>
+ <XnaPlatform>Xbox 360</XnaPlatform>
+ <XnaProfile>HiDef</XnaProfile>
+ <XnaCrossPlatformGroupID>0ed135ea-1216-457e-bc3e-9a191a60dafa</XnaCrossPlatformGroupID>
+ <XnaOutputType>Library</XnaOutputType>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|Xbox 360' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>bin\Xbox 360\Debug</OutputPath>
+ <DefineConstants>DEBUG;TRACE;XBOX;XBOX360</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ <NoStdLib>true</NoStdLib>
+ <UseVSHostingProcess>false</UseVSHostingProcess>
+ <XnaCompressContent>true</XnaCompressContent>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|Xbox 360' ">
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>bin\Xbox 360\Release</OutputPath>
+ <DefineConstants>TRACE;XBOX;XBOX360</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ <NoStdLib>true</NoStdLib>
+ <UseVSHostingProcess>false</UseVSHostingProcess>
+ <XnaCompressContent>true</XnaCompressContent>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="Microsoft.Xna.Framework" />
+ <Reference Include="Microsoft.Xna.Framework.Game" />
+ <Reference Include="Microsoft.Xna.Framework.Graphics" />
+ <Reference Include="Microsoft.Xna.Framework.GamerServices" />
+ <Reference Include="Microsoft.Xna.Framework.Xact" />
+ <Reference Include="Microsoft.Xna.Framework.Video" />
+ <Reference Include="Microsoft.Xna.Framework.Avatar" />
+ <Reference Include="Microsoft.Xna.Framework.Net" />
+ <Reference Include="Microsoft.Xna.Framework.Storage" />
+ <Reference Include="mscorlib" />
+ <Reference Include="System" />
+ <Reference Include="System.Xml" />
+ <Reference Include="System.Core">
+ <RequiredTargetFramework>4.0</RequiredTargetFramework>
+ </Reference>
+ <Reference Include="System.Xml.Linq">
+ <RequiredTargetFramework>4.0</RequiredTargetFramework>
+ </Reference>
+ <Reference Include="System.Net" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="AssemblyUtils.cs" />
+ <Compile Include="CsvConfig.cs" />
+ <Compile Include="JsConfig.cs" />
+ <Compile Include="Common\DeserializeSpecializedCollections.cs" />
+ <Compile Include="Common\JsReader.cs" />
+ <Compile Include="Common\JsState.cs" />
+ <Compile Include="CsvSerializer.cs" />
+ <Compile Include="CsvWriter.cs" />
+ <Compile Include="ITracer.cs" />
+ <Compile Include="JsonObject.cs" />
+ <Compile Include="JsonSerializer.Generic.cs" />
+ <Compile Include="Json\JsonTypeSerializer.cs" />
+ <Compile Include="Jsv\JsvDeserializeType.cs" />
+ <Compile Include="Controller\CommandProcessor.cs" />
+ <Compile Include="Controller\PathInfo.cs" />
+ <Compile Include="JsonSerializer.cs" />
+ <Compile Include="CsvStreamExtensions.cs" />
+ <Compile Include="DateTimeExtensions.cs" />
+ <Compile Include="Env.cs" />
+ <Compile Include="ITypeSerializer.Generic.cs" />
+ <Compile Include="Json\JsonUtils.cs" />
+ <Compile Include="Json\JsonWriter.Generic.cs" />
+ <Compile Include="Common\JsWriter.cs" />
+ <Compile Include="Json\JsonReader.Generic.cs" />
+ <Compile Include="QueryStringSerializer.cs" />
+ <Compile Include="JsvFormatter.cs" />
+ <Compile Include="Common\DateTimeSerializer.cs" />
+ <Compile Include="Common\ITypeSerializer.cs" />
+ <Compile Include="Jsv\JsvReader.Generic.cs" />
+ <Compile Include="Jsv\JsvSerializer.Generic.cs" />
+ <Compile Include="Jsv\JsvWriter.Generic.cs" />
+ <Compile Include="Common\DeserializeArray.cs" />
+ <Compile Include="Common\DeserializeBuiltin.cs" />
+ <Compile Include="Common\DeserializeCollection.cs" />
+ <Compile Include="Common\DeserializeDictionary.cs" />
+ <Compile Include="Common\DeserializeListWithElements.cs" />
+ <Compile Include="Common\ParseUtils.cs" />
+ <Compile Include="Common\StaticParseMethod.cs" />
+ <Compile Include="Common\DeserializeTypeUtils.cs" />
+ <Compile Include="Common\DeserializeType.cs" />
+ <Compile Include="Common\JsDelegates.cs" />
+ <Compile Include="ListExtensions.cs" />
+ <Compile Include="MapExtensions.cs" />
+ <Compile Include="Reflection\StaticAccessors.cs" />
+ <Compile Include="Jsv\JsvTypeSerializer.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ <Compile Include="Common\WriteDictionary.cs" />
+ <Compile Include="Common\WriteLists.cs" />
+ <Compile Include="StreamExtensions.cs" />
+ <Compile Include="StringExtensions.cs" />
+ <Compile Include="Support\AssemblyTypeDefinition.cs" />
+ <Compile Include="Support\DoubleConverter.cs" />
+ <Compile Include="Support\TypePair.cs" />
+ <Compile Include="Tracer.cs" />
+ <Compile Include="TranslateListWithElements.cs" />
+ <Compile Include="TypeConfig.cs" />
+ <Compile Include="TypeSerializer.cs" />
+ <Compile Include="Common\WriteType.cs" />
+ <Compile Include="ReflectionExtensions.cs" />
+ <Compile Include="TextExtensions.cs" />
+ <Compile Include="TypeSerializer.Generic.cs" />
+ <Compile Include="XmlSerializer.cs" />
+ </ItemGroup>
+ <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+ <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\Microsoft.Xna.GameStudio.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>
View
5 src/ServiceStack.Text/ServiceStack.Text.csproj
@@ -31,6 +31,8 @@
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
+ <TargetFrameworkProfile>
+ </TargetFrameworkProfile>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
@@ -72,9 +74,6 @@
<Reference Include="System.Xml.Linq">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
- <Reference Include="System.Data.DataSetExtensions">
- <RequiredTargetFramework>3.5</RequiredTargetFramework>
- </Reference>
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
View
16 src/ServiceStack.Text/StringExtensions.cs
@@ -171,6 +171,7 @@ public static string UrlDecode(this string text)
return sb.ToString();
}
+#if !XBOX
public static string HexEscape(this string text, params char[] anyCharOf)
{
if (string.IsNullOrEmpty(text)) return text;
@@ -194,7 +195,7 @@ public static string HexEscape(this string text, params char[] anyCharOf)
}
return sb.ToString();
}
-
+#endif
public static string HexUnescape(this string text, params char[] anyCharOf)
{
if (string.IsNullOrEmpty(text)) return null;
@@ -390,16 +391,19 @@ public static T FromJson<T>(this string json)
return JsonSerializer.DeserializeFromString<T>(json);
}
+#if !XBOX
public static string ToXml<T>(this T obj)
{
return XmlSerializer.SerializeToString<T>(obj);
}
+#endif
+#if !XBOX
public static T FromXml<T>(this string json)
{
return XmlSerializer.DeserializeFromString<T>(json);
}
-
+#endif
public static string FormatWith(this string text, params object[] args)
{
return string.Format(text, args);
@@ -418,7 +422,15 @@ public static bool StartsWithIgnoreCase(this string text, string startsWith)
public static string ReadAllText(this string filePath)
{
+#if XBOX
+ using( var fileStream = new FileStream( filePath, FileMode.Open, FileAccess.Read ) )
+ {
+ return new StreamReader( fileStream ).ReadToEnd( ) ;
+ }
+#else
return File.ReadAllText(filePath);
+#endif
+
}
public static int IndexOfAny(this string text, params string[] needles)
View
4 src/ServiceStack.Text/Support/DoubleConverter.cs
@@ -21,6 +21,9 @@ public class DoubleConverter
/// <returns>A string representation of the double's exact decimal value.</return>
public static string ToExactString(double d)
{
+#if XBOX
+ return BitConverter.ToString( BitConverter.GetBytes( d ) ) ;
+#else
if (double.IsPositiveInfinity(d))
return "+Infinity";
if (double.IsNegativeInfinity(d))
@@ -89,6 +92,7 @@ public static string ToExactString(double d)
return "-" + ad.ToString();
else
return ad.ToString();
+#endif
}
/// <summary>Private class used for manipulating
View
11 src/ServiceStack.Text/XmlSerializer.cs
@@ -1,12 +1,15 @@
using System;
using System.IO;
+#if !XBOX360
using System.IO.Compression;
+#endif
using System.Runtime.Serialization;
using System.Text;
using System.Xml;
namespace ServiceStack.Text
{
+#if !XBOX
public class XmlSerializer
{
private readonly XmlDictionaryReaderQuotas quotas;
@@ -76,12 +79,7 @@ public static string SerializeToString<T>(T from)
{
using (var xw = new XmlTextWriter(ms, Encoding.UTF8))
{
- if (false)
- {
- xw.Formatting = Formatting.Indented;
- }
-
- var serializer = new System.Runtime.Serialization.DataContractSerializer(from.GetType());
+ var serializer = new DataContractSerializer(from.GetType());
serializer.WriteObject(xw, from);
xw.Flush();
ms.Seek(0, SeekOrigin.Begin);
@@ -144,4 +142,5 @@ public static byte[] Compress<TXmlDto>(TXmlDto from)
}
}
}
+#endif
}
Please sign in to comment.
Something went wrong with that request. Please try again.