File: Program.cs

package info (click to toggle)
hexbox 1.5.0-5
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid, stretch
  • size: 2,440 kB
  • ctags: 1,210
  • sloc: cs: 6,784; makefile: 21; sh: 1
file content (64 lines) | stat: -rw-r--r-- 1,945 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
using System;
using System.Windows.Forms;
using System.Threading;
using System.Globalization;
using Be.HexEditor.Properties;
using Be.Windows.Forms;

namespace Be.HexEditor
{
    class Program
    {
        public const string SoftwareName = "Be.HexEditor";

        public static FormHexEditor ApplictionForm;

        [STAThread()]
        static void Main(string[] args)
        {
            if (!Settings.Default.UseSystemLanguage)
            {
                string l = Settings.Default.SelectedLanguage;
                Thread.CurrentThread.CurrentUICulture = new CultureInfo(l);
                Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(l);
            }

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            ApplictionForm = new FormHexEditor();
            if (args.Length > 0 && System.IO.File.Exists(args[0]))
                ApplictionForm.OpenFile(args[0]);
            Application.Run(ApplictionForm);
        }

        public static DialogResult ShowError(Exception ex)
        {
            return ShowError(ex.Message);
        }


        internal static DialogResult ShowError(string text)
        {
            DialogResult result = MessageBox.Show(text, SoftwareName,
                MessageBoxButtons.OK,
                MessageBoxIcon.Error);
            return result;
        }

        public static void ShowMessage(string text)
        {
            MessageBox.Show(text, SoftwareName,
                MessageBoxButtons.OK,
                MessageBoxIcon.Information);
        }

        public static DialogResult ShowQuestion(string text)
        {
            DialogResult result = MessageBox.Show(text, SoftwareName,
               MessageBoxButtons.YesNo,
               MessageBoxIcon.Question);
            return result;
        }
    }
}