コード例 #1
0
        public unsafe Connect(ConnectConfig cc)
        {
            NativeMethods.LoadClass();
            //ConsoleHelper.AllocConsole();
            // attach a console to parent process (launch from cmd.exe)
            //ConsoleHelper.AttachConsole(-1);

            CONNECT_CONFIG libcCc = new CONNECT_CONFIG();

            connectConfig = cc;
            IntPtr intptr = new IntPtr(this.GetHashCode());

            refKeeper[intptr] = this;

            libcCc.ccAppId         = cc.ccAppId;
            libcCc.ccAnonymousBlob = cc.anonymousblob;
            //libcCc.ccAppSecret = cc.ccAppSecret;
            libcCc.ccProductBuildId  = cc.product_build_id;
            libcCc.ccProductId       = cc.product_id;
            libcCc.ccUserProfilePath = UTF8Marshaler.GetInstance(null).MarshalManagedToNative(cc.ccUserProfilePath);
            libcCc.ccConnectEventCb  = delegate(CONNECT * libcConnect, CONNECT_EVENT *libcConnectEvent, IntPtr userdata)
            {
                Connect      connect      = (Connect)refKeeper[userdata];
                ConnectEvent connectEvent = ConnectEvent.newFromLibcEvent(libcConnectEvent);

                connect.connectConfig.ccConnectEventCb.Invoke(connect, connectEvent);
            };

            libcConnectHndl = dz_connect_new(libcCc);

            UTF8Marshaler.GetInstance(null).CleanUpNativeData(libcCc.ccUserProfilePath);
        }
コード例 #2
0
 static extern unsafe CONNECT *dz_connect_new(
     [In, MarshalAs(UnmanagedType.LPStruct)]
     CONNECT_CONFIG lpcc);