Exemplo n.º 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;
        }
Exemplo n.º 2
0
 public void RNBOsproCleanup()
 {
     try
     {
         DicisionNativeApi.RNBOsproCleanup();
     }
     catch (System.DllNotFoundException)
     {
         throw new System.DllNotFoundException(strError);
     }
     return;
 }
Exemplo n.º 3
0
        public ushort RNBOsproGetVersion(ref byte majVerion, ref byte minVersion, ref byte revision, ref byte osDrvrType)
        {
            ushort status = 0;

            try
            {
                status = DicisionNativeApi.RNBOsproGetVersion(this.packet, ref majVerion, ref minVersion, ref revision, ref osDrvrType);
            }
            catch (System.DllNotFoundException)
            {
                throw new System.DllNotFoundException(strError);
            }
            return(status);
        }
Exemplo n.º 4
0
        public ushort RNBOsproQuery(ushort address, byte[] queryData, byte[] response, ref uint response32, ushort length)
        {
            ushort status = 0;

            try
            {
                status = DicisionNativeApi.RNBOsproQuery(this.packet, address, queryData, response, ref response32, length);
            }
            catch (System.DllNotFoundException)
            {
                throw new System.DllNotFoundException(strError);
            }
            return(status);
        }
Exemplo n.º 5
0
        public ushort RNBOsproGetFullStatus()
        {
            ushort status = 0;

            try
            {
                status = DicisionNativeApi.RNBOsproGetFullStatus(this.packet);
            }
            catch (System.DllNotFoundException)
            {
                throw new System.DllNotFoundException(strError);
            }
            return(status);
        }
Exemplo n.º 6
0
        public ushort RNBOsproActivate(ushort writePassword, ushort activatePassword1, ushort activatePassword2, ushort address)
        {
            ushort status = 0;

            try
            {
                status = DicisionNativeApi.RNBOsproActivate(this.packet, writePassword, activatePassword1, activatePassword2, address);
            }
            catch (System.DllNotFoundException)
            {
                throw new System.DllNotFoundException(strError);
            }
            return(status);
        }
Exemplo n.º 7
0
        public ushort RNBOsproOverwrite(ushort writePassword, ushort overwritePassword1, ushort overwritePassword2, ushort address, ref ushort data, ref byte accessCode)
        {
            ushort status = 0;

            try
            {
                status = DicisionNativeApi.RNBOsproOverwrite(this.packet, writePassword, overwritePassword1, overwritePassword2, address, data, accessCode);
            }
            catch (System.DllNotFoundException)
            {
                throw new System.DllNotFoundException(strError);
            }
            return(status);
        }
Exemplo n.º 8
0
        public ushort RNBOsproExtendedRead(ushort address, ref ushort data, ref byte accessCode)
        {
            ushort status = 0;

            try
            {
                status = DicisionNativeApi.RNBOsproExtendedRead(this.packet, address, ref data, ref accessCode);
            }
            catch (System.DllNotFoundException)
            {
                throw new System.DllNotFoundException(strError);
            }
            return(status);
        }
Exemplo n.º 9
0
        public ushort RNBOsproGetKeyType(ref int keyFamily, ref int formFactor, ref int memUsed)
        {
            ushort status = 0;

            try
            {
                status = DicisionNativeApi.RNBOsproGetKeyType(this.packet, ref keyFamily, ref formFactor, ref memUsed);
            }
            catch (System.DllNotFoundException)
            {
                throw new System.DllNotFoundException(strError);
            }
            return(status);
        }
Exemplo n.º 10
0
        public ushort RNBOsproCheckTerminalService(int termserv)
        {
            ushort status = 0;

            try
            {
                status = DicisionNativeApi.RNBOsproCheckTerminalService(this.packet, termserv);
            }
            catch (System.DllNotFoundException)
            {
                throw new System.DllNotFoundException(strError);
            }
            return(status);
        }
Exemplo n.º 11
0
        public ushort RNBOsproFormatPacket(uint packetSize)
        {
            ushort status = 0;

            try
            {
                status = DicisionNativeApi.RNBOsproFormatPacket(this.packet, packetSize);
            }
            catch (System.DllNotFoundException)
            {
                throw new System.DllNotFoundException(strError);
            }
            return(status);
        }
