コード例 #1
0
        public void Execute(IJobExecutionContext context)
        {
            var latestVersionAvailable = GetLatestVersionAvailable();

            if (latestVersionAvailable == null)
            {
                return;
            }

            if (latestVersionAvailable.IsNewerThan(CurrentVersion.ReleaseInfo))
            {
                var res = MessageBox.Show(
                    L10n.Get("NewVersionAvailableDescription", latestVersionAvailable.ToString(true, true, false, true)),
                    L10n.Get("NewVersionAvailable"),
                    MessageBoxButtons.YesNo,
                    MessageBoxIcon.Exclamation
                    );

                if (res == DialogResult.Yes)
                {
                    ProcessStartInfo sInfo = new ProcessStartInfo("https://subsync.codeplex.com/releases");
                    Process.Start(sInfo);
                }
            }
        }
コード例 #2
0
ファイル: SetupForm.cs プロジェクト: everag/subsync-win
        private void SetupSyncManager()
        {
            SyncManager.Started += (sender, e) => ShowTrayNotification(L10n.Get("AppRunning", AppName), NotificationPeriod.NORMAL);
            SyncManager.Stopped += (sender, e) => ShowTrayNotification(L10n.Get("AppStopped", AppName), NotificationPeriod.NORMAL);

            SyncManager.SubtitleDownloaded += (sender, e) =>
            {
                var subtitleInfo = (e as SubtitleDownloadedEventArgs).SubtitleFile;

                ShowTrayNotification(L10n.Get("SubtitleDownloaded", subtitleInfo.VideoFile.Name), NotificationPeriod.NORMAL);
            };

            SyncManager.InternetConnectivityLost += (sender, e) =>
            {
                if (SyncManager.Status != SyncStatus.RUNNING)
                {
                    return;
                }

                Thread t = new Thread(new ThreadStart(() => BkgWorkerStartStopSync.RunWorkerAsync(SyncAction.STOP)));
                t.Start();

                MessageBox.Show(L10n.Get("InternetOfflineRegularCheck"), CurrentVersion.ReleaseInfo.ApplicationName);
            };
        }
コード例 #3
0
        Control GetPatching()
        {
            var progressBar = new ProgressBar {
                MinValue = 0,
                MaxValue = 100,
            };

            progressBar.Bind(
                p => p.Value,
                Binding.Property(viewModel, vm => vm.PatchProgress)
                .Convert(v => (int)(v * 100)));

            return(new TableLayout {
                Padding = 10,
                Spacing = new Size(10, 10),
                Rows =
                {
                    new TableRow(L10n.Get("Patching...")),
                    new TableRow(progressBar),
                    new TableRow(new ImageView {
                        Image = Bitmap.FromResource(ResourcesName.PatchingBackground),
                    }),
                },
            });
        }
コード例 #4
0
ファイル: SetupForm.cs プロジェクト: everag/subsync-win
        private void SetupForm_Load(object sender, EventArgs e)
        {
            NotifyIcon.Icon = Properties.Resources.SubSync_Logo;
            NotifyIcon.Text = AppCompleteDescription;

            LbWelcomeTitle.Text   = L10n.Get("LbWelcomeTitle.Text", this, AppShortDescription);
            LbWelcomeMessage.Text = L10n.Get("LbWelcomeMessage.Text", this, AppName);

            BtnStartStop.Text = L10n.Get("AppStart", AppName);

            NotifyIconContextMenuItemStartStop.Text  = L10n.Get("MenuAppStart", AppName);
            NotifyIconContextMenuItemAbout.Text      = L10n.Get("NotifyIconContextMenuItemAbout.Text", this, AppName);
            NotifyIconContextMenuItemOpenGUI.Text    = L10n.Get("NotifyIconContextMenuItemOpenGUI.Text", this, AppName);
            NotifyIconContextMenuItemRunAtLogin.Text = L10n.Get("NotifyIconContextMenuItemRunAtLogin.Text", this, AppName);

            if (SubSync.Lib.Configuration.RunningEnvironment == "Debug")
            {
                Text = string.Format("{0} [{1}]", AppCompleteDescription, SubSync.Lib.Configuration.RunningEnvironment);
            }
            else
            {
                Text = AppCompleteDescription;
            }

            Icon = Properties.Resources.SubSync_Logo;

            if (Settings.FirstRun)
            {
                Settings.MediaFolders = GetDefaultFolders();
                Settings.SubtitleLanguagesPreference = GetDefaultLanguages();

                Settings.FirstRun = false;

                Settings.Save();
            }

            SetupSyncManager();

            LoadSupportedLanguages();

            FillSettingsInfo();

            CheckStartButton();

            TaskManager.StartTask <CheckForUpdatesJob>();
            TaskManager.StartTask <CheckInternetAvailabilityJob>();

            if (StartupArgs.InitializeInStartState && IsConfigurationOk())
            {
                StartStopSync();
            }

            if (StartupArgs.InitializeInTray)
            {
                Hide();
            }
        }
コード例 #5
0
ファイル: SetupForm.cs プロジェクト: everag/subsync-win
        private void BkgWorkerStartStopSync_ProgressChanged(object sender, ProgressChangedEventArgs e)
        {
            var progress = (SyncStartStopProgress)e.UserState;

            UpdateButtonCallback updBtnCb = (button, text, enabled) =>
            {
                button.Text    = text;
                button.Enabled = enabled;
            };

            ToggleControlsEnabledCallback toggleEnabledCb = (enabled) => ToggleControlsEnabled(enabled);

            switch (progress)
            {
            case SyncStartStopProgress.STARTING:
                ToggleControlsEnabled(false);

                BtnStartStop.Enabled = false;
                BtnStartStop.Text    = L10n.Get("AppStarting");

                NotifyIconContextMenuItemStartStop.Enabled = false;
                NotifyIconContextMenuItemStartStop.Text    = L10n.Get("AppStarting");

                break;

            case SyncStartStopProgress.STOPPING:
                this.Invoke(toggleEnabledCb, new object[] { false });
                this.Invoke(updBtnCb, new object[] { BtnStartStop, L10n.Get("AppStopping"), false });

                NotifyIconContextMenuItemStartStop.Enabled = false;
                NotifyIconContextMenuItemStartStop.Text    = L10n.Get("AppStopping");

                break;

            case SyncStartStopProgress.STARTED:
                BtnStartStop.Enabled = true;
                BtnStartStop.Text    = L10n.Get("AppStop", AppName);

                NotifyIconContextMenuItemStartStop.Enabled = true;
                NotifyIconContextMenuItemStartStop.Text    = L10n.Get("MenuAppStop", AppName);

                Hide();

                break;

            case SyncStartStopProgress.STOPPED:
                this.Invoke(toggleEnabledCb, new object[] { true });
                this.Invoke(updBtnCb, new object[] { BtnStartStop, L10n.Get("AppStart", AppName), true });

                NotifyIconContextMenuItemStartStop.Enabled = true;
                NotifyIconContextMenuItemStartStop.Text    = L10n.Get("MenuAppStart", AppName);

                break;
            }
        }
コード例 #6
0
        private void InitializeComponents()
        {
            Title       = L10n.Get("Patching assistant Clippy");
            Maximizable = false;
            Resizable   = false;

            Padding = new Padding(5);
            this.BindDataContext(
                s => s.Content,
                Binding.Property((PatcherViewModel vm) => vm.PatchScene)
                .Convert(scene => GetControlFromScene(scene)));
        }
コード例 #7
0
        public CreditsDialog()
        {
            Title       = L10n.Get("Credits", "Window title");
            Maximizable = false;
            Resizable   = false;

            // Content = drawable;
            Content = new ImageView {
                Image = Bitmap.FromResource(ResourcesName.CreditsBackground),
                Size  = new Size(1132 / 2, 667 / 2),
            };
        }
コード例 #8
0
 Control GetCitraInstructions()
 {
     return(new TableLayout {
         Spacing = new Size(5, 5),
         Rows =
         {
             new TableRow(L10n.Get(
                              "Clippy will install the game and the patch in\n" +
                              "the Citra folder of your PC.\n" +
                              "No additional steps from you are required.")),
         },
     });
 }
