diff options
-rw-r--r-- | src/ProtocolBuffers/CodedInputStream.cs | 2 | ||||
-rw-r--r-- | src/ProtocolBuffers/CodedOutputStream.cs | 4 | ||||
-rw-r--r-- | src/ProtocolBuffers/FieldAccess/ReflectionUtil.cs | 9 | ||||
-rw-r--r-- | src/ProtocolBuffers/FieldAccess/RepeatedMessageAccessor.cs | 2 | ||||
-rw-r--r-- | src/ProtocolBuffers/FieldAccess/RepeatedPrimitiveAccessor.cs | 12 | ||||
-rw-r--r-- | src/ProtocolBuffers/FieldAccess/SingleMessageAccessor.cs | 2 | ||||
-rw-r--r-- | src/ProtocolBuffers/FieldAccess/SinglePrimitiveAccessor.cs | 8 | ||||
-rw-r--r-- | src/ProtocolBuffers/FieldSet.cs | 6 | ||||
-rw-r--r-- | src/ProtocolBuffers/GeneratedMessage.cs | 4 | ||||
-rw-r--r-- | src/ProtocolBuffers/MessageStreamIterator.cs | 7 | ||||
-rw-r--r-- | src/ProtocolBuffers/Properties/AssemblyInfo.cs | 2 | ||||
-rw-r--r-- | src/ProtocolBuffers/ProtocolBuffers.csproj | 2 | ||||
-rw-r--r-- | src/ProtocolBuffers/ProtocolBuffersCF.csproj | 143 | ||||
-rw-r--r-- | src/ProtocolBuffers/SortedList.cs (renamed from src/ProtocolBuffers/SortedDictionary.cs) | 2 | ||||
-rw-r--r-- | src/ProtocolBuffers/UnknownFieldSet.cs | 5 |
15 files changed, 180 insertions, 30 deletions
diff --git a/src/ProtocolBuffers/CodedInputStream.cs b/src/ProtocolBuffers/CodedInputStream.cs index 0295d19c..a929df23 100644 --- a/src/ProtocolBuffers/CodedInputStream.cs +++ b/src/ProtocolBuffers/CodedInputStream.cs @@ -163,7 +163,7 @@ namespace Google.ProtocolBuffers { /// Read a double field from the stream. /// </summary> public double ReadDouble() { -#if SILVERLIGHT2 +#if SILVERLIGHT2 || COMPACT_FRAMEWORK_35 byte[] bytes = ReadRawBytes(8); return BitConverter.ToDouble(bytes, 0); #else diff --git a/src/ProtocolBuffers/CodedOutputStream.cs b/src/ProtocolBuffers/CodedOutputStream.cs index bb5e6a20..a7e1eca6 100644 --- a/src/ProtocolBuffers/CodedOutputStream.cs +++ b/src/ProtocolBuffers/CodedOutputStream.cs @@ -332,7 +332,7 @@ namespace Google.ProtocolBuffers { /// </summary> public void WriteDoubleNoTag(double value) { // TODO(jonskeet): Test this on different endiannesses -#if SILVERLIGHT2 +#if SILVERLIGHT2 || COMPACT_FRAMEWORK_35 byte[] bytes = BitConverter.GetBytes(value); WriteRawBytes(bytes, 0, 8); #else @@ -1140,4 +1140,4 @@ namespace Google.ProtocolBuffers { } } } -}
\ No newline at end of file +} diff --git a/src/ProtocolBuffers/FieldAccess/ReflectionUtil.cs b/src/ProtocolBuffers/FieldAccess/ReflectionUtil.cs index c1c3670d..43036f94 100644 --- a/src/ProtocolBuffers/FieldAccess/ReflectionUtil.cs +++ b/src/ProtocolBuffers/FieldAccess/ReflectionUtil.cs @@ -64,13 +64,12 @@ namespace Google.ProtocolBuffers.FieldAccess { public static Func<TSource, object> CreateUpcastDelegateImpl<TSource, TResult>(MethodInfo method) { // Convert the reflection call into an open delegate, i.e. instead of calling x.Method() // we'll call getter(x). - Func<TSource, TResult> getter = (Func<TSource, TResult>)Delegate.CreateDelegate(typeof(Func<TSource, TResult>), method); + Func<TSource, TResult> getter = (Func<TSource, TResult>)Delegate.CreateDelegate(typeof(Func<TSource, TResult>), null, method); // Implicit upcast to object (within the delegate) return delegate(TSource source) { return getter(source); }; } - /// <summary> /// Creates a delegate which will execute the given method after casting the parameter /// down from object to the required parameter type. @@ -84,7 +83,7 @@ namespace Google.ProtocolBuffers.FieldAccess { public static Action<TSource, object> CreateDowncastDelegateImpl<TSource, TParam>(MethodInfo method) { // Convert the reflection call into an open delegate, i.e. instead of calling x.Method(y) we'll // call Method(x, y) - Action<TSource, TParam> call = (Action<TSource, TParam>) Delegate.CreateDelegate(typeof(Action<TSource, TParam>), method); + Action<TSource, TParam> call = (Action<TSource, TParam>) Delegate.CreateDelegate(typeof(Action<TSource, TParam>), null, method); return delegate(TSource source, object parameter) { call(source, (TParam)parameter); }; } @@ -103,7 +102,7 @@ namespace Google.ProtocolBuffers.FieldAccess { // Convert the reflection call into an open delegate, i.e. instead of calling x.Method(y) we'll // call Method(x, y) Func<TSource, TParam, TReturn> call = (Func<TSource, TParam, TReturn>) - Delegate.CreateDelegate(typeof(Func<TSource, TParam, TReturn>), method); + Delegate.CreateDelegate(typeof(Func<TSource, TParam, TReturn>), null, method); return delegate(TSource source, object parameter) { call(source, (TParam)parameter); }; } @@ -118,7 +117,7 @@ namespace Google.ProtocolBuffers.FieldAccess { } public static Func<IBuilder> CreateStaticUpcastDelegateImpl<T>(MethodInfo method) { - Func<T> call = (Func<T>)Delegate.CreateDelegate(typeof(Func<T>), method); + Func<T> call = (Func<T>)Delegate.CreateDelegate(typeof(Func<T>), null, method); return delegate { return (IBuilder)call(); }; } } diff --git a/src/ProtocolBuffers/FieldAccess/RepeatedMessageAccessor.cs b/src/ProtocolBuffers/FieldAccess/RepeatedMessageAccessor.cs index 5cca9748..893b0285 100644 --- a/src/ProtocolBuffers/FieldAccess/RepeatedMessageAccessor.cs +++ b/src/ProtocolBuffers/FieldAccess/RepeatedMessageAccessor.cs @@ -52,7 +52,7 @@ namespace Google.ProtocolBuffers.FieldAccess { private readonly Func<IBuilder> createBuilderDelegate; internal RepeatedMessageAccessor(string name) : base(name) { - MethodInfo createBuilderMethod = ClrType.GetMethod("CreateBuilder", Type.EmptyTypes); + MethodInfo createBuilderMethod = ClrType.GetMethod("CreateBuilder", EmptyTypes); if (createBuilderMethod == null) { throw new ArgumentException("No public static CreateBuilder method declared in " + ClrType.Name); } diff --git a/src/ProtocolBuffers/FieldAccess/RepeatedPrimitiveAccessor.cs b/src/ProtocolBuffers/FieldAccess/RepeatedPrimitiveAccessor.cs index e5bb411a..6bae59cb 100644 --- a/src/ProtocolBuffers/FieldAccess/RepeatedPrimitiveAccessor.cs +++ b/src/ProtocolBuffers/FieldAccess/RepeatedPrimitiveAccessor.cs @@ -35,7 +35,7 @@ using System.Reflection; namespace Google.ProtocolBuffers.FieldAccess { /// <summary> - /// Accesor for a repeated field of type int, ByteString etc. + /// Accessor for a repeated field of type int, ByteString etc. /// </summary> internal class RepeatedPrimitiveAccessor<TMessage, TBuilder> : IFieldAccessor<TMessage, TBuilder> where TMessage : IMessage<TMessage, TBuilder> @@ -49,7 +49,9 @@ namespace Google.ProtocolBuffers.FieldAccess { private readonly Func<TMessage, int> countDelegate; private readonly MethodInfo getElementMethod; private readonly MethodInfo setElementMethod; - + + // Replacement for Type.EmptyTypes which apparently isn't available on the compact framework + internal static readonly Type[] EmptyTypes = new Type[0]; /// <summary> /// The CLR type of the field (int, the enum type, ByteString, the message etc). @@ -64,7 +66,7 @@ namespace Google.ProtocolBuffers.FieldAccess { PropertyInfo messageProperty = typeof(TMessage).GetProperty(name + "List"); PropertyInfo builderProperty = typeof(TBuilder).GetProperty(name + "List"); PropertyInfo countProperty = typeof(TMessage).GetProperty(name + "Count"); - MethodInfo clearMethod = typeof(TBuilder).GetMethod("Clear" + name, Type.EmptyTypes); + MethodInfo clearMethod = typeof(TBuilder).GetMethod("Clear" + name, EmptyTypes); getElementMethod = typeof(TMessage).GetMethod("Get" + name, new Type[] { typeof(int) }); clrType = getElementMethod.ReturnType; MethodInfo addMethod = typeof(TBuilder).GetMethod("Add" + name, new Type[] { ClrType }); @@ -78,9 +80,9 @@ namespace Google.ProtocolBuffers.FieldAccess { || setElementMethod == null) { throw new ArgumentException("Not all required properties/methods available"); } - clearDelegate = (Func<TBuilder, IBuilder>)Delegate.CreateDelegate(typeof(Func<TBuilder, IBuilder>), clearMethod); + clearDelegate = (Func<TBuilder, IBuilder>)Delegate.CreateDelegate(typeof(Func<TBuilder, IBuilder>), null, clearMethod); countDelegate = (Func<TMessage, int>)Delegate.CreateDelegate - (typeof(Func<TMessage, int>), countProperty.GetGetMethod()); + (typeof(Func<TMessage, int>), null, countProperty.GetGetMethod()); getValueDelegate = ReflectionUtil.CreateUpcastDelegate<TMessage>(messageProperty.GetGetMethod()); addValueDelegate = ReflectionUtil.CreateDowncastDelegateIgnoringReturn<TBuilder>(addMethod); getRepeatedWrapperDelegate = ReflectionUtil.CreateUpcastDelegate<TBuilder>(builderProperty.GetGetMethod()); diff --git a/src/ProtocolBuffers/FieldAccess/SingleMessageAccessor.cs b/src/ProtocolBuffers/FieldAccess/SingleMessageAccessor.cs index 9ce2cbb1..ea422c94 100644 --- a/src/ProtocolBuffers/FieldAccess/SingleMessageAccessor.cs +++ b/src/ProtocolBuffers/FieldAccess/SingleMessageAccessor.cs @@ -48,7 +48,7 @@ namespace Google.ProtocolBuffers.FieldAccess { private readonly Func<IBuilder> createBuilderDelegate; internal SingleMessageAccessor(string name) : base(name) { - MethodInfo createBuilderMethod = ClrType.GetMethod("CreateBuilder", Type.EmptyTypes); + MethodInfo createBuilderMethod = ClrType.GetMethod("CreateBuilder", EmptyTypes); if (createBuilderMethod == null) { throw new ArgumentException("No public static CreateBuilder method declared in " + ClrType.Name); } diff --git a/src/ProtocolBuffers/FieldAccess/SinglePrimitiveAccessor.cs b/src/ProtocolBuffers/FieldAccess/SinglePrimitiveAccessor.cs index 8b3153a1..1bc1d8ee 100644 --- a/src/ProtocolBuffers/FieldAccess/SinglePrimitiveAccessor.cs +++ b/src/ProtocolBuffers/FieldAccess/SinglePrimitiveAccessor.cs @@ -46,6 +46,8 @@ namespace Google.ProtocolBuffers.FieldAccess { private readonly Func<TMessage, bool> hasDelegate; private readonly Func<TBuilder, IBuilder> clearDelegate; + internal static readonly Type[] EmptyTypes = new Type[0]; + /// <summary> /// The CLR type of the field (int, the enum type, ByteString, the message etc). /// As declared by the property. @@ -59,13 +61,13 @@ namespace Google.ProtocolBuffers.FieldAccess { PropertyInfo builderProperty = typeof(TBuilder).GetProperty(name); if (builderProperty == null) builderProperty = typeof(TBuilder).GetProperty(name); PropertyInfo hasProperty = typeof(TMessage).GetProperty("Has" + name); - MethodInfo clearMethod = typeof(TBuilder).GetMethod("Clear" + name, Type.EmptyTypes); + MethodInfo clearMethod = typeof(TBuilder).GetMethod("Clear" + name, EmptyTypes); if (messageProperty == null || builderProperty == null || hasProperty == null || clearMethod == null) { throw new ArgumentException("Not all required properties/methods available"); } clrType = messageProperty.PropertyType; - hasDelegate = (Func<TMessage, bool>)Delegate.CreateDelegate(typeof(Func<TMessage, bool>), hasProperty.GetGetMethod()); - clearDelegate = (Func<TBuilder, IBuilder>)Delegate.CreateDelegate(typeof(Func<TBuilder, IBuilder>), clearMethod); + hasDelegate = (Func<TMessage, bool>)Delegate.CreateDelegate(typeof(Func<TMessage, bool>), null, hasProperty.GetGetMethod()); + clearDelegate = (Func<TBuilder, IBuilder>)Delegate.CreateDelegate(typeof(Func<TBuilder, IBuilder>), null ,clearMethod); getValueDelegate = ReflectionUtil.CreateUpcastDelegate<TMessage>(messageProperty.GetGetMethod()); setValueDelegate = ReflectionUtil.CreateDowncastDelegate<TBuilder>(builderProperty.GetSetMethod()); } diff --git a/src/ProtocolBuffers/FieldSet.cs b/src/ProtocolBuffers/FieldSet.cs index 0c5c63d9..7c373b95 100644 --- a/src/ProtocolBuffers/FieldSet.cs +++ b/src/ProtocolBuffers/FieldSet.cs @@ -65,8 +65,8 @@ namespace Google.ProtocolBuffers { } public static FieldSet CreateInstance() { - // Use SortedDictionary to keep fields in the canonical order - return new FieldSet(new SortedDictionary<FieldDescriptor, object>()); + // Use SortedList to keep fields in the canonical order + return new FieldSet(new SortedList<FieldDescriptor, object>()); } /// <summary> @@ -85,7 +85,7 @@ namespace Google.ProtocolBuffers { } if (hasRepeats) { - var tmp = new SortedDictionary<FieldDescriptor, object>(); + var tmp = new SortedList<FieldDescriptor, object>(); foreach (KeyValuePair<FieldDescriptor, object> entry in fields) { IList<object> list = entry.Value as IList<object>; tmp[entry.Key] = list == null ? entry.Value : Lists.AsReadOnly(list); diff --git a/src/ProtocolBuffers/GeneratedMessage.cs b/src/ProtocolBuffers/GeneratedMessage.cs index 1e336740..d60f2b9c 100644 --- a/src/ProtocolBuffers/GeneratedMessage.cs +++ b/src/ProtocolBuffers/GeneratedMessage.cs @@ -69,8 +69,8 @@ namespace Google.ProtocolBuffers { internal IDictionary<FieldDescriptor, Object> GetMutableFieldMap() { - // Use a SortedDictionary so we'll end up serializing fields in order - var ret = new SortedDictionary<FieldDescriptor, object>(); + // Use a SortedList so we'll end up serializing fields in order + var ret = new SortedList<FieldDescriptor, object>(); MessageDescriptor descriptor = DescriptorForType; foreach (FieldDescriptor field in descriptor.Fields) { IFieldAccessor<TMessage, TBuilder> accessor = InternalFieldAccessors[field]; diff --git a/src/ProtocolBuffers/MessageStreamIterator.cs b/src/ProtocolBuffers/MessageStreamIterator.cs index 68519e0f..0466262b 100644 --- a/src/ProtocolBuffers/MessageStreamIterator.cs +++ b/src/ProtocolBuffers/MessageStreamIterator.cs @@ -54,6 +54,9 @@ namespace Google.ProtocolBuffers { private readonly ExtensionRegistry extensionRegistry; private readonly int sizeLimit; + // Type.EmptyTypes isn't present on the compact framework + private static readonly Type[] EmptyTypes = new Type[0]; + /// <summary> /// Delegate created via reflection trickery (once per type) to create a builder /// and read a message from a CodedInputStream with it. Note that unlike in Java, @@ -77,7 +80,7 @@ namespace Google.ProtocolBuffers { Type builderType = FindBuilderType(); // Yes, it's redundant to find this again, but it's only the once... - MethodInfo createBuilderMethod = typeof(TMessage).GetMethod("CreateBuilder", Type.EmptyTypes); + MethodInfo createBuilderMethod = typeof(TMessage).GetMethod("CreateBuilder", EmptyTypes); Delegate builderBuilder = Delegate.CreateDelegate( typeof(Func<>).MakeGenericType(builderType), null, createBuilderMethod); @@ -102,7 +105,7 @@ namespace Google.ProtocolBuffers { /// Works out the builder type for TMessage, or throws an ArgumentException to explain why it can't. /// </summary> private static Type FindBuilderType() { - MethodInfo createBuilderMethod = typeof(TMessage).GetMethod("CreateBuilder", Type.EmptyTypes); + MethodInfo createBuilderMethod = typeof(TMessage).GetMethod("CreateBuilder", EmptyTypes); if (createBuilderMethod == null) { throw new ArgumentException("Message type " + typeof(TMessage).FullName + " has no CreateBuilder method."); } diff --git a/src/ProtocolBuffers/Properties/AssemblyInfo.cs b/src/ProtocolBuffers/Properties/AssemblyInfo.cs index 8d587d18..7438aac1 100644 --- a/src/ProtocolBuffers/Properties/AssemblyInfo.cs +++ b/src/ProtocolBuffers/Properties/AssemblyInfo.cs @@ -64,7 +64,9 @@ using System.Runtime.CompilerServices; // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] +#if !COMPACT_FRAMEWORK_35 [assembly: AssemblyFileVersion("1.0.0.0")] +#endif [assembly:InternalsVisibleTo("Google.ProtocolBuffers.Test,PublicKey="+ "00240000048000009400000006020000002400005253413100040000010001008179f2dd31a648"+ diff --git a/src/ProtocolBuffers/ProtocolBuffers.csproj b/src/ProtocolBuffers/ProtocolBuffers.csproj index c58ac125..703a8235 100644 --- a/src/ProtocolBuffers/ProtocolBuffers.csproj +++ b/src/ProtocolBuffers/ProtocolBuffers.csproj @@ -114,7 +114,7 @@ <Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="RpcUtil.cs" /> <Compile Include="SilverlightCompatibility.cs" /> - <Compile Include="SortedDictionary.cs" /> + <Compile Include="SortedList.cs" /> <Compile Include="TextFormat.cs" /> <Compile Include="TextGenerator.cs" /> <Compile Include="TextTokenizer.cs" /> diff --git a/src/ProtocolBuffers/ProtocolBuffersCF.csproj b/src/ProtocolBuffers/ProtocolBuffersCF.csproj new file mode 100644 index 00000000..78b83838 --- /dev/null +++ b/src/ProtocolBuffers/ProtocolBuffersCF.csproj @@ -0,0 +1,143 @@ +<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5"> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ProductVersion>9.0.30729</ProductVersion> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{49B51802-9D09-4AD8-A0EE-0DA704EFA379}</ProjectGuid> + <OutputType>Library</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <RootNamespace>Google.ProtocolBuffers</RootNamespace> + <AssemblyName>Google.ProtocolBuffers</AssemblyName> + <ProjectTypeGuids>{4D628B5B-2FBC-4AA6-8C16-197242AEB884};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <PlatformFamilyName>PocketPC</PlatformFamilyName> + <PlatformID>b2c48bd2-963d-4549-9169-1fa021dce484</PlatformID> + <OSVersion>5.2</OSVersion> + <DeployDirSuffix>compactframework</DeployDirSuffix> + <TargetFrameworkVersion>v3.5</TargetFrameworkVersion> + <NativePlatformName>Windows Mobile 6 Professional SDK</NativePlatformName> + <FormFactorID> + </FormFactorID> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>bin\Debug\</OutputPath> + <DefineConstants>COMPACT_FRAMEWORK_35;DEBUG;TRACE;$(PlatformFamilyName)</DefineConstants> + <NoStdLib>true</NoStdLib> + <NoConfig>true</NoConfig> + <ErrorReport>prompt</ErrorReport> + <FileAlignment>512</FileAlignment> + <WarningLevel>4</WarningLevel> + <GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + <DebugType>pdbonly</DebugType> + <Optimize>true</Optimize> + <OutputPath>bin\Release\</OutputPath> + <DefineConstants>COMPACT_FRAMEWORK_35;TRACE;$(PlatformFamilyName)</DefineConstants> + <NoStdLib>true</NoStdLib> + <NoConfig>true</NoConfig> + <ErrorReport>prompt</ErrorReport> + <FileAlignment>512</FileAlignment> + <WarningLevel>4</WarningLevel> + <GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies> + </PropertyGroup> + <ItemGroup> + <Reference Include="mscorlib" /> + <Reference Include="System" /> + </ItemGroup> + <ItemGroup> + <Compile Include="AbstractBuilder.cs" /> + <Compile Include="AbstractMessage.cs" /> + <Compile Include="ByteString.cs" /> + <Compile Include="CodedInputStream.cs" /> + <Compile Include="CodedOutputStream.cs" /> + <Compile Include="Collections\Dictionaries.cs" /> + <Compile Include="Collections\Enumerables.cs" /> + <Compile Include="Collections\IPopsicleList.cs" /> + <Compile Include="Collections\Lists.cs" /> + <Compile Include="Collections\PopsicleList.cs" /> + <Compile Include="Collections\ReadOnlyDictionary.cs" /> + <Compile Include="Delegates.cs" /> + <Compile Include="DescriptorProtos\CSharpOptions.cs" /> + <Compile Include="DescriptorProtos\DescriptorProtoFile.cs" /> + <Compile Include="DescriptorProtos\IDescriptorProto.cs" /> + <Compile Include="DescriptorProtos\PartialClasses.cs" /> + <Compile Include="Descriptors\DescriptorBase.cs" /> + <Compile Include="Descriptors\DescriptorPool.cs" /> + <Compile Include="Descriptors\DescriptorUtil.cs" /> + <Compile Include="Descriptors\DescriptorValidationException.cs" /> + <Compile Include="Descriptors\EnumDescriptor.cs" /> + <Compile Include="Descriptors\EnumValueDescriptor.cs" /> + <Compile Include="Descriptors\FieldDescriptor.cs" /> + <Compile Include="Descriptors\FieldMappingAttribute.cs" /> + <Compile Include="Descriptors\FieldType.cs" /> + <Compile Include="Descriptors\FileDescriptor.cs" /> + <Compile Include="Descriptors\IDescriptor.cs" /> + <Compile Include="Descriptors\IndexedDescriptorBase.cs" /> + <Compile Include="Descriptors\MappedType.cs" /> + <Compile Include="Descriptors\MessageDescriptor.cs" /> + <Compile Include="Descriptors\MethodDescriptor.cs" /> + <Compile Include="Descriptors\PackageDescriptor.cs" /> + <Compile Include="Descriptors\ServiceDescriptor.cs" /> + <Compile Include="DynamicMessage.cs" /> + <Compile Include="ExtendableBuilder.cs" /> + <Compile Include="ExtendableMessage.cs" /> + <Compile Include="ExtensionInfo.cs" /> + <Compile Include="ExtensionRegistry.cs" /> + <Compile Include="FieldAccess\FieldAccessorTable.cs" /> + <Compile Include="FieldAccess\IFieldAccessor.cs" /> + <Compile Include="FieldAccess\ReflectionUtil.cs" /> + <Compile Include="FieldAccess\RepeatedEnumAccessor.cs" /> + <Compile Include="FieldAccess\RepeatedMessageAccessor.cs" /> + <Compile Include="FieldAccess\RepeatedPrimitiveAccessor.cs" /> + <Compile Include="FieldAccess\SingleEnumAccessor.cs" /> + <Compile Include="FieldAccess\SingleMessageAccessor.cs" /> + <Compile Include="FieldAccess\SinglePrimitiveAccessor.cs" /> + <Compile Include="FieldSet.cs" /> + <Compile Include="GeneratedBuilder.cs" /> + <Compile Include="GeneratedExtensionBase.cs" /> + <Compile Include="GeneratedMessage.cs" /> + <Compile Include="GeneratedRepeatExtension.cs" /> + <Compile Include="GeneratedSingleExtension.cs" /> + <Compile Include="IBuilder.cs" /> + <Compile Include="IMessage.cs" /> + <Compile Include="InvalidProtocolBufferException.cs" /> + <Compile Include="IRpcChannel.cs" /> + <Compile Include="IRpcController.cs" /> + <Compile Include="IService.cs" /> + <Compile Include="MessageStreamIterator.cs" /> + <Compile Include="MessageStreamWriter.cs" /> + <Compile Include="MessageUtil.cs" /> + <Compile Include="NameHelpers.cs" /> + <Compile Include="Properties\AssemblyInfo.cs" /> + <Compile Include="RpcUtil.cs" /> + <Compile Include="SilverlightCompatibility.cs" /> + <Compile Include="SortedList.cs" /> + <Compile Include="TextFormat.cs" /> + <Compile Include="TextGenerator.cs" /> + <Compile Include="TextTokenizer.cs" /> + <Compile Include="ThrowHelper.cs" /> + <Compile Include="UninitializedMessageException.cs" /> + <Compile Include="UnknownField.cs" /> + <Compile Include="UnknownFieldSet.cs" /> + <Compile Include="WireFormat.cs" /> + </ItemGroup> + <Import Project="$(MSBuildBinPath)\Microsoft.CompactFramework.CSharp.targets" /> + <ProjectExtensions> + <VisualStudio> + <FlavorProperties GUID="{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}"> + <HostingProcess disable="1" /> + </FlavorProperties> + </VisualStudio> + </ProjectExtensions> + <!-- 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>
\ No newline at end of file diff --git a/src/ProtocolBuffers/SortedDictionary.cs b/src/ProtocolBuffers/SortedList.cs index be0975b5..e9f4458e 100644 --- a/src/ProtocolBuffers/SortedDictionary.cs +++ b/src/ProtocolBuffers/SortedList.cs @@ -46,7 +46,7 @@ namespace Google.ProtocolBuffers /// This is only used for Silverlight, which doesn't have the normal /// sorted collections. /// </summary> - internal sealed class SortedDictionary<TKey, TValue> : IDictionary<TKey, TValue> + internal sealed class SortedList<TKey, TValue> : IDictionary<TKey, TValue> { private readonly IDictionary<TKey, TValue> wrapped = new Dictionary<TKey, TValue>(); diff --git a/src/ProtocolBuffers/UnknownFieldSet.cs b/src/ProtocolBuffers/UnknownFieldSet.cs index 2a955fc6..49c1fa32 100644 --- a/src/ProtocolBuffers/UnknownFieldSet.cs +++ b/src/ProtocolBuffers/UnknownFieldSet.cs @@ -243,11 +243,10 @@ namespace Google.ProtocolBuffers { public sealed class Builder { /// <summary> - /// Mapping from number to field. Note that by using a SortedDictionary we ensure + /// Mapping from number to field. Note that by using a SortedList we ensure /// that the fields will be serialized in ascending order. /// </summary> - private IDictionary<int, UnknownField> fields = new SortedDictionary<int, UnknownField>(); - + private IDictionary<int, UnknownField> fields = new SortedList<int, UnknownField>(); // Optimization: We keep around a builder for the last field that was // modified so that we can efficiently add to it multiple times in a // row (important when parsing an unknown repeated field). |