Exemplo n.º 12
0
        public ushort RNBOsproSetSharedLicense(ushort shareMainLic, ushort shareSubLic)
        {
            ushort status = 0;

            try
            {
                status = DicisionNativeApi.RNBOsproSetSharedLicense(this.packet, shareMainLic, shareSubLic);
            }
            catch (System.DllNotFoundException)
            {
                throw new System.DllNotFoundException(strError);
            }
            return(status);
        }
Exemplo n.º 13
0
        public ushort RNBOsproSetProtocol(int protocol)
        {
            ushort status = 0;

            try
            {
                status = DicisionNativeApi.RNBOsproSetProtocol(this.packet, protocol);
            }
            catch (System.DllNotFoundException)
            {
                throw new System.DllNotFoundException(strError);
            }
            return(status);
        }
Exemplo n.º 14
0
        public ushort RNBOsproSetHeartBeat(int heartBeatValue)
        {
            ushort status = 0;

            try
            {
                status = DicisionNativeApi.RNBOsproSetHeartBeat(this.packet, heartBeatValue);
            }
            catch (System.DllNotFoundException)
            {
                throw new System.DllNotFoundException(strError);
            }
            return(status);
        }
Exemplo n.º 15
0
        public ushort RNBOsproEnumServer(int enumFlag, ushort developerID, byte[] nsproServerInfo, ref ushort numServerInfo)
        {
            ushort status = 0;

            try
            {
                status = DicisionNativeApi.RNBOsproEnumServer(enumFlag, developerID, nsproServerInfo, ref numServerInfo);
            }
            catch (System.DllNotFoundException)
            {
                throw new System.DllNotFoundException(strError);
            }
            return(status);
        }
Exemplo n.º 16
0
        public ushort RNBOsproGetKeyInfo(ushort developerID, ushort keyIndex, byte[] nsproMonitorInfo)
        {
            ushort status = 0;

            try
            {
                status = DicisionNativeApi.RNBOsproGetKeyInfo(this.packet, developerID, keyIndex, nsproMonitorInfo);
            }
            catch (System.DllNotFoundException)
            {
                throw new System.DllNotFoundException(strError);
            }
            return(status);
        }
Exemplo n.º 17
0
        public ushort RNBOsproGetContactServer(byte[] serverNameBuffer, uint serverNameBufferSize)
        {
            ushort status = 0;

            try
            {
                status = DicisionNativeApi.RNBOsproGetContactServer(this.packet, serverNameBuffer, serverNameBufferSize);
            }
            catch (System.DllNotFoundException)
            {
                throw new System.DllNotFoundException(strError);
            }
            return(status);
        }
Exemplo n.º 18
0
        public ushort RNBOsproSetContactServer(string serverName)
        {
            ushort status = 0;

            try
            {
                status = DicisionNativeApi.RNBOsproSetContactServer(this.packet, serverName);
            }
            catch (System.DllNotFoundException)
            {
                throw new System.DllNotFoundException(strError);
            }
            return(status);
        }
Exemplo n.º 19
0
        public ushort RNBOsproReleaseLicense(ushort address, ref ushort numSubLic)
        {
            ushort status = 0;

            try
            {
                status = DicisionNativeApi.RNBOsproReleaseLicense(this.packet, address, ref numSubLic);
            }
            catch (System.DllNotFoundException)
            {
                throw new System.DllNotFoundException(strError);
            }
            return(status);
        }
Exemplo n.º 20
0
        public ushort RNBOsproFindFirstUnit(ushort developerID)
        {
            ushort status = 0;


            try
            {
                status = DicisionNativeApi.RNBOsproFindFirstUnit(this.packet, developerID);
            }
            catch (System.DllNotFoundException)
            {
                throw new System.DllNotFoundException(strError);
            }
            return(status);
        }
Exemplo n.º 21
0
        public ushort RNBOsproGetHardLimit(out ushort hardLimit)
        {
            ushort status = 0;

            hardLimit = 0;

            try
            {
                status = DicisionNativeApi.RNBOsproGetHardLimit(this.packet, out hardLimit);
            }
            catch (System.DllNotFoundException)
            {
                throw new System.DllNotFoundException(strError);
            }
            return(status);
        }
Exemplo n.º 22
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;
        }