コード例 #9
0
        private void BtOk_Click(object sender, EventArgs e)
        {
            var language = LanguagesDescriptions[CboLanguage.SelectedItem as string];

            if (!language.Equals(Settings.GuiLanguage))
            {
                Settings.GuiLanguage = language;
                Settings.Save();

                MessageBox.Show(L10n.Get("LanguageChangeRestart"), CurrentVersion.ReleaseInfo.ApplicationName);
            }

            Close();
        }
コード例 #10
0
ファイル: Program.cs プロジェクト: everag/subsync-win
        private static void StartApplication()
        {
            // Prevent multiple executions of application
            // See: http://stackoverflow.com/questions/19147/what-is-the-correct-way-to-create-a-single-instance-application

            if (mutex.WaitOne(TimeSpan.Zero, true))
            {
                InitializeGUI();
                mutex.ReleaseMutex();
            }
            else
            {
                MessageBox.Show(L10n.Get("AppAlreadyRunning"), CurrentVersion.ReleaseInfo.ApplicationName);
            }
        }
コード例 #11
0
ファイル: SetupForm.cs プロジェクト: everag/subsync-win
        private void AddFolder(string folderPath)
        {
            DirectoryInfo folderToAdd = new DirectoryInfo(folderPath);

            if (Settings.MediaFolders.Any(mf => mf.IsSame(folderToAdd)))
            {
                MessageBox.Show(L10n.Get("DirectoryAlreadySelected"));
                return;
            }

            Settings.MediaFolders.Add(folderToAdd);
            LstDirectories.Items.Add(folderPath);

            Settings.Save();

            CheckStartButton();
        }
コード例 #12
0
        private void InitializeComponents()
        {
            var version = Assembly.GetExecutingAssembly().GetName().Version;

            Title = string.Format(L10n.Get("Fan-translation of Attack of the Friday Monsters ~ v{0}"), version);
            Icon  = Icon.FromResource(ResourcesName.Icon);
            Logger.Log($"MainForm - Version: {version}");

            // On GTK3 did doesn't work
            // https://github.com/picoe/Eto/issues/1652
            Maximizable = false;
            Resizable   = false;

            var patchBtn = new Button {
                Text    = L10n.Get("Patch!", "Main window button"),
                Font    = SystemFonts.Bold(),
                Command = viewModel.PatchCommand,
            };

            var creditsBtn = new Button {
                Text    = L10n.Get("Credits", "Main window button"),
                Command = viewModel.OpenCreditsCommand,
            };

            var drawable = new Drawable {
                Size    = new Size(600, 359),
                Content = new StackLayout {
                    Padding = 10,
                    Spacing = 10,
                    VerticalContentAlignment = VerticalAlignment.Bottom,
                    Orientation = Orientation.Horizontal,
                    Items       = { patchBtn, creditsBtn },
                },
            };

            drawable.Paint += (sender, e) =>
                              e.Graphics.DrawImage(
                image: Bitmap.FromResource(ResourcesName.MainBackground),
                x: 0,
                y: 0,
                width: drawable.Width,
                height: drawable.Height);
            Content = drawable;
        }
コード例 #13
0
ファイル: AboutForm.cs プロジェクト: everag/subsync-win
        private void AboutForm_Load(object sender, EventArgs e)
        {
            this.Text = L10n.Get("$this.Text", this, CurrentVersion.ReleaseInfo.ApplicationName);

            Icon = Properties.Resources.SubSync_Logo;

            LbVersion.Text = CurrentVersion.ReleaseInfo.ToString(false, true, true, true);

            if (CurrentVersion.ReleaseInfo.Build != null)
            {
                LbBuild.Text = string.Format("Build {0}", CurrentVersion.ReleaseInfo.Build);
            }

            var dev = "Everton Agner Ramos";

            LnkDevelopedBy.Text = L10n.Get("DevelopedBy", dev);
            LnkDevelopedBy.Links.Clear();

            var devBegin = LnkDevelopedBy.Text.IndexOf(dev);
            var devEnd   = LnkDevelopedBy.Text.Count() - devBegin;

            LnkDevelopedBy.Links.Add(devBegin, devEnd);

            var design = "Diogo Cezar";

            LnkLogoBy.Text = L10n.Get("DesignBy", design);
            LnkLogoBy.Links.Clear();

            var designBegin = LnkLogoBy.Text.IndexOf(design);
            var designEnd   = LnkLogoBy.Text.Count() - designBegin;

            LnkLogoBy.Links.Add(designBegin, designEnd);

            var contactUs = L10n.Get("ContactUs");

            LnkContactUs.Text = L10n.Get("ReportBugs", contactUs);
            LnkContactUs.Links.Clear();

            var contactUsBegin = LnkContactUs.Text.IndexOf(contactUs);
            var contactUsEnd   = LnkContactUs.Text.Count() - contactUsBegin;

            LnkContactUs.Links.Add(contactUsBegin, contactUsEnd);
        }
