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


C# StreamReader.Split方法代码示例

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


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

示例1: ResetIp

        private void ResetIp()
        {
            try
            {
                textBoxIP.Text = "";
                var req = (HttpWebRequest)WebRequest.Create("http://canyouseeme.org");
                var resp = (HttpWebResponse)req.GetResponse();
                string x = new StreamReader(resp.GetResponseStream()).ReadToEnd();
                //  input type="hidden" name="IP" value="41.28.175.2"/>
                string[] sepd = x.Split(new char[] { '<' });
                foreach (string s in sepd)
                    if (s.Contains("input type=\"hidden\" name=\"IP\""))
                    {
                        string[] spdbyspace = s.Split(new char[] { ' ' });
                        foreach (string sen in spdbyspace)
                            if (sen.Contains("value"))
                            {
                                string[] spd_by_qoute = sen.Split(new char[] { '"' });
                                this.CurrentExIp = spd_by_qoute[1];
                                textBoxIP.Text = this.CurrentExIp;

                                this.ExIpDetetected = true;
                                return;
                            }
                    }
            }
            catch (Exception z)
            {
                textBoxIP.Text = "No internet";
            }
        }
开发者ID:4neso,项目名称:Rykon2,代码行数:31,代码来源:FormIps.cs

示例2: ssoauth

        public HttpResponseMessage ssoauth()
        {
            var ssoToken = string.Empty;
            var ssoTokenName = string.Empty;

            using (var requestStream = HttpContext.Current.Request.InputStream)
            {
                requestStream.Seek(0, SeekOrigin.Begin);

                var rawBody = new StreamReader(requestStream).ReadToEnd();

                if (!string.IsNullOrEmpty(rawBody))
                {
                    var ary=rawBody.Split("=".ToCharArray(),2);

                    if (ary.Length != 2 || !ConfigHelper.IsValidToken(ary[0]))
                        return Request.CreateErrorResponse(HttpStatusCode.Unauthorized,new Exception("testing"));

                    ssoToken = ary[1];
                    ssoTokenName = ary[0];

                }
            }

            var result = new GradeBusiness().GetGradeResponse(ssoToken, ssoTokenName);

            HttpStatusCode code;

            if (!Enum.TryParse(result.StatusCode, out code))
                code = HttpStatusCode.OK;

            return Request.CreateResponse(code, result, new JsonMediaTypeFormatter());
        }
开发者ID:babu27,项目名称:ssoTest,代码行数:33,代码来源:RestController.cs

示例3: m00022e

        public static struct014a[] m00022e(string p0, string p1, string p2)
        {
            FtpWebResponse response = m000230(p0, p1, p2, "LIST").GetResponse() as FtpWebResponse;
            string str = new StreamReader(response.GetResponseStream(), Encoding.ASCII).ReadToEnd();
            response.Close();
            List<struct014a> list = new List<struct014a>();
            string[] strArray = str.Split(new char[] { '\n' });
            enum01fa enumfa = m000231(strArray);
            foreach (string str2 in strArray)
            {
                if ((enumfa != enum01fa.f0000c0) && (str2 != ""))
                {
                    struct014a item = new struct014a();
                    item.f0000d7 = "..";
                    switch (enumfa)
                    {
                        case enum01fa.f00002a:
                            item = m000082(str2);
                            break;

                        case enum01fa.f0000bf:
                            item = m000081(str2);
                            break;
                    }
                    if ((item.f0000d7 != ".") && (item.f0000d7 != ".."))
                    {
                        list.Add(item);
                    }
                }
            }
            return list.ToArray();
        }
开发者ID:bing2008,项目名称:CastNetGame,代码行数:32,代码来源:c000147.cs

