Commit 5407a432 authored by Jon Skeet's avatar Jon Skeet

Signed the test assembly, and added InternalsVisibleTo. Some public members now internal again.

parent 38d453d3
...@@ -12,6 +12,8 @@ ...@@ -12,6 +12,8 @@
<AssemblyName>Google.ProtocolBuffers.Test</AssemblyName> <AssemblyName>Google.ProtocolBuffers.Test</AssemblyName>
<TargetFrameworkVersion>v2.0</TargetFrameworkVersion> <TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment> <FileAlignment>512</FileAlignment>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>Properties\ProtocolBuffers.Test.snk</AssemblyOriginatorKeyFile>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols> <DebugSymbols>true</DebugSymbols>
...@@ -75,6 +77,9 @@ ...@@ -75,6 +77,9 @@
<Name>ProtocolBuffers</Name> <Name>ProtocolBuffers</Name>
</ProjectReference> </ProjectReference>
</ItemGroup> </ItemGroup>
<ItemGroup>
<None Include="Properties\ProtocolBuffers.Test.snk" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. <!-- 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. Other similar extension points exist, see Microsoft.Common.targets.
......
...@@ -60,8 +60,7 @@ namespace Google.ProtocolBuffers.Descriptors { ...@@ -60,8 +60,7 @@ namespace Google.ProtocolBuffers.Descriptors {
/// Finds an enum value by number. If multiple enum values have the /// Finds an enum value by number. If multiple enum values have the
/// same number, this returns the first defined value with that number. /// same number, this returns the first defined value with that number.
/// </summary> /// </summary>
// TODO(jonskeet): Make internal and use InternalsVisibleTo? internal EnumValueDescriptor FindValueByNumber(int number) {
public EnumValueDescriptor FindValueByNumber(int number) {
return File.DescriptorPool.FindEnumValueByNumber(this, number); return File.DescriptorPool.FindEnumValueByNumber(this, number);
} }
...@@ -70,8 +69,7 @@ namespace Google.ProtocolBuffers.Descriptors { ...@@ -70,8 +69,7 @@ namespace Google.ProtocolBuffers.Descriptors {
/// </summary> /// </summary>
/// <param name="name">The unqualified name of the value (e.g. "FOO").</param> /// <param name="name">The unqualified name of the value (e.g. "FOO").</param>
/// <returns>The value's descriptor, or null if not found.</returns> /// <returns>The value's descriptor, or null if not found.</returns>
// TODO(jonskeet): Make internal and use InternalsVisibleTo? internal EnumValueDescriptor FindValueByName(string name) {
public EnumValueDescriptor FindValueByName(string name) {
return File.DescriptorPool.FindSymbol<EnumValueDescriptor>(FullName + "." + name); return File.DescriptorPool.FindSymbol<EnumValueDescriptor>(FullName + "." + name);
} }
} }
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
// limitations under the License. // limitations under the License.
using System.Reflection; using System.Reflection;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Runtime.CompilerServices;
// General Information about an assembly is controlled through the following // General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information // set of attributes. Change these attribute values to modify the information
...@@ -47,3 +48,10 @@ using System.Runtime.InteropServices; ...@@ -47,3 +48,10 @@ using System.Runtime.InteropServices;
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
[assembly:InternalsVisibleTo("Google.ProtocolBuffers.Test,PublicKey="+
"00240000048000009400000006020000002400005253413100040000010001008179f2dd31a648"+
"2a2359dbe33e53701167a888e7c369a9ae3210b64f93861d8a7d286447e58bc167e3d99483beda"+
"72f738140072bb69990bc4f98a21365de2c105e848974a3d210e938b0a56103c0662901efd6b78"+
"0ee6dbe977923d46a8fda18fb25c65dd73b149a5cd9f3100668b56649932dadd8cf5be52eb1dce"+
"ad5cedbf")]
...@@ -203,23 +203,19 @@ namespace Google.ProtocolBuffers { ...@@ -203,23 +203,19 @@ namespace Google.ProtocolBuffers {
} }
} }
// TODO(jonskeet): InternalsVisibleTo internal static ulong ParseUInt64(string text) {
public static ulong ParseUInt64(string text) {
return (ulong) ParseInteger(text, false, true); return (ulong) ParseInteger(text, false, true);
} }
// TODO(jonskeet): InternalsVisibleTo internal static long ParseInt64(string text) {
public static long ParseInt64(string text) {
return ParseInteger(text, true, true); return ParseInteger(text, true, true);
} }
// TODO(jonskeet): InternalsVisibleTo internal static uint ParseUInt32(string text) {
public static uint ParseUInt32(string text) {
return (uint) ParseInteger(text, false, false); return (uint) ParseInteger(text, false, false);
} }
// TODO(jonskeet): InternalsVisibleTo internal static int ParseInt32(string text) {
public static int ParseInt32(string text) {
return (int) ParseInteger(text, true, false); return (int) ParseInteger(text, true, false);
} }
...@@ -309,9 +305,8 @@ namespace Google.ProtocolBuffers { ...@@ -309,9 +305,8 @@ namespace Google.ProtocolBuffers {
/// <summary> /// <summary>
/// Unescapes a text string as escaped using <see cref="EscapeText(string)" />. /// Unescapes a text string as escaped using <see cref="EscapeText(string)" />.
/// Two-digit hex escapes (starting with "\x" are also recognised. /// Two-digit hex escapes (starting with "\x" are also recognised.
/// TODO(jonskeet): InternalsVisibleTo
/// </summary> /// </summary>
public static string UnescapeText(string input) { internal static string UnescapeText(string input) {
return UnescapeBytes(input).ToStringUtf8(); return UnescapeBytes(input).ToStringUtf8();
} }
...@@ -319,9 +314,8 @@ namespace Google.ProtocolBuffers { ...@@ -319,9 +314,8 @@ namespace Google.ProtocolBuffers {
/// Like <see cref="EscapeBytes" /> but escapes a text string. /// Like <see cref="EscapeBytes" /> but escapes a text string.
/// The string is first encoded as UTF-8, then each byte escaped individually. /// The string is first encoded as UTF-8, then each byte escaped individually.
/// The returned value is guaranteed to be entirely ASCII. /// The returned value is guaranteed to be entirely ASCII.
/// TODO(jonskeet): InternalsVisibleTo
/// </summary> /// </summary>
public static string EscapeText(string input) { internal static string EscapeText(string input) {
return EscapeBytes(ByteString.CopyFromUtf8(input)); return EscapeBytes(ByteString.CopyFromUtf8(input));
} }
/// <summary> /// <summary>
...@@ -332,9 +326,8 @@ namespace Google.ProtocolBuffers { ...@@ -332,9 +326,8 @@ namespace Google.ProtocolBuffers {
/// which no defined short-hand escape sequence is defined will be escaped /// which no defined short-hand escape sequence is defined will be escaped
/// using 3-digit octal sequences. /// using 3-digit octal sequences.
/// The returned value is guaranteed to be entirely ASCII. /// The returned value is guaranteed to be entirely ASCII.
/// TODO(jonskeet): InternalsVisibleTo
/// </summary> /// </summary>
public static String EscapeBytes(ByteString input) { internal static String EscapeBytes(ByteString input) {
StringBuilder builder = new StringBuilder(input.Length); StringBuilder builder = new StringBuilder(input.Length);
foreach (byte b in input) { foreach (byte b in input) {
switch (b) { switch (b) {
...@@ -366,9 +359,8 @@ namespace Google.ProtocolBuffers { ...@@ -366,9 +359,8 @@ namespace Google.ProtocolBuffers {
/// <summary> /// <summary>
/// Performs string unescaping from C style (octal, hex, form feeds, tab etc) into a byte string. /// Performs string unescaping from C style (octal, hex, form feeds, tab etc) into a byte string.
/// TODO(jonskeet): Make this internal again, and use InternalsVisibleTo.
/// </summary> /// </summary>
public static ByteString UnescapeBytes(string input) { internal static ByteString UnescapeBytes(string input) {
byte[] result = new byte[input.Length]; byte[] result = new byte[input.Length];
int pos = 0; int pos = 0;
for (int i = 0; i < input.Length; i++) { for (int i = 0; i < input.Length; i++) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment