Пример #1
0
        private void TfoDownload_FormCreate(object sender, EventArgs e)
        {
            TGnuGettextInstance.TranslateComponent(this);
            appFile   = Path.GetFileName(Application.ExecutablePath);
            appFolder = Utils.IncludeTrailingPathDelimiter(Path.GetDirectoryName(Application.ExecutablePath));
            if (ApplicationDeployment.IsNetworkDeployed)
            {
                baseFolder = Utils.IncludeTrailingPathDelimiter(ApplicationDeployment.CurrentDeployment.DataDirectory);
            }
            else
            {
                baseFolder = Utils.IncludeTrailingPathDelimiter(Application.StartupPath);
            }
            LogFile = new TStringList();
            Log("Update Log " + DateTime.Now.ToString());
            DataStream   = new MemoryStream();
            step         = 1;
            selfUpdate   = false;
            filesUpdated = false;
            newsUpdated  = false;
            errorUpdate  = false;
            bool done;

            idleHandler       = (s, args) => UpdateIdle(s, out done);
            Application.Idle += idleHandler;
        }
Пример #2
0
        //---------------------------------------------------------------------------
        private void TfrmDBStatus_FormCreate(object sender, EventArgs e)
        {
            TGnuGettextInstance.TranslateComponent(this);
            string sql = "select alb.cnt as alb, hib.cnt as hib, mid.cnt as mid, arte.cnt as arte, alle.cnt as alle";

            sql = sql + " from (select count(*) as cnt from items where realm = 1) as alb,";
            sql = sql + " (select count(*) as cnt from items where realm = 2) as hib,";
            sql = sql + " (select count(*) as cnt from items where realm = 4) as mid,";
            sql = sql + " (select count(*) as cnt from items where maxlevel > 0) as arte,";
            sql = sql + " (select count(*) as cnt from items) as alle";
            ZQuery.CommandText = sql;
            ZQuery.Open();
            lbAlbion.Text    = ZQuery.FieldByName("alb").AsString;
            lbHibernia.Text  = ZQuery.FieldByName("hib").AsString;
            lbMidgard.Text   = ZQuery.FieldByName("mid").AsString;
            lbArtifacts.Text = ZQuery.FieldByName("arte").AsString;
            lbSum.Text       = ZQuery.FieldByName("alle").AsString;
            ZQuery.Close();

            lbDBVersion.Text = SQLiteUtils.SQLiteDBVersion(ZQuery).ToString();
            lbDBVersion.SetHint(ZQuery.Connection.GetDataSource());
            int size = (int)(new FileInfo(ZQuery.Connection.GetDataSource()).Length / 1024.0);

            lbDBSize.Text  = string.Format("{0:N0} KByte", size);
            lbSysLang.Text = Unit.xml_config.sysLanguage;
        }
Пример #3
0
        //---------------------------------------------------------------------------

        private void TfrmManageDB_FormCreate(object sender, EventArgs e)
        {
            TGnuGettextInstance.TranslateComponent(this);
            LoadSettings();
            InitFilter();
            Unit.player.SetPreviewMode(true);
            Unit.player.UpdateAttributes();
        }
Пример #4
0
        private void TfrmReport_FormCreate(object sender, EventArgs e)
        {
            TGnuGettextInstance.TranslateComponent(this);
            Utils.LoadWindowPosition("Report", this, true);
            int          l        = Utils.GetRegistryString("LastReport", "0").ToIntDef(0);
            TSpeedButton btReport = (TSpeedButton)this.FindComponent("btReport" + (l + 1).ToString());

            btReport.Checked = true;
            btReportClick(btReport, EventArgs.Empty);
        }
Пример #5
0
 //---------------------------------------------------------------------------
 private void TfrmSetArmor_FormCreate(object sender, EventArgs e)
 {
     TGnuGettextInstance.TranslateComponent(this);
     cbQuality.SelectedIndex   = 5;
     cbArmorType.SelectedIndex = cbArmorType.Items.Count - 1;
     cbArmorTypeChange(null, EventArgs.Empty);
     cbSubClass.SelectedIndex = iSubClass;
     cbSubClassChange(null, EventArgs.Empty);
     cbMaterial.SelectedIndex = iMatLevel - Utils.ConvertTagToInt(cbMaterial.Tag);
 }