示例4: runServer

        public void runServer()
        {
            tcpListener.Start();

            //Byte[] bytes = new Byte[16];
            //Byte[] data = new Byte[16];

            while (true)
            {
                TcpClient tcpClient = tcpListener.AcceptTcpClient();
                NetworkStream stream = tcpClient.GetStream();
                string command = new StreamReader(stream).ReadToEnd();

                string[] commands = command.Split(seperators);

                if (commands[0].Contains("GET"))
                {
                    file = new File(commands[1]);
                    FileStream fs = new FileStream(commands[1], FileMode.Open);

                    int currentPos = 0;

                    while (currentPos < fs.Length)
                    {
                        byte[] bytes = new byte[16];
                        int data = fs.Read(bytes, currentPos, 16);

                        stream.Write(bytes, 0, 16);
                        currentPos += 16;
                    }
                }
            }
        }
开发者ID:j0z,项目名称:Alexandria,代码行数:33,代码来源:Server.cs

示例5: GetWordById

        public static Word GetWordById(List<WordSource> wordSourceList, int sourceId, int wordId)
        {
            WordSource wordSource = WordSourceHelper.GetWordSourceById(wordSourceList, sourceId);
            if (wordSource == null)
                return null;

            StreamResourceInfo streamResourceInfo = Application.GetResourceStream(wordSource.fileUri);
            if (streamResourceInfo != null)
            {
                Stream stream = streamResourceInfo.Stream;
                string fileContent = new StreamReader(stream).ReadToEnd();

                string[] lines = fileContent.Split('\n');
                for (int i = 0; i < lines.Length; i++)
                {
                    string[] lineParts = lines[i].Trim().Split('\t');
                    if (int.Parse(lineParts[0]) == wordId)
                    {
                        Word word = ConvertLineToWord(lines[i]);
                        return word;
                    }
                }
            }
            return null;
        }
开发者ID:jacklandrin,项目名称:GermanWords,代码行数:25,代码来源:WordFileHelper.cs

示例6: Main

        static void Main(string[] args)
        {
            var text = new StreamReader("text.txt").ReadToEnd().ToLower();
            //             string regex = @"\b\w+\b";
            //             MatchCollectionollection words = Regex.Matches(text, regex);
            var words = text.Split(new char[] { '.', '!', '?', ';', ' ', ':', ',', '-' }, StringSplitOptions.RemoveEmptyEntries);
            var dictionary = new Dictionary<string, int>();
            foreach (var item in words)
            {
                if (dictionary.ContainsKey(item))
                {
                    dictionary[item]++;
                }
                else
                {
                    dictionary.Add(item, 1);
                }
            }

            foreach (var item in dictionary.OrderBy(x => x.Value))
            {
                Console.WriteLine("{0} -> {1}", item.Key, item.Value);
            }

            Console.ReadKey(true);
        }
开发者ID:kaizer04,项目名称:Telerik-Academy-2015-2016,代码行数:26,代码来源:Program.cs

示例7: ReadFiles

 public static Queue<string> ReadFiles(string path)
 {
     Queue<string> data = new Queue<string> { };
     try
     {
         string[] filesPaths = Directory.GetFiles(@path.ToString(), "*.", SearchOption.TopDirectoryOnly);
         foreach (string filePath in filesPaths)
         {
             try
             {
                 string file = new System.IO.StreamReader(filePath).ReadToEnd();
                 string[] docs = file.Split(new string[] { "<DOC>" }, StringSplitOptions.None);
                 foreach (string doc in docs)
                 {
                     if (doc.Length > 0)
                         data.Enqueue(doc.Split(new string[] { "</DOC>" }, StringSplitOptions.None)[0]);
                 }
             }
             catch (Exception e)
             {
                 throw e;
             }
         }
     }
     catch (Exception e)
     {
         throw e;
     }
     return data;
 }
开发者ID:barbelity,项目名称:SearchEngine,代码行数:30,代码来源:ReadFile.cs

示例8: EvoSQLExpression

        public EvoSQLExpression(string query)
        {
            MemoryStream stream = new MemoryStream();
            String errorString;
            StreamWriter writer = new StreamWriter(stream);
            writer.Write(query);
            writer.Flush();

            Scanner scanner = new Scanner(stream);
            Parser parser = new Parser(scanner);
            MemoryStream errorStream = new MemoryStream();
            StreamWriter errorWriter = new StreamWriter(errorStream);

            parser.errors.errorStream = errorWriter;
            parser.Parse();
            errorWriter.Flush();
            errorStream.Seek(0, SeekOrigin.Begin);
            errorString = new StreamReader(errorStream).ReadToEnd();
            errorStream.Close();
            stream.Close();

            if (parser.errors.count > 0)
            {
                Errors = errorString.Split('\n');
                HadErrors = true;
            }
            else
            {
                Tree = parser.RootTree;
            }
        }
