Example #1
0
        private void Import()
        {
            Microsoft.Win32.OpenFileDialog ImportActor = new Microsoft.Win32.OpenFileDialog();
            ImportActor.InitialDirectory = FxActorFile.DirectoryName;
            ImportActor.Multiselect      = false;
            ImportActor.Filter           = "FxActor file (*.fxa)|*.fxa";

            if (ImportActor.ShowDialog() == true)
            {
                FxContainer <FxActor> ImportActorContainer;

                using (BinaryReader Reader = new BinaryReader(File.Open(ImportActor.FileName, FileMode.Open)))
                {
                    ImportActorContainer = new FxContainer <FxActor>();
                    ImportActorContainer.ReadFromFile(Reader);
                }

                ActorContainer.Archives.AddRange(ImportActorContainer.Archives);
                TreeView_FxActors.Nodes.Clear();

                foreach (FxArchive Archive in ActorContainer.Archives)
                {
                    FxActor Actor = Archive.GetObjectAs <FxActor>();

                    TreeNode ActorNode = new TreeNode(Actor.Name.ToString());

                    ActorNode.Tag = Actor;

                    TreeView_FxActors.Nodes.Add(ActorNode);
                }

                Text          = Language.GetString("$FXACTOR_EDITOR") + "*";
                bIsFileEdited = true;
            }
        }
Example #2
0
        private void BuildData()
        {
            using (BinaryReader Reader = new BinaryReader(File.Open(FxActorFile.FullName, FileMode.Open)))
            {
                ActorContainer = new FxContainer <FxActor>();
                ActorContainer.ReadFromFile(Reader);
            }

            foreach (FxArchive Archive in ActorContainer.Archives)
            {
                FxActor Actor = Archive.GetObjectAs <FxActor>();

                TreeNode ActorNode = new TreeNode(Actor.Name.ToString());

                ActorNode.Tag = Actor;

                TreeView_FxActors.Nodes.Add(ActorNode);
            }
        }
Example #3
0
        private void Paste()
        {
            if (clipboard is FxArchive)
            {
                FxArchive Archive = (clipboard as FxArchive);
                ActorContainer.Archives.Add(Archive);

                FxActor Actor = Archive.GetObjectAs <FxActor>();

                TreeNode ActorNode = new TreeNode(Actor.Name.ToString());

                ActorNode.Tag = Actor;

                TreeView_FxActors.Nodes.Add(ActorNode);

                Text          = Language.GetString("$FXACTOR_EDITOR") + "*";
                bIsFileEdited = true;
            }
        }
Example #4
0
        private void Export()
        {
            int       index           = TreeView_FxActors.SelectedNode.Index;
            FxArchive SelectedArchive = ActorContainer.Archives[index];

            FxActor Actor = SelectedArchive.GetObjectAs <FxActor>();

            Microsoft.Win32.SaveFileDialog ExportActor = new Microsoft.Win32.SaveFileDialog();
            ExportActor.InitialDirectory = FxActorFile.DirectoryName;
            ExportActor.FileName         = Actor.Name.ToString();
            ExportActor.Filter           = "FxActor file (*.fxa)|*.fxa";

            if (ExportActor.ShowDialog() == true)
            {
                FxContainer <FxActor> ExportActorContainer = new FxContainer <FxActor>();
                ExportActorContainer.Archives = new List <FxArchive>();
                ExportActorContainer.Archives.Add(SelectedArchive);

                using (BinaryWriter Writer = new BinaryWriter(File.Open(ExportActor.FileName, FileMode.Create)))
                {
                    ExportActorContainer.WriteToFile(Writer);
                }
            }
        }