本文整理汇总了C#中GameInfo.SetValue方法的典型用法代码示例。如果您正苦于以下问题:C# GameInfo.SetValue方法的具体用法?C# GameInfo.SetValue怎么用?C# GameInfo.SetValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GameInfo
的用法示例。
在下文中一共展示了GameInfo.SetValue方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ReadXml
public void ReadXml(XmlReader reader)
{
XPathDocument xPath = new XPathDocument(reader);
XPathNavigator navigator = xPath.CreateNavigator();
XPathNodeIterator iterator = navigator.Select("//GameInfoEntries/GameInfo");
while (iterator.MoveNext())
{
GameInfo entry = new GameInfo();
entry.RomPath = iterator.Current.GetAttribute("romPath", String.Empty);
entry.Game = new Game(iterator.Current.GetAttribute("md5", String.Empty), entry.RomPath);
if (iterator.Current.MoveToFirstChild())
{
do
{
entry.SetValue(iterator.Current.Name, iterator.Current.InnerXml);
}
while (iterator.Current.MoveToNext());
}
_entries.Add(entry);
}
}
示例2: FindNewGames
private IEnumerable<GameInfo> FindNewGames()
{
List<GameInfo> newGames = new List<GameInfo>();
foreach (var path in _directoryManager.GetFilePaths(EmulationContext.Empty, GameLibraryModule.RomPathKey, GameLibraryModule.RomExtensionKey))
{
if (_gameInfoEntries.ContainsGame(path))
continue;
var game = new GameInfo() { RomPath = path };
game.SetValue("Name", Path.GetFileName(path));
var hashProvider = System.Security.Cryptography.MD5CryptoServiceProvider.Create();
String md5 = String.Empty;
if (game.RomPath.ToLower().EndsWith(".zip"))
{
using (var zip = ZipFile.Read(game.RomPath))
{
if (zip.EntryFileNames.Count() > 1)
continue;
var file = zip.Entries.First();
md5 = ByteArrayToHexString(hashProvider.ComputeHash(file.OpenReader()));
}
}
else
{
using (var fs = File.OpenRead(path))
{
md5 = ByteArrayToHexString(hashProvider.ComputeHash(fs));
game.Game = new Game(md5, path);
}
}
newGames.Add(game);
}
return newGames;
}