当前位置: 首页>>代码示例>>C#>>正文


C# StreamReader.ToLower方法代码示例

本文整理汇总了C#中System.IO.StreamReader.ToLower方法的典型用法代码示例。如果您正苦于以下问题:C# StreamReader.ToLower方法的具体用法?C# StreamReader.ToLower怎么用?C# StreamReader.ToLower使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.IO.StreamReader的用法示例。


在下文中一共展示了StreamReader.ToLower方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GenerateLink

        private void GenerateLink()
        {
            // helper function to clean up code
            // MakeURL() returns the Adfly API url
            string url = MakeURL();

            try
            {
                // create a new HttpWebRequest for the Adfly url
                HttpWebRequest wRequest = (HttpWebRequest)HttpWebRequest.Create(url);
                HttpWebResponse wResponse = (HttpWebResponse)wRequest.GetResponse();

                // read the response
                string sResult = new StreamReader(wResponse.GetResponseStream()).ReadToEnd();

                // check for error
                if (sResult.ToLower() != "error")
                {
                    // update status and display the adfly link
                    UpdateStatus("Link generated", sResult.Trim());
                }
                else
                    UpdateStatus("Error");
            }
            catch (Exception ex)
            {
                // display any errors and set the status
                MessageBox.Show(ex.Message);
                UpdateStatus("Error");
            }
        }
开发者ID:neto737,项目名称:AdFlyShrinker_v1.0,代码行数:31,代码来源:Init.cs

