예제 #1
0
        /// <summary>
        /// 获取错误信息.
        /// </summary>
        /// <param name="token">
        /// CreateNlsToken所建立的NlsToken对象.
        /// </param>
        /// <returns>成功则返回错误信息; 失败返回NULL.</returns>
        public string GetErrorMsg(NlsToken token)
        {
            IntPtr get   = NativeMethods.NlsGetErrorMsg(token.native_token);
            string error = Marshal.PtrToStringAnsi(get);

            return(error);
        }
예제 #2
0
        /// <summary>
        /// 获取token id.
        /// </summary>
        /// <param name="token">
        /// CreateNlsToken所建立的NlsToken对象.
        /// </param>
        /// <returns>返回 token 字符串.</returns>
        public string GetToken(NlsToken token)
        {
            IntPtr get       = NativeMethods.NlsGetToken(token.native_token);
            string token_str = Marshal.PtrToStringAnsi(get);

            return(token_str);
        }
예제 #3
0
        /// <summary>
        /// 创建Token获取对象.
        /// </summary>
        /// <returns>成功返回NlsToken对象, 否则返回NULL.</returns>
        public NlsToken CreateNlsToken()
        {
            IntPtr   token    = NativeMethods.NlsCreateNlsToken();
            NlsToken nlsToken = new NlsToken();

            nlsToken.native_token = token;
            return(nlsToken);
        }
예제 #4
0
 /// <summary>
 /// 销毁Token获取对象.
 /// </summary>
 /// <param name="token">
 /// CreateNlsToken所建立的NlsToken对象.
 /// </param>
 /// <returns></returns>
 public void ReleaseNlsToken(NlsToken token)
 {
     NativeMethods.NlsReleaseNlsToken(token.native_token);
     return;
 }
예제 #5
0
 /// <summary>
 /// 设置阿里云账号的KeySecret.
 /// </summary>
 /// <param name="token">
 /// CreateNlsToken所建立的NlsToken对象.
 /// </param>
 /// <param name="KeySecret">
 /// Secret字符串.
 /// </param>
 /// <returns></returns>
 public void SetKeySecret(NlsToken token, string KeySecret)
 {
     NativeMethods.NlsSetKeySecret(token.native_token, KeySecret);
     return;
 }
예제 #6
0
 /// <summary>
 /// 获得token有效期时间戳(秒).
 /// </summary>
 /// <param name="token">
 /// CreateNlsToken所建立的NlsToken对象.
 /// </param>
 /// <returns>成功则返回有效期时间戳, 失败返回0.</returns>
 public UInt32 GetExpireTime(NlsToken token)
 {
     return(NativeMethods.NlsGetExpireTime(token.native_token));
 }
예제 #7
0
 /// <summary>
 /// 设置功能.
 /// </summary>
 /// <param name="token">
 /// CreateNlsToken所建立的NlsToken对象.
 /// </param>
 /// <param name="action">
 /// 功能.
 /// </param>
 /// <returns></returns>
 public void SetAction(NlsToken token, string action)
 {
     NativeMethods.NlsSetAction(token.native_token, action);
     return;
 }
예제 #8
0
 /// <summary>
 /// 申请获取token.
 /// </summary>
 /// <param name="token">
 /// CreateNlsToken所建立的NlsToken对象.
 /// </param>
 /// <returns></returns>
 public int ApplyNlsToken(NlsToken token)
 {
     return(NativeMethods.NlsApplyNlsToken(token.native_token));
 }
예제 #9
0
 /// <summary>
 /// 设置RegionId.
 /// </summary>
 /// <param name="token">
 /// CreateNlsToken所建立的NlsToken对象.
 /// </param>
 /// <param name="regionId">
 /// 服务地区.
 /// </param>
 /// <returns></returns>
 public void SetRegionId(NlsToken token, string regionId)
 {
     NativeMethods.NlsSetRegionId(token.native_token, regionId);
     return;
 }
예제 #10
0
 /// <summary>
 /// 设置服务路径.
 /// </summary>
 /// <param name="token">
 /// CreateNlsToken所建立的NlsToken对象.
 /// </param>
 /// <param name="serverResourcePath">
 /// 服务路径字符串.
 /// </param>
 /// <returns></returns>
 public void SetServerResourcePath(NlsToken token, string serverResourcePath)
 {
     NativeMethods.NlsSetServerResourcePath(token.native_token, serverResourcePath);
     return;
 }
예제 #11
0
 /// <summary>
 /// 设置API版本.
 /// </summary>
 /// <param name="token">
 /// CreateNlsToken所建立的NlsToken对象.
 /// </param>
 /// <param name="serverVersion">
 /// API版本字符串.
 /// </param>
 /// <returns></returns>
 public void SetServerVersion(NlsToken token, string serverVersion)
 {
     NativeMethods.NlsSetServerVersion(token.native_token, serverVersion);
     return;
 }
예제 #12
0
 /// <summary>
 /// 设置域名.
 /// </summary>
 /// <param name="token">
 /// CreateNlsToken所建立的NlsToken对象.
 /// </param>
 /// <param name="domain">
 /// 域名url字符串.
 /// </param>
 /// <returns></returns>
 public void SetDomain(NlsToken token, string domain)
 {
     NativeMethods.NlsSetDomain(token.native_token, domain);
     return;
 }
예제 #13
0
 /// <summary>
 /// 设置阿里云账号的KeyId.
 /// </summary>
 /// <param name="token">
 /// CreateNlsToken所建立的NlsToken对象.
 /// </param>
 /// <param name="accessKeyId">
 /// Access Key Id 字符串.
 /// </param>
 /// <returns></returns>
 public void SetAccessKeyId(NlsToken token, string accessKeyId)
 {
     NativeMethods.NlsSetAccessKeyId(token.native_token, accessKeyId);
     return;
 }