本文整理汇总了C#中IPackage.Find方法的典型用法代码示例。如果您正苦于以下问题:C# IPackage.Find方法的具体用法?C# IPackage.Find怎么用?C# IPackage.Find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IPackage
的用法示例。
在下文中一共展示了IPackage.Find方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ReadTable
protected static Dictionary<ulong, STBLImporter.Lookup> ReadTable(string prefix, string instance, IPackage package, bool addOtherKeys)
{
instance = prefix + instance.Substring(4);
Dictionary<ulong, STBLImporter.Lookup> lookup = new Dictionary<ulong, STBLImporter.Lookup>();
IResourceIndexEntry entry = package.Find(key => ((key.ResourceType == (uint)ResourceType.STBL) && (key["Instance"] == instance)));
if (entry != null)
{
StblResource.StblResource resource = ResourceHandlers.CreateResource(entry, package) as StblResource.StblResource;
foreach (KeyValuePair<ulong,string> element in resource)
{
bool space = false;
string keyValue = element.Value;
if (prefix == "0x17")
{
if (keyValue.StartsWith("PackerSpace|"))
{
keyValue = keyValue.Replace("PackerSpace|", "");
space = true;
}
}
if (!lookup.ContainsKey(element.Key))
{
STBLImporter.Lookup recent = new STBLImporter.Lookup(keyValue, keyValue, space);
lookup.Add(element.Key, recent);
}
if ((addOtherKeys) && (!HasSuffix(keyValue)))
{
foreach (string suffix in sSuffixes)
{
string value = keyValue + suffix;
ulong key = FNV64.GetHash(value);
if (lookup.ContainsKey(key)) continue;
STBLImporter.Lookup recent = new STBLImporter.Lookup(value, value, space);
lookup.Add(key, recent);
}
}
}
}
return lookup;
}
示例2: CreateKeyResource
public static IResource CreateKeyResource(IPackage package)
{
IResourceIndexEntry key = package.Find(value => value.ResourceType == (uint)ResourceType._KEY);
if (key == null)
{
return null;
}
else
{
return ResourceHandlers.CreateResource(key, package);
}
}
示例3: exportResourceToPackage
private void exportResourceToPackage(IPackage tgtpkg, IResourceIndexEntry srcrie, bool replace)
{
IResourceIndexEntry rie = tgtpkg.Find(x => ((IResourceKey)srcrie).Equals(x));
if (rie != null)
{
if (!replace) return;
tgtpkg.DeleteResource(rie);
}
rie = tgtpkg.AddResource(srcrie, null, true);
if (rie == null) return;
rie.Compressed = srcrie.Compressed;
IResource srcres = s4pi.WrapperDealer.WrapperDealer.GetResource(0, CurrentPackage, srcrie, true);//Don't need wrapper
tgtpkg.ReplaceResource(rie, srcres);
}
示例4: Compare
string Compare(IPackage pkgA, IPackage pkgB, IResourceKey rk)
{
IResource left = s3pi.WrapperDealer.WrapperDealer.GetResource(0, pkgA, pkgA.Find(x => x.CompareTo(rk) == 0), true);
IResource right = s3pi.WrapperDealer.WrapperDealer.GetResource(0, pkgB, pkgB.Find(x => x.CompareTo(rk) == 0), true);
return left.AsBytes.CompareTo(right.AsBytes) == 0 ? "=" : "!";
}