本文整理汇总了C#中TvDatabase.TvBusinessLayer.WaitForInsertPrograms方法的典型用法代码示例。如果您正苦于以下问题:C# TvBusinessLayer.WaitForInsertPrograms方法的具体用法?C# TvBusinessLayer.WaitForInsertPrograms怎么用?C# TvBusinessLayer.WaitForInsertPrograms使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TvDatabase.TvBusinessLayer
的用法示例。
在下文中一共展示了TvBusinessLayer.WaitForInsertPrograms方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ThreadFunctionImportTVGuide
//.........这里部分代码省略.........
// stmt.Execute();
//}
int numChannels = 0, numPrograms = 0;
string errors = "";
try
{
if (param._importXML)
{
string fileName = folder + @"\tvguide.xml";
Log.Write("plugin:xmltv importing " + fileName);
XMLTVImport import = new XMLTVImport(10); // add 10 msec dely to the background thread
import.Import(fileName, deleteBeforeImport, false);
numChannels += import.ImportStats.Channels;
numPrograms += import.ImportStats.Programs;
if (import.ErrorMessage.Length != 0)
errors += "tvguide.xml:" + import.ErrorMessage + "; ";
}
if (param._importLST)
{
string fileName = folder + @"\tvguide.lst";
Log.Write("plugin:xmltv importing files in " + fileName);
Encoding fileEncoding = Encoding.Default;
streamIn = File.Open(fileName, FileMode.Open, FileAccess.Read, FileShare.Read);
fileIn = new StreamReader(streamIn, fileEncoding, true);
while (!fileIn.EndOfStream)
{
string tvguideFileName = fileIn.ReadLine();
if (tvguideFileName.Length == 0) continue;
if (!System.IO.Path.IsPathRooted(tvguideFileName))
{
// extend by directory
tvguideFileName = System.IO.Path.Combine(folder, tvguideFileName);
}
Log.WriteFile(@"plugin:xmltv importing " + tvguideFileName);
XMLTVImport import = new XMLTVImport(10); // add 10 msec dely to the background thread
import.Import(tvguideFileName, deleteBeforeImport, false);
numChannels += import.ImportStats.Channels;
numPrograms += import.ImportStats.Programs;
if (import.ErrorMessage.Length != 0)
errors += tvguideFileName + ": " + import.ErrorMessage + "; ";
}
}
setting = layer.GetSetting("xmlTvResultLastImport", "");
setting.Value = DateTime.Now.ToString();
setting.Persist();
setting = layer.GetSetting("xmlTvResultChannels", "");
setting.Value = numChannels.ToString();
setting.Persist();
setting = layer.GetSetting("xmlTvResultPrograms", "");
setting.Value = numPrograms.ToString();
setting.Persist();
setting = layer.GetSetting("xmlTvResultStatus", "");
setting.Value = errors;
setting.Persist();
Log.Write("Xmltv: imported {0} channels, {1} programs status:{2}", numChannels, numPrograms, errors);
}
catch (Exception ex)
{
Log.Error(@"plugin:xmltv import failed");
Log.Write(ex);
}
setting = layer.GetSetting("xmlTvLastUpdate", "");
setting.Value = param._importDate.ToString();
setting.Persist();
Log.Info("Xmltv: waiting for database to finish inserting imported programs.");
layer.WaitForInsertPrograms();
}
finally
{
Log.WriteFile(@"plugin:xmltv import done");
if (streamIn != null)
{
streamIn.Close();
streamIn.Dispose();
}
if (fileIn != null)
{
fileIn.Close();
fileIn.Dispose();
}
_workerThreadRunning = false;
SetStandbyAllowed(true);
}
}