Skip to content

Commit

Permalink
Migrated to .NET 4.5 PCL.
Browse files Browse the repository at this point in the history
  • Loading branch information
artema committed Dec 5, 2013
1 parent b835a65 commit 24bef55
Show file tree
Hide file tree
Showing 18 changed files with 137 additions and 115 deletions.
28 changes: 15 additions & 13 deletions DotAmf.sln
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DotAmf", "Src\DotAmf\DotAmf.csproj", "{DBF8762E-17D7-4AAE-9F06-133DE9870FBC}"
EndProject
# Visual Studio 2013
VisualStudioVersion = 12.0.21005.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DotAmf.Wcf", "Src\DotAmf.Wcf\DotAmf.Wcf.csproj", "{7F1303A6-9994-490E-B6B3-BDC5113281EE}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Examples", "Examples", "{3B6BCA40-E0E2-41FF-AB07-BDA371D65A2E}"
Expand All @@ -13,6 +13,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{BB6A307C
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DotAmf", "Tests\DotAmf\DotAmf.csproj", "{CE809E33-59C8-4C66-81AE-2F99207CEC9A}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DotAmf", "Src\DotAmf\DotAmf.csproj", "{C98B985D-3FAA-4827-84AA-85B0F3B91C46}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -23,16 +25,6 @@ Global
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{DBF8762E-17D7-4AAE-9F06-133DE9870FBC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DBF8762E-17D7-4AAE-9F06-133DE9870FBC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DBF8762E-17D7-4AAE-9F06-133DE9870FBC}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{DBF8762E-17D7-4AAE-9F06-133DE9870FBC}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{DBF8762E-17D7-4AAE-9F06-133DE9870FBC}.Debug|x86.ActiveCfg = Debug|Any CPU
{DBF8762E-17D7-4AAE-9F06-133DE9870FBC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DBF8762E-17D7-4AAE-9F06-133DE9870FBC}.Release|Any CPU.Build.0 = Release|Any CPU
{DBF8762E-17D7-4AAE-9F06-133DE9870FBC}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{DBF8762E-17D7-4AAE-9F06-133DE9870FBC}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{DBF8762E-17D7-4AAE-9F06-133DE9870FBC}.Release|x86.ActiveCfg = Release|Any CPU
{7F1303A6-9994-490E-B6B3-BDC5113281EE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7F1303A6-9994-490E-B6B3-BDC5113281EE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7F1303A6-9994-490E-B6B3-BDC5113281EE}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
Expand Down Expand Up @@ -63,6 +55,16 @@ Global
{CE809E33-59C8-4C66-81AE-2F99207CEC9A}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{CE809E33-59C8-4C66-81AE-2F99207CEC9A}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{CE809E33-59C8-4C66-81AE-2F99207CEC9A}.Release|x86.ActiveCfg = Release|Any CPU
{C98B985D-3FAA-4827-84AA-85B0F3B91C46}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C98B985D-3FAA-4827-84AA-85B0F3B91C46}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C98B985D-3FAA-4827-84AA-85B0F3B91C46}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{C98B985D-3FAA-4827-84AA-85B0F3B91C46}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{C98B985D-3FAA-4827-84AA-85B0F3B91C46}.Debug|x86.ActiveCfg = Debug|Any CPU
{C98B985D-3FAA-4827-84AA-85B0F3B91C46}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C98B985D-3FAA-4827-84AA-85B0F3B91C46}.Release|Any CPU.Build.0 = Release|Any CPU
{C98B985D-3FAA-4827-84AA-85B0F3B91C46}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{C98B985D-3FAA-4827-84AA-85B0F3B91C46}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{C98B985D-3FAA-4827-84AA-85B0F3B91C46}.Release|x86.ActiveCfg = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
9 changes: 6 additions & 3 deletions Examples/ExampleService/ExampleService.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,14 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>ExampleService</RootNamespace>
<AssemblyName>ExampleService</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<WcfConfigValidationEnabled>True</WcfConfigValidationEnabled>
<UseIISExpress>true</UseIISExpress>
<IISExpressSSLPort />
<IISExpressAnonymousAuthentication />
<IISExpressWindowsAuthentication />
<IISExpressUseClassicPipelineMode />
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
Expand All @@ -29,6 +30,7 @@
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
Expand All @@ -37,15 +39,16 @@
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Web.DynamicData" />
<Reference Include="System.Web.Entity" />
<Reference Include="System.Web.ApplicationServices" />
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.EnterpriseServices" />
Expand Down Expand Up @@ -89,7 +92,7 @@
<Name>DotAmf.Wcf</Name>
</ProjectReference>
<ProjectReference Include="..\..\Src\DotAmf\DotAmf.csproj">
<Project>{dbf8762e-17d7-4aae-9f06-133de9870fbc}</Project>
<Project>{c98b985d-3faa-4827-84aa-85b0f3b91c46}</Project>
<Name>DotAmf</Name>
</ProjectReference>
</ItemGroup>
Expand Down
17 changes: 10 additions & 7 deletions Src/DotAmf.Wcf/DotAmf.Wcf.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>DotAmf.ServiceModel</RootNamespace>
<AssemblyName>DotAmf.Wcf</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
Expand All @@ -21,6 +22,7 @@
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
Expand All @@ -29,6 +31,7 @@
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
Expand Down Expand Up @@ -97,19 +100,19 @@
<Compile Include="Messaging\RemotingMessage.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\DotAmf\DotAmf.csproj">
<Project>{DBF8762E-17D7-4AAE-9F06-133DE9870FBC}</Project>
<Name>DotAmf</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Errors.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Errors.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\DotAmf\DotAmf.csproj">
<Project>{c98b985d-3faa-4827-84aa-85b0f3b91c46}</Project>
<Name>DotAmf</Name>
</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
2 changes: 1 addition & 1 deletion Src/DotAmf.Wcf/Errors.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions Src/DotAmf/Decoder/Amf0Decoder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ private static string ReadUtf8(AmfStreamReader reader, uint length)
var data = reader.ReadBytes((int)length);