コード例 #14
0
        Control GetConsoleInstructions()
        {
            var selectOutputPicker = new FilePicker {
                FileAction = FileAction.SelectFolder,
                Title      = L10n.Get("Select output luma folder"),
            };

            selectOutputPicker.BindDataContext(s => s.FilePath, (PatcherViewModel vm) => vm.SelectedOutputPath);

            return(new TableLayout {
                Spacing = new Size(10, 10),
                Rows =
                {
                    new TableRow(L10n.Get(
                                     "Select where you want to export the luma folder.\n" +
                                     "Copy this folder to the root directory of your microSD\n" +
                                     "and start the game as always!\n" +
                                     "Use Luma v10.2.1 or higher, or the game will crash.")),
                    new TableRow(selectOutputPicker),
                },
            });
        }
コード例 #15
0
ファイル: SetupForm.cs プロジェクト: everag/subsync-win
        public void StartStopSync()
        {
            if (SyncManager.Status == SyncStatus.NOT_RUNNING)
            {
                if (NetworkUtils.IsInternetAvailable())
                {
                    LstDirectories.ClearSelected();
                    LstLanguagePreferences.ClearSelected();
                    LstLanguages.ClearSelected();

                    BkgWorkerStartStopSync.RunWorkerAsync(SyncAction.START);
                }
                else
                {
                    MessageBox.Show(L10n.Get("InternetOfflineStartSync"), CurrentVersion.ReleaseInfo.ApplicationName);
                }
            }
            else if (SyncManager.Status == SyncStatus.RUNNING)
            {
                BkgWorkerStartStopSync.RunWorkerAsync(SyncAction.STOP);
            }
        }
コード例 #16
0
ファイル: Program.cs プロジェクト: everag/subsync-win
        static void Main(string[] args)
        {
            CheckUpgradeSettings();

            if (NetworkUtils.IsInternetAvailable())
            {
                StartupArgs.SetArgs(args);

                if (Configuration.RunningEnvironment == "Debug")
                {
                    StartApplicationInDebug();
                }
                else
                {
                    StartApplication();
                }
            }
            else
            {
                MessageBox.Show(L10n.Get("InternetOfflineStartup"), CurrentVersion.ReleaseInfo.ApplicationName);
            }
        }
コード例 #17
0
ファイル: GetText.cs プロジェクト: PatrickSannes/rebelcmsxu5
 public static string Get()
 {
     return(L10n.Get("Plugin.Key", new { Count = 10 }));
 }
