Esempio n. 1
0
        public bool InitializePartition(string partition)
        {
            Files.Clear();
            LSEntry resource = null;

            if ((resource = LS.TryGetValue(partition)) == null)
            {
                return(false);
            }

            File.WriteAllBytes(partition,
                               GetFile(resource.DTOffset, resource.Size, resource.DTIndex));

            RF = new RFFile(partition);
            if (partition.Contains("("))
            {
                RF.Locale = partition.Substring(partition.IndexOf("("));
            }
            RegionCode = RF.RegionCode;

            LSEntry     lsentry = null;
            IndexedPath path    = new IndexedPath($"data{RF.Locale}/");

            foreach (ResourceEntry rsobj in RF.ResourceEntries)
            {
                if (rsobj == null)
                {
                    continue;
                }

                path[rsobj.FolderDepth] = rsobj.EntryString;

                if (rsobj.Packed)
                {
                    lsentry = LS.TryGetValue(path.ToString() + "packed");
                }

                if (lsentry != null)
                {
                    var tpl = new Tuple <LSEntry, ResourceEntry>(lsentry, rsobj);
                    if (rsobj.Packed)
                    {
                        Files.Add(path.ToString() + "packed", tpl);
                    }
                    else
                    {
                        Files.Add(path.ToString(), tpl);
                    }
                }
            }
            return(true);
        }
Esempio n. 2
0
        public bool InitializePartition(RFFile rf, string partition)
        {
            Files.Clear();
            RegionCode = rf.RegionCode;
            LSEntry     lsentry = null;
            IndexedPath path    = new IndexedPath($"data{RF.Locale}/");

            foreach (ResourceEntry rsobj in RF.ResourceEntries)
            {
                if (rsobj == null)
                {
                    continue;
                }

                path[rsobj.FolderDepth] = rsobj.EntryString;

                if (rsobj.Packed)
                {
                    lsentry = LS.TryGetValue(path.ToString() + "packed");
                }

                if (lsentry != null)
                {
                    var tpl = new Tuple <LSEntry, ResourceEntry>(lsentry, rsobj);
                    if (rsobj.Packed)
                    {
                        Files.Add(path.ToString() + "packed", tpl);
                    }
                    else
                    {
                        Files.Add(path.ToString(), tpl);
                    }
                }
            }
            return(true);
        }