Example #1
0
        public static bool IsHere()
        {
            Autodesk.AutoCAD.EditorInput.Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;
            const ushort VALIDDATA_LENGTH          = 4;
            bool         Answer = false;

            //byte[] packet = new byte[Dicisionpro.SPRO_APIPACKET_SIZE];
            //ed.WriteMessage("  ##  ##  H-1 \n");
            if (DicisionNativeApi.RNBOsproFormatPacket(packet, Dicisionpro.SPRO_APIPACKET_SIZE) == 0)
            {
                //ed.WriteMessage("  ##  ##  H0 \n");
                if (DicisionNativeApi.RNBOsproInitialize(packet) == 0)
                {
                    //ed.WriteMessage("  ##  ##  H1 \n");
                    string sDevID = "1c6d";// string variable for DevID
                    ushort DevID  = 0;
                    isValidData(sDevID.Trim(), VALIDDATA_LENGTH, ref DevID);
                    ushort result = DicisionNativeApi.RNBOsproFindFirstUnit(packet, DevID);
                    if (result == 0)
                    {
                        //ed.WriteMessage("  ##  ##  H2 \n");
                        //ed.WriteMessage("HERE FOUND \n");
                        Answer = true;
                    }
                }
            }

            return(Answer);

            //return true;
        }
Example #2
0
        public ushort RNBOsproInitialize()
        {
            ushort status = 0;

            try
            {
                status = DicisionNativeApi.RNBOsproInitialize(this.packet);
            }
            catch (System.DllNotFoundException)
            {
                throw new System.DllNotFoundException(strError);
            }
            return(status);
        }
Example #3
0
        public static bool IsThere()
        {
            Autodesk.AutoCAD.EditorInput.Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;
            const ushort VALIDDATA_LENGTH          = 4;
            bool         Answer = false;

            //---- check terminal
            int allowCheck;

            allowCheck = Dicisionpro.SP_ALLOW_CHECK_TERMINAL_CLIENT;

            //if (TerminalClientCheck.Checked == true)
            if (true)
            {
                allowCheck = Dicisionpro.SP_ALLOW_CHECK_TERMINAL_CLIENT;
            }
            //ed.WriteMessage("  ##  ##  0 \n");
            //if (TerminalClientCheck.Checked == false)
            //{
            //    allowCheck = Dicisionpro.SP_DISALLOW_CHECK_TERMINAL_CLIENT;
            //}

            //----------------


            //------ set shered licence -----
            ushort shareMainLic, shareSubLic;

            //ushort status;
            shareMainLic = Dicisionpro.SP_DISABLE_MAINLIC_SHARING;
            shareSubLic  = Dicisionpro.SP_DISABLE_SUBLIC_SHARING;

            //-------------------------------

            if (DicisionNativeApi.RNBOsproFormatPacket(packet, Dicisionpro.SPRO_APIPACKET_SIZE) == 0)
            {
                //ed.WriteMessage("  ##  ##  1 \n");
                if (DicisionNativeApi.RNBOsproInitialize(packet) == 0)
                {
                    //ed.WriteMessage("  ##  ##  2 \n");
                    if (DicisionNativeApi.RNBOsproSetProtocol(packet, (int)Dicisionpro.PROTOCOL_FLAG.NSPRO_TCP_PROTOCOL) == 0)
                    {
                        //ed.WriteMessage("  ##  ##  3 \n");
                        status = RNBOsproCheckTerminalService(allowCheck);
                        //If API successfull
                        if (status == 0)
                        {
                            //ed.WriteMessage("  ##  ##  4 \n");
                            //Clear all the input text box
                            //clearTextBox_succ("CheckTerminalService");
                            string ServerName = Atend.Control.ConnectionString.LST;
                            if (DicisionNativeApi.RNBOsproSetContactServer(packet, ServerName) == 0)
                            {
                                //ed.WriteMessage("  ##  ##  5 \n");
                                string sDevID = "1c6d";// string variable for DevID
                                ushort DevID  = 0;
                                isValidData(sDevID.Trim(), VALIDDATA_LENGTH, ref DevID);
                                ushort result = DicisionNativeApi.RNBOsproFindFirstUnit(packet, DevID);
                                if (result == 0)
                                {
                                    //ed.WriteMessage("  ##  ##  6 \n");
                                    //if (MainSharing.Checked != false)
                                    //if (true)
                                    //{
                                    //if (MainSharing.Checked == true && SubLicSharing.Checked == true)
                                    //if (true && true)
                                    //{
                                    //    shareMainLic = Superpro.SP_ENABLE_MAINLIC_SHARING;
                                    //    shareSubLic = Superpro.SP_ENABLE_SUBLIC_SHARING;
                                    //}
                                    //if (MainSharing.Checked == true && SubLicSharing.Checked == false)
                                    //////////////////if (true)
                                    //////////////////{
                                    //////////////////    shareMainLic = Dicisionpro.SP_ENABLE_MAINLIC_SHARING;
                                    //////////////////    shareSubLic = Dicisionpro.SP_DISABLE_SUBLIC_SHARING;
                                    //////////////////}
                                    //}
                                    //**************RNBOsproSetSharedLicense API **********************
                                    //////////////////////status = RNBOsproSetSharedLicense(shareMainLic, shareSubLic);
                                    ////////////////////////If API successfull
                                    //////////////////////if (status == 0)
                                    //////////////////////{
                                    //Clear all the input text box
                                    //clearTextBox_succ("SetSharedLicense");

                                    ////////////sDevID = "1c6d";// string variable for DevID
                                    ////////////DevID = 0;
                                    ////////////isValidData(sDevID.Trim(), VALIDDATA_LENGTH, ref DevID);
                                    ////////////result = DicisionNativeApi.RNBOsproFindFirstUnit(packet, DevID);
                                    ////////////if (result == 0)
                                    ////////////{

                                    //ed.WriteMessage("THERE FOUND \n");
                                    Answer = true;
                                    ////////////}

                                    ////////////////////}
                                    ////////////////////else //If API failed then
                                    ////////////////////{
                                    ////////////////////    //Display API failure message with API return code.
                                    ////////////////////    //clearTextBox_fail("SetSharedLicense", status);
                                    ////////////////////    //RNBOsproSetSharedLicense
                                    ////////////////////    ed.WriteMessage("SuperproNativeApi.RNBOsproSetSharedLicense failed \n");
                                    ////////////////////}
                                }
                                else
                                {
                                    //RNBOsproFindFirstUnit
                                    ed.WriteMessage("SuperproNativeApi.RNBOsproFindFirstUnit failed \n");
                                }
                            }
                            else
                            {
                                ed.WriteMessage("SuperproNativeApi.RNBOsproSetContactServer failed \n");
                            }
                        }
                        else //If API failed then
                        {
                            //Display API failure message with API return code.
                            //clearTextBox_fail("CheckTerminalService", status);
                            ed.WriteMessage("DicisionNativeApi.RNBOsproCheckTerminalService failed \n");
                        }
                    }
                    else
                    {
                        ed.WriteMessage("DicisionNativeApi.RNBOsproSetProtocol failed \n");
                    }
                }
                else
                {
                    ed.WriteMessage("DicisionNativeApi.RNBOsproInitialize failed \n");
                }
            }
            else
            {
                ed.WriteMessage("DicisionNativeApi.RNBOsproFormatPacket failed \n");
            }
            return(Answer);
            //return true;
        }