コード例 #18
0
        Control GetBaseInstructions()
        {
            string GetGameStatusText(FilePatchStatus status) =>
            status switch
            {
                FilePatchStatus.Unknown => L10n.Get("Oops, error?", "File patch status"),
                FilePatchStatus.NoFile => L10n.Get("No file selected"),
                FilePatchStatus.ValidFile => L10n.Get("Game compatible with the patch!"),
                FilePatchStatus.InvalidFormat => L10n.Get("This is not a game in CIA format"),
                FilePatchStatus.InvalidRegion => L10n.Get("The patcher does not support this game region"),
                FilePatchStatus.InvalidTitle => L10n.Get("Invalid game..."),
                FilePatchStatus.InvalidVersion => L10n.Get("The patcher does not support this game version"),
                FilePatchStatus.InvalidDump => L10n.Get("Game dump is not valid. Make sure to dump your own game"),
                FilePatchStatus.GameIsEncrypted => L10n.Get("Game is encrypted. Redump the game decrypted"),
                _ => L10n.Get("Oops, error?", "File patch status"),
            };

            var selectGameBtn = new Button {
                Text    = L10n.Get("Select", "Choose button in patcher"),
                Command = viewModel.SelectGameCommand,
            };

            var selectedPathBox = new TextBox {
                ReadOnly        = true,
                PlaceholderText = L10n.Get("Click in the button Select"),
                Width           = 300,
            };

            selectedPathBox.TextBinding.BindDataContext <PatcherViewModel>(vm => vm.SelectedGamePath);

            var verifySpinning = new Spinner {
                Enabled = true
            };

            verifySpinning.BindDataContext(s => s.Visible, (PatcherViewModel vm) => vm.SelectGameCommand.IsRunning);

            var verifyLabel = new Label {
                Text = string.Empty,
                Font = SystemFonts.Bold(),
            };

            verifyLabel.TextBinding.Bind(
                Binding.Property(viewModel, vm => vm.SelectGameCommand.IsRunning)
                .Convert(r => r
                        ? L10n.Get("Please wait while we check the game...")
                        : GetGameStatusText(viewModel.FileStatus)));
            verifyLabel.Bind(
                l => l.TextColor,
                Binding.Property(viewModel, vm => vm.FileStatus)
                .Convert(s => s == FilePatchStatus.ValidFile
                        ? Colors.Green
                        : Colors.Red));

            var citraRadioBtn = new RadioButton {
                Text = L10n.Get("Citra emulator"),
            };

            citraRadioBtn.Bind(
                c => c.Checked,
                Binding.Property(viewModel, vm => vm.TargetDevice)
                .ToBool(TargetDevice.CitraPcLayeredFs));

            var consoleRadioBtn = new RadioButton(citraRadioBtn)
            {
                Text = L10n.Get("Console"),
            };

            consoleRadioBtn.Bind(
                c => c.Checked,
                Binding.Property(viewModel, vm => vm.TargetDevice)
                .ToBool(TargetDevice.ConsoleLayeredFs));

            var patchBtn = new Button {
                Text    = L10n.Get("Patch!", "Button in patcher"),
                Font    = SystemFonts.Bold(),
                Command = viewModel.PatchCommand,
            };

            var consoleControl = GetConsoleInstructions();
            var citraControl   = GetCitraInstructions();
            var infoLayout     = new Panel();

            infoLayout.Bind(
                c => c.Content,
                Binding.Property(viewModel, vm => vm.TargetDevice)
                .Convert(t => t == TargetDevice.CitraPcLayeredFs ? citraControl : consoleControl));

            var table = new TableLayout {
                Padding = 10,
                Spacing = new Size(10, 10),
                Rows    =
                {
                    new TableRow(L10n.Get("1. Buy the game in the Nintendo e-shop")),
                    new TableRow(L10n.Get("2. Dump the game to the microSD using the format no legit CIA\n   (e.g. using godmode9)")),
                    new TableRow(L10n.Get("3. Copy the game from the microSD to the computer.")),
                    new TableRow(L10n.Get("4. Choose the CIA file:")),
                    new TableLayout {
                        Spacing = new Size(10,                                                                                            10),
                        Rows    = { new TableRow(selectGameBtn,                                                                       selectedPathBox) },
                    },
                    new TableLayout {
                        Spacing = new Size(10,                                                                                            10),
                        Rows    = { new TableRow(verifySpinning,                                                                      verifyLabel) },
                    },
                    new TableRow(L10n.Get("5. Select how you will play the game:")),
                    new TableLayout {
                        Spacing = new Size(10,                                                                                            10),
                        Rows    =
                        {
                            new TableRow(citraRadioBtn,   null),
                            new TableRow(consoleRadioBtn, null),
                        },
                    },
                    new TableRow(infoLayout),
                    new TableRow()
                    {
                        ScaleHeight = true
                    },
                    new TableLayout(new TableRow(patchBtn,                                                                            null)),
                    new TableRow(),
                },
            };

            var drawable = new Drawable {
                Content = table,
            };

            Bitmap clippyImage = Bitmap.FromResource(ResourcesName.Clippy);

            drawable.Paint += (sender, e) =>
                              e.Graphics.DrawImage(
                image: clippyImage,
                x: table.Width - clippyImage.Width - 10,
                y: 200,
                width: clippyImage.Width,
                height: clippyImage.Height);

            return(drawable);
        }