예제 #1
0
        /// <summary>
        /// Saves the current file as .bgf or .xml/.bmp
        /// </summary>
        /// <param name="Filename"></param>
        public static void Save(string Filename)
        {
            // set values in file from input controls in 'settings' window
            CurrentFile.ShrinkFactor = SettingsForm.ShrinkFactor;
            CurrentFile.Version      = SettingsForm.Version;
            CurrentFile.Name         = SettingsForm.BgfName;

            string extension = Path.GetExtension(Filename);

            switch (extension)
            {
            case FileExtensions.BGF:
                if (SettingsForm.IsSaveCompresed)
                {
                    CurrentFile.CompressAll();
                }
                else
                {
                    CurrentFile.DecompressAll();
                }

                CurrentFile.Save(Filename);
                break;

            case FileExtensions.XML:
                CurrentFile.WriteXml(Filename);
                break;
            }
        }
예제 #2
0
        /// <summary>
        /// Load a BGF from .bgf or .xml
        /// </summary>
        /// <param name="Filename">Full path and filename of BGF or XML</param>
        public static void Load(string Filename)
        {
            if (File.Exists(Filename))
            {
                string extension = Path.GetExtension(Filename).ToLower();

                switch (extension)
                {
                case FileExtensions.BGF:
                    CurrentFile.Load(Filename);
                    CurrentFile.DecompressAll();
                    break;

                case FileExtensions.XML:
                    CurrentFile.LoadXml(Filename);
                    break;
                }

                // set input controls in 'settings' window to values from file
                SettingsForm.ShrinkFactor = CurrentFile.ShrinkFactor;
                SettingsForm.Version      = CurrentFile.Version;
                SettingsForm.BgfName      = CurrentFile.Name;

                // set mainoverlay resource to loaded file
                RoomObject.OverlayFile = CurrentFile.Filename + ".bgf";
                RoomObject.Resource    = CurrentFile;
            }
        }
예제 #3
0
        /// <summary>
        /// Load a BGF from .bgf or .xml
        /// </summary>
        /// <param name="Filename">Full path and filename of BGF or XML</param>
        public static void Load(string Filename)
        {
            // stop animation playback
            Program.IsPlaying      = false;
            MainForm.btnPlay.Image = Properties.Resources.Play;

            if (File.Exists(Filename))
            {
                string extension = Path.GetExtension(Filename).ToLower();

                switch (extension)
                {
                case FileExtensions.BGF:
                    CurrentFile.Load(Filename);
                    CurrentFile.DecompressAll();
                    break;

                case FileExtensions.XML:
                    CurrentFile.LoadXml(Filename);
                    break;
                }

                // set input controls in 'settings' window to values from file
                SettingsForm.ShrinkFactor = CurrentFile.ShrinkFactor;
                SettingsForm.Version      = CurrentFile.Version;
                SettingsForm.BgfName      = CurrentFile.Name;
            }
        }
예제 #4
0
        /// <summary>
        /// Load a BGF from .bgf or .xml
        /// </summary>
        /// <param name="Filename">Full path and filename of BGF or XML</param>
        public static void Load(string Filename)
        {
            if (File.Exists(Filename))
            {
                string extension = Path.GetExtension(Filename);

                switch (extension)
                {
                case FileExtensions.BGF:
                    CurrentFile.Load(Filename);
                    CurrentFile.DecompressAll();
                    break;

                case FileExtensions.XML:
                    CurrentFile.LoadXml(Filename);
                    break;
                }
            }
        }
예제 #5
0
        /// <summary>
        /// Load a BGF from .bgf or .xml
        /// </summary>
        /// <param name="Filename">Full path and filename of BGF or XML</param>
        public static void Load(string Filename)
        {
            if (File.Exists(Filename))
            {
                string extension = Path.GetExtension(Filename).ToLower();

                switch (extension)
                {
                case FileExtensions.BGF:
                    CurrentFile.Load(Filename);
                    CurrentFile.DecompressAll();
                    break;

                case FileExtensions.XML:
                    CurrentFile.LoadXml(Filename);
                    break;
                }

                SetLoadedBgfProperties();
                HasFileChanged = false;
            }
        }