Пример #6
0
        //---------------------------------------------------------------------------
        private void btReportClick(object sender, EventArgs e)
        {
            int    idx     = Utils.ConvertTagToInt(((Control)sender).Tag);
            string curlang = TGnuGettextInstance.GetCurrentLanguage();

            curlang = curlang.Substring(0, 2);

            switch (idx)
            {
            case 0: DoReport(Unit.frmMain.DataPath + "reports\\Configreport_" + curlang + ".rpt"); break;

            case 1: DoReport(Unit.frmMain.DataPath + "reports\\Shortreport_" + curlang + ".rpt"); break;

            case 2: DoReport(Unit.frmMain.DataPath + "reports\\Crafterreport_" + curlang + ".rpt"); break;

            case 3: DoReport(Unit.frmMain.DataPath + "reports\\Materiallist_" + curlang + ".rpt"); break;
            }
            NativeMethods.SendMessage(new HandleRef(tbReport, tbReport.Handle), NativeMethods.EM_LINESCROLL, 0, 0xFFFF8000);
            tbReport.Invalidate();
            Utils.SetRegistryString("LastReport", (idx).ToString());
        }
Пример #7
0
        public static string ComponentGettext(string MsgId)
        {
            if (MsgId == "" || ComponentDomainListCS == null)
            {
                // This only happens during very complicated program startups that fail,
                // or when Msgid=''
                return(MsgId);
            }

            // First, get the value from the default domain
            string Result;

            Result = TGnuGettextInstance.dgettext(TGnuGettextInstance.curmsgdomain, MsgId);
            if (Result != MsgId)
            {
                return(Result);
            }

            // If it was not in the default domain, then go through the others
            ComponentDomainListCS.AcquireReaderLock(Timeout.Infinite);
            try
            {
                for (int i = 0; i < ComponentDomainList.Count; i++)
                {
                    Result = TGnuGettextInstance.dgettext(ComponentDomainList.Strings[i], MsgId);
                    if (Result != MsgId)
                    {
                        break;
                    }
                }
            }
            finally
            {
                ComponentDomainListCS.ReleaseLock();
            }
            return(Result);
        }
Пример #8
0
 private static string _(string szMsgId)
 {
     return(TGnuGettextInstance.gettext(szMsgId));
 }
Пример #9
0
 //---------------------------------------------------------------------------
 private void TfrmCraft_FormCreate(object sender, EventArgs e)
 {
     TGnuGettextInstance.TranslateComponent(this);
 }
Пример #10
0
 private void TfrmOverWrite_FormCreate(object sender, EventArgs e)
 {
     TGnuGettextInstance.TranslateComponent(this);
     cbAllOptions.SelectedIndex = 0;
 }
Пример #11
0
        public override void Execute()
        {
            ICollection <List <TTP_RetranslatorItem> > items = (ICollection <List <TTP_RetranslatorItem> >)ValuesProp.GetValue(list, null);

            foreach (var item in items.Flatten())
            {
                object obj = item.obj.IsAlive ? item.obj.Target : null;
                if (obj == null)
                {
                    continue;
                }
                if (obj is Component)
                {
                    var comp = ((Component)obj).FindComponent("GNUgettextMarker") as TGnuGettextComponentMarker;
                    if (comp != null && this != comp.Retranslator)
                    {
                        comp.Retranslator.Execute();
                        continue;
                    }
                }
                if (obj is TStringList)
                {
                    // Since we don't know the order of items in sl, and don't have
                    // the original .Objects[] anywhere, we cannot anticipate anything
                    // about the current sl.Strings[] and sl.Objects[] values. We therefore
                    // have to discard both values. We can, however, set the original .Strings[]
                    // value into the list and retranslate that.
                    var sl = new TStringList();
                    try
                    {
                        sl.Text = item.OldValue;
                        TGnuGettextInstance.TranslateStrings(sl, TextDomain);
                        ((TStringList)obj).BeginUpdate();
                        try
                        {
                            ((TStringList)obj).Text = sl.Text;
                        }
                        finally
                        {
                            ((TStringList)obj).EndUpdate();
                        }
                    }
                    finally
                    {
                        sl.Clear();
                        sl = null;
                    }
                }
                else
                {
                    string newValue;
                    if (TextDomain == "" || TextDomain == TGnuGettextInstance.DefaultTextDomain)
                    {
                        newValue = Utils.ComponentGettext(item.OldValue);
                    }
                    else
                    {
                        newValue = TGnuGettextInstance.dgettext(TextDomain, item.OldValue);
                    }
                    var ppi = obj.GetType().GetProperty(item.Propname);
                    if (ppi != null)
                    {
                        ppi.SetValue(obj, newValue, null);
                    }
                    else
                    {
#if DXGETTEXTDEBUG
                        Debug.WriteLine("ERROR: On retranslation, property disappeared: " + item.Propname + " for object of type " + obj.GetType().Name);
#endif
                    }
                }
            }
        }