Example #1
0
 // Start is called before the first frame update
 void Start()
 {
     audioSource = transform.parent.GetComponent <AudioSource>();
     animator    = GetComponent <Animator>();
     _scope      = gameObject.GetComponent <scope>();
     bullets     = clipSize;
 }
Example #2
0
        /// <summary>
        /// 微信网页授权,如果用户同意授权,页面将跳转至 redirect_uri/?code=CODE&amp;state=STATE。
        /// </summary>
        /// <param name="redirect_uri">授权后重定向的回调链接地址</param>
        /// <param name="state">重定向后会带上state参数,开发者可以填写a-zA-Z0-9的参数值,最多128字节</param>
        /// <param name="scope">应用授权作用域</param>
        /// <returns></returns>
        public static string OAuthToURL(string redirect_uri, string state = "", scope scope = scope.snsapi_base)
        {
            if (string.IsNullOrWhiteSpace(redirect_uri))
            {
                throw new ArgumentException("参数值无效", nameof(redirect_uri));
            }

            return(string.Format("https://open.weixin.qq.com/connect/oauth2/authorize?appid={0}&redirect_uri={1}&response_type=code&scope={2}&state={3}#wechat_redirect"
                                 , Privacy.AppId
                                 , HttpUtility.UrlEncode(redirect_uri)
                                 , scope.ToString()
                                 , state
                                 ));
        }
        /// <summary>
        /// looks up a service and returns a valid service handle
        /// </summary>
        /// <param name="serviceName">name of the service</param>
        /// <returns> looks up a service handle</returns>
        private static IntPtr LookupServiceHandle(string serviceName, scope scope)
        {
            IntPtr databaseHandle = IntPtr.Zero;
            IntPtr serviceHandle  = IntPtr.Zero;

            try
            {
                databaseHandle = OpenSCManager(null, null, SC_MANAGER_ALL_ACCESS);
                // int errorcode = GetLatError();
                if (databaseHandle == IntPtr.Zero)
                {
                    throw new System.Runtime.InteropServices.ExternalException(string.Format("Cannot open ServiceManager. Last Error: {0}.", Marshal.GetLastWin32Error()));
                }
                switch (scope)
                {
                case scope.Query:
                {
                    serviceHandle = OpenService(databaseHandle, serviceName, SERVICE_QUERY_CONFIG);
                    break;
                }

                case scope.Modify:
                {
                    serviceHandle = OpenService(databaseHandle, serviceName, SERVICE_ALL_ACCESS);
                    break;
                }
                }

                if (serviceHandle == IntPtr.Zero)
                {
                    throw new System.Runtime.InteropServices.ExternalException(string.Format("Cannot find Service {0}. Last Error: {1}.", serviceName, Marshal.GetLastWin32Error()));
                }
            }
            finally
            {
                if (IntPtr.Zero == databaseHandle)
                {
                    CloseServiceHandle(databaseHandle);
                }
                if (IntPtr.Zero == serviceHandle)
                {
                    CloseServiceHandle(serviceHandle);
                }
            }
            return(serviceHandle);
        }
Example #4
0
        /// <summary>
        /// 引导用户进入授权页面同意授权,获取code
        /// 如果用户同意授权,页面将跳转至 redirect_uri/?code=CODE&amp;state=STATE。
        /// 若用户禁止授权,则重定向后不会带上code参数,仅会带上state参数redirect_uri?state=STATE
        /// (注意:重定向后会带上state参数,开发者可以填写a-zA-Z0-9的参数值)
        /// </summary>
        /// <param name="redirect_uri">目标页面URL(不包含页面参数)</param>
        /// <param name="scope">应用授权作用域</param>
        /// <param name="state">重定向后会带上state参数,开发者可以填写a-zA-Z0-9的参数值</param>
        /// <returns></returns>
        public static string OAuthToURL(string redirect_uri, scope scope, string state)
        {
            if (string.IsNullOrEmpty(redirect_uri))
            {
                throw new Exception("redirect_uri 为必填参数!");
            }
            if (scope == null)
            {
                scope = scope.snsapi_login;
            }
            if (string.IsNullOrEmpty(state))
            {
                state = string.Empty;
            }

            return(string.Format("https://open.weixin.qq.com/connect/qrconnect?appid={0}&redirect_uri={1}&response_type=code&scope={2}&state={3}#wechat_redirect"
                                 , Privacy.AppId
                                 , HttpUtility.UrlEncode(redirect_uri)
                                 , scope.ToString()
                                 , state
                                 ));
        }
 if (names.Contains(await Store.GetNameAsync(scope, cancellationToken), StringComparer.Ordinal))
Example #6
0
 var(scope, test, action) = CreateCase();
Example #7
0
 await AddAsync(scope, cancellationToken);
Example #8
0
 return(ProtectOrUnprotect(userData, optionalEntropy, scope, protect: true));
Example #9
0
 public ipAttr(scope Scope = default, byte Precedence = default, byte Label = default)
 {
     this.Scope      = Scope;
     this.Precedence = Precedence;
     this.Label      = Label;
 }
Example #10
0
        /// <summary>
        /// looks up a service and returns a valid service handle
        /// </summary>
        /// <param name="serviceName">name of the service</param>
        /// <returns> looks up a service handle</returns>
        private static IntPtr LookupServiceHandle(string serviceName, scope scope)
        {
            IntPtr databaseHandle = IntPtr.Zero;
            IntPtr serviceHandle = IntPtr.Zero;

            try
            {
                databaseHandle = OpenSCManager(null, null, SC_MANAGER_ALL_ACCESS);
                // int errorcode = GetLatError();
                if (databaseHandle == IntPtr.Zero)
                {
                    throw new System.Runtime.InteropServices.ExternalException(string.Format("Cannot open ServiceManager. Last Error: {0}.", Marshal.GetLastWin32Error()));
                }
                switch (scope)
                {
                    case scope.Query:
                        {
                            serviceHandle = OpenService(databaseHandle, serviceName, SERVICE_QUERY_CONFIG);
                            break;
                        }
                    case scope.Modify:
                        {
                            serviceHandle = OpenService(databaseHandle, serviceName, SERVICE_ALL_ACCESS);
                            break;
                        }
                }

                if (serviceHandle == IntPtr.Zero)
                {
                    throw new System.Runtime.InteropServices.ExternalException(string.Format("Cannot find Service {0}. Last Error: {1}.", serviceName, Marshal.GetLastWin32Error()));
                }
            }
            finally
            {
                if (IntPtr.Zero == databaseHandle)
                {
                    CloseServiceHandle(databaseHandle);
                }
                if (IntPtr.Zero == serviceHandle)
                {
                    CloseServiceHandle(serviceHandle);
                }
            }
            return serviceHandle;
        }
Example #11
0
        /// <summary>
        /// 第一步:用户同意授权,获取code
        /// </summary>
        /// <param name="cope"></param>
        /// <param name="state"></param>
        /// <returns></returns>
        public string GetAuthorizeURL(scope cope, string state)
        {
            string url = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=" + Appid + "&redirect_uri=" + CallbackUrl + "&response_type=" + code + "&scope=" + cope.ToString() + "&state=" + state + "#wechat_redirect";

            return(url);
        }
Example #12
0
 static extern uint SCardEstablishContext(scope Scope, IntPtr reserved1, IntPtr reserved2, out IntPtr context);
Example #13
0
 static extern uint SCardEstablishContext(scope Scope, IntPtr reserved1, IntPtr reserved2, out IntPtr context);
Example #14
0
 await _streams.Get(scope, stream, cancellationToken).ConfigureAwait(false),