From 603b3461abd35d472f9c80a2e7c5311a5a3f577b Mon Sep 17 00:00:00 2001 From: Jacob Santos Date: Mon, 2 Nov 2015 16:33:30 -0600 Subject: [PATCH 1/2] * Constructors need to be public. * Add boolean implementation to interface. --- TestCOMServer/TestCOMServer/COMTestDispatch.cs | 11 +++++++---- TestCOMServer/TestCOMServer/TestCOMServer.csproj | 3 ++- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/TestCOMServer/TestCOMServer/COMTestDispatch.cs b/TestCOMServer/TestCOMServer/COMTestDispatch.cs index 6871f3c..d10b5d5 100644 --- a/TestCOMServer/TestCOMServer/COMTestDispatch.cs +++ b/TestCOMServer/TestCOMServer/COMTestDispatch.cs @@ -189,6 +189,7 @@ public interface ICOMEchoTestObject float EchoFloat32(float value); double EchoFloat64(double value); string EchoString(string value); + bool EchoBoolean(bool value); } [ComVisible(true), @@ -197,18 +198,20 @@ public interface ICOMEchoTestObject ComSourceInterfaces(typeof(ICOMEchoTestObject))] public class COMEchoTestObject : ICOMEchoTestObject { - public string EchoString(string value) + public COMEchoTestObject() { - return value; } + public String EchoString(String value) + { + return value; + } public sbyte EchoInt8(sbyte value) { return value; } - public byte EchoUInt8(byte value) { return value; @@ -351,7 +354,7 @@ public bool BooleanField set { rawBoolean = value; } } - COMTestScalarClass() + public COMTestScalarClass() { rawString = ""; rawInt8 = 0; diff --git a/TestCOMServer/TestCOMServer/TestCOMServer.csproj b/TestCOMServer/TestCOMServer/TestCOMServer.csproj index dfdb40e..0d8236f 100644 --- a/TestCOMServer/TestCOMServer/TestCOMServer.csproj +++ b/TestCOMServer/TestCOMServer/TestCOMServer.csproj @@ -20,7 +20,7 @@ DEBUG;TRACE prompt 4 - false + true Off @@ -42,6 +42,7 @@ Off prompt MinimumRecommendedRules.ruleset + false bin\x64\Release\ From b893dc649d2c5e864bd8fe89a64759d98055642f Mon Sep 17 00:00:00 2001 From: Jacob Santos Date: Mon, 2 Nov 2015 17:39:44 -0600 Subject: [PATCH 2/2] And fuck. Interface needs to copy properties and methods in order to show up in COM. --- .../TestCOMServer/COMTestDispatch.cs | 116 +++++++++++++++++- .../TestCOMServer/Properties/AssemblyInfo.cs | 4 +- 2 files changed, 115 insertions(+), 5 deletions(-) diff --git a/TestCOMServer/TestCOMServer/COMTestDispatch.cs b/TestCOMServer/TestCOMServer/COMTestDispatch.cs index d10b5d5..8ea44be 100644 --- a/TestCOMServer/TestCOMServer/COMTestDispatch.cs +++ b/TestCOMServer/TestCOMServer/COMTestDispatch.cs @@ -171,7 +171,115 @@ public interface ICOMTestTypes : ICOMTestFloat, ICOMTestDouble, ICOMTestBoolean - { } + { + new string StringField + { + get; + set; + } + + new int PutString(string value); + new string GetString(); + + new sbyte Int8Field + { + get; + set; + } + + new byte UInt8Field + { + get; + set; + } + + new int PutInt8(sbyte value); + new sbyte GetInt8(); + + new int PutUInt8(byte value); + new byte GetUInt8(); + + new short Int16Field + { + get; + set; + } + + new ushort UInt16Field + { + get; + set; + } + + new int PutInt16(short value); + new short GetInt16(); + + new int PutUInt16(ushort value); + new ushort GetUInt16(); + + new int Int32Field + { + get; + set; + } + + new uint UInt32Field + { + get; + set; + } + + new int PutInt32(int value); + new int GetInt32(); + + new int PutUInt32(uint value); + new uint GetUInt32(); + + new long Int64Field + { + get; + set; + } + + new ulong UInt64Field + { + get; + set; + } + + new int PutInt64(long value); + new long GetInt64(); + + new int PutUInt64(ulong value); + new ulong GetUInt64(); + + new float Float32Field + { + get; + set; + } + + new int PutFloat32(float value); + new float GetFloat32(); + + new double Float64Field + { + get; + set; + } + + new int PutFloat64(double value); + new double GetFloat64(); + + new bool BooleanField + { + get; + set; + } + + new int PutBoolean(bool value); + new bool GetBoolean(); + } [ComVisible(true), Guid("6485B1EF-D780-4834-A4FE-1EBB51746CA3"), @@ -194,7 +302,8 @@ public interface ICOMEchoTestObject [ComVisible(true), Guid("3C24506A-AE9E-4D50-9157-EF317281F1B0"), - ClassInterface(ClassInterfaceType.AutoDual), + ClassInterface(ClassInterfaceType.None), + ProgId("GOOLE.COMEchoTestObject"), ComSourceInterfaces(typeof(ICOMEchoTestObject))] public class COMEchoTestObject : ICOMEchoTestObject { @@ -265,7 +374,8 @@ public bool EchoBoolean(bool value) [ComVisible(true), Guid("865B85C5-0334-4AC6-9EF6-AACEC8FC5E86"), - ClassInterface(ClassInterfaceType.AutoDual), + ClassInterface(ClassInterfaceType.None), + ProgId("GOOLE.COMTestScalarClass"), ComSourceInterfaces(typeof(ICOMTestTypes))] public class COMTestScalarClass : ICOMTestTypes { diff --git a/TestCOMServer/TestCOMServer/Properties/AssemblyInfo.cs b/TestCOMServer/TestCOMServer/Properties/AssemblyInfo.cs index 5c1c61a..84fc8f8 100644 --- a/TestCOMServer/TestCOMServer/Properties/AssemblyInfo.cs +++ b/TestCOMServer/TestCOMServer/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] +[assembly: AssemblyVersion("1.1.0.0")] +[assembly: AssemblyFileVersion("1.1.0.0")]