开发者ID:yonglehou,项目名称:Bermuda,代码行数:31,代码来源:EvoSQLExpression.cs

示例9: Create

        public ActionResult Create(InstallModel m)
        {
            if (m.InstallType == "SCHEMA" || ModelState.IsValid) {
                // Read embedded create script
                Stream str = Assembly.GetExecutingAssembly().GetManifestResourceStream("Piranha.Data.Scripts.Create.sql") ;
                String sql = new StreamReader(str).ReadToEnd() ;
                str.Close() ;

                // Read embedded data script
                str = Assembly.GetExecutingAssembly().GetManifestResourceStream("Piranha.Data.Scripts.Data.sql") ;
                String data = new StreamReader(str).ReadToEnd() ;
                str.Close() ;

                // Split statements and execute
                string[] stmts = sql.Split(new char[] { ';' }) ;
                using (IDbTransaction tx = Database.OpenTransaction()) {
                    // Create database from script
                    foreach (string stmt in stmts) {
                        if (!String.IsNullOrEmpty(stmt.Trim()))
                            SysUser.Execute(stmt, tx) ;
                    }
                    tx.Commit() ;
                }

                if (m.InstallType.ToUpper() == "FULL") {
                    // Split statements and execute
                    stmts = data.Split(new char[] { ';' }) ;
                    using (IDbTransaction tx = Database.OpenTransaction()) {
                        // Create user
                        SysUser usr = new SysUser() {
                            Login = m.UserLogin,
                            Email = m.UserEmail,
                            GroupId = new Guid("7c536b66-d292-4369-8f37-948b32229b83"),
                            CreatedBy = new Guid("ca19d4e7-92f0-42f6-926a-68413bbdafbc"),
                            UpdatedBy = new Guid("ca19d4e7-92f0-42f6-926a-68413bbdafbc"),
                            Created = DateTime.Now,
                            Updated = DateTime.Now
                        } ;
                        usr.Save(tx) ;

                        // Create user password
                        SysUserPassword pwd = new SysUserPassword() {
                            Id = usr.Id,
                            Password = m.Password,
                            IsNew = false
                        } ;
                        pwd.Save(tx) ;

                        // Create default data
                        foreach (string stmt in stmts) {
                            if (!String.IsNullOrEmpty(stmt.Trim()))
                                SysUser.Execute(stmt, tx) ;
                        }
                        tx.Commit() ;
                    }
                }
                return RedirectToAction("index", "account") ;
            }
            return Index() ;
        }
开发者ID:Joebeazelman,项目名称:Piranha,代码行数:60,代码来源:InstallController.cs

示例10: GetAddressForNumber

 /// <summary>
 /// Looks up the messaging address for the phone number
 /// </summary>
 /// <param name="cc">Country Code</param>
 /// <param name="num">Phone Number</param>
 /// <returns>The messaging address to that phone number</returns>
 public static string GetAddressForNumber(string cc, string num)
 {
     byte[] b = System.Text.Encoding.ASCII.GetBytes("cc=" + cc + "&phonenum=" + num);
     WebRequest r = WebRequest.Create("http://www.freecarrierlookup.com/getcarrier.php");
     r.ContentType = "application/x-www-form-urlencoded";
     r.ContentLength = b.Length;
     r.Method = "POST";
     Stream requestStream = r.GetRequestStream();
     requestStream.Write(b, 0, b.Length);
     requestStream.Close();
     HttpWebResponse response;
     response = (HttpWebResponse)r.GetResponse();
     string responseStr;
     if (response.StatusCode == HttpStatusCode.OK)
     {
         Stream responseStream = response.GetResponseStream();
         responseStr = new StreamReader(responseStream).ReadToEnd();
         string[] respTok = responseStr.Split(new string[] { "<", ">" }, StringSplitOptions.RemoveEmptyEntries);
         foreach (string token in respTok)
         {
             if (token.Contains("@"))
             {
                 return token;
             }
         }
         return null;
     }
     else
     {
         Console.WriteLine("RETRY.");
         return null;
     }
 }
