public FormEditTrafficClass(FormMainWindow parent, trClass edytowana) { master = parent; InitializeComponent(); klasaEdytowana = edytowana; numericUpDownEdycjaKlasyAt.Value = (decimal)edytowana.atProp; numericUpDownEdycjaKlasyT.Value = (decimal)edytowana.t; numericUpDownEdycjaKlasyMu.Value = (decimal)edytowana.mu; if (edytowana.typ == trClass.typKlasy.ENGSET) { labelEdycjaKlasyS.Visible = true; numericUpDownEdycjaKlasyS.Visible = true; trClassEngset kl = (trClassEngset)klasaEdytowana; numericUpDownEdycjaKlasyS.Value = (decimal)kl.S; } if (edytowana.typ == trClass.typKlasy.PASCAL) { labelEdycjaKlasyS.Visible = true; numericUpDownEdycjaKlasyS.Visible = true; trClassPascal kl = (trClassPascal)klasaEdytowana; numericUpDownEdycjaKlasyS.Value = (decimal)kl.S; } if (edytowana.typ == trClass.typKlasy.ERLANG) { labelEdycjaKlasyS.Visible = false; numericUpDownEdycjaKlasyS.Visible = false; } }
public UrlEditor(FormMainWindow formMainWindow) { // TODO: Complete member initialization InitializeComponent(); comboWikiSelector.DataSource = mediaWikiVars; this.formMainWindow = formMainWindow; }
public WBrowser(FormMainWindow formMainWindow) { InitializeComponent(); currentCulture = CultureInfo.CurrentCulture; favoritesPanel.Visible = false; this.mainWindow = formMainWindow; }
/// <summary> /// Konstruktor inicjalizujący pola /// </summary> /// <param name="name">Nazwa użytkownika</param> /// <param name="newPassword">Hasło użytkownika</param> /// <param name="window">Główne okno z repozytoriami</param> public User(string name, string newPassword, FormMainWindow window) { Login = name; Password = newPassword; ClanName = "No Clan"; RankId = 1; Clan = window.Clans.GetById(ClanName); Rank = window.Ranks.GetById(RankId); }
/// <summary> /// Gets usually invoked from FormMainwindow, hence we don't have any issues yet. /// </summary> /// <param name="paramformMainWindow"></param> public TemplateCopier(FormMainWindow paramformMainWindow) { InitializeComponent(); this.formMainWindow = paramformMainWindow; //brobot bRobot = new BackGroundRobot(); //ResetBot(); ruleEditor.SetFileName(SessionsManager.TemplateParserFileName); comboWikiSelector.DataSource = mediaWikiVars; }
public void Crack(string text, FormMainWindow wnd) { wnd.InitialiseProgressBar(1); wnd.SetProgressText("Step 1 of 1"); string output = Encrypt(text); wnd.StepProgress(); wnd.SetProgressText("ROT13 cipher cracked!"); wnd.SetOutputText(output); }
public void Crack(string text, FormMainWindow wnd) { wnd.InitialiseProgressBar(311); string textRev = text.ReverseString(); double best_score = 0.0; int best_keya = 0; int best_keyb = 0; for (int this_keya = 1; this_keya < 26; this_keya += 2) { if (this_keya == 13) { continue; } for (int this_keyb = 1; this_keyb <= 26; this_keyb++) { int i = ((this_keya - 1) / 2); wnd.SetProgressText($"Step {(i > 6 ? i-1 : i)*26 + this_keyb - 1} of 311\nAttempting keys of {this_keya} and {this_keyb}..."); Affine cipher = new Affine(this_keya, this_keyb); string this_output = cipher.Decrypt(text); double this_score = NgramScore.MonogramScore.Score(this_output); if (this_score > best_score) { best_score = this_score; best_keya = this_keya; best_keyb = this_keyb; } wnd.StepProgress(); } } string output; if ( NgramScore.QuadgramScore.Score(new Affine(best_keya, best_keyb).Decrypt(text)) > NgramScore.QuadgramScore.Score(new Affine(best_keya, best_keyb).Decrypt(textRev))) { output = new Affine(best_keya, best_keyb).Decrypt(text); } else { output = new Affine(best_keya, best_keyb).Decrypt(textRev); } wnd.SetOutputText(output.ToLower()); }
/// <summary> /// This is the Budford folder where all the downloaded files will be saved /// </summary> private static void SetDefaultFolder(Model.Model model) { if (model.Settings.DownloadsFolder == "") { if (!CurrentOs.IsWindows) { model.Settings.DownloadsFolder = "Budford"; } else { model.Settings.DownloadsFolder = "C:\\ProgramData\\Budford"; } } if (!Directory.Exists(model.Settings.DownloadsFolder)) { Directory.CreateDirectory(model.Settings.DownloadsFolder); } Directory.SetCurrentDirectory(model.Settings.DownloadsFolder); Persistence.Save(model, FormMainWindow.GetModelFileName()); }
public void Crack(string text, FormMainWindow wnd) { wnd.InitialiseProgressBar(26); string textRev = text.ReverseString(); double best_score = 0.0; int best_key = 0; for (int this_key = 0; this_key < 26; this_key++) { wnd.SetProgressText($"Step {this_key+1} of 26\nAttempting key of {Util.alphabet[this_key]}..."); Caesar cipher = new Caesar(this_key); string this_output = cipher.Decrypt(text); double this_score = NgramScore.MonogramScore.Score(this_output); if (this_score > best_score) { best_score = this_score; best_key = this_key; } wnd.StepProgress(); } string output; if ( NgramScore.QuadgramScore.Score(new Caesar(best_key).Decrypt(text)) > NgramScore.QuadgramScore.Score(new Caesar(best_key).Decrypt(textRev))) { output = new Caesar(best_key).Decrypt(text); } else { output = new Caesar(best_key).Decrypt(textRev); } wnd.SetOutputText(output.ToLower()); }
/// <summary> /// Wczytywanie parametrów każdego z progów /// </summary> /// <param name="nowaKlasa">Nowa klasa, która Zostanie dodana, gdy zostaną podane odpowiednio progi</param> /// <param name="lProgow">Liczba Progów. Zostanie utworzona o jeden większa liczba przedziałów</param> /// <param name="parent">Główna klasa formatki</param> /// <param name="dodanoKlase">Informacja o tym, czy klasa została już wcześneij dodana, czy nie</param> public progiFmt(trClass nowaKlasa, int lProgow, FormMainWindow parent, bool dodanoKlase) { Master = parent; dodano = dodanoKlase; this.nowaKlasa = nowaKlasa; if (dodano == true) { lProgow = nowaKlasa.progiKlasy.liczbaPrzedziałow - 1; } liczbaPrzedzialow = lProgow + 1; if (dodanoKlase == false) { nowaKlasa.progiKlasy = new progiKlasy(lProgow); } InitializeComponent(); labelNrProgu = new Label[liczbaPrzedzialow]; labelWspIntensywnosci = new Label[liczbaPrzedzialow]; numericUpDownWspIntensywnosci = new NumericUpDown[liczbaPrzedzialow]; labelT = new Label[liczbaPrzedzialow]; numericUpDownT = new NumericUpDown[liczbaPrzedzialow]; labelMu = new Label[liczbaPrzedzialow]; numericUpDownMu = new NumericUpDown[liczbaPrzedzialow]; labelMaksN = new Label[liczbaPrzedzialow]; numericUpDownMaksN = new NumericUpDown[liczbaPrzedzialow]; this.Height = 125 + 50 * liczbaPrzedzialow; for (int i = 0; i < liczbaPrzedzialow; i++) { int nrProgu = i + 1; labelNrProgu[i] = new Label(); labelNrProgu[i].AutoSize = true; labelNrProgu[i].Location = new System.Drawing.Point(10, 100 + 50 * i); labelNrProgu[i].Name = "Przedział nr " + nrProgu.ToString(); labelNrProgu[i].Size = new System.Drawing.Size(110, 13); labelNrProgu[i].TabIndex = 10 * i + 10; labelNrProgu[i].Text = "Próg nr " + nrProgu.ToString(); this.Controls.Add(this.labelNrProgu[i]); labelWspIntensywnosci[i] = new Label(); labelWspIntensywnosci[i].AutoSize = true; labelWspIntensywnosci[i].Location = new System.Drawing.Point(15, 120 + 50 * i); labelWspIntensywnosci[i].Size = new System.Drawing.Size(110, 13); labelWspIntensywnosci[i].TabIndex = 10 * i + 11; labelWspIntensywnosci[i].Text = "mnożnik A"; this.Controls.Add(this.labelWspIntensywnosci[i]); numericUpDownWspIntensywnosci[i] = new NumericUpDown(); numericUpDownWspIntensywnosci[i].Location = new Point(75, 117 + 50 * i); numericUpDownWspIntensywnosci[i].Size = new Size(50, 16); numericUpDownWspIntensywnosci[i].Minimum = 0; numericUpDownWspIntensywnosci[i].Maximum = 10; numericUpDownWspIntensywnosci[i].Value = (decimal)nowaKlasa.progiKlasy[i].mnoznikIntensywnosci; numericUpDownWspIntensywnosci[i].DecimalPlaces = 2; numericUpDownWspIntensywnosci[i].Increment = 0.05M; numericUpDownWspIntensywnosci[i].TabIndex = 10 * i + 12; this.Controls.Add(this.numericUpDownWspIntensywnosci[i]); labelT[i] = new Label(); labelT[i].AutoSize = true; labelT[i].Location = new System.Drawing.Point(130, 120 + 50 * i); labelT[i].Size = new System.Drawing.Size(110, 13); labelT[i].TabIndex = 10 * i + 13; labelT[i].Text = "t"; this.Controls.Add(this.labelT[i]); numericUpDownT[i] = new NumericUpDown(); numericUpDownT[i].Location = new Point(140, 117 + 50 * i); numericUpDownT[i].Size = new Size(50, 16); numericUpDownT[i].Minimum = 1; numericUpDownT[i].Maximum = 100; numericUpDownT[i].Value = nowaKlasa.progiKlasy[i].t; numericUpDownT[i].Increment = 1; numericUpDownT[i].TabIndex = 10 * i + 14; this.Controls.Add(this.numericUpDownT[i]); labelMu[i] = new Label(); labelMu[i].AutoSize = true; labelMu[i].Location = new System.Drawing.Point(190, 120 + 50 * i); labelMu[i].Size = new System.Drawing.Size(110, 13); labelMu[i].TabIndex = 10 * i + 15; labelMu[i].Text = "μ"; this.Controls.Add(this.labelMu[i]); numericUpDownMu[i] = new NumericUpDown(); numericUpDownMu[i].Location = new Point(215, 117 + 50 * i); numericUpDownMu[i].Size = new Size(50, 16); numericUpDownMu[i].Minimum = 0.0001M; numericUpDownMu[i].Maximum = 10; numericUpDownMu[i].Value = (decimal)nowaKlasa.progiKlasy[i]._mu; numericUpDownMu[i].DecimalPlaces = 2; numericUpDownMu[i].Increment = 0.05M; numericUpDownMu[i].TabIndex = 10 * i + 16; this.Controls.Add(this.numericUpDownMu[i]); if (i != liczbaPrzedzialow - 1) { labelMaksN[i] = new Label(); labelMaksN[i].AutoSize = true; labelMaksN[i].Location = new System.Drawing.Point(270, 170 + 50 * i); labelMaksN[i].Size = new System.Drawing.Size(110, 13); labelMaksN[i].TabIndex = 10 * i + 17; labelMaksN[i].Text = "próg od"; this.Controls.Add(this.labelMaksN[i]); numericUpDownMaksN[i] = new NumericUpDown(); numericUpDownMaksN[i].Location = new Point(330, 167 + 50 * i); numericUpDownMaksN[i].Size = new Size(50, 16); numericUpDownMaksN[i].Minimum = 1; numericUpDownMaksN[i].Maximum = 10000; numericUpDownMaksN[i].Value = 1; numericUpDownMaksN[i].DecimalPlaces = 0; numericUpDownMaksN[i].Increment = 1; numericUpDownMaksN[i].TabIndex = 10 * i + 18; numericUpDownMaksN[i].ValueChanged += new System.EventHandler(this.numericUpDownMaksNValueChanged); this.Controls.Add(this.numericUpDownMaksN[i]); } } radioButtonAconst.Checked = true; this.Refresh(); }
public FormAlgorytmIteracyjny(FormMainWindow parent, bool rekurencyjny) { this.parent = parent; algRek = rekurencyjny; InitializeComponent(); }
/// <summary> /// Constructor /// </summary> /// <param name="parentIn"></param> internal Launcher(FormMainWindow parentIn) { parent = parentIn; }
/// <summary> /// /// </summary> /// <param name="parentIn"></param> /// <param name="modelIn"></param> /// <param name="game"></param> /// <param name="getSaveDir"></param> /// <param name="cemuOnly"></param> /// <param name="shiftUp"></param> /// <param name="forceFullScreen"></param> internal void LaunchCemu(FormMainWindow parentIn, Model.Model modelIn, GameInformation game, bool getSaveDir = false, bool cemuOnly = false, bool shiftUp = true, bool forceFullScreen = false) { makeBorderLess = false; SetCemuVersion(modelIn, game); if (runningVersion == null) { if (parent != null) { parent.ProcessExited(); } return; } Model = modelIn; if (game != null && !game.Exists) { if (parentIn != null) { if (!parentIn.InvokeRequired) { MessageBox.Show(parentIn, Resources.Launcher_LaunchCemu_If_you_are_using_a_removable_storage_device_check_it_is_plugged_in_and_try_again, Resources.Launcher_LaunchCemu_Can_not_find_file); if (parent != null) { parent.ProcessExited(); } } } return; } if (File.Exists(cemu) || File.Exists(modelIn.Settings.WineExe)) { DeleteLogFile(modelIn, logfile); SetupCafeLibs(modelIn, game); if (game != null) { CopyLargestShaderCacheToCemu(game); CopyLatestSaveToCemu(game); } if (modelIn.Settings.DisableShaderCache) { FileManager.DeleteShaderCache(runningVersion); } if (!getSaveDir) { CreateDefaultSettingsFile(runningVersion, game); DeleteShaderCacheIfRequired(modelIn, runningVersion); CreateDefaultSettingsFile(modelIn, game); } // Prepare the process to run ProcessStartInfo start = new ProcessStartInfo(); PopulateStartInfo(game, getSaveDir, cemuOnly, CemuFeatures.Cemu, start, shiftUp, forceFullScreen); // Required since 1.11.2 if (runningVersion != null) { start.WorkingDirectory = runningVersion.Folder; } // Run the external process & wait for it to finish var parentProcess = Process.GetCurrentProcess(); var original = parentProcess.PriorityClass; parentProcess.PriorityClass = GetProcessPriority(modelIn.Settings.ShaderPriority); startTime = DateTime.Now; if (File.Exists(Path.Combine(runningVersion.Folder, start.FileName))) { runningProcess = Process.Start(start); if (runningProcess != null) { runningProcess.EnableRaisingEvents = true; runningProcess.Exited += proc_Exited; runningGame = game; if (parentIn != null) { try { parentIn.SetParent(runningProcess); } catch (Exception) { // Dies in Linux } } parentProcess.PriorityClass = original; // Allow the process to finish starting. if (runningProcess != null) { try { runningProcess.PriorityClass = GetProcessPriority(modelIn.Settings.ShaderPriority); } catch (Exception) { // Probably not enough permissions... } WaitForProcess(modelIn, game, getSaveDir, cemuOnly); } } } else { if (parent != null) { parent.ProcessExited(); } } } else { MessageBox.Show(parentIn, Resources.Launcher_LaunchCemu_Please_install_CEMU, Resources.Launcher_LaunchCemu_CEMU_is_not_installed); if (parent != null) { parent.ProcessExited(); } } }
static void Main() { string programFiles = Environment.ExpandEnvironmentVariables("%ProgramW6432%"); var arguments = Environment.GetCommandLineArgs(); if (!arguments[0].Contains(programFiles)) { if (arguments[0].Contains("Budford.exe")) { IsInstalled = false; } } var model = FormMainWindow.TransferLegacyModel(); if (!Get45Or451FromRegistry()) { MessageBox.Show(Resources.Program_Main_Needs__NET_4_5_or_higher_to_run, Resources.Program_Main_Please_update_your__NET_run_environment); } if (IsInstalled) { SetDefaultFolder(model); } Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); bool cmdLineLaunch = false; bool cmdLineFullScreen = false; string cmdLineFileName = string.Empty; ParseCommandLineArguments(arguments, ref cmdLineLaunch, ref cmdLineFullScreen, ref cmdLineFileName); if (arguments.Length == 2) { cmdLineLaunch = true; } FormMainWindow mainForm = new FormMainWindow(); if (cmdLineFileName == string.Empty || !cmdLineLaunch) { Application.Run(mainForm); } else { if (model.Settings.StopHotkey != "None") { mainForm.launchGame = cmdLineFileName; mainForm.LaunchFull = cmdLineFullScreen; Application.Run(mainForm); } else { if (model.Settings.AutomaticallyDownloadGraphicsPackOnStart) { CemuFeatures.DownloadLatestGraphicsPack(null, model, false); } foreach (var game in model.GameData) { if (game.Value.LaunchFile.ToLower() == cmdLineFileName.ToLower()) { game.Value.Exists = true; new Launcher(null).LaunchCemu(null, model, game.Value, false, false, true, cmdLineFullScreen); return; } } new Launcher(null).LaunchRpx(model, cmdLineFileName, cmdLineFullScreen); } } }