コード例 #1
0
ファイル: Commands.cs プロジェクト: ooame0825/Effekseer
        /// <summary>
        /// ファイルを開く
        /// </summary>
        /// <param name="fullPath">絶対パス</param>
        public static bool Open(string fullPath)
        {
            if (System.IO.Path.GetFullPath(fullPath) != fullPath)
            {
                throw new Exception(Properties.Resources.NotAbsolutePathError);
            }

            if (SaveOnDisposing())
            {
            }
            else
            {
                return(true);
            }

            try
            {
                if (Core.LoadFrom(fullPath))
                {
                    GUIManager.AddRecentFile(fullPath);
                }
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            System.IO.Directory.SetCurrentDirectory(System.IO.Path.GetDirectoryName(fullPath));

            return(true);
        }
コード例 #2
0
ファイル: Commands.cs プロジェクト: ooame0825/Effekseer
        public static bool SaveAs()
        {
            SaveFileDialog ofd = new SaveFileDialog();

            ofd.InitialDirectory = System.IO.Directory.GetCurrentDirectory();
            ofd.Filter           = Properties.Resources.ProjectFilter;
            ofd.FilterIndex      = 2;
            ofd.OverwritePrompt  = true;

            if (ofd.ShowDialog() == DialogResult.OK)
            {
                var filepath = ofd.FileName;
                Core.SaveTo(filepath);
                GUIManager.AddRecentFile(filepath);

                System.IO.Directory.SetCurrentDirectory(System.IO.Path.GetDirectoryName(filepath));

                if (GUIManager.Network.SendOnSave)
                {
                    GUIManager.Network.Send();
                }
            }

            return(true);
        }
コード例 #3
0
        public static void SaveAs()
        {
            SaveFileDialog ofd = new SaveFileDialog();

            ofd.InitialDirectory = System.IO.Directory.GetCurrentDirectory();
            ofd.Filter           = "エフェクトプロジェクト (*.efkproj)|*.efkproj";
            ofd.FilterIndex      = 2;
            ofd.OverwritePrompt  = true;

            if (ofd.ShowDialog() == DialogResult.OK)
            {
                var filepath = ofd.FileName;
                Core.SaveTo(filepath);
                GUIManager.AddRecentFile(filepath);

                System.IO.Directory.SetCurrentDirectory(System.IO.Path.GetDirectoryName(filepath));

                if (GUIManager.Network.SendOnSave)
                {
                    GUIManager.Network.Send();
                }
            }
            else
            {
                return;
            }
        }
コード例 #4
0
        /// <summary>
        /// ファイルを開く
        /// </summary>
        /// <param name="fullPath">絶対パス</param>
        public static void Open(string fullPath)
        {
            if (System.IO.Path.GetFullPath(fullPath) != fullPath)
            {
                throw new Exception("絶対パスでありません。");
            }

            if (SaveOnDisposing())
            {
            }
            else
            {
                return;
            }

            try
            {
                if (Core.LoadFrom(fullPath))
                {
                    GUIManager.AddRecentFile(fullPath);
                }
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            System.IO.Directory.SetCurrentDirectory(System.IO.Path.GetDirectoryName(fullPath));
        }
コード例 #5
0
        /// <summary>
        /// ファイルを開く
        /// </summary>
        /// <param name="fullPath">絶対パス</param>
        public static void Open(string fullPath)
        {
            var errorText = string.Empty;

            if (Core.Language == Language.Japanese)
            {
                errorText = "絶対パスでありません。";
            }
            else if (Core.Language == Language.English)
            {
                errorText = "This is not an absolute path.";
            }

            if (System.IO.Path.GetFullPath(fullPath) != fullPath)
            {
                throw new Exception(errorText);
            }

            if (SaveOnDisposing())
            {
            }
            else
            {
                return;
            }

            try
            {
                if (Core.LoadFrom(fullPath))
                {
                    GUIManager.AddRecentFile(fullPath);
                }
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            System.IO.Directory.SetCurrentDirectory(System.IO.Path.GetDirectoryName(fullPath));
        }