From fb77cc9d9f066a8ce4f12e8d5f76188d48101444 Mon Sep 17 00:00:00 2001 From: Jon Skeet Date: Fri, 26 Jun 2015 11:23:33 +0100 Subject: More cleanup, based around searches for "Google.ProtocolBuffers" - Remove some old proto2-based C#-only messages - Remove the "build" directory which only contained out-of-date files - Remove the csharp_namespace option from proto2 messages - Change "Google.ProtocolBuffers" to "Google.Protobuf" in other messages --- csharp/src/AddressBook/AddPerson.cs | 3 +- csharp/src/AddressBook/AddressBook.csproj | 4 +- csharp/src/AddressBook/Addressbook.cs | 62 ++++++++++++++--------------- csharp/src/AddressBook/ListPeople.cs | 2 +- csharp/src/AddressBook/Program.cs | 2 +- csharp/src/AddressBook/SampleUsage.cs | 5 +-- csharp/src/ProtoDump/Program.cs | 3 +- csharp/src/ProtoDump/ProtoDump.csproj | 2 +- csharp/src/ProtocolBuffers.Test/App.xaml | 8 ---- csharp/src/ProtocolBuffers.Test/App.xaml.cs | 60 ---------------------------- 10 files changed, 40 insertions(+), 111 deletions(-) delete mode 100644 csharp/src/ProtocolBuffers.Test/App.xaml delete mode 100644 csharp/src/ProtocolBuffers.Test/App.xaml.cs (limited to 'csharp/src') diff --git a/csharp/src/AddressBook/AddPerson.cs b/csharp/src/AddressBook/AddPerson.cs index 630108cf..5a4de39e 100644 --- a/csharp/src/AddressBook/AddPerson.cs +++ b/csharp/src/AddressBook/AddPerson.cs @@ -36,9 +36,8 @@ using System; using System.IO; -using Google.Protobuf; -namespace Google.ProtocolBuffers.Examples.AddressBook +namespace Google.Protobuf.Examples.AddressBook { internal class AddPerson { diff --git a/csharp/src/AddressBook/AddressBook.csproj b/csharp/src/AddressBook/AddressBook.csproj index f7e0d6be..b338af9c 100644 --- a/csharp/src/AddressBook/AddressBook.csproj +++ b/csharp/src/AddressBook/AddressBook.csproj @@ -8,11 +8,11 @@ {A31F5FB2-4FF3-432A-B35B-5CD203606311} Exe Properties - Google.ProtocolBuffers.Examples.AddressBook + Google.Protobuf.Examples.AddressBook AddressBook v4.0 512 - Google.ProtocolBuffers.Examples.AddressBook.Program + Google.Protobuf.Examples.AddressBook.Program Client diff --git a/csharp/src/AddressBook/Addressbook.cs b/csharp/src/AddressBook/Addressbook.cs index 1d8b8f10..c88ca424 100644 --- a/csharp/src/AddressBook/Addressbook.cs +++ b/csharp/src/AddressBook/Addressbook.cs @@ -7,18 +7,18 @@ using pb = global::Google.Protobuf; using pbc = global::Google.Protobuf.Collections; using pbd = global::Google.Protobuf.Descriptors; using scg = global::System.Collections.Generic; -namespace Google.ProtocolBuffers.Examples.AddressBook { +namespace Google.Protobuf.Examples.AddressBook { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public static partial class Addressbook { #region Static variables internal static pbd::MessageDescriptor internal__static_tutorial_Person__Descriptor; - internal static pb::FieldAccess.FieldAccessorTable internal__static_tutorial_Person__FieldAccessorTable; + internal static pb::FieldAccess.FieldAccessorTable internal__static_tutorial_Person__FieldAccessorTable; internal static pbd::MessageDescriptor internal__static_tutorial_Person_PhoneNumber__Descriptor; - internal static pb::FieldAccess.FieldAccessorTable internal__static_tutorial_Person_PhoneNumber__FieldAccessorTable; + internal static pb::FieldAccess.FieldAccessorTable internal__static_tutorial_Person_PhoneNumber__FieldAccessorTable; internal static pbd::MessageDescriptor internal__static_tutorial_AddressBook__Descriptor; - internal static pb::FieldAccess.FieldAccessorTable internal__static_tutorial_AddressBook__FieldAccessorTable; + internal static pb::FieldAccess.FieldAccessorTable internal__static_tutorial_AddressBook__FieldAccessorTable; #endregion #region Descriptor public static pbd::FileDescriptor Descriptor { @@ -35,22 +35,22 @@ namespace Google.ProtocolBuffers.Examples.AddressBook { "TnVtYmVyEg4KBm51bWJlchgBIAIoCRIuCgR0eXBlGAIgASgOMhoudHV0b3Jp", "YWwuUGVyc29uLlBob25lVHlwZToESE9NRSIrCglQaG9uZVR5cGUSCgoGTU9C", "SUxFEAASCAoESE9NRRABEggKBFdPUksQAiIvCgtBZGRyZXNzQm9vaxIgCgZw", - "ZXJzb24YASADKAsyEC50dXRvcmlhbC5QZXJzb25CVwoUY29tLmV4YW1wbGUu", - "dHV0b3JpYWxCEUFkZHJlc3NCb29rUHJvdG9zqgIrR29vZ2xlLlByb3RvY29s", - "QnVmZmVycy5FeGFtcGxlcy5BZGRyZXNzQm9vaw==")); + "ZXJzb24YASADKAsyEC50dXRvcmlhbC5QZXJzb25CUAoUY29tLmV4YW1wbGUu", + "dHV0b3JpYWxCEUFkZHJlc3NCb29rUHJvdG9zqgIkR29vZ2xlLlByb3RvYnVm", + "LkV4YW1wbGVzLkFkZHJlc3NCb29r")); pbd::FileDescriptor.InternalDescriptorAssigner assigner = delegate(pbd::FileDescriptor root) { descriptor = root; internal__static_tutorial_Person__Descriptor = Descriptor.MessageTypes[0]; internal__static_tutorial_Person__FieldAccessorTable = - new pb::FieldAccess.FieldAccessorTable(internal__static_tutorial_Person__Descriptor, + new pb::FieldAccess.FieldAccessorTable(internal__static_tutorial_Person__Descriptor, new string[] { "Name", "Id", "Email", "Phone", }); internal__static_tutorial_Person_PhoneNumber__Descriptor = internal__static_tutorial_Person__Descriptor.NestedTypes[0]; internal__static_tutorial_Person_PhoneNumber__FieldAccessorTable = - new pb::FieldAccess.FieldAccessorTable(internal__static_tutorial_Person_PhoneNumber__Descriptor, + new pb::FieldAccess.FieldAccessorTable(internal__static_tutorial_Person_PhoneNumber__Descriptor, new string[] { "Number", "Type", }); internal__static_tutorial_AddressBook__Descriptor = Descriptor.MessageTypes[1]; internal__static_tutorial_AddressBook__FieldAccessorTable = - new pb::FieldAccess.FieldAccessorTable(internal__static_tutorial_AddressBook__Descriptor, + new pb::FieldAccess.FieldAccessorTable(internal__static_tutorial_AddressBook__Descriptor, new string[] { "Person", }); }; pbd::FileDescriptor.InternalBuildGeneratedFileFrom(descriptorData, @@ -69,11 +69,11 @@ namespace Google.ProtocolBuffers.Examples.AddressBook { private static readonly string[] _fieldNames = new string[] { "email", "id", "name", "phone" }; private static readonly uint[] _fieldTags = new uint[] { 26, 16, 10, 34 }; public static pbd::MessageDescriptor Descriptor { - get { return global::Google.ProtocolBuffers.Examples.AddressBook.Addressbook.internal__static_tutorial_Person__Descriptor; } + get { return global::Google.Protobuf.Examples.AddressBook.Addressbook.internal__static_tutorial_Person__Descriptor; } } public pb::FieldAccess.FieldAccessorTable Fields { - get { return global::Google.ProtocolBuffers.Examples.AddressBook.Addressbook.internal__static_tutorial_Person__FieldAccessorTable; } + get { return global::Google.Protobuf.Examples.AddressBook.Addressbook.internal__static_tutorial_Person__FieldAccessorTable; } } private bool _frozen = false; @@ -131,8 +131,8 @@ namespace Google.ProtocolBuffers.Examples.AddressBook { } public const int PhoneFieldNumber = 4; - private readonly pbc::RepeatedField phone_ = new pbc::RepeatedField(); - public pbc::RepeatedField Phone { + private readonly pbc::RepeatedField phone_ = new pbc::RepeatedField(); + public pbc::RepeatedField Phone { get { return phone_; } } @@ -193,7 +193,7 @@ namespace Google.ProtocolBuffers.Examples.AddressBook { size += 1 + pb::CodedOutputStream.ComputeStringSize(Email); } if (phone_.Count > 0) { - foreach (global::Google.ProtocolBuffers.Examples.AddressBook.Person.Types.PhoneNumber element in phone_) { + foreach (global::Google.Protobuf.Examples.AddressBook.Person.Types.PhoneNumber element in phone_) { size += pb::CodedOutputStream.ComputeMessageSize(element); } size += 1 * phone_.Count; @@ -241,7 +241,7 @@ namespace Google.ProtocolBuffers.Examples.AddressBook { break; } case 34: { - input.ReadMessageArray(phone_, global::Google.ProtocolBuffers.Examples.AddressBook.Person.Types.PhoneNumber.Parser); + input.ReadMessageArray(phone_, global::Google.Protobuf.Examples.AddressBook.Person.Types.PhoneNumber.Parser); break; } } @@ -265,11 +265,11 @@ namespace Google.ProtocolBuffers.Examples.AddressBook { private static readonly string[] _fieldNames = new string[] { "number", "type" }; private static readonly uint[] _fieldTags = new uint[] { 10, 16 }; public static pbd::MessageDescriptor Descriptor { - get { return global::Google.ProtocolBuffers.Examples.AddressBook.Addressbook.internal__static_tutorial_Person_PhoneNumber__Descriptor; } + get { return global::Google.Protobuf.Examples.AddressBook.Addressbook.internal__static_tutorial_Person_PhoneNumber__Descriptor; } } public pb::FieldAccess.FieldAccessorTable Fields { - get { return global::Google.ProtocolBuffers.Examples.AddressBook.Addressbook.internal__static_tutorial_Person_PhoneNumber__FieldAccessorTable; } + get { return global::Google.Protobuf.Examples.AddressBook.Addressbook.internal__static_tutorial_Person_PhoneNumber__FieldAccessorTable; } } private bool _frozen = false; @@ -304,8 +304,8 @@ namespace Google.ProtocolBuffers.Examples.AddressBook { } public const int TypeFieldNumber = 2; - private global::Google.ProtocolBuffers.Examples.AddressBook.Person.Types.PhoneType type_ = global::Google.ProtocolBuffers.Examples.AddressBook.Person.Types.PhoneType.HOME; - public global::Google.ProtocolBuffers.Examples.AddressBook.Person.Types.PhoneType Type { + private global::Google.Protobuf.Examples.AddressBook.Person.Types.PhoneType type_ = global::Google.Protobuf.Examples.AddressBook.Person.Types.PhoneType.HOME; + public global::Google.Protobuf.Examples.AddressBook.Person.Types.PhoneType Type { get { return type_; } set { pb::Freezable.CheckMutable(this); @@ -332,7 +332,7 @@ namespace Google.ProtocolBuffers.Examples.AddressBook { public override int GetHashCode() { int hash = 1; if (Number.Length != 0) hash ^= Number.GetHashCode(); - if (Type != global::Google.ProtocolBuffers.Examples.AddressBook.Person.Types.PhoneType.HOME) hash ^= Type.GetHashCode(); + if (Type != global::Google.Protobuf.Examples.AddressBook.Person.Types.PhoneType.HOME) hash ^= Type.GetHashCode(); return hash; } @@ -341,7 +341,7 @@ namespace Google.ProtocolBuffers.Examples.AddressBook { output.WriteRawTag(10); output.WriteString(Number); } - if (Type != global::Google.ProtocolBuffers.Examples.AddressBook.Person.Types.PhoneType.HOME) { + if (Type != global::Google.Protobuf.Examples.AddressBook.Person.Types.PhoneType.HOME) { output.WriteRawTag(16); output.WriteEnum((int) Type); } @@ -352,7 +352,7 @@ namespace Google.ProtocolBuffers.Examples.AddressBook { if (Number.Length != 0) { size += 1 + pb::CodedOutputStream.ComputeStringSize(Number); } - if (Type != global::Google.ProtocolBuffers.Examples.AddressBook.Person.Types.PhoneType.HOME) { + if (Type != global::Google.Protobuf.Examples.AddressBook.Person.Types.PhoneType.HOME) { size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) Type); } return size; @@ -365,7 +365,7 @@ namespace Google.ProtocolBuffers.Examples.AddressBook { if (other.Number.Length != 0) { Number = other.Number; } - if (other.Type != global::Google.ProtocolBuffers.Examples.AddressBook.Person.Types.PhoneType.HOME) { + if (other.Type != global::Google.Protobuf.Examples.AddressBook.Person.Types.PhoneType.HOME) { Type = other.Type; } } @@ -386,7 +386,7 @@ namespace Google.ProtocolBuffers.Examples.AddressBook { break; } case 16: { - type_ = (global::Google.ProtocolBuffers.Examples.AddressBook.Person.Types.PhoneType) input.ReadEnum(); + type_ = (global::Google.Protobuf.Examples.AddressBook.Person.Types.PhoneType) input.ReadEnum(); break; } } @@ -408,11 +408,11 @@ namespace Google.ProtocolBuffers.Examples.AddressBook { private static readonly string[] _fieldNames = new string[] { "person" }; private static readonly uint[] _fieldTags = new uint[] { 10 }; public static pbd::MessageDescriptor Descriptor { - get { return global::Google.ProtocolBuffers.Examples.AddressBook.Addressbook.internal__static_tutorial_AddressBook__Descriptor; } + get { return global::Google.Protobuf.Examples.AddressBook.Addressbook.internal__static_tutorial_AddressBook__Descriptor; } } public pb::FieldAccess.FieldAccessorTable Fields { - get { return global::Google.ProtocolBuffers.Examples.AddressBook.Addressbook.internal__static_tutorial_AddressBook__FieldAccessorTable; } + get { return global::Google.Protobuf.Examples.AddressBook.Addressbook.internal__static_tutorial_AddressBook__FieldAccessorTable; } } private bool _frozen = false; @@ -437,8 +437,8 @@ namespace Google.ProtocolBuffers.Examples.AddressBook { } public const int PersonFieldNumber = 1; - private readonly pbc::RepeatedField person_ = new pbc::RepeatedField(); - public pbc::RepeatedField Person { + private readonly pbc::RepeatedField person_ = new pbc::RepeatedField(); + public pbc::RepeatedField Person { get { return person_; } } @@ -472,7 +472,7 @@ namespace Google.ProtocolBuffers.Examples.AddressBook { public int CalculateSize() { int size = 0; if (person_.Count > 0) { - foreach (global::Google.ProtocolBuffers.Examples.AddressBook.Person element in person_) { + foreach (global::Google.Protobuf.Examples.AddressBook.Person element in person_) { size += pb::CodedOutputStream.ComputeMessageSize(element); } size += 1 * person_.Count; @@ -499,7 +499,7 @@ namespace Google.ProtocolBuffers.Examples.AddressBook { } break; case 10: { - input.ReadMessageArray(person_, global::Google.ProtocolBuffers.Examples.AddressBook.Person.Parser); + input.ReadMessageArray(person_, global::Google.Protobuf.Examples.AddressBook.Person.Parser); break; } } diff --git a/csharp/src/AddressBook/ListPeople.cs b/csharp/src/AddressBook/ListPeople.cs index 9666c425..5ae73e53 100644 --- a/csharp/src/AddressBook/ListPeople.cs +++ b/csharp/src/AddressBook/ListPeople.cs @@ -37,7 +37,7 @@ using System; using System.IO; -namespace Google.ProtocolBuffers.Examples.AddressBook +namespace Google.Protobuf.Examples.AddressBook { internal class ListPeople { diff --git a/csharp/src/AddressBook/Program.cs b/csharp/src/AddressBook/Program.cs index e0d6d49b..19c677c0 100644 --- a/csharp/src/AddressBook/Program.cs +++ b/csharp/src/AddressBook/Program.cs @@ -36,7 +36,7 @@ using System; -namespace Google.ProtocolBuffers.Examples.AddressBook +namespace Google.Protobuf.Examples.AddressBook { /// /// Entry point. Repeatedly prompts user for an action to take, delegating actual behaviour diff --git a/csharp/src/AddressBook/SampleUsage.cs b/csharp/src/AddressBook/SampleUsage.cs index c06188b4..b9a61497 100644 --- a/csharp/src/AddressBook/SampleUsage.cs +++ b/csharp/src/AddressBook/SampleUsage.cs @@ -1,8 +1,7 @@ -using Google.Protobuf; -using System; +using System; using System.IO; -namespace Google.ProtocolBuffers.Examples.AddressBook +namespace Google.Protobuf.Examples.AddressBook { internal class SampleUsage { diff --git a/csharp/src/ProtoDump/Program.cs b/csharp/src/ProtoDump/Program.cs index d2eee9b7..ebe4255d 100644 --- a/csharp/src/ProtoDump/Program.cs +++ b/csharp/src/ProtoDump/Program.cs @@ -36,9 +36,8 @@ using System; using System.IO; -using Google.Protobuf; -namespace Google.ProtocolBuffers.ProtoDump +namespace Google.Protobuf.ProtoDump { /// /// Small utility to load a binary message and dump it in text form diff --git a/csharp/src/ProtoDump/ProtoDump.csproj b/csharp/src/ProtoDump/ProtoDump.csproj index b7e6c1a3..a74067e4 100644 --- a/csharp/src/ProtoDump/ProtoDump.csproj +++ b/csharp/src/ProtoDump/ProtoDump.csproj @@ -10,7 +10,7 @@ {D7282E99-2DC3-405B-946F-177DB2FD2AE2} Exe Properties - Google.ProtocolBuffers.ProtoDump + Google.Protobuf.ProtoDump ProtoDump v4.0 512 diff --git a/csharp/src/ProtocolBuffers.Test/App.xaml b/csharp/src/ProtocolBuffers.Test/App.xaml deleted file mode 100644 index d4f1f2e3..00000000 --- a/csharp/src/ProtocolBuffers.Test/App.xaml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - diff --git a/csharp/src/ProtocolBuffers.Test/App.xaml.cs b/csharp/src/ProtocolBuffers.Test/App.xaml.cs deleted file mode 100644 index 0c9fd9e6..00000000 --- a/csharp/src/ProtocolBuffers.Test/App.xaml.cs +++ /dev/null @@ -1,60 +0,0 @@ -using System; -using System.Windows; -using Microsoft.Silverlight.Testing; - -namespace Google.ProtocolBuffers -{ - public partial class App : Application - { - - public App() - { - this.Startup += this.Application_Startup; - this.Exit += this.Application_Exit; - this.UnhandledException += this.Application_UnhandledException; - - //InitializeComponent(); - } - - private void Application_Startup(object sender, StartupEventArgs e) - { - this.RootVisual = UnitTestSystem.CreateTestPage(); - } - - private void Application_Exit(object sender, EventArgs e) - { - - } - private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e) - { - // If the app is running outside of the debugger then report the exception using - // the browser's exception mechanism. On IE this will display it a yellow alert - // icon in the status bar and Firefox will display a script error. - if (!System.Diagnostics.Debugger.IsAttached) - { - - // NOTE: This will allow the application to continue running after an exception has been thrown - // but not handled. - // For production applications this error handling should be replaced with something that will - // report the error to the website and stop the application. - e.Handled = true; - Deployment.Current.Dispatcher.BeginInvoke( - new EventHandler(ReportErrorToDOM), - new object[] { sender, e } ); - } - } - private void ReportErrorToDOM(object sender, ApplicationUnhandledExceptionEventArgs e) - { - try - { - string errorMsg = e.ExceptionObject.Message + e.ExceptionObject.StackTrace; - errorMsg = errorMsg.Replace('"', '\'').Replace("\r\n", @"\n"); - - System.Windows.Browser.HtmlPage.Window.Eval("throw new Error(\"Unhandled Error in Silverlight 2 Application " + errorMsg + "\");"); - } - catch (Exception) - { - } - } - } -} \ No newline at end of file -- cgit v1.2.3