当前位置: 首页>>代码示例>>C#>>正文


C# Authenticator.isCorrectId方法代码示例

本文整理汇总了C#中Authenticator.isCorrectId方法的典型用法代码示例。如果您正苦于以下问题:C# Authenticator.isCorrectId方法的具体用法?C# Authenticator.isCorrectId怎么用?C# Authenticator.isCorrectId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Authenticator的用法示例。


在下文中一共展示了Authenticator.isCorrectId方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: run

 public void run()
 {
     Cleaner SmartCleaner = new Cleaner();
     Receiver CmdReceiver = new Receiver();
     //Decrypter CmdDecrypter = new Decrypter(SERVER_PW);
     CommandFactory CmdFactory = new CommandFactory();
     SenderAssistant SmartSenderAssistant = new SenderAssistant();
     Authenticator SmartAuthenticator = new Authenticator();
     Killer SmartKiller = new Killer(SmartAuthenticator);
     Executor SmartExecutor = new Executor(SmartAuthenticator, SmartKiller);
     //Encrypter CmdEncrypter = new Encrypter(SERVER_PW);
     Sender SmartSender = new Sender();
     while(true)
     {
         //Read password everytime.. if changing..
         SERVER_PW = readPassword();
         //Clean following things before next round..
         SmartCleaner.clean(CmdReceiver.CurrentClient);
         Logger.getReady();
         //Receive an encrypted RequestCommandStr
         byte[] encryptedRequestComand = CmdReceiver.waitForCommand();
         Logger.incomingCommand();
         //Decrypt the encrypted RequestCommand
         byte[] decryptedRequestComand = Crypto.Decrypt(encryptedRequestComand,SERVER_PW);
         //If the encrypted RequestCommandStr has got a wrong encryption..
         if(decryptedRequestComand== null)
         {
             Logger.wrongPassword(" just wrong..");
             SmartSenderAssistant.sendWrongPassword(CmdReceiver.CurrentClient);
             continue;
         }
         Logger.correctPassword();
         //Extract RequestCommandStr as Command-Instance
         Command requestCommand = CommandFactory.extractCommand(decryptedRequestComand);
         //If requestCommandStr has got the wrong format..
         if(requestCommand== null)
         {
             Logger.wrongCmdFormat(" just wrong format..");
             SmartSenderAssistant.sendWrongCommandFormat(CmdReceiver.CurrentClient);
             continue;
         }
         Logger.correctCmdFormat();
         if(SmartKiller.clientEntreation(requestCommand)==1)
         {
             continue;
         }
         //If userid too old..
         if(SmartKiller.kill(requestCommand))
         {
             Logger.userKilled();
             SmartSenderAssistant.sendObituary(CmdReceiver.CurrentClient);
             SmartAuthenticator.Login = false;
             continue;
         }
         Logger.killerForgiven();
         //If there wasn't any login before..
         if(!SmartAuthenticator.isLogin())
         {
             Logger.noActiveUser();
             //Client don't want to connect.. FUCK CLIENT!!
             if (SmartAuthenticator.isNoLoginCommand(requestCommand))
             {
                 Logger.isNoLoginCommand();
                 SmartSenderAssistant.sendLoginRequired(CmdReceiver.CurrentClient);
                 continue;
             }
             //Client want to connect! .. let him.. PW checked before..
             else
             {
                 SmartKiller.LastAlive = SmartKiller.GetCurrentUnixTimestampMillis();
                 //SmartSenderAssistant.sendLoginSucceed(CmdReceiver.CurrentClient);
                 Command loginSucceedResponse = CmdFactory.createLoginSuceedCommand(SmartAuthenticator);
                 Logger.loginSucceed(SmartAuthenticator.Id);
                 SmartSender.send(loginSucceedResponse, CmdReceiver.CurrentClient);
                 continue;
             }
         }
         //If there was a login.. Check if the user has got the correct Session-ID.. if not do this if
         if (SmartAuthenticator.isCorrectId(requestCommand)==false)
         {
             Logger.wrongId(requestCommand.Id);
             SmartSenderAssistant.sendWrongId(CmdReceiver.CurrentClient);
             continue;
         }
         Logger.correctId(requestCommand.Id);
         //All was allright.. now execute command
         Command responseCommand = SmartExecutor.execute(requestCommand);
         //Encrypt and send responseCommand to client
         SmartSender.send(responseCommand,CmdReceiver.CurrentClient);
         Logger.finishedCommand();
     }
 }
开发者ID:apolol92,项目名称:SmartTransfer,代码行数:92,代码来源:SmartTransferServer.cs


注:本文中的Authenticator.isCorrectId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。