Beispiel #1
0
    //---------------------------------------------------------------------------------------------

    public void BuyTrailBoat()
    {
        HideDialog();
        string dialogText = string.Format(LangManager.GetTranslation("comprar_barco_arrastre_confirm"), Definitions.PRECIO_COMPRA_ARRASTRE);
        Action onConfirm  = delegate()
        {
            GameObject newBoatGameObject = GameObject.Instantiate(TrailBoatPrefab, stateManager.InitialTile.transform.position, Quaternion.identity, BoatContainer.transform);
            Boat       newBoat           = newBoatGameObject.GetComponent <Boat>();
            stateManager.CurrentPlayer().AddBoat(newBoat);
            stateManager.CurrentPlayer().Money -= Definitions.PRECIO_COMPRA_ARRASTRE;
            newBoat.SetCurrentTile(stateManager.InitialTile.GetComponent <Tile>());
            newBoat.ArriveAtTile();
            newBoat.currentTile.UpdateBoatPositions(newBoat);
            newBoatGameObject.transform.position = newBoat.GetPositionForCurrentTile();

            stateManager.currentState = WaitingForAnimation.GetInstance();
        };
        Action onReject = delegate()
        {
            ShowDialog
            (
                String.Format
                (
                    LangManager.GetTranslation("boat_shop_text"),
                    Definitions.CANTIDAD_A_RECIBIR_SALIDA
                )
            );
        };

        GameObject.FindObjectOfType <ConfirmDialog>().ShowDialog(dialogText, onConfirm, onReject);
    }
        private void gZipGToolStripMenuItem_Click(object sender, EventArgs e)
        {
            OpenFileDialog dialog = new OpenFileDialog();

            dialog.AddExtension     = true;
            dialog.CheckFileExists  = true;
            dialog.CheckPathExists  = true;
            dialog.Multiselect      = false;
            dialog.RestoreDirectory = true;
            dialog.Title            = LangManager.GetString("nbtViewer_selectNBTFormatFile");

            DialogResult result = dialog.ShowDialog();

            if (result == DialogResult.OK)
            {
                this.cacheData.NBTViewerCache.Rows.Clear();
                try
                {
                    CompoundTag tag = NBTIO.ReadGZIPFile(dialog.FileName, this.Endian);
                    this._Load(tag);
                }
                catch (Exception exc)
                {
                    MessageBox.Show(exc.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
    static private void CheckEscapeGame()
    {
        if (Input.GetKeyDown(KeyCode.Escape))
        {
            if (m_ClickCounts == 0)
            {
                m_LastClickTick = Time.time;
            }
            if (Time.time - m_LastClickTick >= 1.0f)
            {
                m_ClickCounts   = 0;
                m_LastClickTick = Time.time;
            }
            m_ClickCounts++;

            // 点击两次才有反应
            if (m_ClickCounts >= 2)
            {
                m_ClickCounts = 0;
                AlertManager.Instance.ShowConfirm((int)eInternalUIID.ID_ALERT, LangManager.GetText(5), LangManager.GetText(1), LangManager.GetText(2),
                                                  (eAlertBtnType type) =>
                {
                    if (type == eAlertBtnType.OK)
                    {
                        Application.Quit();
                    }
                });
            }
        }
    }
    /// <summary>
    /// 設定語系相關欄位
    /// </summary>
    private void SetupLangRelatedFields()
    {
        if (!LangManager.IsEnableEditLangZHTW())
        {
            ArticleSubjectZhTwArea.Visible = false;
            SubtitleZhTwArea.Visible       = false;
            PreviewBannerZhTwArea.Visible  = false;
            chkIsShowInLangZhTw.Checked    = false;
            chkIsShowInLangZhTw.Visible    = false;
            ContextTabZhTwArea.Visible     = false;
            ContextPnlZhTwArea.Visible     = false;
            PublisherNameAreaZhTw.Visible  = false;
        }

        if (!LangManager.IsEnableEditLangEN())
        {
            ArticleSubjectEnArea.Visible = false;
            SubtitleEnArea.Visible       = false;
            PreviewBannerEnArea.Visible  = false;
            chkIsShowInLangEn.Checked    = false;
            chkIsShowInLangEn.Visible    = false;
            ContextTabEnArea.Visible     = false;
            ContextPnlEnArea.Visible     = false;
            PublisherNameAreaEn.Visible  = false;
        }
    }
Beispiel #5
0
        void downer_DownloadForgeCompleted(object sender, System.ComponentModel.AsyncCompletedEventArgs e)
        {
            try
            {
                Clipboard.SetText(txtInsPath.Text);
                MessageBox.Show(LangManager.GetLangFromResource("ForgeInstallInfo"));
            }
            catch
            {
                MessageBox.Show(LangManager.GetLangFromResource("ForgeCopyError"));
            }
            var forgeIns = new Process();

            if (!File.Exists(BmclCore.Config.Javaw))
            {
                MessageBox.Show(LangManager.GetLangFromResource("ForgeJavaError"));
                return;
            }
            forgeIns.StartInfo.FileName  = BmclCore.Config.Javaw;
            forgeIns.StartInfo.Arguments = "-jar \"" + AppDomain.CurrentDomain.BaseDirectory + "\\forge.jar\"";
            Logger.log(forgeIns.StartInfo.Arguments);
            forgeIns.Start();
            forgeIns.WaitForExit();
            BmclCore.MainWindow.GridGame.ReFlushlistver();
            BmclCore.MainWindow.TabMain.SelectedIndex = 0;
            BmclCore.MainWindow.SwitchDownloadGrid(Visibility.Hidden);
        }
    // Methods ////////////////////////////////////////////////////////////////////////////////////

    void Start()
    {
        textComponent      = gameObject.GetComponentInChildren <Text>();
        translationKey     = textComponent.text;
        currentLang        = LangManager.currentLang;
        textComponent.text = LangManager.GetTranslation(translationKey);
    }
Beispiel #7
0
        public NotiIcon()
        {
            NIcon.Visible = false;
            NIcon         = new NotifyIcon {
                Visible = true
            };
            var s = System.Windows.Application.GetResourceStream(new Uri("pack://application:,,,/screenLaunch.png"));

            if (s != null)
            {
                this.NIcon.Icon = System.Drawing.Icon.FromHandle(new System.Drawing.Bitmap(s.Stream).GetHicon());
            }
            MenuItem menuItem = _nMenu.MenuItems.Add(LangManager.GetLangFromResource("MenuShowMainWindow"));

            menuItem.Name        = "ShowMainWindow";
            menuItem.DefaultItem = true;
            menuItem.Enabled     = false;
            menuItem.Click      += NMenu_ShowMainWindows_Click;
            NIcon.DoubleClick   += NIcon_DoubleClick;
            MenuItem debugMode = _nMenu.MenuItems.Add(LangManager.GetLangFromResource("MenuUseDebugMode"));

            debugMode.Name    = "DebugMode";
            debugMode.Click  += DebugMode_Click;
            NIcon.ContextMenu = _nMenu;
        }
Beispiel #8
0
        private void listVer_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (listVer.SelectedIndex == -1)
            {
                listVer.SelectedIndex = 0;
                return;
            }
            this.listVer.ScrollIntoView(listVer.SelectedItem);
            string jsonFilePath = gameinfo.GetGameInfoJsonPath(listVer.SelectedItem.ToString());

            if (string.IsNullOrEmpty(jsonFilePath))
            {
                MessageBox.Show(LangManager.GetLangFromResource("ErrorNoGameJson"));
                _mainWindow.SwitchStartButton(false);
                return;
            }
            _mainWindow.SwitchStartButton(true);
            BmclCore.GameInfo = gameinfo.Read(jsonFilePath);
            if (BmclCore.GameInfo == null)
            {
                MessageBox.Show(LangManager.GetLangFromResource("ErrorJsonEncoding"));
                return;
            }
            labVer.Content     = BmclCore.GameInfo.id;
            labTime.Content    = BmclCore.GameInfo.time;
            labRelTime.Content = BmclCore.GameInfo.releaseTime;
            labType.Content    = BmclCore.GameInfo.type;
        }
Beispiel #9
0
 private void btnDelete_Click(object sender, RoutedEventArgs e)
 {
     if (MessageBox.Show(LangManager.GetLangFromResource("DeleteMessageBoxInfo"), LangManager.GetLangFromResource("DeleteMessageBoxTitle"), MessageBoxButton.OKCancel, MessageBoxImage.Question) == MessageBoxResult.OK)
     {
         try
         {
             FileStream isused = File.OpenWrite(".minecraft\\versions\\" + listVer.SelectedItem + "\\" + BmclCore.GameInfo.id + ".jar");
             isused.Close();
             Directory.Delete(".minecraft\\versions\\" + listVer.SelectedItem, true);
             if (Directory.Exists(".minecraft\\libraries\\" + listVer.SelectedItem))
             {
                 Directory.Delete(".minecraft\\libraries\\" + listVer.SelectedItem, true);
             }
         }
         catch (UnauthorizedAccessException)
         {
             MessageBox.Show(LangManager.GetLangFromResource("DeleteFailedMessageInfo"));
         }
         catch (IOException)
         {
             MessageBox.Show(LangManager.GetLangFromResource("DeleteFailedMessageInfo"));
         }
         finally
         {
             ReFlushlistver();
         }
     }
 }
Beispiel #10
0
        private async void DownloadForge(string ver)
        {
            var frmPrs = new FrmPrs(LangManager.GetLangFromResource("DownloadingForge"));

            void OnProgressChange(string status) => frmPrs.ChangeStatus(LangManager.GetLangFromResource(status));

            try
            {
                var forgeVersion = _forgeVersions.First(version => version.name == ver);
                _forgeTask.ProcessChange += OnProgressChange;
                frmPrs.Show();
                await _forgeTask.DownloadForge(forgeVersion);
            }
            catch (InvalidOperationException exception)
            {
                Logger.Fatal(exception);
                MessageBox.Show(BmclCore.MainWindow, LangManager.Translate("ForgeNoSuchVersion", ver),
                                BmclCore.MainWindow.Title,
                                MessageBoxButton.OK, MessageBoxImage.Error);
            }
            finally
            {
                _forgeTask.ProcessChange -= OnProgressChange;
                frmPrs.Close();
            }
            BmclCore.MainWindow.GridGame.ReFlushlistver();
            BmclCore.MainWindow.TabMain.SelectedIndex = 0;
        }
Beispiel #11
0
        void downer_DownloadFileCompleted(object sender, System.ComponentModel.AsyncCompletedEventArgs e)
        {
            _inDownloading--;
            int num = (int)e.UserState;

            if (e.Error != null)
            {
                Logger.Log(string.Format("下载资源文件失败{0},远程路径为{1}", _dt.Rows[num]["FileName"], (sender as WebClient).BaseAddress));
                Logger.Log(e.Error);
            }
            else
            {
                lock (_dt)
                {
                    _dt.Rows[num]["Status"] = LangManager.GetLangFromResource("ResInSync");
                }
                Dispatcher.Invoke(new System.Windows.Forms.MethodInvoker(delegate { prs.Value++; }));
                Logger.Log(string.Format("下载资源文件成功{0},远程路径为{1}", _dt.Rows[num]["FileName"], (sender as WebClient).BaseAddress));
                if (_inDownloading == 0)
                {
                    Logger.Log(string.Format("下载资源文件完毕"));
                    MessageBox.Show(LangManager.GetLangFromResource("ResFinish"));
                    Dispatcher.Invoke(new System.Windows.Forms.MethodInvoker(delegate { this.Close(); }));
                }
            }
        }
Beispiel #12
0
        private void SetupLanguage()
        {
            this.button1.Text = LangManager.GetString("mainForm_button1_label");
            this.button2.Text = LangManager.GetString("mainForm_button2_label");

            this.playerList1.Text                    = LangManager.GetString("mainForm_playerList_label");
            this.inputOutput1.InputLabel             = LangManager.GetString("mainForm_input_label");
            this.inputOutput1.InputButtonLabel       = LangManager.GetString("mainForm_inputButton_label");
            this.inputOutput1.OutputLabel            = LangManager.GetString("mainForm_output_label");
            this.inputOutput1.OutputOptionLabel      = LangManager.GetString("mainForm_outputOption_label");
            this.inputOutput1.OutputClearButtonLabel = LangManager.GetString("mainForm_outputClearButton_label");
            this.inputOutput1.InputModeLabel         = LangManager.GetString("mainForm_inputMode_label");

            this.fileFToolStripMenuItem.Text = LangManager.GetString("mainForm_fileFToolStripMenuItem_label");
            this.exitEToolStripMenuItem.Text = LangManager.GetString("mainForm_exitEToolStripMenuItem_label");

            this.controlCToolStripMenuItem.Text = LangManager.GetString("mainForm_controlCToolStripMenuItem_label");

            this.debugDToolStripMenuItem.Text = LangManager.GetString("mainForm_debugDToolStripMenuItem_label");

            this.toolTToolStripMenuItem.Text = LangManager.GetString("mainForm_toolTToolStripMenuItem_label");

            this.helpHToolStripMenuItem.Text             = LangManager.GetString("mainForm_helpHToolStripMenuItem_label");
            this.mineNETGUIVersionToolStripMenuItem.Text = LangManager.GetString("mainForm_mineNETGUIVersionToolStripMenuItem_label");
        }
Beispiel #13
0
 private void btnReName_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         var rname = Microsoft.VisualBasic.Interaction.InputBox(LangManager.GetLangFromResource("RenameNewName"), LangManager.GetLangFromResource("RenameTitle"), listVer.SelectedItem.ToString());
         if (rname == "")
         {
             return;
         }
         if (rname == listVer.SelectedItem.ToString())
         {
             return;
         }
         if (listVer.Items.IndexOf(rname) != -1)
         {
             throw new Exception(LangManager.GetLangFromResource("RenameFailedExist"));
         }
         Directory.Move(".minecraft\\versions\\" + listVer.SelectedItem, ".minecraft\\versions\\" + rname);
     }
     catch (UnauthorizedAccessException)
     {
         MessageBox.Show(LangManager.GetLangFromResource("RenameFailedError"));
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
     ReFlushlistver();
 }
 public static T Load <T>(string filePath) where T : YamlStaticConfig
 {
     try
     {
         if (File.Exists(filePath))
         {
             using (StreamReader r = new StreamReader(filePath, false))
             {
                 Deserializer s = new DeserializerBuilder()
                                  .Build();
                 YamlStaticConfig conv = s.Deserialize <T>(r);
                 conv.filePath = filePath;
                 return((T)Convert.ChangeType(conv, typeof(T)));
             }
         }
         else
         {
             object           ins  = Activator.CreateInstance(typeof(T));
             YamlStaticConfig conv = (YamlStaticConfig)ins;
             conv.filePath = filePath;
             conv.Save <T>();
             return((T)conv);
         }
     }
     catch
     {
         Logger.Error("%server_exception_config");
         Logger.Notice("%server_exception_config2", filePath);
         throw new IOException(LangManager.GetString("server_exception_config")
                               + Environment.NewLine
                               + string.Format(LangManager.GetString("server_exception_config2"), filePath));
     }
 }
Beispiel #15
0
        public ILangMan CreateLangMan(object sender)
        {
            if (sender == null)
            {
                return(null);
            }

            string lngSign = GlobalOptions.Instance.GetLanguageSign();

            Assembly asm = sender.GetType().Assembly;

            Module[] mods    = asm.GetModules();
            string   asmFile = mods[0].FullyQualifiedName;

            string langFile = Path.ChangeExtension(asmFile, "." + lngSign);

            if (!File.Exists(langFile))
            {
                langFile = Path.ChangeExtension(asmFile, "." + LangMan.LS_DEF_SIGN);
            }

            LangManager langMan = new LangManager();
            bool        res     = langMan.LoadFromFile(langFile);

            return((res) ? langMan : null);
        }
        private static async Task Main()
        {
            Directory.CreateDirectory(Configuration.OutputPath);
            Log.Logger = new LoggerConfiguration()
                         .WriteTo.Console()
                         .CreateLogger();

            var mods = (await ApiManager.GetModsAsync()).ToList();
            await ModDownloadManager.DownloadModsAsync(mods);

            LangManager.ProcessLangFiles(mods);
            var languages = mods.SelectMany(_ => _.Languages).Where(_ => !_.IsInBlackList).ToList();

            foreach (var language in languages)
            {
                string path;
                try
                {
                    _    = languages.Single(_ => _.AssetDomain == language.AssetDomain);
                    path = $"assets/{language.AssetDomain}/lang/";
                }
                catch (Exception)
                {
                    path = $"assets/{language.AssetDomain}-{language.BaseMod.ShortUrl}/lang/";
                }

                Directory.CreateDirectory(Path.Combine(Configuration.OutputPath, path));
                var fullPath = Path.Combine(Configuration.OutputPath, path, "en_us.lang");
                await File.WriteAllTextAsync(fullPath, language.OutPutText).ContinueWith(
                    t => Log.Information($"写入了一个语言文件到: {fullPath}")).ConfigureAwait(false);
            }

            RepositoryManager.PushToGithub();
            Log.CloseAndFlush();
        }
        protected override IAsyncResult BeginExecuteCore(AsyncCallback callback, object state)
        {
            string lang = null;

            // Получаем куки пользователя
            // Сохраняем выбранную культуру в куки
            HttpCookie langCookie = Request.Cookies["culture"];

            // если куки уже установлено, то обновляем значение
            if (langCookie != null)
            {
                lang = langCookie.Value;
            }
            else
            {
                // Получает отсортированный массив языковых предпочтений пользователя
                var userLanguage = Request.UserLanguages;

                var userlang = userLanguage != null ? userLanguage[0] : "";

                if (userlang != "")
                {
                    lang = userlang;
                }
                else
                {
                    lang = LangManager.GetDefaultLanguage();
                }
            }

            new LangManager().SetLanguage(lang);

            return(base.BeginExecuteCore(callback, state));
        }
Beispiel #18
0
 /// <summary>
 /// 初始化启动器
 /// </summary>
 /// <param name="javaPath"></param>
 /// <param name="javaXmx"></param>
 /// <param name="userName"></param>
 /// <param name="name"></param>
 /// <param name="info"></param>
 /// <param name="extarg"></param>
 /// <param name="li"></param>
 public Launcher(string javaPath, string javaXmx, string userName, string name, Gameinfo info, string extarg, LoginInfo li)
 {
     OnStateChangeEvent(LangManager.GetLangFromResource("LauncherCheckJava"));
     if (!File.Exists(javaPath))
     {
         BMCLV4.Logger.Log("找不到java", BMCLV4.Logger.LogType.Error);
         throw new NoJavaException();
     }
     OnStateChangeEvent(LangManager.GetLangFromResource("LauncherCheckMem"));
     _javaxmx   = javaXmx;
     _username  = userName;
     _version   = info.id;
     this._name = name;
     _game.StartInfo.FileName = javaPath;
     if (BMCLV4.Logger.Debug)
     {
         _game.StartInfo.CreateNoWindow         = true;
         _game.StartInfo.RedirectStandardOutput = true;
         _game.StartInfo.RedirectStandardError  = true;
     }
     _info       = info;
     this._li    = li;
     this.Extarg = extarg;
     this._info  = info;
 }
Beispiel #19
0
            public override string GetStrValue(ExpressionMediator exm, IOperandTerm[] arguments)
            {
                string ret = arguments[0].GetStrValue(exm);

                if (arguments[1] == null)
                {
                    return(ret);
                }
                int totalLength   = (int)arguments[1].GetIntValue(exm);
                int currentLength = LangManager.GetStrlenLang(ret);

                totalLength -= currentLength - ret.Length;                //全角文字の数だけマイナス。タブ文字?ゼロ幅文字?知るか!
                if (totalLength < ret.Length)
                {
                    return(ret);                   //PadLeftは0未満を送ると例外を投げる
                }
                if (arguments[2] != null)
                {
                    ret = ret.PadRight(totalLength, ' ');                    //LEFT
                }
                else
                {
                    ret = ret.PadLeft(totalLength, ' ');                    //RIGHT
                }
                return(ret);
            }
Beispiel #20
0
        private void StartBtn_Click(object sender, EventArgs e)
        {
            if (String.IsNullOrWhiteSpace(inputDirectory))
            {
                MsgBoxForm msgbox = new MsgBoxForm(LangManager.GetString("selectInputDirectory"), LangManager.GetString("attention"), MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                msgbox.ShowDialog();
                return;
            }
            else if (String.IsNullOrWhiteSpace(outputDirectory))
            {
                MsgBoxForm msgbox = new MsgBoxForm(LangManager.GetString("selectOutputDirectory"), LangManager.GetString("attention"), MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                msgbox.ShowDialog();
                return;
            }

            WorkForm wf       = new WorkForm(inputDirectory, outputDirectory);
            Point    location = this.PointToScreen(Point.Empty);

            wf.Location = new Point(location.X + (this.Width / 2) - (wf.Width / 2),
                                    location.Y + (this.Height / 2) - (wf.Height / 2) - 30);

            this.Hide();

            wf.ShowDialog();

            this.Show();
        }
Beispiel #21
0
 public EmoteRecord(byte id, int nameid, string defaultanim, bool isaura)
 {
     this.Id     = id;
     this.NameId = nameid;
     this.Name   = LangManager.GetText(nameid);
     this.IsAura = isaura;
 }
Beispiel #22
0
        private void btnSaveConfig_Click(object sender, RoutedEventArgs e)
        {
            BmclCore.Config.Autostart   = checkAutoStart.IsChecked != null && (bool)checkAutoStart.IsChecked;
            BmclCore.Config.ExtraJvmArg = txtExtJArg.Text;
            BmclCore.Config.Javaw       = txtJavaPath.Text;
            BmclCore.Config.Javaxmx     = txtJavaXmx.Text;
            BmclCore.Config.Login       = listAuth.SelectedItem.ToString();
            try
            {
                BmclCore.Config.LastPlayVer = BmclCore.MainWindow.GridGame.GetSelectedVersion();
            }
            catch (NoSelectGameException)
            {
                BmclCore.Config.LastPlayVer = null;
            }
            BmclCore.Config.Passwd             = Encoding.UTF8.GetBytes(txtPwd.Password);
            BmclCore.Config.Username           = txtUserName.Text;
            BmclCore.Config.WindowTransparency = sliderWindowTransparency.Value;
            BmclCore.Config.Report             = checkReport.IsChecked != null && checkReport.IsChecked.Value;
            BmclCore.Config.CheckUpdate        = checkCheckUpdate.IsChecked != null && checkCheckUpdate.IsChecked.Value;
            BmclCore.Config.DownloadSource     = listDownSource.SelectedIndex;
            BmclCore.Config.Lang       = LangManager.GetLangFromResource("LangName");
            BmclCore.Config.Height     = int.Parse(ScreenHeightTextBox.Text);
            BmclCore.Config.Width      = int.Parse(ScreenWidthTextBox.Text);
            BmclCore.Config.FullScreen = FullScreenCheckBox.IsChecked ?? false;
            BmclCore.Config.LaunchMode = chkLaunchMode.IsChecked == true ? LaunchMode.Standalone : LaunchMode.Normal;
            BmclCore.Config.Save(null);
            var dak = new DoubleAnimationUsingKeyFrames();

            dak.KeyFrames.Add(new LinearDoubleKeyFrame(0, TimeSpan.FromSeconds(0)));
            dak.KeyFrames.Add(new LinearDoubleKeyFrame(30, TimeSpan.FromSeconds(0.3)));
            dak.KeyFrames.Add(new LinearDoubleKeyFrame(30, TimeSpan.FromSeconds(2.3)));
            dak.KeyFrames.Add(new LinearDoubleKeyFrame(0, TimeSpan.FromSeconds(2.6)));
            popupSaveSuccess.BeginAnimation(FrameworkElement.HeightProperty, dak);
        }
Beispiel #23
0
        public override bool EnterMapping(IPropertyDescriptor key, IObjectDescriptor value, IEmitter context)
        {
            CommentObjectDescriptor comment = value as CommentObjectDescriptor;

            if (comment != null && !string.IsNullOrEmpty(comment.Comment))
            {
                if (comment.Comment[0] == '%')
                {
                    if (comment.Manager != null)
                    {
                        string msg = comment.Manager.GetString(comment.Comment.Remove(0, 1));
                        context.Emit(new Comment(msg, false));
                    }
                    else
                    {
                        string msg = LangManager.GetString(comment.Comment.Remove(0, 1));
                        context.Emit(new Comment(msg, false));
                    }
                }
                else
                {
                    context.Emit(new Comment(comment.Comment, false));
                }
            }

            return(base.EnterMapping(key, value, context));
        }
Beispiel #24
0
        private void Run()
        {
            curCode = codeRTB.Text;
            string fileName = Directory.GetCurrentDirectory() + "\\";

            if (path != null)
            {
                fileName = path;
            }
            LangManager langManager = new LangManager(fileName);

            langManager.interpreter.breakpoints = (ArrayList)LineNumberer.BreakPoints.Clone();
            try
            {
                langManager.updateCode(curCode);
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            Thread runnerThread = new Thread(new ThreadStart(langManager.run), 33554432);

            Thread.Sleep(500);
            runnerThread.SetApartmentState(ApartmentState.STA);
            runnerThread.Start();
            LiveErrors.Enabled = false;
        }
Beispiel #25
0
 private void LoadConfig()
 {
     GridConfig.txtUserName.Text         = BmclCore.Config.Username;
     GridConfig.txtPwd.Password          = Encoding.UTF8.GetString(BmclCore.Config.Passwd);
     GridConfig.txtJavaPath.Text         = BmclCore.Config.Javaw;
     GridConfig.sliderJavaxmx.Maximum    = Config.GetMemory();
     GridConfig.txtJavaXmx.Text          = BmclCore.Config.Javaxmx;
     GridConfig.sliderJavaxmx.Value      = int.Parse(BmclCore.Config.Javaxmx);
     GridConfig.txtExtJArg.Text          = BmclCore.Config.ExtraJvmArg;
     GridConfig.checkAutoStart.IsChecked = BmclCore.Config.Autostart;
     if (GridConfig.listAuth.SelectedItem == null)
     {
         GridConfig.listAuth.SelectedIndex = 0;
     }
     GridConfig.sliderWindowTransparency.Value = BmclCore.Config.WindowTransparency;
     GridConfig.checkReport.IsChecked          = BmclCore.Config.Report;
     GridForge.txtInsPath.Text = AppDomain.CurrentDomain.BaseDirectory + ".minecraft";
     GridConfig.listDownSource.SelectedIndex = BmclCore.Config.DownloadSource;
     GridConfig.comboLang.SelectedItem       = LangManager.GetLangFromResource("DisplayName");
     GridConfig.ScreenHeightTextBox.Text     = BmclCore.Config.Height.ToString();
     GridConfig.ScreenWidthTextBox.Text      = BmclCore.Config.Width.ToString();
     GridConfig.FullScreenCheckBox.IsChecked = BmclCore.Config.FullScreen;
     GridConfig.checkCheckUpdate.IsChecked   = BmclCore.Config.CheckUpdate;
     GridConfig.chkLaunchMode.IsChecked      = BmclCore.Config.LaunchMode == LaunchMode.Standalone;
 }
Beispiel #26
0
        private async void btnDownloadVer_Click(object sender, RoutedEventArgs e)
        {
            if (listRemoteVer.SelectedItem == null)
            {
                MessageBox.Show(LangManager.GetLangFromResource("RemoteVerErrorNoVersionSelect"));
                return;
            }
            var selectVer = listRemoteVer.SelectedItem as DataRowView;

            if (selectVer == null)
            {
                return;
            }
            var url = selectVer[3] as string;
            var versionDownloader = new Version(url);

            _prs = new FrmPrs(LangManager.GetLangFromResource("btnDownloadVer"));
            _prs.Show();
            versionDownloader.ProcessChange += status => _prs.ChangeStatus(LangManager.GetLangFromResource(status));
            await versionDownloader.Start();

            Logger.Log("下载客户端文件成功");
            MessageBox.Show(LangManager.GetLangFromResource("RemoteVerDownloadSuccess"));
            btnDownloadVer.Content   = LangManager.GetLangFromResource("btnDownloadVer");
            btnDownloadVer.IsEnabled = true;
            BmclCore.MainWindow.GridGame.ReFlushlistver();
            BmclCore.MainWindow.SwitchDownloadGrid(Visibility.Hidden);
            BmclCore.MainWindow.TabMain.SelectedIndex = 0;
            _prs.Close();
            _prs = null;
        }
Beispiel #27
0
        private async void RefreshForgeVersionList()
        {
            treeForgeVer.Items.Add(LangManager.GetLangFromResource("ForgeListGetting"));
            _forgeVersions = await _forgeTask.GetVersion();

            treeForgeVer.Items.Clear();
            var versionList = new SortedList <string, TreeViewItem>();

            foreach (var version in _forgeVersions)
            {
                var mc = version.GetMc();
                if (mc == null)
                {
                    continue;
                }
                if (!versionList.ContainsKey(mc))
                {
                    versionList[version.GetMc()] = new TreeViewItem()
                    {
                        Header = version.GetMc()
                    };
                }
                versionList[version.GetMc()].Items.Add(version.name);
            }
            foreach (var treeViewItem in versionList)
            {
                treeForgeVer.Items.Add(treeViewItem.Value);
            }
            btnReForge.Content     = LangManager.GetLangFromResource("btnReForge");
            btnReForge.IsEnabled   = true;
            btnLastForge.IsEnabled = true;
        }
Beispiel #28
0
        private void WorkForm_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (bgWorker.IsBusy)
            {
                if (bgWorker.CancellationPending == true)
                {
                    e.Cancel = true;
                    MsgBoxForm msgbox1 = new MsgBoxForm(LangManager.GetString("cancellationInProgress"), LangManager.GetString("attention"), MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2);
                    msgbox1.ShowDialog();
                    return;
                }

                MsgBoxForm   msgbox = new MsgBoxForm(LangManager.GetString("reallyWantToInterrupt"), LangManager.GetString("attention"), MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2);
                DialogResult res    = msgbox.ShowDialog();
                if (res == DialogResult.No)
                {
                    e.Cancel = true;
                }
                else
                {
                    e.Cancel = true;
                    bgWorker.CancelAsync();
                    cancelBtn.Text    = LangManager.GetString("cancellingBtn");
                    cancelBtn.Enabled = false;
                }
            }
        }
Beispiel #29
0
    //---------------------------------------------------------------------------------------------

    void Update()
    {
        PlayerMoney.text       = string.Format(LangManager.GetTranslation("currency_abreviation"), stateManager.CurrentPlayer().Money);
        buyButton.interactable = stateManager.CurrentPlayer().Money >= Definitions.PRECIO_COMPRA_CARTAS &&
                                 stateManager.CurrentPlayer().cards.Count < 3;
        sellButton.interactable = stateManager.CurrentPlayer().cards.Count > 0;
    }
Beispiel #30
0
        private void btnRefreshRemoteVer_Click(object sender, RoutedEventArgs e)
        {
            btnRefreshRemoteVer.IsEnabled = false;
            listRemoteVer.DataContext     = null;
            var rawJson = new DataContractJsonSerializer(typeof(RawVersionListType));
            var getJson = (HttpWebRequest)WebRequest.Create(BmclCore.UrlDownloadBase + "versions/versions.json");

            getJson.Timeout          = 10000;
            getJson.ReadWriteTimeout = 10000;
            getJson.UserAgent        = "BMCL" + BmclCore.BmclVersion;
            var thGet = new Thread(new ThreadStart(delegate
            {
                try
                {
                    Dispatcher.Invoke(new System.Windows.Forms.MethodInvoker(delegate { btnRefreshRemoteVer.Content = LangManager.GetLangFromResource("RemoteVerGetting"); }));
                    var getJsonAns = (HttpWebResponse)getJson.GetResponse();
                    // ReSharper disable once AssignNullToNotNullAttribute
                    var remoteVersion = rawJson.ReadObject(getJsonAns.GetResponseStream()) as RawVersionListType;
                    var dt            = new DataTable();
                    dt.Columns.Add("Ver");
                    dt.Columns.Add("RelTime");
                    dt.Columns.Add("Type");
                    if (remoteVersion != null)
                    {
                        foreach (RemoteVerType rv in remoteVersion.getVersions())
                        {
                            dt.Rows.Add(new object[] { rv.id, rv.releaseTime, rv.type });
                        }
                    }
                    Dispatcher.Invoke(new System.Windows.Forms.MethodInvoker(delegate
                    {
                        btnRefreshRemoteVer.Content   = LangManager.GetLangFromResource("btnRefreshRemoteVer");
                        btnRefreshRemoteVer.IsEnabled = true;
                        listRemoteVer.DataContext     = dt;
                        listRemoteVer.Items.SortDescriptions.Add(new System.ComponentModel.SortDescription("RelTime", System.ComponentModel.ListSortDirection.Descending));
                    }));
                }
                catch (WebException ex)
                {
                    MessageBox.Show(LangManager.GetLangFromResource("RemoteVerFailedTimeout") + "\n" + ex.Message);
                    Dispatcher.Invoke(new System.Windows.Forms.MethodInvoker(delegate
                    {
                        btnRefreshRemoteVer.Content   = LangManager.GetLangFromResource("btnRefreshRemoteVer");
                        btnRefreshRemoteVer.IsEnabled = true;
                    }));
                }
                catch (TimeoutException ex)
                {
                    MessageBox.Show(LangManager.GetLangFromResource("RemoteVerFailedTimeout") + "\n" + ex.Message);
                    Dispatcher.Invoke(new System.Windows.Forms.MethodInvoker(delegate
                    {
                        btnRefreshRemoteVer.Content   = LangManager.GetLangFromResource("btnRefreshRemoteVer");
                        btnRefreshRemoteVer.IsEnabled = true;
                    }));
                }
            }));

            thGet.Start();
        }
Beispiel #31
0
  void Awake() {
    lm = this;
    fontDict = new Dictionary<string, LocalFont>();
    foreach (LocalFont localFont in localFonts) {
      fontDict[localFont.name] = localFont;
    }

    if (autoLangDetection) {
      lang = systemLanguageToCode(Application.systemLanguage);
    }
  }