Exemple #1
0
        public FormREA(fpkParser fpkParser, string reaParserVar)
        {
            try
            {
                InitializeComponent();
                this.Controls.Remove(this.menuStrip1);

                reaParser parser = (reaParser)Gui.Scripting.Variables[reaParserVar];

                this.ShowHint = DockState.Document;
                this.Text = parser.Name;
                this.ToolTipText = fpkParser.FilePath + @"\" + parser.Name;

                ParserVar = reaParserVar;

                EditorVar = Gui.Scripting.GetNextVariable("reaEditor");
                Editor = (reaEditor)Gui.Scripting.RunScript(EditorVar + " = reaEditor(parser=" + ParserVar + ")");

                Init();
                LoadREA();
            }
            catch (Exception ex)
            {
                Utility.ReportException(ex);
            }
        }
Exemple #2
0
        public FormREA(fpkParser fpkParser, string reaParserVar)
        {
            try
            {
                InitializeComponent();
                this.Controls.Remove(this.menuStrip1);

                reaParser parser = (reaParser)Gui.Scripting.Variables[reaParserVar];

                this.ShowHint    = DockState.Document;
                this.Text        = parser.Name;
                this.ToolTipText = fpkParser.FilePath + @"\" + parser.Name;

                ParserVar = reaParserVar;

                EditorVar = Gui.Scripting.GetNextVariable("reaEditor");
                Editor    = (reaEditor)Gui.Scripting.RunScript(EditorVar + " = reaEditor(parser=" + ParserVar + ")");

                Init();
                LoadREA();
            }
            catch (Exception ex)
            {
                Utility.ReportException(ex);
            }
        }
Exemple #3
0
        public static reaParser OpenREA([DefaultVar] fpkParser parser, string name)
        {
            for (int i = 0; i < parser.Subfiles.Count; i++)
            {
                if (parser.Subfiles[i].Name == name)
                {
                    IReadFile subfile = parser.Subfiles[i] as IReadFile;
                    if (subfile != null)
                    {
                        return(new reaParser(subfile.CreateReadStream(), subfile.Name, parser.FilePath));
                    }

                    break;
                }
            }
            return(null);
        }
Exemple #4
0
        public static void ExportFPK([DefaultVar] fpkParser parser, string path)
        {
            DirectoryInfo dir = new DirectoryInfo(path);

            if (!dir.Exists)
            {
                dir.Create();
            }

            for (int i = 0; i < parser.Subfiles.Count; i++)
            {
                var subfile = parser.Subfiles[i];
                using (FileStream fs = File.Create(dir.FullName + @"\" + subfile.Name))
                {
                    subfile.WriteTo(fs);
                }
            }
        }
Exemple #5
0
        public static void ExportSubfile([DefaultVar] fpkParser parser, string name, string path)
        {
            for (int i = 0; i < parser.Subfiles.Count; i++)
            {
                if (parser.Subfiles[i].Name == name)
                {
                    FileInfo      file = new FileInfo(path);
                    DirectoryInfo dir  = file.Directory;
                    if (!dir.Exists)
                    {
                        dir.Create();
                    }

                    using (FileStream fs = file.Create())
                    {
                        parser.Subfiles[i].WriteTo(fs);
                    }
                    break;
                }
            }
        }
Exemple #6
0
        public FormFPK(string path, string variable)
        {
            try
            {
                InitializeComponent();

                FormVariable = variable;

                ParserVar = Gui.Scripting.GetNextVariable("fpkParser");
                fpkParser fpkParser = (fpkParser)Gui.Scripting.RunScript(ParserVar + " = OpenFPK(path=\"" + path + "\")");

                EditorVar = Gui.Scripting.GetNextVariable("fpkEditor");
                Editor    = (fpkEditor)Gui.Scripting.RunScript(EditorVar + " = fpkEditor(parser=" + ParserVar + ")");

                Text        = Path.GetFileName(fpkParser.FilePath);
                ToolTipText = fpkParser.FilePath;
                ShowHint    = DockState.Document;

                saveFileDialog1.Filter = ".fpk Files (*.fpk)|*.fpk|All Files (*.*)|*.*";

                subfileListViews.Add(remSubfilesList);
                subfileListViews.Add(reaSubfilesList);
                subfileListViews.Add(imageSubfilesList);
                subfileListViews.Add(soundSubfilesList);
                subfileListViews.Add(otherSubfilesList);

                InitSubfileLists();

                Gui.Docking.ShowDockContent(this, Gui.Docking.DockFiles, ContentCategory.Archives);
                this.FormClosing += new FormClosingEventHandler(FormFPK_FormClosing);

                List <DockContent> formFPKList;
                if (Gui.Docking.DockContents.TryGetValue(typeof(FormFPK), out formFPKList))
                {
                    var listCopy = new List <FormFPK>(formFPKList.Count);
                    for (int i = 0; i < formFPKList.Count; i++)
                    {
                        listCopy.Add((FormFPK)formFPKList[i]);
                    }

                    foreach (var form in listCopy)
                    {
                        if (form != this)
                        {
                            var formParser = (fpkParser)Gui.Scripting.Variables[form.ParserVar];
                            if (formParser.FilePath == path)
                            {
                                form.Close();
                            }
                        }
                    }
                }

                keepBackupToolStripMenuItem.CheckedChanged += keepBackupToolStripMenuItem_CheckedChanged;
                compressToolStripMenuItem.CheckedChanged   += compressToolStripMenuItem_CheckedChanged;
            }
            catch (Exception ex)
            {
                Utility.ReportException(ex);
            }
        }
Exemple #7
0
 public fpkEditor(fpkParser parser)
 {
     Parser = parser;
 }
Exemple #8
0
 public fpkEditor(fpkParser parser)
 {
     Parser = parser;
 }