csharp 瞬移

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了csharp 瞬移相关的知识,希望对你有一定的参考价值。

 private ObjRespuesta EjecutarConsulta(Uri Uri, string Metodo, string Body, bool GuardarCookies, String ContentType = "")
        {            
            var Resultado = new ObjRespuesta();
            
            HttpWebRequest request = HttpWebRequest.Create(Uri) as HttpWebRequest;

            request.Method = Metodo.ToString().ToUpper();
            request.ServicePoint.Expect100Continue = false;
            request.ContentType = ContentType;
            request.Timeout = 999999999;
            if (Metodo == "PATCH"){
                WebHeaderCollection Header = new WebHeaderCollection();
                Header.Add("B1S-ReplaceCollectionsOnPatch:true");
                request.Headers = Header;
            }
            ServicePointManager.ServerCertificateValidationCallback = delegate { return true; };
            request.CookieContainer = new CookieContainer();

            /*Definicion de Cookies*/
            if (cookieData.Count > 0)
            {
                foreach (Cookie cookie in cookieData)
                {
                    request.CookieContainer.Add(Uri, new Cookie(cookie.Name, cookie.Value));
                }
            }

            /*Escribir el Body del Request*/
            if (!string.IsNullOrEmpty(Body))
            {
                using (var requestStream = request.GetRequestStream())
                {
                    var writer = new StreamWriter(requestStream);
                    writer.Write(Body);
                    writer.Close();
                }
            }
            /*Obtener y procesar la respuesta*/
            System.Net.HttpWebResponse response;
            try
            {
                response = (HttpWebResponse)request.GetResponse();
                using (var reader = new StreamReader(response.GetResponseStream()))
                {
                    Resultado.exito = true;
                    Resultado.Contenido = reader.ReadToEnd();
                }
                if (GuardarCookies)
                    this.cookieData = response.Cookies;
                response.Close();
            }
            catch (WebException ex)
            {
                if (ex.Response != null)
                {
                    // can use ex.Response.Status, .StatusDescription
                    if (ex.Response.ContentLength != 0)
                    {
                        using (var stream = ex.Response.GetResponseStream())
                        {
                            using (var reader = new StreamReader(stream))
                            {
                                try
                                {
                                    if (ex.Response.ContentType == "application/json;charset=utf-8")
                                    {
                                        String Valor = reader.ReadToEnd();
                                        if (Valor != "")
                                        {
                                            Resultado = JsonConvert.DeserializeObject<ObjRespuesta>(Valor);
                                        }
                                        else
                                        {
                                            Resultado.MsgError = "" + ex.Message;
                                        }
                                    }
                                    else
                                    {
                                        Resultado.MsgError = "" + ex.Message;
                                    }



                                }
                                catch (WebException ex2)
                                {
                                    Resultado.MsgError = ex2.Message.ToString();
                                    Resultado.exito = false;
                                }

                                //Resultado.Add(false, reader.ReadToEnd());
                            }
                        }
                    }
                }
                else
                {
                    Resultado.MsgError = ex.Message;
                }
            }
            return Resultado;
        }

以上是关于csharp 瞬移的主要内容,如果未能解决你的问题,请参考以下文章

Unity控制逻辑(移动,翻滚,瞬移)

Windows 逆向CE 地址遍历工具 ( CE 结构剖析工具 | 尝试进行瞬移操作 | 尝试查找飞天漏洞 )

人的瞬移

使用瞬移在图中查找最短路径

vue3中的teleport(瞬移)组件

路径瞬移:让路径跳转变得更加智能 - z