//All strings are encoded in UTF-8)
return Encoding.UTF8.GetString(data);
return Encoding.UTF8.GetString(data, 0, data.Length);
}
#endregion

Expand Down Expand Up @@ -390,7 +390,7 @@ private void ReadObject(AmfContext context, AmfStreamReader reader, XmlWriter ou
//Read properties
using (var ms = new MemoryStream())
{
var buffer = new XmlTextWriter(ms, Encoding.UTF8);
var buffer = XmlWriter.Create(ms);
buffer.WriteStartElement("buffer");
buffer.WriteAttributeString("xmlns", AmfxContent.Namespace);

Expand Down Expand Up @@ -419,7 +419,7 @@ private void ReadObject(AmfContext context, AmfStreamReader reader, XmlWriter ou
if (members.Count > 0)
{
ms.Position = 0;
var bufferreader = new XmlTextReader(ms);
var bufferreader = XmlReader.Create(ms);
bufferreader.Read();
bufferreader.ReadStartElement();

Expand Down
16 changes: 11 additions & 5 deletions Src/DotAmf/Decoder/Amf3Decoder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ private static string ReadUtf8(AmfStreamReader reader, int length)
var data = reader.ReadBytes(length);

//All strings are encoded in UTF-8
return Encoding.UTF8.GetString(data);
return Encoding.UTF8.GetString(data, 0, data.Length);
}

/// <summary>
Expand Down Expand Up @@ -672,9 +672,14 @@ private void ReadObject(AmfContext context, AmfStreamReader reader, XmlWriter ou
#region Reading object members
var members = new List<string>();

var buffer = new XmlTextWriter(ms, Encoding.UTF8);
buffer.WriteStartElement("buffer");
buffer.WriteAttributeString("xmlns", AmfxContent.Namespace);
var settings = new XmlWriterSettings
{

};

var buffer = XmlWriter.Create(ms, settings);
buffer.WriteStartDocument();
buffer.WriteStartElement("buffer", AmfxContent.Namespace);

#if DEBUG
var memberPosition = 0;
Expand Down Expand Up @@ -720,6 +725,7 @@ private void ReadObject(AmfContext context, AmfStreamReader reader, XmlWriter ou
}

buffer.WriteEndElement();
buffer.WriteEndDocument();
buffer.Flush();
#endregion

Expand Down Expand Up @@ -768,7 +774,7 @@ private void ReadObject(AmfContext context, AmfStreamReader reader, XmlWriter ou
if (members.Count > 0)
{
ms.Position = 0;
var bufferreader = new XmlTextReader(ms);
var bufferreader = XmlReader.Create(ms);
bufferreader.Read();
bufferreader.ReadStartElement();

Expand Down
21 changes: 8 additions & 13 deletions Src/DotAmf/DotAmf.csproj
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<MinimumVisualStudioVersion>10.0</MinimumVisualStudioVersion>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{DBF8762E-17D7-4AAE-9F06-133DE9870FBC}</ProjectGuid>
<ProjectGuid>{C98B985D-3FAA-4827-84AA-85B0F3B91C46}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>DotAmf</RootNamespace>
<AssemblyName>DotAmf</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkProfile>Profile158</TargetFrameworkProfile>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
<ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
Expand All @@ -32,12 +33,7 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Runtime.Serialization" />
<Reference Include="System.Xml" />
<!-- A reference to the entire .NET Framework is automatically included -->
</ItemGroup>
<ItemGroup>
<Compile Include="Data\Amf0TypeMarker.cs" />
Expand Down Expand Up @@ -81,8 +77,7 @@
<SubType>Designer</SubType>
</EmbeddedResource>
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.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.
<Target Name="BeforeBuild">
Expand Down
15 changes: 5 additions & 10 deletions Src/DotAmf/Encoder/Amf0Encoder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,6 @@ protected override void WriteAmfValue(AmfContext context, XmlReader input, AmfSt
default:
throw new NotSupportedException("Unexpected AMFX type: " + reader.Name);
}

reader.Close();
#endregion
}

Expand Down Expand Up @@ -163,7 +161,7 @@ private static void WriteNumber(AmfStreamWriter writer, XmlReader input)
{
WriteTypeMarker(writer, Amf0TypeMarker.Number);

var value = Convert.ToDouble(input.ReadString());
var value = input.ReadContentAsDouble();
writer.Write(value);
}

Expand All @@ -173,8 +171,8 @@ private static void WriteNumber(AmfStreamWriter writer, XmlReader input)
private static void WriteString(AmfStreamWriter writer, XmlReader input)
{
var value = input.IsEmptyElement
? string.Empty
: input.ReadString();
? string.Empty
: input.ReadContentAsString();

WriteString(writer, value);
}
Expand Down Expand Up @@ -241,7 +239,7 @@ private static void WriteReference(AmfContext context, AmfStreamWriter writer, X
/// </summary>
private static void WriteDate(AmfStreamWriter writer, XmlReader input)
{
var value = Convert.ToDouble(input.ReadString());
var value = input.ReadContentAsDouble();
WriteDate(writer, value);
}

Expand All @@ -260,7 +258,7 @@ private static void WriteDate(AmfStreamWriter writer, double value)
/// </summary>
private static void WriteXml(AmfStreamWriter writer, XmlReader input)
{
var value = input.ReadString();
var value = input.ReadContentAsString();
var data = Encoding.UTF8.GetBytes(value);
WriteXml(writer, data);
}
Expand Down Expand Up @@ -301,7 +299,6 @@ private void WriteArray(AmfContext context, AmfStreamWriter writer, XmlReader in
var itemreader = input.ReadSubtree();
itemreader.MoveToContent();
WriteAmfValue(context, itemreader, writer);
itemreader.Close();
}
}
}
Expand Down Expand Up @@ -339,7 +336,6 @@ private void WriteObject(AmfContext context, AmfStreamWriter writer, XmlReader i
members.Add(traitsReader.ReadElementContentAsString());

traits.ClassMembers = members.ToArray();
traitsReader.Close();
}

break;
Expand Down Expand Up @@ -376,7 +372,6 @@ private void WriteObject(AmfContext context, AmfStreamWriter writer, XmlReader i
WriteUtf8(writer, memberName);
WriteAmfValue(context, memberReader, writer);

memberReader.Close();
i++;
}
#endregion
Expand Down
Loading

0 comments on commit 24bef55

Please sign in to comment.