Esempio n. 1
0
        private async Task InitializeAsync()
        {
            BundleManager ??= await Task.Run(() => Tw3Controller.LoadBundleManager()).ConfigureAwait(false);

            W3StringManager ??= await Task.Run(() => Tw3Controller.LoadStringsManager()).ConfigureAwait(false);

            TextureManager ??= await Task.Run(() => Tw3Controller.LoadTextureManager()).ConfigureAwait(false);

            CollisionManager ??= await Task.Run(() => Tw3Controller.LoadCollisionManager()).ConfigureAwait(false);

            SoundManager ??= await Task.Run(() => Tw3Controller.LoadSoundManager()).ConfigureAwait(false);

            SpeechManager ??= await Task.Run(() => Tw3Controller.LoadSpeechManager()).ConfigureAwait(false);



            // Hash all filepaths
            _logger.LogString("Starting additional tasks...", Logtype.Important);
            var relativepaths = ModFiles
                                .Select(_ => _.Substring(_.IndexOf(Path.DirectorySeparatorChar) + 1))
                                .ToList();

            Cr2wResourceManager.Get().RegisterAndWriteCustomPaths(relativepaths);

            // register all custom classes
            CR2WManager.Init(FileDirectory, MainController.Get().Logger);
            _logger.LogString("Finished additional tasks...", Logtype.Success);

            ServiceLocator.Default.ResolveType <INotificationService>().ShowNotification("WolvenKit", $"Project {Name} has finished loading.");
        }
Esempio n. 2
0
        private async Task InitializeAsync()
        {
            // Hash all filepaths
            _logger.LogString("Starting additional tasks...", Logtype.Important);
            var relativepaths = ModFiles
                                .Select(_ => _.Substring(_.IndexOf(Path.DirectorySeparatorChar) + 1))
                                .ToList();

            Cr2wResourceManager.Get().RegisterAndWriteCustomPaths(relativepaths);

            // register all custom classes
            CR2WManager.Init(FileDirectory, MainController.Get().Logger);
            _logger.LogString("Finished additional tasks...", Logtype.Success);

            ServiceLocator.Default.ResolveType <INotificationService>().ShowNotification("WolvenKit", $"Project {Name} has finished loading.");
        }
Esempio n. 3
0
        public override void Write(BinaryWriter file)
        {
            box0.Write(file);
            box1.Write(file);
            box2.Write(file);
            box3.Write(file);
            box4.Write(file);
            box5.Write(file);

            // here for now until maincontroller is in Wkit.Common
            ulong hashint = 0;

            // awkward test for unrecognized custom hashes
            if (string.IsNullOrEmpty(pathHash.Value))
            {
                hashint = 0;
            }
            else if (pathHash.Value[0] == '#')
            {
                hashint = ulong.Parse(pathHash.Value.TrimStart('#'));
            }
            else
            {
                //check if in game depot hashes
                if (Cr2wResourceManager.Get().HashdumpDict.ContainsKey(pathHash.Value))
                {
                    hashint = Cr2wResourceManager.Get().HashdumpDict[pathHash.Value];
                }
                else
                {
                    //check if in local custom hashes
                    if (Cr2wResourceManager.Get().CHashdumpDict.ContainsKey(pathHash.Value))
                    {
                        hashint = Cr2wResourceManager.Get().CHashdumpDict[pathHash.Value];
                    }
                    //hash new path and add to collection
                    else
                    {
                        hashint = Cr2wResourceManager.Get().RegisterAndWriteCustomPath(pathHash.Value);
                    }
                }
            }
            file.Write(hashint);
        }
Esempio n. 4
0
        public override void Read(BinaryReader file, uint size)
        {
            box0.Read(file, 4);
            box1.Read(file, 4);
            box2.Read(file, 4);
            box3.Read(file, 4);
            box4.Read(file, 4);
            box5.Read(file, 4);
            UInt64 hashint = file.ReadUInt64();

            // here for now until maincontroller is in Wkit.Common
            if (hashint == 0)
            {
                pathHash.Value = "";
            }
            else
            {
                // check for vanilla hashed paths
                if (Cr2wResourceManager.Get().HashdumpDict.ContainsValue(hashint))
                {
                    pathHash.Value = Cr2wResourceManager.Get().HashdumpDict.First(_ => _.Value == hashint).Key;
                }
                else
                {
                    // check for custom hashed paths
                    if (Cr2wResourceManager.Get().CHashdumpDict.ContainsValue(hashint))
                    {
                        pathHash.Value = Cr2wResourceManager.Get().CHashdumpDict.First(_ => _.Value == hashint).Key;
                    }
                    else
                    {
                        pathHash.Value = $"#{hashint}";
                    }
                }
            }
        }