コード例 #1
0
        public static T InvokeApi <T>(string url, RequestFunction requestFun) where T : class
        {
            using (HttpClient link = new HttpClient())
            {
                HttpRequestMessage requestMessage = new HttpRequestMessage();

                switch (requestFun)
                {
                case RequestFunction.Get:
                    requestMessage.Method = HttpMethod.Get;
                    break;

                case RequestFunction.Post:
                    requestMessage.Method = HttpMethod.Post;
                    break;

                case RequestFunction.Put:
                    requestMessage.Method = HttpMethod.Put;
                    break;

                case RequestFunction.Delete:
                    requestMessage.Method = HttpMethod.Delete;
                    break;

                default:
                    requestMessage.Method = HttpMethod.Get;
                    break;
                }
                requestMessage.RequestUri = new Uri(url);
                var result  = link.SendAsync(requestMessage).Result;
                T   context = JsonConvert.DeserializeObject <T>(result.Content.ReadAsStringAsync().Result);
                return(context);
            }
        }
コード例 #2
0
ファイル: NativeHelper.cs プロジェクト: markhc/ReClass.NET
        public IntPtr RequestFunctionPtr(RequestFunction request)
        {
            switch (request)
            {
            case RequestFunction.IsProcessValid:
                return(fnIsProcessValid);

            case RequestFunction.OpenRemoteProcess:
                return(fnOpenRemoteProcess);

            case RequestFunction.CloseRemoteProcess:
                return(fnCloseRemoteProcess);

            case RequestFunction.ReadRemoteMemory:
                return(fnReadRemoteMemory);

            case RequestFunction.WriteRemoteMemory:
                return(fnWriteRemoteMemory);

            case RequestFunction.EnumerateProcesses:
                return(fnEnumerateProcesses);

            case RequestFunction.EnumerateRemoteSectionsAndModules:
                return(fnEnumerateRemoteSectionsAndModules);

            case RequestFunction.DisassembleRemoteCode:
                return(fnDisassembleRemoteCode);

            case RequestFunction.ControlRemoteProcess:
                return(fnControlRemoteProcess);
            }

            throw new ArgumentException(nameof(request));
        }
コード例 #3
0
ファイル: NativeHelper.cs プロジェクト: markhc/ReClass.NET
        private void RegisterMethod(RequestFunction method, MethodInfo methodInfo)
        {
            Contract.Requires(methodInfo != null);

            List <MethodInfo> infos;

            if (!methodRegistry.TryGetValue(method, out infos))
            {
                infos = new List <MethodInfo>();

                methodRegistry.Add(method, infos);
            }

            infos.Add(methodInfo);
        }
コード例 #4
0
 public DeferredDictionary(RequestFunction requester)
 {
     request = requester;
 }
コード例 #5
0
 public DeferredList(QueryableFunction requester)
 {
     request = () => requester().ToList();
 }
コード例 #6
0
 public DeferredList(RequestFunction requester)
 {
     request = requester;
 }
コード例 #7
0
 public DeferredCollection(RequestFunction requester)
 {
     request = requester;
 }