本文整理汇总了C#中StreamReader.IndexOf方法的典型用法代码示例。如果您正苦于以下问题:C# StreamReader.IndexOf方法的具体用法?C# StreamReader.IndexOf怎么用?C# StreamReader.IndexOf使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StreamReader
的用法示例。
在下文中一共展示了StreamReader.IndexOf方法的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;
//.........这里部分代码省略.........