如何在C#中编写控制AddCode()的脚本?

如何在C#中编写控制AddCode()的脚本?,c#,C#,我在C#中使用此代码: 我想在RSA.js中使用以下代码: function createRsaKey(id, pw, sessionKey, keyName, eValue, nValue) { var rsa = new RSAKey(); rsa.setPublic(eValue, nValue); var comVal = getLenChar(sessionKey) + sessionKey + getLenChar(id) + i

我在C#中使用此代码:

我想在RSA.js中使用以下代码:

    function createRsaKey(id, pw, sessionKey, keyName, eValue, nValue)
    {
      var rsa = new RSAKey();
      rsa.setPublic(eValue, nValue);

      var comVal = getLenChar(sessionKey) + sessionKey + getLenChar(id) + id;
      return rsa.encrypt(comVal + getLenChar(pw) + pw);
    }

请告诉我,如何在script.AddCode编写代码。请:)

您是否尝试了
script.AddCode(“函数createRsaKey(…){…}”)
?Lasse//是的!我试着按你的方式去做。但是,显示此异常“NotSupportedException”。我怎样才能避免这种情况?
    function createRsaKey(id, pw, sessionKey, keyName, eValue, nValue)
    {
      var rsa = new RSAKey();
      rsa.setPublic(eValue, nValue);

      var comVal = getLenChar(sessionKey) + sessionKey + getLenChar(id) + id;
      return rsa.encrypt(comVal + getLenChar(pw) + pw);
    }