开发者ID:ActiveAuthentication,项目名称:ActiveAuthentication,代码行数:39,代码来源:Messager.cs

示例11: SaveIniFileContent

        public static string[] SaveIniFileContent(IniFile file, IniOptions options)
        {
            string iniFileContent;
            using (var stream = new MemoryStream())
            {
                file.Save(stream);
                iniFileContent = new StreamReader(stream, options.Encoding).ReadToEnd();
            }

            return iniFileContent.Split(new string[] { Environment.NewLine }, StringSplitOptions.None);
        }
开发者ID:javadib,项目名称:MadMilkman.Ini,代码行数:11,代码来源:IniUtilities.cs

示例12: PrepareRhetosDatabase

        public static void PrepareRhetosDatabase(ISqlExecuter sqlExecuter)
        {
            string rhetosDatabaseScriptResourceName = "Rhetos.Deployment.RhetosDatabase." + SqlUtility.DatabaseLanguage + ".sql";
            var resourceStream = typeof(DeploymentUtility).Assembly.GetManifestResourceStream(rhetosDatabaseScriptResourceName);
            if (resourceStream == null)
                throw new FrameworkException("Cannot find resource '" + rhetosDatabaseScriptResourceName + "'.");
            var sql = new StreamReader(resourceStream).ReadToEnd();

            var sqlScripts = sql.Split(new[] {"\r\nGO\r\n"}, StringSplitOptions.RemoveEmptyEntries).Where(s => !String.IsNullOrWhiteSpace(s));
            sqlExecuter.ExecuteSql(sqlScripts);
        }
开发者ID:koav,项目名称:Rhetos,代码行数:11,代码来源:DeploymentUtility.cs

示例13: write

        public void write(string data)
        {

            Request.InputStream.Seek(0, SeekOrigin.Begin);
            string jsonData = new StreamReader(Request.InputStream).ReadToEnd();
            String subject = jsonData.Split('<')[0];
            int subjectId = Int32.Parse(subject);
            String xaml = jsonData.Substring(subject.Length);
      
            _db.WS_Subjects.Find(subjectId).Xaml_Data = xaml;
           _db.SaveChanges();
        }
开发者ID:InFlowBPM,项目名称:InFlow-BPMS,代码行数:12,代码来源:XAMLController.cs

示例14: Main

        public static void Main()
        {
            var text = new StreamReader("../../text.txt").ReadToEnd().ToLower();

            var splitedWords = text.Split(new char[] { '.', '!', '?', ';', ' ', ':', ',', '-' }, StringSplitOptions.RemoveEmptyEntries);

            var dictionary = splitedWords.GroupBy(w => w).ToDictionary(w => w.Key, w => w.Count()).OrderBy(w => w.Value);

            foreach (var pair in dictionary)
            {
                Console.WriteLine("Word: {0} -> appearance {1}", pair.Key, pair.Value);
            }
        }
开发者ID:MarinMarinov,项目名称:Data-structures-and-algorithms,代码行数:13,代码来源:Startup.cs

示例15: fileToDocString

 internal static string[] fileToDocString(string filePath)
 {
     /*
     XmlDocument file = new XmlDocument();
     XmlNodeList docs = file.GetElementsByTagName("DOC");
     foreach (XmlNode doc in docs)
     {
         RetrievalEngineProject.MainWindow.docCounter++;
         Doc newDoc = new Doc(elem);
     }
     doc.Load(filePath);
     */
     string file = new System.IO.StreamReader(filePath).ReadToEnd();
     return file.Split(new string[] { "<DOC>" }, StringSplitOptions.None);
 }
开发者ID:barbelity,项目名称:SearchEngine,代码行数:15,代码来源:ReadFile.cs


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