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


C# IPackage.Find方法代码示例

本文整理汇总了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;
        }
开发者ID:Robobeurre,项目名称:NRaas,代码行数:50,代码来源:STBLExporter.cs

示例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);
            }
        }
开发者ID:Robobeurre,项目名称:NRaas,代码行数:13,代码来源:MainForm.cs

示例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);
        }
开发者ID:Kuree,项目名称:Sims4Tools,代码行数:16,代码来源:MainForm.cs

示例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 ? "=" : "!";
        }
开发者ID:dd-dk,项目名称:sims3tools,代码行数:7,代码来源:Form1.cs


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