示例2: Login

        public override void Login(string Username, string Password, string twofa)
        {
            HttpWebRequest getHeaders = HttpWebRequest.Create("https://pocketrocketscasino.eu/play/#dice") as HttpWebRequest;
            if (Prox != null)
                getHeaders.Proxy = Prox;
            var cookies = new CookieContainer();
            getHeaders.CookieContainer = cookies;
            HttpWebResponse Response = null;
            string rqtoken = "";
            try
            {

                Response = (HttpWebResponse)getHeaders.GetResponse();
                string s1 = new StreamReader(Response.GetResponseStream()).ReadToEnd();
                string tmp = s1.Substring(s1.IndexOf("__RequestVerificationToken")+"__RequestVerificationToken\" type=\"hidden\" value=\"".Length);
                s = rqtoken = tmp.Substring(0, tmp.IndexOf("\""));
            }
            catch (WebException e)
            {
                System.Windows.Forms.MessageBox.Show("Failed to log in. Please check your username and password.");
                finishedlogin(false);
            }
            
            getHeaders = HttpWebRequest.Create("https://pocketrocketscasino.eu/account/login") as HttpWebRequest;
            if (Prox != null)
                getHeaders.Proxy = Prox;
            getHeaders.CookieContainer = new CookieContainer();
            foreach (Cookie c in Response.Cookies)
            {
                
                getHeaders.CookieContainer.Add(c);
            }
            getHeaders.Method = "POST";
            string post = string.Format("userName={0}&password={1}&twoFactorCode={2}&__RequestVerificationToken={3}", Username, Password, twofa, rqtoken);
            getHeaders.ContentType = "application/x-www-form-urlencoded";
            getHeaders.ContentLength = post.Length;
            using (var writer = new StreamWriter(getHeaders.GetRequestStream()))
            {
                string writestring = post as string;
                writer.Write(writestring);
            }
            try
            {

                Response = (HttpWebResponse)getHeaders.GetResponse();
                string s1 = new StreamReader(Response.GetResponseStream()).ReadToEnd();
                if (!s1.ToLower().Contains("success"))
                {
                    System.Windows.Forms.MessageBox.Show("Failed to log in. Please check your username and password.");
                    finishedlogin(false);
                }
                /*string tmp = s1.Substring(s1.IndexOf("__RequestVerificationToken") + "__RequestVerificationToken\" type=\"hidden\" value=\"".Length);
                rqtoken = tmp.Substring(0, tmp.IndexOf("\""));*/
            }
            catch (WebException e)
            {
                Response = (HttpWebResponse)e.Response;
                string s1 = new StreamReader(Response.GetResponseStream()).ReadToEnd();
                System.Windows.Forms.MessageBox.Show("Failed to log in. Please check your username and password.");
                finishedlogin(false);
            }
            
            foreach (Cookie c in Response.Cookies)
            {
                if (c.Name == "__RequestVerificationToken")
                    rqtoken = c.Value;
                Cookies.Add(c);
            }
            Cookies.Add((new Cookie("PRC_Affiliate", "357", "/", "pocketrocketscasino.eu")));
            con.CookieContainer = Cookies;
            try
            {
                getHeaders = HttpWebRequest.Create("https://pocketrocketscasino.eu/play/#dice") as HttpWebRequest;
                if (Prox != null)
                    getHeaders.Proxy = Prox;
                getHeaders.CookieContainer = Cookies;
                Response = (HttpWebResponse)getHeaders.GetResponse();
                string stmp = new StreamReader(Response.GetResponseStream()).ReadToEnd();
                string sstmp = stmp.Substring(stmp.IndexOf("__RequestVerificationToken") + "__RequestVerificationToken\" type=\"hidden\" value=\"".Length);
                s = rqtoken = sstmp.Substring(0, sstmp.IndexOf("\""));
                



                dicehub = con.CreateHubProxy("diceHub");
                con.Start().Wait();

                dicehub.Invoke("joinChatRoom", 1);
                dicehub.On<string, string, string, int, int, bool>("chat", ReceivedChat);
                dicehub.On<string, string, string, int, bool>("receivePrivateMesssage", ReceivedChat);

                getHeaders = HttpWebRequest.Create("https://pocketrocketscasino.eu/account/GetUserAccount") as HttpWebRequest;
                if (Prox != null)
                    getHeaders.Proxy = Prox;
                getHeaders.CookieContainer = Cookies;
                Response = (HttpWebResponse)getHeaders.GetResponse();
                string s1 = new StreamReader(Response.GetResponseStream()).ReadToEnd();
                PRCUser tmp = json.JsonDeserialize<PRCUser>(s1);
                balance = (double)tmp.AvailableBalance;
                profit = (double)tmp.Profit;
//.........这里部分代码省略.........
开发者ID:wmgjang,项目名称:DiceBot,代码行数:101,代码来源:PRC.cs

示例3: GetRealIP

 public static string GetRealIP()
 {
     string str3;
     string requestUriString = "http://checkrealip.com";
     try
     {
         str3 = new StreamReader(WebRequest.Create(requestUriString).GetResponse().GetResponseStream(), true).ReadToEnd();
     }
     catch (Exception exception1)
     {
         ProjectData.SetProjectError(exception1);
         Exception exception = exception1;
         ProjectData.ClearProjectError();
         return "";
     }
     str3 = str3.ToLower();
     int index = str3.IndexOf("address:");
     if (index == -1)
     {
         return "";
     }
     str3 = str3.Substring(index + 8);
     index = str3.IndexOf("\r\n");
     if (index == -1)
     {
         return "";
     }
     return str3.Substring(0, index);
 }
开发者ID:tmsdy,项目名称:RegRainbowEcommerce,代码行数:29,代码来源:Util.cs

示例4: Login

        public override void Login(string Username, string Password, string twofa)
        {
            try
            {
                this.username = Username;
                HttpWebRequest getHeaders = (HttpWebRequest)HttpWebRequest.Create("https://rollin.io/ref/8c4");
                if (Prox != null)
                    getHeaders.Proxy = Prox;
                var cookies = new CookieContainer();
                getHeaders.CookieContainer = cookies;

                try
                {
                    HttpWebResponse Response = (HttpWebResponse)getHeaders.GetResponse();
                    string s1 = new StreamReader(Response.GetResponseStream()).ReadToEnd();
                    foreach (Cookie C in Response.Cookies)
                    {
                        cookies.Add(C);
                    }
                    s1 = s1.Substring(s1.IndexOf("<input name=\"_token\" type=\"hidden\""));
                    s1 = s1.Substring("<input name=\"_token\" type=\"hidden\" value=\"".Length);
                    Token = s1.Substring(0, s1.IndexOf("\""));
                }
                catch
                {
                    finishedlogin(false);
                    return;
                }

                HttpWebRequest betrequest = (HttpWebRequest)HttpWebRequest.Create("https://rollin.io/api/customer/login");
                if (Prox != null)
                    betrequest.Proxy = Prox;
                betrequest.CookieContainer = cookies;

                betrequest.Method = "POST";

                string post = string.Format("username={0}&password={1}&code={2}", Username, Password, twofa);
                betrequest.ContentLength = post.Length;
                betrequest.ContentType = "application/x-www-form-urlencoded; charset=UTF-8";
                betrequest.Headers.Add("X-CSRF-Token", Token);
                using (var writer = new StreamWriter(betrequest.GetRequestStream()))
                {

                    writer.Write(post);
                }
                HttpWebResponse EmitResponse = (HttpWebResponse)betrequest.GetResponse();
                string sEmitResponse = new StreamReader(EmitResponse.GetResponseStream()).ReadToEnd();
                if (!sEmitResponse.ToLower().Contains("true"))
                {
                    finishedlogin(false);
                    return;
                }
                this.Cookies = cookies;
                HttpWebRequest betrequest2 = (HttpWebRequest)HttpWebRequest.Create("https://rollin.io/api/customer/info?username=" + username);
                if (Prox != null)
                    betrequest2.Proxy = Prox;
                betrequest2.CookieContainer = cookies;
                betrequest2.Headers.Add("X-CSRF-Token", Token);
                HttpWebResponse EmitResponse2 = (HttpWebResponse)betrequest2.GetResponse();
                string sEmitResponse2 = new StreamReader(EmitResponse2.GetResponseStream()).ReadToEnd();
                RollinLoginStats tmpStats = json.JsonDeserialize<RollinLoginStats>(sEmitResponse2);

                //https://rollin.io/api/customer/sync
                betrequest2 = (HttpWebRequest)HttpWebRequest.Create("https://rollin.io/api/customer/sync");
                if (Prox != null)
                    betrequest2.Proxy = Prox;
                betrequest2.CookieContainer = cookies;
                betrequest2.Headers.Add("X-CSRF-Token", Token);
                EmitResponse2 = (HttpWebResponse)betrequest2.GetResponse();
                sEmitResponse2 = new StreamReader(EmitResponse2.GetResponseStream()).ReadToEnd();
                RollinBet tmpStats2 = json.JsonDeserialize<RollinBet>(sEmitResponse2);

                if (tmpStats.success && tmpStats2.success)
                {
                    ClientHandlr = new HttpClientHandler { UseCookies = true };
                    Client = new HttpClient(ClientHandlr) { BaseAddress = new Uri("https://rollin.io/api/") };
                    ClientHandlr.CookieContainer = this.Cookies;
                    Client.DefaultRequestHeaders.Add("X-CSRF-Token", Token);

                    GetDeposit();
                    balance = double.Parse(tmpStats2.customer.balance, System.Globalization.NumberFormatInfo.InvariantInfo) / 1000.0; //i assume
                    bets = tmpStats.user.bets;
                    profit = double.Parse(tmpStats.user.profit, System.Globalization.NumberFormatInfo.InvariantInfo) / 1000.0;

                    Parent.updateBalance((decimal)(balance));
                    Parent.updateBets(tmpStats.user.bets);
                    Parent.updateLosses(tmpStats.user.losses);
                    Parent.updateProfit(double.Parse(tmpStats.user.profit, System.Globalization.NumberFormatInfo.InvariantInfo) / 1000.0);
                    Parent.updateWagered(double.Parse(tmpStats.user.wagered, System.Globalization.NumberFormatInfo.InvariantInfo) / 1000.0);
                    Parent.updateWins(tmpStats.user.wins);

                    finishedlogin(true);
                    return;
                }
            }
            catch
            {

            }
            finishedlogin(false);
//.........这里部分代码省略.........
开发者ID:bdcravens,项目名称:DiceBot,代码行数:101,代码来源:rollin.cs

示例5: GetDeliveryStatus

        public DeliveryStatusResponse GetDeliveryStatus(Guid transactionId)
        {
            var response = new DeliveryStatusResponse();

            try
            {
                var requestString = "https://api.elasticemail.com/mailer/status/" + transactionId + "?showstats=true";
                var request = WebRequest.Create(requestString);
                Stream stream = new RetryLogic(_configuration.PreferredRetryStrategy).Execute(() => request.GetResponse().GetResponseStream());
                var xmlString = new StreamReader(stream, Encoding.UTF8).ReadToEnd();
                if (xmlString.ToLower().StartsWith("no job with transactionid"))
                {
                    response.ErrorMessage = xmlString;
                    response.ResultType = ResultType.Error;
                }
                else
                {
                    try
                    {
                        XmlSerializer serializer = new XmlSerializer(typeof(job));
                        StringReader rdr = new StringReader(xmlString);
                        var job = (job)serializer.Deserialize(rdr);
                        var deliveryStatus = new DeliveryStatus();
                        deliveryStatus.Id = transactionId;
                        deliveryStatus.Recipients = job.recipients;
                        deliveryStatus.Delivered = job.delivered;
                        deliveryStatus.Failed = job.failed;
                        deliveryStatus.Pending = job.pending;
                        deliveryStatus.Status = job.status;
                        deliveryStatus.Clicked = job.clicked;
                        deliveryStatus.Opened = job.opened;
                        deliveryStatus.Unsubscribed = job.unsubscribed;

                        response.DeliveryStatus = deliveryStatus;
                        response.ResultType = ResultType.Success;
                    }
                    catch (Exception ex)
                    {
                        response.ErrorMessage = "Could not deserialize message: " + Environment.NewLine + ex;
                        response.ResultType = ResultType.Error;
                    }
                }
            }
            catch (Exception ex)
            {
                response.ErrorMessage = ex.ToString();
                response.ResultType = ResultType.Error;
            }

            return response;
        }
开发者ID:MarcDrexler,项目名称:CAIRO.ElasticEmail,代码行数:51,代码来源:ElasticemailWebApi.cs


注:本文中的System.IO.StreamReader.ToLower方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。