private void Import() { Microsoft.Win32.OpenFileDialog ImportSet = new Microsoft.Win32.OpenFileDialog(); ImportSet.InitialDirectory = FxAnimSetFile.DirectoryName; ImportSet.Multiselect = false; ImportSet.Filter = "FxAnimSet file (*.fas)|*.fas"; if (ImportSet.ShowDialog() == true) { FxContainer <FxAnimSet> ImportAnimSetContainer; using (BinaryReader Reader = new BinaryReader(File.Open(ImportSet.FileName, FileMode.Open))) { ImportAnimSetContainer = new FxContainer <FxAnimSet>(); ImportAnimSetContainer.ReadFromFile(Reader); } AnimSetContainer.Archives.AddRange(ImportAnimSetContainer.Archives); TreeView_FxAnimSets.Nodes.Clear(); foreach (FxArchive Archive in AnimSetContainer.Archives) { FxAnimSet AnimSet = Archive.GetObjectAs <FxAnimSet>(); TreeNode AnimSetNode = new TreeNode(AnimSet.Name.ToString()); AnimSetNode.Tag = AnimSet; TreeView_FxAnimSets.Nodes.Add(AnimSetNode); } Text = Language.GetString("$FXANIMSET_EDITOR") + "*"; bIsFileEdited = true; } }
private void BuildData() { using (BinaryReader Reader = new BinaryReader(File.Open(FxAnimSetFile.FullName, FileMode.Open))) { AnimSetContainer = new FxContainer <FxAnimSet>(); AnimSetContainer.ReadFromFile(Reader); } foreach (FxArchive Archive in AnimSetContainer.Archives) { FxAnimSet AnimSet = Archive.GetObjectAs <FxAnimSet>(); TreeNode AnimSetNode = new TreeNode(AnimSet.Name.ToString()); AnimSetNode.Tag = AnimSet; TreeView_FxAnimSets.Nodes.Add(AnimSetNode); } }
private void Paste() { if (clipboard is FxArchive) { FxArchive Archive = (clipboard as FxArchive); AnimSetContainer.Archives.Add(Archive); FxAnimSet AnimSet = Archive.GetObjectAs <FxAnimSet>(); TreeNode AnimSetNode = new TreeNode(AnimSet.Name.ToString()); AnimSetNode.Tag = AnimSet; TreeView_FxAnimSets.Nodes.Add(AnimSetNode); Text = Language.GetString("$FXANIMSET_EDITOR") + "*"; bIsFileEdited = true; } }
private void Export() { int index = TreeView_FxAnimSets.SelectedNode.Index; FxArchive SelectedArchive = AnimSetContainer.Archives[index]; FxAnimSet AnimSet = SelectedArchive.GetObjectAs <FxAnimSet>(); Microsoft.Win32.SaveFileDialog ExportSet = new Microsoft.Win32.SaveFileDialog(); ExportSet.InitialDirectory = FxAnimSetFile.DirectoryName; ExportSet.FileName = AnimSet.Name.ToString(); ExportSet.Filter = "FxAnimSet file (*.fas)|*.fas"; if (ExportSet.ShowDialog() == true) { FxContainer <FxAnimSet> ExportAnimSetContainer = new FxContainer <FxAnimSet>(); ExportAnimSetContainer.Archives = new List <FxArchive>(); ExportAnimSetContainer.Archives.Add(SelectedArchive); using (BinaryWriter Writer = new BinaryWriter(File.Open(ExportSet.FileName, FileMode.Create))) { ExportAnimSetContainer.WriteToFile(Writer); } } }