Exemplo n.º 1
0
        private void OnBtnOpenFolder(object sender, EventArgs e)
        {
            try
            {
                AceDir d = (WinUtil.IsAppX ? AceDir.User : AceDir.App);

                // try
                // {
                //	string strU = AceApplication.GetLanguagesDir(AceDir.User, false);
                //	List<string> l = UrlUtil.GetFilePaths(strU, "*." +
                //		KPTranslation.FileExtension, SearchOption.TopDirectoryOnly);
                //	if(l.Count > 0) d = AceDir.User;
                // }
                // catch(Exception) { }

                string str = AceApplication.GetLanguagesDir(d, false);
                if (!Directory.Exists(str))
                {
                    Directory.CreateDirectory(str);
                }

                WinUtil.OpenUrlDirectly(str);
                this.DialogResult = DialogResult.Cancel;
            }
            catch (Exception ex) { MessageService.ShowWarning(ex); }
        }
Exemplo n.º 2
0
 protected void Init(AceUserSettings settings)
 {
     Logger = UniLogger.GetLogger("CliDriver");
     fe     = new AceCliFrontend(settings);
     gn     = new AceGameNet();
     appl   = new AceApplication(gn, fe);
     appl.Start(settings.startMode);
 }
Exemplo n.º 3
0
        private static void CheckCompatibility(string strHash, Plugin p)
        {
            AceApplication aceApp = Program.Config.Application;

            // bool? ob = aceApp.GetPluginCompat(strHash);
            // if(ob.HasValue) return ob.Value;
            if (aceApp.IsPluginCompat(strHash))
            {
                return;
            }

            CheckCompatibilityPriv(p);

            aceApp.SetPluginCompat(strHash);
        }
Exemplo n.º 4
0
        private static void SetLastUsedFile(IOConnectionInfo ioc)
        {
            if (ioc == null)
            {
                Debug.Assert(false); return;
            }

            AceApplication aceApp = Program.Config.Application;

            if (aceApp.Start.OpenLastFile)
            {
                if (!string.IsNullOrEmpty(ioc.Path))
                {
                    aceApp.LastUsedFile = ioc.CloneDeep();
                }
            }
            else
            {
                aceApp.LastUsedFile = new IOConnectionInfo();
            }
        }
Exemplo n.º 5
0
        private void OnFormLoad(object sender, EventArgs e)
        {
            GlobalWindowManager.AddWindow(this, this);

            BannerFactory.CreateBannerEx(this, m_bannerImage,
                                         Properties.Resources.B48x48_Keyboard_Layout,
                                         KPRes.SelectLanguage, KPRes.SelectLanguageDesc);
            this.Icon = AppIcons.Default;
            this.Text = KPRes.SelectLanguage;

            UIUtil.SetExplorerTheme(m_lvLanguages, true);

            List <Image> lImg = new List <Image>();

            lImg.Add(Properties.Resources.B16x16_Browser);

            m_ilIcons = UIUtil.BuildImageListUnscaled(lImg,
                                                      DpiUtil.ScaleIntX(16), DpiUtil.ScaleIntY(16));
            m_lvLanguages.SmallImageList = m_ilIcons;

            m_lvLanguages.Columns.Add(KPRes.InstalledLanguages);
            m_lvLanguages.Columns.Add(KPRes.Version);
            m_lvLanguages.Columns.Add(KPRes.Author);
            m_lvLanguages.Columns.Add(KPRes.Contact);
            m_lvLanguages.Columns.Add(KPRes.File);

            KPTranslation trlEng = new KPTranslation();

            trlEng.Properties.NameEnglish        = "English";
            trlEng.Properties.NameNative         = "English";
            trlEng.Properties.ApplicationVersion = PwDefs.VersionString;
            trlEng.Properties.AuthorName         = AppDefs.DefaultTrlAuthor;
            trlEng.Properties.AuthorContact      = AppDefs.DefaultTrlContact;

            string strDirA    = AceApplication.GetLanguagesDir(AceDir.App, false);
            string strDirASep = UrlUtil.EnsureTerminatingSeparator(strDirA, false);
            string strDirU    = AceApplication.GetLanguagesDir(AceDir.User, false);

            List <KeyValuePair <string, KPTranslation> > lTrls =
                new List <KeyValuePair <string, KPTranslation> >();

            lTrls.Add(new KeyValuePair <string, KPTranslation>(string.Empty, trlEng));
            AddTranslations(strDirA, lTrls);
            if (WinUtil.IsAppX)
            {
                AddTranslations(strDirU, lTrls);
            }
            lTrls.Sort(LanguageForm.CompareTrlItems);

            foreach (KeyValuePair <string, KPTranslation> kvp in lTrls)
            {
                KPTranslationProperties p = kvp.Value.Properties;
                string strName            = p.NameEnglish + " (" + p.NameNative + ")";
                string strVer             = PwDefs.GetTranslationDisplayVersion(p.ApplicationVersion);
                bool   bBuiltIn           = ((kvp.Key.Length == 0) || (WinUtil.IsAppX &&
                                                                       kvp.Key.StartsWith(strDirASep, StrUtil.CaseIgnoreCmp)));

                ListViewItem lvi = m_lvLanguages.Items.Add(strName, 0);
                lvi.SubItems.Add(strVer);
                lvi.SubItems.Add(p.AuthorName);
                lvi.SubItems.Add(p.AuthorContact);
                lvi.SubItems.Add(bBuiltIn ? KPRes.BuiltInU : kvp.Key);
                lvi.Tag = kvp.Key;

                // try
                // {
                //	string nl = MessageService.NewLine;
                //	lvi.ToolTipText = strName + " " + strVer + nl + p.AuthorName +
                //		nl + p.AuthorContact + nl + nl + kvp.Key;
                // }
                // catch(Exception) { Debug.Assert(false); } // Too long?

                // if(kvp.Key.Equals(Program.Config.Application.GetLanguageFilePath(),
                //	StrUtil.CaseIgnoreCmp))
                //	UIUtil.SetFocusedItem(m_lvLanguages, lvi, true);
            }

            UIUtil.ResizeColumns(m_lvLanguages, new int[] { 5, 2, 5, 5, 3 }, true);
            UIUtil.SetFocus(m_lvLanguages, this);
        }