private bool UnpackFile(IPackFile packFile) { bool isUnpackSuccessful = true; try { packFile.Unpack(); if (!"Game".Equals(packFile.FileName)) { this.log.Debug(packFile.FileName, "Unpacked successfully."); } this.Refresh(); } catch (SystemException exc) { this.log.Error(packFile.FileName, "Error: " + exc.Message); isUnpackSuccessful = false; if (System.Diagnostics.Debugger.IsAttached) { throw; } } foreach (IPackFile file in packFile.PackFiles) { isUnpackSuccessful &= this.UnpackFile(file); } return(isUnpackSuccessful); }
private void ViewModel_FileOpen(IPackFile file) { SelectedFile = file as PackFile; if (DialogResult != true) { DialogResult = true; } Close(); }
private void ExportPackFile(IPackFile packFile) { foreach (ITextFile file in packFile.TextFiles) { this.ExportTextFile(file); } foreach (IPackFile file in packFile.PackFiles) { this.ExportPackFile(file); } }
public PackFileContainer GetPackFileContainer(IPackFile file) { foreach (var pf in Database.PackFiles) { var res = pf.FileList.FirstOrDefault(x => x.Value == file).Value; if (res != null) { return(pf); } } _logger.Here().Information($"Unknown packfile container for {file.Name}"); return(null); }
/// <summary> /// Populates the list of files in the game. /// </summary> public override void InitializeFiles() { IPackFile[] packFiles = new IPackFile[] { new DPKFile(@"confidence\ConfidenceDataText.dpk", this), new DPKFile(@"General\BattleInfText.dpk", this), new DPKFile(@"General\VoicePlayDataText.dpk", this), new DPKFile(@"map\field\FieldEventText.dpk", this) }; foreach (IPackFile file in packFiles) { this.Files.PackFiles.Add(file); } ITextFile[] textFiles = new ITextFile[] { new DTXFile(@"battle\UnisonData.dtx", this), new DTXFile(@"confidence\ConfidenceList.dtx", this), new DTXFile(@"General\CharacterData.dtx", this), new DTXFile(@"General\GimmickData.dtx", this), new DTXFile(@"General\ItemData.dtx", this), new DTXFile(@"General\SkillDataBTL.dtx", this), new DTXFile(@"General\SkillDataFLD.dtx", this), new DTXFile(@"General\SummonData.dtx", this), new DTXFile(@"General\VoicePlayList.dtx", this), new DTXFile(@"map\field\ShopInf.dtx", this), new DTXFile(@"map\field\teleportData.dtx", this), new DTXFile(@"muumuu\MuumuuData.dtx", this), new DTXFile(@"progtext\St_Bt_Battle.dtx", this), new DTXFile(@"progtext\St_Ev_Ending.dtx", this), new DTXFile(@"progtext\St_Ge_General.dtx", this), new DTXFile(@"progtext\St_Ge_Option.dtx", this), new DTXFile(@"progtext\St_GE_Record.dtx", this), new DTXFile(@"progtext\St_Ge_Save.dtx", this), new DTXFile(@"progtext\St_Ge_Status.dtx", this), new DTXFile(@"progtext\St_Mu_muumuu.dtx", this), new DTXFile(@"progtext\St_Op_Voiceplay.dtx", this), new DTXFile(@"progtext\St_Pl_panel.dtx", this), new DTXFile(@"progtext\St_Save.dtx", this), new DTXFile(@"progtext\St_Sk_SkillInfo.dtx", this), new DTXFile(@"progtext\St_WM_Field.dtx", this) }; foreach (ITextFile file in textFiles) { this.Files.TextFiles.Add(file); } }
private bool LoadPackFile(IPackFile packFile) { bool isLoadSuccessful = true; foreach (ITextFile file in packFile.TextFiles) { isLoadSuccessful &= this.LoadTextFile(file); } foreach (IPackFile file in packFile.PackFiles) { isLoadSuccessful &= this.LoadPackFile(file); } return(isLoadSuccessful); }
public void DeleteFile(PackFileContainer pf, IPackFile file) { if (pf.IsCaPackFile) { throw new Exception("Can not add files to ca pack file"); } var key = pf.FileList.FirstOrDefault(x => x.Value == file).Key; _logger.Here().Information($"Deleting file {key}"); Database.TriggerPackFileRemoved(pf, new List <PackFile>() { file as PackFile }); pf.FileList.Remove(key); }
// Modify // --------------------------- public void RenameFile(PackFileContainer pf, IPackFile file, string newName) { if (pf.IsCaPackFile) { throw new Exception("Can not add files to ca pack file"); } var key = pf.FileList.FirstOrDefault(x => x.Value == file).Key; pf.FileList.Remove(key); var dir = Path.GetDirectoryName(key); file.Name = newName; pf.FileList[dir + "\\" + file.Name] = file; Database.TriggerPackFilesUpdated(pf, new List <PackFile>() { file as PackFile }); }
private bool SavePackFile(IPackFile packFile) { bool isModified = false; foreach (ITextFile file in packFile.TextFiles) { isModified |= this.SaveTextFile(file); } foreach (IPackFile file in packFile.PackFiles) { isModified |= this.SavePackFile(file); } try { if (isModified) { packFile.Pack(); if (!"Game".Equals(packFile.FileName)) { this.log.Info(packFile.FileName, "Repacked successfully."); } } else { this.log.Debug(packFile.FileName, "Has not been modified."); } } catch (SystemException exc) { this.log.Error(packFile.FileName, "Error: " + exc.Message); if (System.Diagnostics.Debugger.IsAttached) { throw; } } return(isModified); }
public void AddFileToPack(PackFileContainer container, string directoryPath, IPackFile newFile) { if (container.IsCaPackFile) { throw new Exception("Can not add files to ca pack file"); } if (!string.IsNullOrWhiteSpace(directoryPath)) { directoryPath += "\\"; } directoryPath += newFile.Name; container.FileList[directoryPath.ToLower()] = newFile; _skeletonAnimationLookUpHelper.UnloadAnimationFromContainer(this, container); _skeletonAnimationLookUpHelper.LoadFromPackFileContainer(this, container); Database.TriggerPackFileAdded(container, new List <PackFile>() { newFile as PackFile }); }
public MainEditableNode(string name, SkeletonNode skeletonNode, IPackFile mainFile) : base(name) { Skeleton = skeletonNode; MainPackFile = mainFile; }
public ModelLoaderService(PackFileService packFileService, ResourceLibary resourceLibary, AnimationControllerViewModel animationView, SceneManager sceneManager, IPackFile mainFile) { _packFileService = packFileService; _resourceLibary = resourceLibary; _animationView = animationView; _sceneManager = sceneManager; var skeletonNode = _sceneManager.RootNode.AddObject(new SkeletonNode(resourceLibary.Content, animationView) { IsLockable = false }) as SkeletonNode; EditableMeshNode = (MainEditableNode)_sceneManager.RootNode.AddObject(new MainEditableNode("Editable Model", skeletonNode, mainFile)); ReferenceMeshRoot = sceneManager.RootNode.AddObject(new GroupNode("Reference meshs") { IsEditable = false, IsLockable = false }); }