Пример #1
0
 public bool Validate(MrModuleType power, out bool IsOut)
 {
     try
     {
         ulong ID1 = USerial;
         ulong ID2 = GetSerial();
         IsOut = true;
         CServers.GetServers().GetUserName();
         if (ID2 == 0)
         {
             MessageBox.Show("未检测到加密狗!请确认是否已经插好!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
             return(false);
         }
         else if (ID1 != ID2)
         {
             MessageBox.Show("在使用中不可以更换加密狗!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
             return(false);
         }
         else if (Validate())
         {
             if (UserAuthority > 0)
             {
                 if ((UserAuthority & ((int)power)) == ((int)power))
                 {
                     IsOut = false;
                     return(true);
                 }
                 else
                 {
                     MessageBox.Show("该模块需要另外付费购买才能运行!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                     IsOut = false;
                     return(false);
                 }
             }
         }
         MessageBox.Show("未检测到加密狗!请确认是否已经插好!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         return(false);
     }
     catch
     {
         MessageBox.Show("服务器异常,请确认网络或者加密狗", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         IsOut = true;
         return(false);
     }
 }
Пример #2
0
 /// <summary>
 /// 验证当前该模块是否可用;
 /// </summary>
 /// <param name="mrModuleType"></param>
 /// <returns></returns>
 private bool ValidateModule(MrModuleType mrModuleType)
 {
     //需要验证加密狗;
     if (CCommonPara.mBEnableLock)
     {
         bool IsOut;
         if (!CDogTools.GetInstance().Validate(mrModuleType, out IsOut))
         {
             if (IsOut)
             {
                 return(false);
             }
         }
         return(true);
     }
     else
     {
         return(true);
     }
 }