コード例 #1
0
ファイル: SpellCheck.cs プロジェクト: meguerreroa/VNXTLP
        public static Hunspell GetHunspell(string dictionary)
        {
            if (Info.IsRunningOnLinux() || Engine.GetConfig("VNXTLP", "System", false).ToLower() == "linux")
            {
                return(new LinuxHunspell(dictionary + ".aff", dictionary + ".dic"));
            }
            if (Info.IsRunningOnMac() || Engine.GetConfig("VNXTLP", "System", false).ToLower() == "mac")
            {
                return(new MacHunspell(dictionary + ".aff", dictionary + ".dic"));
            }

            // Finnish uses Voikko (not available via hunspell)
            if (dictionary.EndsWith("fi_fi", StringComparison.OrdinalIgnoreCase))
            {
                return(new VoikkoSpellCheck(AppDomain.CurrentDomain.BaseDirectory, AppDomain.CurrentDomain.BaseDirectory));
            }

            return(new WindowsHunspell(dictionary + ".aff", dictionary + ".dic"));
        }
コード例 #2
0
ファイル: NoStyle.cs プロジェクト: meguerreroa/VNXTLP
        private void NoStyle_Shown(object sender, EventArgs e)
        {
            try {
                string cfg   = Engine.GetConfig("VNXTLP", "LastScript", false);
                string File  = cfg.Split('|')[0];
                string Index = cfg.Split('|')[1];

                if (System.IO.File.Exists(File))
                {
                    OpenScript.FileName = File;
                    OpenScript_FileOk(null, null);

                    int ID = int.Parse(Index);
                    if (ID > 0 && ID < StrList.Items.Count)
                    {
                        this.Index = ID;
                    }
                }
            }
            catch { }
        }
