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


C# StreamReader.Substring方法代码示例

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


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

示例1: EditShowInfo

            /// <summary>
            /// Do work on the data
            /// </summary>
            /// <param name="table">The datatable to read and edit</param>
            /// <param name="nav">XPathNavigator for column info</param>
            /// <returns>true if the edit was successful</returns>
            public Boolean EditShowInfo(ref DataTable table, XPathNavigator nav)
            {
                Int32 updatedRowCount = 0;

                Boolean DEBUG = false;

                // Progress box
                progressForm = new Form();
                progressForm.Size = new System.Drawing.Size(400, 100);
                progressForm.Text = "IMDb Movie Tagger";
                progressForm.StartPosition = FormStartPosition.CenterScreen;
                Label progressLabel = new Label();
                progressLabel.Size = new System.Drawing.Size(300, 50);
                progressForm.Controls.Add(progressLabel);
                progressForm.Show();

                // HTTP vars
                HttpWebRequest webreq;
                HttpWebResponse webres;
                Stream resStream;
                string response;
                string indexToFind;
                int startindex;
                int endindex;

                Regex yearRegex;
                Match yearMatch;

                int count = 1;
                foreach (DataRow row in table.Rows)
                {
                    // Movie variable names
                    string imdbID = "";
                    string movieTitle = "";
                    string moviePlot = "";
                    string movieGenre = "";
                    string movieYear = "";
                    string movieDate = "";
                    string movieActors = "";
                    int discNum = 1;
                    bool multidisc = false;
                    bool isIMDB = false;

                    Thread.Sleep(500);

                    // Get the search URI for IMDb
                    string name = row["Name"].ToString();
                    // Remove the extension
                    name = name.Remove(name.LastIndexOf('.')).Trim();
                    // Remove some special characters for spacing
                    name = name.Replace("_", " ");
                    // See if it is a multi-part movie
                    if (name.IndexOf("-Disc") > 0)
                    {
                        discNum = int.Parse(name.Substring(name.IndexOf("-Disc") + 5));
                        name = name.Remove(name.IndexOf("-Disc")).Trim();
                        multidisc = true;
                    }
                    else
                    {
                        discNum = 1;
                        multidisc = false;
                    }

                    name = name.Replace(" ", "+");
                    string searchURI = "";
                    // Find out if the movie used the imdb ID or a title
                    if (name.StartsWith("tt"))
                    {
                        isIMDB = true;
                        imdbID = name;
                    }
                    else
                        searchURI = "http://www.imdb.com/find?s=all&q=" + name + "&x=0&y=0";

                    if (DEBUG)
                    {
                        MessageBox.Show("Tagging: " + name);
                    }

                    progressLabel.Text = "Tagging " + count + "/" + table.Rows.Count + ": " + row["Name"].ToString();

                    // Get the IMDB ID using the title
                    if (!isIMDB)
                    {
                        if (DEBUG)
                            MessageBox.Show("Finding IMDb ID by Title");

                        try
                        {
                            int popResults = 0;
                            int exactResults = 0;
                            int partialResults = 0;
                            int totalResults = 0;
//.........这里部分代码省略.........
开发者ID:tmar89,项目名称:tmar89snapstreamdev,代码行数:101,代码来源:PluginMovieTagger.cs


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