protected override bool OnSave(string fileName, Progress progress)
        {
            try
            {
                myBIN.Save(fileName, progress);

                NamesBINController c = GetNamesController();

                if (c.Modified)
                {
                    string namesBin =
                        Path.GetDirectoryName(fileName) + "\\names.bin";

                    c.Names.Save(c.FileName);

                    if (namesBin == c.FileName)
                    {
                        c.Modified = false;
                    }
                }
            }
            catch (Exception ex)
            {
                FormMain.Instance.ErrorMessage(ex.Message);
                return(false);
            }

            return(true);
        }
        public override void LoadProcess(List <Processor> processors,
                                         bool form)
        {
            NamesBINController c = GetNamesController();

            c.LoadProcess(processors, false);

            base.LoadProcess(processors, form);
        }
Exemple #3
0
        protected override NamesBINFile LoadNames()
        {
            NamesBINController c = (NamesBINController)
                                   AutoLoad(Settings.GetString("Files", "Names"));

            if (c == null)
            {
                return(null);
            }

            return(c.Names);
        }
Exemple #4
0
        public FileController Get(string fileName)
        {
            fileName = GetAbsoluteFileName(fileName);

            FileController c = Find(fileName);

            if (c != null)
            {
                // Already in the system.
                return(c);
            }

            FileInfo info = new FileInfo(fileName);

            string ext = info.Extension.ToUpper();

            if (ext == ".BIG")
            {
                c = new BIGFileController(this, fileName);
            }
            else if (ext == ".BIN")
            {
                if (info.Name.ToUpper() == "NAMES.BIN")
                {
                    c = new NamesBINController(this, fileName);
                }
                else
                {
                    c = new BINFileController(this, fileName);
                }
            }
            else if (ext == ".STB")
            {
                c = new BBBFileController(
                    this, new FableMod.STB.STBFile(), fileName);
            }
            else if (ext == ".WAD")
            {
                c = new BBBFileController(
                    this, new FableMod.BBB.BBBFile(), fileName);
            }
            else if (ext == ".WLD")
            {
                c = new WLDFileController(this, fileName);
            }

            if (c != null)
            {
                myFiles.Add(c);
            }

            return(c);
        }
        protected override bool OnLoad(Progress progress)
        {
            try
            {
                NamesBINController c = GetNamesController();

                myBIN = new BINFile(c.Names);

                myBIN.Load(FileName, progress);
            }
            catch (Exception ex)
            {
                FormMain.Instance.ErrorMessage(ex.Message);
                return(false);
            }

            return(true);
        }