コード例 #3
0
        static void Main(string[] Args)
        {
            bool EndUpdate = false;

            for (int i = 0; i < Args.Length; i++)
            {
                switch (Args[i].ToLower().Trim('-', '\\', '/'))
                {
                default:
                    continue;

                case "offline":
                    OfflineMode = true;
                    continue;

                case "endupdate":
                    EndUpdate = true;
                    continue;

                case "retry":
                    if (i + 1 >= Args.Length)
                    {
                        continue;
                    }
                    uint.TryParse(Args[++i], out Retry);
                    continue;
                }
            }

            if (System.IO.File.Exists(AppDomain.CurrentDomain.BaseDirectory + "Launcher.exe"))
            {
                try {
                    Thread.Sleep(500);
                    System.IO.File.Delete(AppDomain.CurrentDomain.BaseDirectory + "Launcher.exe");
                } catch { }
            }

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

            Engine.InitializeStrings();

            if (EndUpdate)
            {
                MessageBox.Show(Engine.LoadTranslation(Engine.TLID.UpdatesInstaled), "VNXTLP", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }

            if (Retry > 1)
            {
                OfflineMode = true;
                MessageBox.Show(Engine.LoadTranslation(Engine.TLID.FailedToConnect), "VNXTLP", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }

            if (!OfflineMode && !System.Diagnostics.Debugger.IsAttached)
            {
                new Thread(() => {
                    try {
                        if (Engine.GetConfig("FTP", "AutoLogin", false) == "true")
                        {
                            Connecting = true;
                            Engine.Login(Engine.GetConfig("FTP", "AutoUser", true), Engine.GetConfig("FTP", "AutoPass", true), false);
                        }
                    } catch { }
                    Connecting = false;
                }).Start();

                try {
                    (new CheckUpdate()).ShowDialog();
                } catch { }
                if (!Engine.FTP.Avaliable)
                {
                    MessageBox.Show(Engine.LoadTranslation(Engine.TLID.NoFTPServer), "VNXTLP", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    System.Diagnostics.Process.GetCurrentProcess().Kill();
                    return;
                }
                if (!Engine.Authenticated)
                {
                    Form Login;
                    switch (Engine.UsingTheme())
                    {
                    case "modern":
                        Login = new NewStyle.StyleLogin();
                        break;

                    case "bern":
                        Login = new BernStyle.StyleLogin();
                        break;

                    default:
                        Login = new NoStyleLogin();
                        break;
                    }

                    Login.ShowDialog();
                    if (!Engine.Authenticated)
                    {
                        return;
                    }
                }
            }

            switch (Engine.UsingTheme())
            {
            case "modern":
                MainForm = new NewStyle.StyleProgram();
                break;

            case "bern":
                MainForm = new BernStyle.StyleProgram();
                break;

            default:
                MainForm = new NoStyle();
                break;
            }

            new Thread(() => {
                Engine.InitializePipe();
            }).Start();

            Application.Run(MainForm);
        }
コード例 #4
0
ファイル: NoStyle.cs プロジェクト: meguerreroa/VNXTLP
        internal NoStyle()
        {
            InitializeComponent();
#if !DEBUG
            //Initialize TLBOX
            TLBox = new SpellTextBox();
            MainPanel.Controls.Add(TLBox);
            TLBox.Anchor    = ((AnchorStyles.Bottom | AnchorStyles.Left) | AnchorStyles.Right);
            TLBox.Enabled   = false;
            TLBox.Font      = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(128)));
            TLBox.Location  = new System.Drawing.Point(Scroll.Location.X, Scroll.Location.Y - (Scroll.Size.Height + 5));
            TLBox.Margin    = new Padding(3, 2, 3, 2);
            TLBox.Multiline = false;
            TLBox.Size      = new System.Drawing.Size(Scroll.Size.Width, 26);

            TLBox.SizeChanged += new EventHandler(TLBox_SizeChanged);
            Engine.Append(ref TLBox.TextChanged, TLBox_TextChanged);
            TLBox.KeyDown += new KeyEventHandler(TLBox_KeyDown);

            //Initialize RadioToolStrip Engine
            ToolStripMenuItem[] BackupItems = new ToolStripMenuItem[] { BackupOnSaveItem, BackupOn200MenuItem, BackupOn100MenuItem, BackupOn50Item, BackupOn25Item, BackupOn10Item, NeverBackupItem };
            RadioEngine = new Engine.RadioToolStrip(ref BackupItems, 3);

            ToolStripMenuItem[] ThemeItems = new ToolStripMenuItem[] { BasicThemeMenuItem, ModernThemeMenuItem, bernToolStripMenuItem };
            ThemeEngine = new Engine.RadioToolStrip(ref ThemeItems, 1);
            ThemeEngine.CheckedChange += ChangeTheme;

            ToolStripMenuItem[] TLCLients = new ToolStripMenuItem[] { lECToolStripMenuItem, googleToolStripMenuItem, zBingToolStripMenuItem };
            TLEngine = new Engine.RadioToolStrip(ref TLCLients, 1);
            TLEngine.CheckedChange += TLEngine_CheckedChange;

            ToolStripMenuItem[] SelItems = new ToolStripMenuItem[] { AutomaticoToolStripMenuItem, asiaticaToolStripMenuItem, latimToolStripMenuItem };
            SelEngine = new Engine.RadioToolStrip(ref SelItems, 0);
            SelEngine.CheckedChange += SelEngine_CheckedChange;

            //Initialize DeleyedMouseOver Event
            OVE = new Engine.OverTimerEvent()
            {
                sender = StrList
            };
            OVE.MouseStopOver += StrList_MouseStopOver;
            OVE.Initialize();

            //Set File Filter
            OpenScript.Filter = Engine.Filter;
            SaveScript.Filter = Engine.Filter;

            //Initalize SpellCheck Engine
            TLBox.LoadDictionary(AppDomain.CurrentDomain.BaseDirectory + "Dictionary");
            TLBox.BootUP();

            //Initialize Config
            SpellCheckEnableMenuItem.Checked         = Engine.GetConfig("VNXTLP", "SpellCheck", false).ToLower() == "true";
            TLBox.SpellCheckEnable                   = SpellCheckEnableMenuItem.Checked;
            IndexTestEnableMenuItem.Checked          = Engine.GetConfig("VNXTLP", "AutoJump", false).ToLower() == "true";
            altaResoluçãoToolStripMenuItem.Checked   = Engine.GetConfig("VNXTLP", "HighFont", false).ToLower() == "true";
            altoContrasteToolStripMenuItem.Checked   = Engine.GetConfig("VNXTLP", "BlackTheme", false).ToLower() == "true";
            delimitarAvançoToolStripMenuItem.Checked = Engine.GetConfig("VNXTLP", "SkipDelay", false).ToLower() == "true";
            modoDinâmicoToolStripMenuItem.Checked    = Engine.GetConfig("VNXTLP", "DynamicMode", false).ToLower() == "true";


            //get int
            string cfg = Engine.GetConfig("VNXTLP", "BackupSpeed", false);
            int    Val = 0;
            if (int.TryParse(cfg, out Val))
            {
                RadioEngine.SelectedIndex = Val;
            }

            //get int
            cfg = Engine.GetConfig("VNXTLP", "SelMode", false);
            if (int.TryParse(cfg, out Val))
            {
                SelEngine.SelectedIndex = Val;
            }

            //get int
            cfg = Engine.GetConfig("VNXTLP", "TLClient", false);
            if (int.TryParse(cfg, out Val))
            {
                TLEngine.SelectedIndex = Val;
            }
            else if (cfg == "off")
            {
                sistemaDeTraduçãoToolStripMenuItem.Visible = false;
            }

            //Load Translation
            SkipBnt.Text = Engine.LoadTranslation(Engine.TLID.Next);
            RetBnt.Text  = Engine.LoadTranslation(Engine.TLID.Back);
            arquivoToolStripMenuItem.Text = Engine.LoadTranslation(Engine.TLID.File);
            OpenItem.Text                              = Engine.LoadTranslation(Engine.TLID.Open);
            SaveAsItem.Text                            = Engine.LoadTranslation(Engine.TLID.SaveAs);
            TLAccMenuItem.Text                         = Engine.LoadTranslation(Engine.TLID.MyAccount);
            seleçãoToolStripMenuItem.Text              = Engine.LoadTranslation(Engine.TLID.Selection);
            SelectAll.Text                             = Engine.LoadTranslation(Engine.TLID.SelectAll);
            UnselectAll.Text                           = Engine.LoadTranslation(Engine.TLID.UnselectAll);
            AutoSelect.Text                            = Engine.LoadTranslation(Engine.TLID.AutoSelect);
            opçõesToolStripMenuItem.Text               = Engine.LoadTranslation(Engine.TLID.Options);
            temaToolStripMenuItem.Text                 = Engine.LoadTranslation(Engine.TLID.Theme);
            BasicThemeMenuItem.Text                    = Engine.LoadTranslation(Engine.TLID.Basic);
            ModernThemeMenuItem.Text                   = Engine.LoadTranslation(Engine.TLID.Modern);
            períodoDeBackupToolStripMenuItem.Text      = Engine.LoadTranslation(Engine.TLID.BackupFrequence);
            BackupOnSaveItem.Text                      = Engine.LoadTranslation(Engine.TLID.OnSave);
            BackupOn50Item.Text                        = Engine.LoadTranslation(Engine.TLID.BackOn50);
            BackupOn25Item.Text                        = Engine.LoadTranslation(Engine.TLID.BackOn25);
            BackupOn10Item.Text                        = Engine.LoadTranslation(Engine.TLID.BackOn10);
            NeverBackupItem.Text                       = Engine.LoadTranslation(Engine.TLID.Never);
            SpellCheckEnableMenuItem.Text              = Engine.LoadTranslation(Engine.TLID.SpellChecking);
            IndexTestEnableMenuItem.Text               = Engine.LoadTranslation(Engine.TLID.ValidateIndex);
            OpenScript.Title                           = Engine.LoadTranslation(Engine.TLID.SelectAScript);
            SaveScript.Title                           = Engine.LoadTranslation(Engine.TLID.SelectAScript);
            pesquisaToolStripMenuItem.Text             = Engine.LoadTranslation(Engine.TLID.SearchOrReplace);
            sistemaDeTraduçãoToolStripMenuItem.Text    = Engine.LoadTranslation(Engine.TLID.TranslationSystem);
            lECToolStripMenuItem.Text                  = Engine.LoadTranslation(Engine.TLID.LEC);
            googleToolStripMenuItem.Text               = Engine.LoadTranslation(Engine.TLID.Google);
            RefScriptMenuItem.Text                     = Engine.LoadTranslation(Engine.TLID.ReferenceScript);
            altoContrasteToolStripMenuItem.Text        = Engine.LoadTranslation(Engine.TLID.HighContrast);
            altaResoluçãoToolStripMenuItem.Text        = Engine.LoadTranslation(Engine.TLID.HighResolution);
            SelecaoAutomaticaMenuItem1.Text            = Engine.LoadTranslation(Engine.TLID.SelectMode);
            AutomaticoToolStripMenuItem.Text           = Engine.LoadTranslation(Engine.TLID.AutoDetect);
            asiaticaToolStripMenuItem.Text             = Engine.LoadTranslation(Engine.TLID.Asian);
            latimToolStripMenuItem.Text                = Engine.LoadTranslation(Engine.TLID.Latim);
            SaveItem.Text                              = Engine.LoadTranslation(Engine.TLID.Save);
            delimitarAvançoToolStripMenuItem.Text      = Engine.LoadTranslation(Engine.TLID.LimitSkip);
            modoDinâmicoToolStripMenuItem.Text         = Engine.LoadTranslation(Engine.TLID.DynamicMode);
            outrasopçõesmenuitem.Text                  = Engine.LoadTranslation(Engine.TLID.MoreOptions);
            salvarEstadoDaJanelaToolStripMenuItem.Text = Engine.LoadTranslation(Engine.TLID.SaveWindowState);

            //Special Items
            foreach (ToolStripMenuItem item in Engine.CustomResources(ref TLBox))
            {
                MainMenu.Items.Add(item);
            }

            Engine.LoadWindowState(this);
#endif
        }