Exemple #1
0
        /// <summary>
        /// リソースファイルの保存
        /// </summary>
        private void リソース情報を保存するToolStripMenuItem_Click(object sender, EventArgs e)
        {
Point:
            using (var dialog = new SaveFileDialog()
            {
                Filter = FilePathHelper.GetFilter("UIGenertor Resource Pack File", ".ugrpf"),
                FileName = DataBase.ProjectName,
                DefaultExt = ".ugrpf"
            })
            {
                var state = dialog.ShowDialog();
                if (state != DialogResult.OK)
                {
                    return;
                }
                var path = dialog.FileName;
                if (!Directory.Exists(Path.GetDirectoryName(path)))
                {
                    Console.WriteLine("ディレクトリが存在しません");
                    goto Point;
                }
                DataBase.SaveResourcePackage(path);
                Console.WriteLine("リソースファイルの保存が完了しました");
            }
        }
Exemple #2
0
 /// <summary>
 /// プロジェクトファイルを開く
 /// </summary>
 private void プロジェクトを開く_Click(object sender, EventArgs e)
 {
     using (var dialog = new OpenFileDialog()
     {
         FileName = DataBase.ProjectName,
         DefaultExt = ".ugpf",
         AddExtension = true,
         Filter = FilePathHelper.GetFilter("UIGenerator project Files", ".ugpf")
     })
     {
         var state = dialog.ShowDialog();
         if (state != DialogResult.OK)
         {
             return;
         }
         UsePath = dialog.FileName;
     }
     if (!File.Exists(UsePath))
     {
         Console.WriteLine("ディレクトリが存在しません");
         return;
     }
     DataBase.LoadProject(UsePath);
     Console.WriteLine("プロジェクトの読み込みが完了しました");
 }
Exemple #3
0
        /// <summary>
        /// <see cref="名前を付けて保存ToolStripMenuItem"/>クリック時の挙動
        /// </summary>
        private void  前を付けて保存ToolStripMenuItem_Click(object sender, EventArgs e)
        {
Point:
            using (var dialog = new SaveFileDialog()
            {
                FileName = DataBase.ProjectName,
                DefaultExt = ".ugpf",
                AddExtension = true,
                Filter = FilePathHelper.GetFilter("UIGenerator project Files", ".ugpf")
            })
            {
                var state = dialog.ShowDialog();
                if (state != DialogResult.OK)
                {
                    return;
                }
                UsePath = dialog.FileName;
            }
            if (!Directory.Exists(Path.GetDirectoryName(UsePath)))
            {
                Console.WriteLine("ディレクトリが存在しません");
                goto Point;
            }
            DataBase.SaveProject(UsePath);
            Console.WriteLine("プロジェクトの保存に成功しました");
        }
        /// <summary>
        /// <see cref="SaveFileDialog"/>のフィルターを返す
        /// </summary>
        private string GetFilter()
        {
            var lang = ComboBox_Lang.Text;

            return(lang switch
            {
                "C#" => FilePathHelper.GetFilter("CSharp Code File", ".cs"),
                _ => throw new NotSupportedException(),
            });
        /// <summary>
        /// <see cref="Button_S_FileSearch"/>クリック時の挙動
        /// </summary>
        private void Button_S_FileSearch_Click(object sender, EventArgs e)
        {
            var name = TextBox_S_Path.Text;
            var o    = new OpenFileDialog()
            {
                Title  = "Open the Font File",
                Filter = FilePathHelper.GetFilter("Font Files", ".aff")
            };
            var state = o.ShowDialog();

            if (state == DialogResult.OK)
            {
                name = o.FileName;
            }
            o.Dispose();
            TextBox_S_Path.Text = name;
        }
        /// <summary>
        /// <see cref="Button_FileSearch"/>クリック時の挙動
        /// </summary>
        private void Button_FileSearch_Click(object sender, EventArgs e)
        {
            var name = TextBox_Path.Text;
            var o    = new OpenFileDialog()
            {
                Title  = "Open the Texture File",
                Filter = FilePathHelper.GetFilter("Texture Files", ".png", ".jpg", ".jpeg", ".gif", ".tif", ".tiff", ".bmp")
            };
            var state = o.ShowDialog();

            if (state == DialogResult.OK)
            {
                name = o.FileName;
            }
            o.Dispose();
            TextBox_Path.Text = name;
        }
Exemple #7
0
 /// <summary>
 /// リソースファイルの読込
 /// </summary>
 private void リソース情報を読み込むToolStripMenuItem_Click(object sender, EventArgs e)
 {
     using (var dialog = new OpenFileDialog()
     {
         Filter = FilePathHelper.GetFilter("UIGenertor Resource Pack File", ".ugrpf"),
         FileName = DataBase.ProjectName,
         DefaultExt = ".ugrpf"
     })
     {
         var state = dialog.ShowDialog();
         if (state != DialogResult.OK)
         {
             return;
         }
         var path = dialog.FileName;
         if (!File.Exists(path))
         {
             Console.WriteLine("ファイルが存在しません");
             return;
         }
         DataBase.LoadResourcePackage(path);
         Console.WriteLine("リソースファイルの読み込みが完了しました");
     }
 }