Exemple #1
0
 public override void AddRecipes()
 {
     base.AddRecipes();
     if (Loaded)
     {
         return;
     }
     //_messageChecker = new MessageChecker();
     ShowTooltip       = "";
     _packetHandler    = new PacketHandler();
     _sscPacketHandler = new SSCPacketHandler();
     if (!Main.dedServ)
     {
         // 加载资源只有在非服务器端才会执行
         // MethodSwapper.SwapMethods();
         MainPlayerGroup       = new Group("default");
         ToolBarServiceManager = new ToolBarServiceManager();
         ResourceLoader.LoadAll();
         GuiManager        = new GUIManager(this);
         IsLoginClientSide = false;
         ClientUnion       = null;
         if (DEBUGMODE)
         {
             ClientUnion       = new Union("裙中世界");
             ClientUnion.Owner = "我不是裙子";
         }
     }
     else
     {
         // 生成玩家存档,这里用json文件存储玩家信息
         // 顺序一定不能错
         PlayerCollection = new PlayerCollection();
         PlayerDoc        = new PlayersDocument("players.json");
         PlayerDoc.ExtractPlayersData();
         GroupManager = new GroupManager();
         GroupManager.SetGroups();
         UnionManager  = new UnionManager();
         RegionManager = new RegionManager();
         MailManager   = new MailManager();
         // 服务器端生成RSA私钥
         RSACrypto.GenKey();
         ConfigLoader.Load();
         MarketManager  = new MarketManager();
         MatchingSystem = new MatchingSystem();
         AddUnionRegions();
     }
     Loaded = true;
     if (!Main.dedServ)
     {
         GuiManager.SetNPCDefaults();
     }
 }
Exemple #2
0
    void Start()
    {
        RSACrypto.GenKey();

        //Create a UnicodeEncoder to convert between byte array and string.
        UnicodeEncoding ByteConverter = new UnicodeEncoding();

        //Create byte arrays to hold original, encrypted, and decrypted data.
        byte[] dataBytes = ByteConverter.GetBytes("Data to Encrypt,hahaha");
        byte[] encryptedData;
        byte[] decryptedData;

        encryptedData = RSACrypto.RSAEncrypt(dataBytes, RSACrypto.m_publickey, false);

        decryptedData = RSACrypto.RSADecrypt(encryptedData, RSACrypto.m_privateKey, false);

        Debug.Log("message:" + ByteConverter.GetString(decryptedData));
    }