예제 #1
0
 public TagAnalyzer(TagCacheHaloOnline cache)
 {
     _cache = cache;
     foreach (var group in cache.NonNull().Select(t => t.Group.Tag).Distinct())
     {
         _tagGroups.Add(group);
     }
 }
예제 #2
0
        public GameCacheModPackage(FileInfo file)
        {
            ModPackageFile = file;
            Version        = CacheVersion.HaloOnline106708;
            Endianness     = EndianFormat.LittleEndian;
            Deserializer   = new TagDeserializer(Version);
            Serializer     = new TagSerializer(Version);
            Directory      = file.Directory;

            // load mod package
            BaseModPackage = new ModPackage(file);
            DisplayName    = BaseModPackage.Metadata.Name + ".pak";

            ResourceCaches        = new ResourceCachesModPackage(BaseModPackage);
            TagCacheGenHO         = new TagCacheHaloOnline(BaseModPackage.TagCachesStreams[0], BaseModPackage.TagCacheNames[0]);
            StringTableHaloOnline = BaseModPackage.StringTable;
        }
예제 #3
0
        public TagCacheHaloOnline CreateTagCache(DirectoryInfo directory, out FileInfo file)
        {
            if (directory == null)
            {
                directory = Directory;
            }

            if (!directory.Exists)
            {
                directory.Create();
            }

            file = new FileInfo(Path.Combine(directory.FullName, "tags.dat"));

            TagCacheHaloOnline cache = null;

            using (var stream = file.Create())
                cache = CreateTagCache(stream);

            return(cache);
        }
예제 #4
0
        public ModPackage(FileInfo file = null)
        {
            if (file != null)
            {
                Load(file);
            }
            else
            {
                // init a single cache
                var tagStream = new MemoryStream();
                TagCachesStreams.Add(tagStream);

                var names = new Dictionary <int, string>();
                var tags  = new TagCacheHaloOnline(tagStream, names);
                TagCaches = new List <TagCacheHaloOnline>();
                TagCaches.Add(tags);
                TagCacheNames.Add(names);
                Files = new Dictionary <string, Stream>();

                Resources           = new ResourceCacheHaloOnline(CacheVersion.HaloOnline106708, ResourcesStream);
                Header.SectionTable = new ModPackageSectionTable();
            }
        }