private static void Main() { // Get the command line arguments and check // if the current session is a restart string[] args = Environment.GetCommandLineArgs(); if (args.Any(arg => arg == $"{ProgramController.ParameterPrefix}restart")) { isRestarted = true; } // Make sure only one instance is running // if the application is not currently restarting Mutex mutex = new Mutex(true, "ParserMini", out bool isUnique); if (!isUnique && !isRestarted) { MessageBox.Show(Strings.OtherInstanceRunning, Strings.Error, MessageBoxButtons.OK, MessageBoxIcon.Error); return; } // Initialize the controllers and // display the main user form Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); LocalizationController.InitializeLocale(); ProgramController.InitializeServerIp(); Application.Run(new UI.Main()); // Don't let the garbage // collector touch the Mutex GC.KeepAlive(mutex); }
public static void addVariableToDefaultLanguageFile(LocalizationController controller, Lang defaultLanguage, string variableName, string variableValue) { var path = controller.absoluteMessagesPath + "/messages." + defaultLanguage.code; var line = Environment.NewLine + variableName + "=" + variableValue; File.AppendAllText(@path, line); }
public LocalizationControllerTest() { mockLocalizationRepository = new Mock <ILocalizationRepository>(MockBehavior.Loose); mockMapper = new Mock <IMapper>(MockBehavior.Loose); mockIpStackService = new Mock <IIpStackService>(MockBehavior.Loose); controller = new LocalizationController(mockLocalizationRepository.Object, mockMapper.Object, mockIpStackService.Object); }
public void Populate(TeamData _team, int _index) { Team = _team; LocalizationController loc = LocalizationController.Instance; nameLabel.text = _team.Name; winsLabel.text = loc.FormatBigNumber(_team.LifeTimeStats.Wins); lostsLabel.text = loc.FormatBigNumber(_team.LifeTimeStats.Losts); drawsLabel.text = loc.FormatBigNumber(_team.LifeTimeStats.Draws); goalslabel.text = loc.FormatBigNumber(_team.LifeTimeStats.Goals); goalsAgainstLabel.text = loc.FormatBigNumber(_team.LifeTimeStats.GoalsAgainst); shotsLabel.text = loc.FormatBigNumber(_team.LifeTimeStats.Shots); headersLabel.text = loc.FormatBigNumber(_team.LifeTimeStats.Headers); stealsLabel.text = loc.FormatBigNumber(_team.LifeTimeStats.Steals); passesLabel.text = loc.FormatBigNumber(_team.LifeTimeStats.Passes); passesLabel.text = loc.FormatBigNumber(_team.LifeTimeStats.Passes); longPassesLabel.text = loc.FormatBigNumber(_team.LifeTimeStats.LongPasses); passesMissedLabel.text = loc.FormatBigNumber(_team.LifeTimeStats.PassesMissed); boxCrossesLabel.text = loc.FormatBigNumber(_team.LifeTimeStats.BoxCrosses); faultsLabel.text = loc.FormatBigNumber(_team.LifeTimeStats.Faults); counterAttacksLabel.text = loc.FormatBigNumber(_team.LifeTimeStats.CounterAttacks); if (_index % 2 != 0) { frame.color = Color.white; } }
public async Task WHEN_SyncToAsync_SHOULD_Not_Deadlock() { //Arrange LocalizationController controller = _container.CreateInstance <LocalizationController>(); HttpRequest request = new HttpRequest("c:\\dummy.txt", "http://dummy.txt", ""); request.Browser = new HttpBrowserCapabilities(); HttpResponse response = new HttpResponse(TextWriter.Null); HttpContextBase context = new HttpContextWrapper(new HttpContext(request, response)); RouteData routeData = new RouteData(); routeData.Values["controller"] = GetRandom.String(32); ControllerContext cc = new ControllerContext(context, routeData, controller); controller.ControllerContext = cc; //Act await Task.Delay(1); var result = controller.GetTree("en-CA"); //Assert //Nothing to assert, we just don't want the Timeout to proc result.Should().NotBeNull(); }
public void WHEN_Returning_Json_From_HttpGet_SHOULD_Not_Return_An_Array() { //Arrange LocalizationController controller = _container.CreateInstance <LocalizationController>(); string jsonResponse; using (StringWriter output = new StringWriter()) { HttpRequest request = new HttpRequest("c:\\dummy.txt", "http://dummy.txt", ""); request.Browser = new HttpBrowserCapabilities(); HttpResponse response = new HttpResponse(output); HttpContextBase context = new HttpContextWrapper(new HttpContext(request, response)); RouteData routeData = new RouteData(); routeData.Values["controller"] = GetRandom.String(32); ControllerContext cc = new ControllerContext(context, routeData, controller); controller.ControllerContext = cc; //Act controller.GetTree("en-CA").ExecuteResult(cc); jsonResponse = output.ToString().Trim(); output.Close(); } //Assert jsonResponse.Should().NotStartWith("["); }
private void Awake() { if (Instance == null) { Instance = this; } }
public MainWindow() { // Get command line arguments commandLineArgs = CommandLineParser.GetCommandLineArgs(); // Load localization LocalizationController.LoadLocalization(); // Load appearance AppearanceController.LoadAppearance(); InitializeComponent(); DataContext = this; // Set a filter for ListView Apps and sort them CollectionView view = (CollectionView)CollectionViewSource.GetDefaultView(lvApps.ItemsSource); view.SortDescriptions.Add(new SortDescription("Name", ListSortDirection.Ascending)); view.Filter = SearchFilter; // Init notify icon InitNotifyIcon(); if (commandLineArgs.Autostart && Properties.Settings.Default.Application_StartApplicationMinimized) { HideWindowToTray(); } }
static Core() { Configurator.Load(); Config.PropertyChanged += Config_PropertyChanged; Events.Events.SyncFailedEvent.SyncFailed.OnSyncFailedEvent += SyncFailed_OnSyncFailedEvent; LocalizationController.SetLanguage(Config.language); Events.Events.LoginedEvent.Logined.OnLoginedEvent += Logined_OnLoginedEvent; }
protected override void Awake() { base.Awake(); _localizationController = Camera.main.GetComponent <LocalizationController>(); // Подписываем изменение спрайта кнопки _localizationController.LanguageChanged += ChangeSprite; }
private void addNewLanguageMessageFile(LocalizationController controller, Lang newLang) { // only create the file if one doesn't already exist if (!controller.getSupportedLanguages().Exists(l => { return(l == newLang); })) { File.Create(controller.absoluteMessagesPath + "/messages." + newLang.code).Dispose(); } }
public void Initialize(Color _homeColor, Color _awayColor, TeamData _awayTeam) { homeColor = _homeColor; awayColor = _awayColor; awayTeam = _awayTeam; loc = LocalizationController.Instance; visualNarration.SetNarrationText(""); visualNarration.ShowGoalCelebration(false); }
/// <summary> /// Saves the chosen locale and restarts /// the application /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void StartButton_Click(object sender, RoutedEventArgs e) { Properties.Settings.Default.LanguageCode = LocalizationController.GetLanguage(); Properties.Settings.Default.HasPickedLanguage = true; Properties.Settings.Default.Save(); _isStarting = true; Close(); }
/// <summary> /// Sets the chosen locale /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void LanguageList_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e) { if (!_handleListChange) { return; } LocalizationController.SetLanguage((LocalizationController.Language)LanguageList.SelectedIndex, false); }
void Start() { _lc = LocalizationController.Instance; _goat = GameState.Instance.Goat; var ls = LevelSettings.Instance; if (!ls.Endless) { gameObject.SetActive(false); return; } }
public void OnEnable() { dialogController = (DialogController)target; dialogControllerSerializedObject = new SerializedObject(dialogController); dialogControllerSerializedProperty = dialogControllerSerializedObject.FindProperty("dialogList"); dialogListSize = dialogControllerSerializedObject.FindProperty(listSize); GameObject go = GameObject.Find("GameObject"); LocalizationController other = (LocalizationController)go.GetComponent(typeof(LocalizationController)); keyOptions = other.LangController.getKeys(); }
/// <summary> /// The main entry point for the application. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Application_Startup(object sender, StartupEventArgs e) { // Get the command line arguments and check // if the current session is a restart or // a minimized start string[] args = Environment.GetCommandLineArgs(); if (args.Any(arg => arg == $"{AppController.ParameterPrefix}restart")) { isRestarted = true; } if (args.Any(arg => arg == $"{AppController.ParameterPrefix}minimized")) { startMinimized = true; } // Make sure only one instance is running // if the application is not currently restarting Mutex mutex = new Mutex(true, "GTAWAssistant", out bool isUnique); if (!isUnique && !isRestarted) { MessageBox.Show(Localization.Strings.OtherInstanceRunning, Localization.Strings.Error, MessageBoxButton.OK, MessageBoxImage.Error); Current.Shutdown(); return; } // Initialize the controllers and // display the server picker on the // first start, or the main window // on subsequent starts LocalizationController.InitializeLocale(); AppController.InitializeServerIp(); if (!Settings.Default.HasPickedLanguage) { LanguagePickerWindow languagePicker = new LanguagePickerWindow(); languagePicker.Show(); } else { MainWindow mainWindow = new MainWindow(startMinimized); if (!startMinimized) { mainWindow.Show(); } } // Don't let the garbage // collector touch the Mutex GC.KeepAlive(mutex); }
public void SetUp() { _repository = new Mock <IMongoRepository>(); _controller = new LocalizationController(_repository.Object) { ControllerContext = new ControllerContext { HttpContext = new DefaultHttpContext() }, ObjectValidator = Mock.Of <IObjectModelValidator>() }; StubCursors(); }
private void UpdateGameModeInfo(GameInfo gameInfo) { tbGameMode.Text = gameInfo.Mode == GameMode.LIVE ? Resources.GameMode_LIVE : Resources.GameMode_PTU; btnLocalization.Text = string.Format(Resources.LocalizationButton_Text, gameInfo.Mode); tbGameVersion.Text = gameInfo.ExeVersion; btnUpdateLocalization.Text = Resources.Localization_CheckForUpdates_Text; var controller = new LocalizationController(gameInfo); btnUpdateLocalization.Visible = controller.CurrentInstallation.InstalledVersion != null && controller.GetInstallationType() != LocalizationInstallationType.None; }
/// <summary> /// Adds menu options under "Server" on the menu /// strip for each Language in LocalizationController /// </summary> private void SetupServerList() { // Get the current Language to add a check on // the option and loop through the Languages enum string currentLanguage = LocalizationController.GetLanguageFromCode(LocalizationController.GetLanguage()); for (int i = 0; i < ((LocalizationController.Language[])Enum.GetValues(typeof(LocalizationController.Language))).Length; ++i) { // Add the menu option and the click event LocalizationController.Language language = (LocalizationController.Language)i; ToolStripItem newLanguage = ServerToolStripMenuItem.DropDownItems.Add(language.ToString()); newLanguage.Click += (s, e) => { // No need to do anything if the current language // is clicked on since that won't change anything if (((ToolStripMenuItem)newLanguage).Checked) { return; } // Make sure the user wants to switch if (MessageBox.Show(Strings.SwitchServer, Strings.Restart, MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes) { return; } LocalizationController.SetLanguage(language); // Restart the program ProcessStartInfo startInfo = Process.GetCurrentProcess().StartInfo; startInfo.FileName = Application.ExecutablePath; startInfo.Arguments = $"{ProgramController.ParameterPrefix}restart"; var exit = typeof(Application).GetMethod("ExitInternal", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Static); exit?.Invoke(null, null); Process.Start(startInfo); }; // Check the current Language if (currentLanguage == language.ToString()) { ((ToolStripMenuItem)ServerToolStripMenuItem.DropDownItems[i]).Checked = true; } } }
/// <summary> /// Adds menu options under "Server" on the menu /// strip for each Language in LocalizationController /// </summary> private void SetupServerList() { string currentLanguage = LocalizationController.GetLanguageFromCode(LocalizationController.GetLanguage()); for (int i = 0; i < ((LocalizationController.Language[])Enum.GetValues(typeof(LocalizationController.Language))).Length; ++i) { LocalizationController.Language language = (LocalizationController.Language)i; MenuItem menuItem = new MenuItem { Header = language.ToString() }; LanguageToolStripMenuItem.Items.Add(menuItem); menuItem.Click += (s, e) => { if (menuItem.IsChecked) { return; } CultureInfo cultureInfo = new CultureInfo(LocalizationController.GetCodeFromLanguage(language)); if (MessageBox.Show(Strings.ResourceManager.GetString("SwitchServer", cultureInfo), Strings.ResourceManager.GetString("Restart", cultureInfo), MessageBoxButton.YesNo, MessageBoxImage.Question) != MessageBoxResult.Yes) { return; } LocalizationController.SetLanguage(language); isRestarting = true; ProcessStartInfo startInfo = Process.GetCurrentProcess().StartInfo; startInfo.FileName = AppController.ExecutablePath; startInfo.Arguments = $"{AppController.ParameterPrefix}restart"; Process.Start(startInfo); System.Windows.Application.Current.Shutdown(); }; if (currentLanguage == language.ToString()) { menuItem.IsChecked = true; } } }
public Form1() { // bot = new WTGLib("a"); LocalizationController.SetLanguage(Core.Config.language); this.InitializeComponent(); this.BuildingGrid = this.dataGridView1; this.ShipGrid = this.dataGridView2; this.CoinsLabel = this.lbl_coins; this.FishLabel = this.lbl_fish; this.StoneLabel = this.lbl_stone; this.TabControl = this.tabControl1; this.GemLabel = this.lbl_gems; this.IronLabel = this.lbl_iron; this.WoodLabel = this.lbl_wood; this.LevelLabel = this.lbl_lvl; this.SailorsLabel = this.lbl_sailors; this.NeededAlgoGrid = this.dataGridView3; this.InventoryGrid = this.dataGridView4; instance = this; TeleConfigSer.Load(); this.MaximizeBox = false; this.CheckForUpdates(); this.UpdateButtons(Core.Config.autoshiptype); this.LoadControls(); Logger.Event.LogMessageChat.OnLogMessage += this.LogMessageChat_OnLogMessage; if (!Core.Config.acceptedresponsibility) { var msg = MessageBox.Show( PrivateLocal.SEABOTGUI_WELCOME, "Root to the SeaBot!", MessageBoxButtons.OKCancel); if (msg == DialogResult.OK) { Core.Config.acceptedresponsibility = true; } else { Environment.Exit(0); } } // Check for cache }
// Start is called before the first frame update void Start() { LocalizationController = new LocalizationController(_localizationData); LocalizationController.setLanguage(_defaultLanguageCode); _eventList = new Dictionary <EngineEvents, AEvent>(); _eventList.Add(EngineEvents.ENGINE_CHECKPOINT_REACHED, new AEvent()); _eventList.Add(EngineEvents.ENGINE_GAME_OVER, new AEvent()); _eventList.Add(EngineEvents.ENGINE_GAME_INIT, new AEvent()); _eventList.Add(EngineEvents.ENGINE_GAME_PAUSE, new AEvent()); _eventList.Add(EngineEvents.ENGINE_GAME_START, new AEvent()); _eventList.Add(EngineEvents.ENGINE_GAME_RESUME, new AEvent()); _eventList.Add(EngineEvents.ENGINE_LOAD_FINISH, new AEvent()); _eventList.Add(EngineEvents.ENGINE_LOAD_START, new AEvent()); _eventList.Add(EngineEvents.ENGINE_STAGE_COMPLETE, new AEvent()); _eventList.Add(EngineEvents.ENGINE_CUTSCENE_START, new AEvent()); _eventList.Add(EngineEvents.ENGINE_CUTSCENE_END, new AEvent()); stateMachine = new ControllerStateMachine(); // Must be created After events }
public override void OnInspectorGUI() { LocalizationController myTarget = (LocalizationController)target; DrawDefaultInspector(); EditorGUILayout.HelpBox("Press play to view supported languages." + "While in play mode you can add new languages below.", MessageType.Info ); // allow adding a new language file EditorGUILayout.PrefixLabel("Add a new Language:"); EditorGUI.indentLevel++; languageCode = EditorGUILayout.TextField("Language Code", languageCode); if (GUILayout.Button("Add")) { addNewLanguageMessageFile(myTarget, new Lang(languageCode)); } }
private static void SyncVoid() { LocalizationController.SetLanguage(Core.Config.language); while (true) { Thread.Sleep(6 * 1000); if (_gametasks.Count != 0 && Core.GlobalData.Level != 0) { Logger.Logger.Debug(Localization.NETWORKING_SYNCING); Sync(); } if ((DateTime.Now - _lastRaised).TotalSeconds > (Core.GlobalData.HeartbeatInterval == 0 ? 300 : Core.GlobalData.HeartbeatInterval)) { Logger.Logger.Debug(Localization.NETWORKING_HEARTBEAT); _gametasks.Add(new Task.HeartBeat()); Sync(); } } }
private async void btnUpdateLocalization_Click(object sender, EventArgs e) { if (Program.CurrentGame == null) { return; } var controller = new LocalizationController(Program.CurrentGame); controller.Load(); var installedVersion = controller.CurrentInstallation.InstalledVersion; if (installedVersion != null && await controller.RefreshVersionsAsync(this)) { var availableUpdate = controller.CurrentRepository.LatestUpdateInfo; if (availableUpdate != null && string.Compare(installedVersion, availableUpdate.GetVersion(), StringComparison.OrdinalIgnoreCase) != 0) { var dialogResult = MessageBox.Show(this, string.Format(Resources.Localization_UpdateAvailableInstallAsk_Text, $"\n{controller.CurrentRepository.Name} - {availableUpdate.GetVersion()}"), Resources.Localization_CheckForUpdate_Title, MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dialogResult == DialogResult.Yes && await controller.InstallVersionAsync(this, availableUpdate)) { controller.CurrentRepository.SetCurrentVersion(availableUpdate.GetVersion()); } } else { MessageBox.Show(this, Resources.Localization_NoUpdatesFound_Text, Resources.Localization_CheckForUpdate_Title, MessageBoxButtons.OK, MessageBoxIcon.Information); } } }
/// <summary> /// Displays some information about the program /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void AboutToolStripMenuItem_Click(object sender, EventArgs e) { // ReSharper disable once UnreachableCode // ReSharper disable once ConditionIsAlwaysTrueOrFalse #pragma warning disable 162 MessageBox.Show(string.Format(Strings.About, ProgramController.Version, ProgramController.IsBetaVersion ? Strings.Beta : string.Empty, LocalizationController.GetLanguageFromCode(LocalizationController.GetLanguage()), ProgramController.ServerIPs[0], ProgramController.ServerIPs[1]), Strings.Information, MessageBoxButtons.OK, MessageBoxIcon.Information); #pragma warning restore 162 }
public void Init(DescriptionData data) { _tittle.text = $"#{data.Number}. {LocalizationController.GetLocalizationString(data.Title)}"; _description.text = LocalizationController.GetLocalizationString(data.Description); }
private void Awake() { _localizationController = FindObjectOfType <LocalizationController>(); _text = GetComponent <Text>(); }
protected override void Awake() { base.Awake(); _localizationController = Camera.main.GetComponent <LocalizationController>(); _localizationController.LanguageChanged += ChangeSprite; }