Пример #1
0
        public MainForm()
        {
            arguments = Environment.GetCommandLineArgs();
            exepath = arguments[0];
            InitializeComponent();
            search = new Searcher(this);
            tipper = new ToolTip();
            tipper.AutoPopDelay = 5000;
            tipper.InitialDelay = 1000;
            tipper.ReshowDelay = 500;
            tipper.ShowAlways = true;

            DirectoryInfo root = Directory.GetParent(Directory.GetParent(exepath).ToString());
            string[] dirs = Directory.GetDirectories(root.ToString());
            foreach (string dir in dirs)
            {
                if (!dir.Equals(Directory.GetCurrentDirectory()) && File.Exists(dir + "\\=HEAD=.txt"))
                {
                    int pos = dir.LastIndexOf('\\');
                    string item = dir.Substring(pos + 1);
                    LangpacksComboBox.Items.Add(item);
                }
            }

            for (int i = 1; i < arguments.Length; i++)
            {
                string key = arguments[i].Substring(0, 2);
                if (key.Equals("\\q"))
                {
                    quiet = true;
                }
                if (key.Equals("\\n"))
                {
                    LangpackNameEdit.Text = arguments[i].Substring(2);
                    if (LangpackNameEdit.Text.Contains(":\\") || LangpackNameEdit.Text.Contains(".\\"))
                    {
                        output = arguments[i].Substring(2);
                        outfile = true;
                    }
                }
                if (key.Equals("\\o"))
                {
                    string fname = arguments[i].Substring(2);
                    if (fname.Contains("\\"))
                        OwnFileEdit.Text = fname;
                    else
                        OwnFileEdit.Text = Directory.GetParent(Directory.GetParent(exepath).ToString()).ToString() + "\\" + LangpacksComboBox.Text + "\\" + fname;
                    OwnFileCheckBox.Checked = true;
                    OwnFilesCheckBoxChange();
                }
                if (key.Equals("\\u"))
                {
                    string fname = arguments[i].Substring(2);
                    VIURLTextBox.Text = fname;
                    GetVICheckBox.Checked = true;
                    GetVICheckBoxChange();
                }
                if (key.Equals("\\p"))
                {
                    string fname = arguments[i].Substring(2);
                    LangpacksComboBox.Text = fname;
                    LangpacksComboBoxChange();
                }
            }
            if (quiet)
            {
                Hide();
                GenerateLang();
                Close();
                Environment.Exit(1);
            }
            culture = CultureInfo.CurrentCulture;
            if (culture.ToString() == "ru-RU")
            {
                LanguageComboBox.SelectedIndex = 1;
            }
            else if (culture.ToString() == "uk-UA")
            {
                LanguageComboBox.SelectedIndex = 2;
            }
            else if (culture.ToString() == "be-BY")
            {
                LanguageComboBox.SelectedIndex = 3;
            }
            else if (culture.ToString() == "de-DE")
            {
                LanguageComboBox.SelectedIndex = 4;
            }
			else if (culture.ToString() == "cs-CZ")
            {
                LanguageComboBox.SelectedIndex = 5;
            }
            else
            {
                culture = CultureInfo.CreateSpecificCulture("en-US");
                LanguageComboBox.SelectedIndex = 0;
            }
            adjustCulture();
        }
Пример #2
0
        public MainForm()
        {
            arguments = Environment.GetCommandLineArgs();
            InitializeComponent();
            search = new Searcher(this);
            tipper = new ToolTip();
            tipper.AutoPopDelay = 5000;
            tipper.InitialDelay = 1000;
            tipper.ReshowDelay = 500;
            tipper.ShowAlways = true;

            for (int i = 1; i < arguments.Length; i++)
            {
                string key = arguments[i].Substring(0, 2);
                if (key.Equals("\\q"))
                {
                    quiet = true;
                }
                if (key.Equals("\\n"))
                {
                    LangpackNameEdit.Text = arguments[i].Substring(2);
                }
                if (key.Equals("\\o"))
                {
                    string fname = arguments[i].Substring(2);
                    if (fname.Contains("\\"))
                        OwnFileEdit.Text = fname;
                    else
                        OwnFileEdit.Text = Directory.GetCurrentDirectory() + "\\" + fname;
                    OwnFileCheckBox.Checked = true;
                    OwnFilesCheckBoxChange();
                }
                if (key.Equals("\\c"))
                {
                    CommentMUIDCheckBox.Checked = true;
                }
                if (key.Equals("\\a"))
                {
                    ANSICheckBox.Checked = true;
                }
                if (key.Equals("\\u"))
                {
                    string fname = arguments[i].Substring(2);
                    VIURLTextBox.Text = fname;
                    GetVICheckBox.Checked = true;
                    GetVICheckBoxChange();
                }
                if (key.Equals("\\l"))
                {
                    output = arguments[i].Substring(2);
                }
            }
            if (quiet)
            {
                Hide();
                GenerateLang();
                Close();
                Environment.Exit(1);
            }
            culture = CultureInfo.CurrentCulture;
            if (culture.ToString() == "ru-RU")
            {
                LanguageComboBox.SelectedIndex = 1;
            }
            else
            {
                culture = CultureInfo.CreateSpecificCulture("en-EN");
                LanguageComboBox.SelectedIndex = 0;
            }
            adjustCulture();
        }