示例#1
0
        private void Open_Click(object sender, RoutedEventArgs e)
        {
            StackPanel.Children.Clear();
            Canvas.Children.Clear();
            if (anibnd.Files.Count < 1)
            {
                return;
            }
            if (!cmb_moveset.HasItems)
            {
                return;
            }
            if (!cmb_animation.HasItems)
            {
                return;
            }
            if (cmb_moveset.SelectedItem == null)
            {
                return;
            }
            if (cmb_animation.SelectedItem == null)
            {
                return;
            }
            if (!dropdownOptions.ContainsKey(cmb_moveset.Text))
            {
                return;
            }
            if (!dropdownOptions[cmb_moveset.Text].ContainsKey(cmb_animation.Text))
            {
                return;
            }

            int fileID = dropdownOptions[cmb_moveset.Text][cmb_animation.Text];

            if (!anibnd.Files.Any(f => f.ID == fileID))
            {
                return;
            }

            string extractPath      = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "RootmotionToolTemp.hkx");
            string hkxpacksoulsPath = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "hkxpackds3.exe");

            var extractedFile = BND4Extract.Extract(anibnd, fileID, extractPath);

            HKXPack unpacker         = new HKXPack(hkxpacksoulsPath);
            string  unpackedFilePath = unpacker.Unpack(extractedFile.Path);

            OpenFile.extractedFile = extractedFile;
            OpenFile.hkxPath       = extractedFile.Path;
            OpenFile.xmlPath       = unpackedFilePath;

            OpenFrameData(OpenFile.xmlPath);
        }
示例#2
0
        private void Export_Click(object sender, RoutedEventArgs e)
        {
            if (string.IsNullOrEmpty(OpenFile.xmlPath))
            {
                return;
            }
            if (string.IsNullOrEmpty(OpenFile.bndPath))
            {
                return;
            }

            Data.UpdateRootmotionData(AnimXml.FrameDataToString(TempFrameData.Absolute));
            Data.Save(OpenFile.xmlPath);

            string  hkxpacksoulsPath = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "hkxpackds3.exe");
            HKXPack packer           = new HKXPack(hkxpacksoulsPath);

            OpenFile.hkxPath = packer.Pack(OpenFile.xmlPath);

            OpenFile.extractedFile.File.Bytes = File.ReadAllBytes(OpenFile.hkxPath);

            if (!anibnd.Files.Any(f => f.ID == OpenFile.extractedFile.File.ID))
            {
                return;
            }
            int listID = anibnd.Files.FindIndex(f => f.ID == OpenFile.extractedFile.File.ID);

            anibnd.Files[listID] = OpenFile.extractedFile.File;

            FileInfo bakFileInfo = new FileInfo(OpenFile.bndPath + ".bak");
            FileInfo bndFileInfo = new FileInfo(OpenFile.bndPath);

            bakFileInfo.IsReadOnly = false;
            bndFileInfo.IsReadOnly = false;

            if (File.Exists(OpenFile.bndPath + ".bak"))
            {
                File.SetAttributes(OpenFile.bndPath + ".bak", FileAttributes.Normal);
            }

            File.Delete(OpenFile.bndPath + ".bak");
            File.Move(OpenFile.bndPath, OpenFile.bndPath + ".bak");
            anibnd.Write(OpenFile.bndPath);
        }