private void UpdateTimedProcesses() { string configMsg = "Current configuration starts download when usage is \nbelow " + Program.belowUloadDload.ToString() + " kb/s for consecutive " + Program.waitSeconds.ToString() + " seconds."; lblConfig.Text = configMsg; if (timeSpan <= Program.waitSeconds) { prgTimeSpan.Value = (timeSpan * 100 / Program.waitSeconds); } else { timeSpan = 0; timer.Stop(); stopMonitoring("Download Mode"); #region OldMSGBox //DialogResult dr = MessageBox.Show("Download starts now! Press OK to go back to monitor mode.", "Downloading...", MessageBoxButtons.OK); //if (dr == System.Windows.Forms.DialogResult.OK) //{ // timer.Start(); //} #endregion string chosenURL = StaticLists.toBeDownloadList[0]; DownloadForm df = new DownloadForm(chosenURL); df.ShowDialog(); StaticLists.toBeDownloadList.Remove(chosenURL); StaticLists.doneDownloadList.Add(chosenURL); startMonitoring(); } }
private void DownloadNewVersion() { if (File.Exists(NetUtils.DownloadedTargetTempPath)) { File.Delete(NetUtils.DownloadedTargetTempPath); } var downloadForm = new DownloadForm("Download Update"); downloadForm.OnCancel += (o, e) => { NetUtils.Cancel(); }; NetUtils.OnProgressChanged += (o, e) => { downloadForm.SetValues(e.CurrentSpeed, e.TotalSize, e.TotalDownloaded, e.Remaining, e.CurrentPercentage); }; NetUtils.OnError += (o, e) => { }; NetUtils.OnDownloadCompleted += (o, e) => { downloadForm.Close(); ApplyUpdate(); }; downloadForm.Show(this); NetUtils.DownloadLatestVersion(); }
private void DownloadUpdate(IParseInfo updateInfo) { // Show DownloadForm var form = new DownloadForm(updateInfo, _applicationInfo.ApplicationIcon); var result = form.ShowDialog(_applicationInfo.Context); // Download update if (result == DialogResult.OK) { var updateFolderName = string.Format("{0}_update_{1}", _applicationInfo.ApplicationName, Utilities.CleanFileName(updateInfo.Version.ToString())); var currentPath = _applicationInfo.ApplicationAssembly.Location; var newFolderPath = Path.GetDirectoryName(currentPath); // string newPath = Path.GetDirectoryName(currentPath) + "\\" + updateFolderName; // Update UpdateApplication(updateInfo.Files, currentPath, newFolderPath, updateInfo.LaunchArgs); Application.Exit(); } else if (result == DialogResult.Abort) { MessageBox.Show("The update download was cancelled.\nThis program has not been modified.", "Update Download Cancelled", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("There was a problem downloading the update.\nPlease try again later.", "Update Download Error", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private static void DownloadFetched(IEnumerable <IVideoInfo> videos, DownloadForm downloadWindow) { Console.WriteLine("Enqueueing " + videos.Count() + " videos..."); foreach (IVideoInfo videoInfo in videos) { Console.WriteLine("Enqueueing " + videoInfo.Username + "/" + videoInfo.VideoId); downloadWindow.CreateAndEnqueueJob(videoInfo); } }
public FetchTaskGroup(DownloadForm form, CancellationToken cancellationToken) { Form = form; CancelToken = cancellationToken; ContainerLock = new object(); UserInfos = new List <IUserInfo>(); Runner = Run(); }
protected override bool RunDialog(IntPtr hwndOwner) { using (DownloadForm frm = new DownloadForm()) { frm.Url = this.Url; frm.FilePath = this.FilePath; return(frm.ShowDialog() == DialogResult.OK); } }
protected override bool RunDialog(IntPtr hwndOwner) { using (Process process = Process.GetCurrentProcess()) using (DownloadForm frm = new DownloadForm()) { frm.Url = this.Url; frm.Text = this.Text; frm.FilePath = this.FilePath; return(frm.ShowDialog() == DialogResult.OK); } }
protected override bool RunDialog(IntPtr hwndOwner) { using (Process process = Process.GetCurrentProcess()) using (DownloadForm frm = new DownloadForm { Url = this.Url, FilePath = this.FilePath }) { bool isAsyn = hwndOwner == process.MainWindowHandle; frm.StartPosition = isAsyn ? FormStartPosition.CenterParent : FormStartPosition.CenterScreen; return(frm.ShowDialog() == DialogResult.OK); } }
private void DownloadAllImages_Click(object sender, EventArgs e) { var files = new WebImageDownloader(URL).GetSafeUrls(); if (files.Count == 0) { MessageBox.Show("There are either no images to download from this page, or OSIRT is unable to download them.", "No Images to Download", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } using (var downloader = new DownloadForm(files, Enums.Actions.Scraped)) { downloader.ShowDialog(); } }
/// <summary> /// 检查内核是否存在,若不存在则下载内核压缩包并解压 /// </summary> /// <param name="minerName">内核名称</param> /// <param name="url">下载链接</param> public static void checkMinerAndDownload(string minerName, string url) { if (Directory.Exists(Application.StartupPath + "\\miner\\" + minerName)) { return; } else { DownloadForm downloadForm = new DownloadForm(url, minerName + ".zip"); downloadForm.ShowDialog(); ZipFile.ExtractToDirectory(Application.StartupPath + "\\miner\\" + minerName + ".zip", Application.StartupPath + "\\miner\\"); File.Delete(Application.StartupPath + "\\miner\\" + minerName + ".zip"); //ZipFile.CreateFromDirectory(Application.StartupPath + "\\miner\\", Application.StartupPath + "\\miner\\" + minerName + ".zip"); } }
public string Activate() { DownloadForm form = new DownloadForm(); if (form.ShowDialog() == DialogResult.OK) { if (String.IsNullOrEmpty(form.Target)) { return(String.Format("{0} {1}", Identifier, form.File)); } return(String.Format("{0} {1} {2}", Identifier, form.File, form.Target.Replace(" ", "%20"))); } return(null); }
public async void DoIfUpdateNeeded(CurrentProjectClass project) { if (project.ProjectVersion == "1.0.0") { if (!Directory.Exists(project.ProjectPath + "/dependencies")) { //Setup sampctl for it project.SampCtlData = new PawnJson() { entry = "gamemodes\\" + project.ProjectName + ".pwn", output = "gamemodes\\" + project.ProjectName + ".amx", user = Environment.UserName, repo = project.ProjectName, dependencies = new List <string>() { "sampctl/samp-stdlib" }, builds = new List <BuildInfo>() { new BuildInfo() { name = "main", args = Program.SettingsForm.GetCompilerArgs().Split(' ').ToList() } }, runtime = new RuntimeInfo() { version = "latest" }, }; project.SaveInfo(); project.LoadSampCtlData(); //to make sure pawno/includes is also supported. DownloadForm frm = new DownloadForm { progressBar1 = { Style = ProgressBarStyle.Marquee }, descLabel = { Text = translations.StartupForm_CreateProjectBtn_Click_Ensuring_packages } }; frm.Show(); await SampCtl.SendCommand(Path.Combine(Application.StartupPath, "sampctl.exe"), project.ProjectPath, "p ensure"); frm.Close(); } } project.ProjectVersion = CurrentVersion; }
public override void StartUp() { if (this._form == null) { this._form = new DownloadForm(); this._form.FormClosing += delegate(object sender, FormClosingEventArgs e) { this._form = null; }; _form.StartPosition = FormStartPosition.CenterScreen; } if (this._form.WindowState == FormWindowState.Minimized) { this._form.WindowState = FormWindowState.Normal; } this._form.Show(); this._form.BringToFront(); }
private static async Task DoFetch(Random rng, IUserInfo userInfo, DownloadForm downloadWindow, CancellationToken cancellationToken) { List <IVideoInfo> videos = new List <IVideoInfo>(); while (true) { downloadWindow.AddStatusMessage("Fetching " + userInfo.ToString() + "..."); try { FetchReturnValue fetchReturnValue; int Offset = 0; do { try { await Task.Delay(rng.Next(55000, 95000), cancellationToken); } catch (Exception) { } if (cancellationToken.IsCancellationRequested) { break; } fetchReturnValue = await userInfo.Fetch(Offset, true); Offset += fetchReturnValue.VideoCountThisFetch; if (fetchReturnValue.Success) { videos.AddRange(fetchReturnValue.Videos); } } while (fetchReturnValue.Success && fetchReturnValue.HasMore); break; } catch (Exception ex) { downloadWindow.AddStatusMessage("Error during " + userInfo.ToString() + ": " + ex.ToString()); break; } } if (!cancellationToken.IsCancellationRequested) { try { await Task.Delay(rng.Next(55000, 95000), cancellationToken); } catch (Exception) { } } downloadWindow.AddStatusMessage("Fetched " + videos.Count + " items from " + userInfo.ToString() + "."); DownloadFetched(videos, downloadWindow); }
void ShowMessgeBox() { if (this.InvokeRequired) { this.Invoke(new V_F_V(ShowMessgeBox)); } else { if (!GlobalData.ExpMsg.isMessageBoxOpen) { MessageBox.Show(this, "检测到部分文件损坏,请重新下载", "警告", MessageBoxButtons.OK); GlobalData.ExpMsg.isMessageBoxOpen = false; DownloadForm d = new DownloadForm(); d.Owner = GlobalData.mainForm; Dispose(); d.ShowDialog(); } } }
public static async Task <bool> EnsureLatestInstalled(string path) { string latestInfo = DownloadForm.DownloadString("Checking for sampctl update...", "http://api.github.com/repos/Southclaws/sampctl/releases/latest"); var mtch = Regex.Match(latestInfo, "\"tag_name\":\"(?<version>.+?)\","); string version = mtch.Groups["version"].Value; //If exists and different version, download, else keep. if (File.Exists(Path.Combine(path, "sampctl.exe")) == false || (File.Exists(Path.Combine(path, "sampctl.exe")) && await GetCurrentVersion(Path.Combine(path, "sampctl.exe")) != version)) { string arch = Environment.Is64BitOperatingSystem ? "amd64" : "386"; string fileToDownload = $@"https://github.com/Southclaws/sampctl/releases/download/{version}/sampctl_{version}_windows_{arch}.tar.gz"; DownloadForm.DownloadFile("Downloading SampCTL...", fileToDownload, Path.Combine(path, "archive.tar.gz")); GeneralFunctions.FastZipUnpack(Path.Combine(path, "archive.tar.gz"), path, "sampctl.exe"); File.Delete(Path.Combine(path, "archive.tar.gz")); } return(true); }
private void btnDownload_Click(object sender, EventArgs e) { List <String> links = new List <String>(); foreach (ListViewItem item in lvSongs.Items) { if (item.Checked) { links.Add(item.SubItems[2].Text); } } if (links.Count > 0) { DownloadForm form = new DownloadForm(); form.SetDirectLinks(links); form.ShowDialog(); form.Dispose(); } else { MessageBox.Show("Please selecte any songs!", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private async void StartupForm_Load(object sender, EventArgs e) { //Download SAMPCTL await SampCtl.EnsureLatestInstalled(Application.StartupPath); //Add event. pathTextBox.PathText.TextChanged += pathTextBox_TextChanged; //Check for updates AutoUpdater.ParseUpdateInfoEvent += AutoUpdater_ParseUpdateInfoEvent; DownloadForm.DownloadFile(translations.StartupForm_StartupForm_Load_Checking_for_updates, "https://api.github.com/repos/Ahmad45123/ExtremeStudio/releases/latest", Application.StartupPath + "/latest.txt"); AutoUpdater.Start(Application.StartupPath + "/latest.txt"); //If the interop files don't exist, Extract the files. /*if (IsFirst && * (!File.Exists( * Application.StartupPath + "/x64/SQLite.Interop.dll") || * !File.Exists( * Application.StartupPath + "/x86/SQLite.Interop.dll"))) * { * //Remove old. * if (File.Exists( * Application.StartupPath + "/x64/SQLite.Interop.dll")) * { * File.Delete( * Application.StartupPath + "/x64/SQLite.Interop.dll"); * } * * if (File.Exists( * Application.StartupPath + "/x86/SQLite.Interop.dll")) * { * File.Delete( * Application.StartupPath + "/x86/SQLite.Interop.dll"); * } * * //Extract New * File.WriteAllBytes( * Application.StartupPath + "/interop.zip", Properties.Resources.SQLite_Interop); //Write the file. * GeneralFunctions.FastZipUnpack(Application.StartupPath + "/interop.zip", * Application.StartupPath); //Extract it. * File.Delete( * Application.StartupPath + "/interop.zip"); //Delete the temp file. * }*/ //Create needed folders and files. if (!Directory.Exists( Application.StartupPath + "/cache")) { Directory.CreateDirectory( Application.StartupPath + "/cache"); } if (!Directory.Exists( Application.StartupPath + "/cache/serverPackages")) { Directory.CreateDirectory( Application.StartupPath + "/cache/serverPackages"); } if (!Directory.Exists( Application.StartupPath + "/cache/includes")) { Directory.CreateDirectory( Application.StartupPath + "/cache/includes"); } if (!Directory.Exists( Application.StartupPath + "/configs")) { Directory.CreateDirectory( Application.StartupPath + "/configs"); File.WriteAllText( Application.StartupPath + "/configs/recent.json", ""); } //Setting the IsGlobal in Settings will make sure the settings are in place and correct. Program.SettingsForm.IsGlobal = true; //Load all the recent. if (File.Exists( Application.StartupPath + "/configs/recent.json")) { try { Recent = JsonConvert.DeserializeObject <List <string> >( File.ReadAllText( Application.StartupPath + "/configs/recent.json")); if (ReferenceEquals(Recent, null)) { Recent = new List <string>(); } } catch (Exception) { } } if (ProjectToOpen != "") { if (GeneralFunctions.IsValidExtremeProject(ProjectToOpen)) { Program.MainForm.CurrentProject.ProjectPath = ProjectToOpen; Program.MainForm.CurrentProject.ReadInfo(); projectName.Text = Program.MainForm.CurrentProject.ProjectName; string projVersion = Convert.ToString(Program.MainForm.CurrentProject.ProjectVersion); string progVersion = Convert.ToString(_versionHandler.CurrentVersion); VersionReader.CompareVersionResult versionCompare = VersionReader.CompareVersions(projVersion, progVersion); if (versionCompare == VersionReader.CompareVersionResult.VersionSame) { loadProjectBtn_Click(null, EventArgs.Empty); } else if (versionCompare == VersionReader.CompareVersionResult.VersionNew) { loadProjectBtn_Click(null, EventArgs.Empty); } else if (versionCompare == VersionReader.CompareVersionResult.VersionOld) { MessageBox.Show(translations.StartupForm_pathTextBox_TextChanged_ProjectVersionNewer); Application.Exit(); } } else { MessageBox.Show(Convert.ToString(translations.StartupForm_pathTextBox_TextChanged_InvalidESPrj)); Application.Exit(); } } }
public DownloadPool(int maxCurrent, DownloadForm downloadForm, ProgressTracker progressTracker) { this.maxCurrent = maxCurrent; this.downloadForm = downloadForm; this.progressTracker = progressTracker; }
private async void SplashScreen_Shown() { #if !COMMUNITYEDITION await LicenceManager.Instance.CheckLicenceAsync(); while (LicenceManager.Instance.status == LICSTATUS.INITIATING) { Thread.Sleep(100); } #else PWDataEditorPaied.Classes.Licence Licence = new PWDataEditorPaied.Classes.Licence { LicenceName = "CM", HardwereHash = "AAAA", HardwereName = "BBBB", Products = new int[] { 0, //Profile Editor 0, //Admin Editor 1, //Element Editor 1, //Task Editor 1, //Shop Editor 1, //NPC Editor 0, //Policy Editor 1, //Pck Editor 0, //Domain Editor 0, //Region Editor 0, //Precinct Editor 0, //DynTask Editor 0, //DynObject Editor 0, //Fashion Rip 1, //SkinChanger 0, //WorldTargetsev 0, //ExtraDropSev 0 //AdminTool }, MaxTimes = 999, OpenTimes = 0, Msg = "Your licence will never expire, but you can get a lot more futures if for just 10 Euro/Month contact me (Skype or Gmail): [email protected]", Type = 2 }; LicenceManager.Instance.status = LICSTATUS.READY; LicenceManager.Instance.LicenceName = "CM"; LicenceManager.Products = Licence.Products; LicenceManager.message = Licence.Msg; LicenceManager.Instance.SaveLicence(Licence); #endif switch (LicenceManager.Instance.status) { case LICSTATUS.READY: Thread th = new Thread(() => { DatabaseManager.Instance.LoadDefault(); }) { IsBackground = true }; th.Start(); break; case LICSTATUS.UNACTIVATED: File.WriteAllText(LicenceManager.Instance.Xp, LicenceManager.Instance.Cn); Environment.Exit(0); Application.Exit(); break; } if (LicenceManager.type == LICENCETYPE.TIMED && UpdateManager.instance.isNewUpdate()) { this.Hide(); DownloadForm download = new DownloadForm(UpdateManager.server_verion); download.ShowDialog(this); } if (LicenceManager.Instance.status == LICSTATUS.READY) { LICENCETYPE lictype = LicenceManager.type; Preferences pref = PreferencesManager.Instance.Get(); lictype = LicenceManager.type; pref = PreferencesManager.Instance.Get(); Program.SHOWMINIMIZEBUTTON = pref.DisplayMinimize; Program.HIDEINTASKBAR = pref.HideFormCompleatlyOnClose; mainForm = new MainProgram(); bool load_elementsEditor = true; bool load_gameShopEditor = false; bool load_taskEditor = false; bool load_npcEditor = false; bool load_aiPolicyEditor = false; bool load_domainEditor = false; bool load_packView = false; bool isShowMainForm = true; bool load_Precinct_Editor = false; bool load_Region_Editor = false; bool load_WorldTargets_Editor = false; bool load_extraDrop_Editor = false; bool load_DynObjects_Editor = false; string start = ""; string path = ""; SplashScreen.args = System.Environment.GetCommandLineArgs(); if (SplashScreen.args != null && SplashScreen.args.Length > 0) { int id = -2; for (int r = 0; r < SplashScreen.args.Length; r++) { string[] split = SplashScreen.args[r].Split(' '); for (int i = 0; i < split.Length; i++) { if (split[i] == "-start") { start = split[i + 1]; } if (split[i] == "-path") { path = split[i + 1]; } } } if (start.Length > 0) { bool isInt = int.TryParse(start, out id); if (isInt) { try { load_elementsEditor = load_gameShopEditor = load_taskEditor = load_npcEditor = load_aiPolicyEditor = load_domainEditor = load_packView = false; bool canShow = true; EditorsColors editor = EditorsColors.Elements_Editor; if (1985 != id) { editor = (EditorsColors)id; switch (editor) { case EditorsColors.Elements_Editor: load_elementsEditor = true; break; case EditorsColors.Domain_Editor: load_domainEditor = true; break; case EditorsColors.NPC_Editor: load_npcEditor = true; break; case EditorsColors.Pck_Editor: load_packView = true; break; case EditorsColors.Policy_Editor: load_aiPolicyEditor = true; break; case EditorsColors.Shop_Editor: load_gameShopEditor = true; break; case EditorsColors.Tasks_Editor: load_taskEditor = true; break; case EditorsColors.Precinct_Editor: load_Precinct_Editor = true; break; case EditorsColors.Region_Editor: load_Region_Editor = true; break; case EditorsColors.WorldTargets_Editor: load_WorldTargets_Editor = true; break; case EditorsColors.DynObjects_Editor: load_DynObjects_Editor = true; break; default: canShow = false; break; } } else { if (path != null && path.Length > 0) { if (id == 1985) { string file = Path.GetFileName(path); if (file.ToLower().Contains("element")) { canShow = load_elementsEditor = true; editor = EditorsColors.Elements_Editor; } else if (file.ToLower().Contains("task")) { canShow = load_taskEditor = true; editor = EditorsColors.Tasks_Editor; } else if (file.ToLower().Contains("npcge")) { canShow = load_npcEditor = true; editor = EditorsColors.NPC_Editor; } else if (file.ToLower().Contains("shop")) { canShow = load_gameShopEditor = true; editor = EditorsColors.Shop_Editor; } else if (file.ToLower().Contains("policy")) { canShow = load_aiPolicyEditor = true; editor = EditorsColors.Policy_Editor; } else if (file.ToLower().Contains("domain")) { canShow = load_domainEditor = true; editor = EditorsColors.Domain_Editor; } else if (file.ToLower().Contains("dynamicobjects")) { canShow = load_DynObjects_Editor = true; editor = EditorsColors.DynObjects_Editor; } else if (file.ToLower().Contains("region")) { canShow = load_Region_Editor = true; editor = EditorsColors.Region_Editor; } else if (file.ToLower().Contains("precinct")) { canShow = load_Precinct_Editor = true; editor = EditorsColors.Precinct_Editor; } else if (file.ToLower().Contains("world_targets")) { canShow = load_WorldTargets_Editor = true; editor = EditorsColors.WorldTargets_Editor; } else if (file.ToLower().Contains("extra_drops")) { canShow = load_extraDrop_Editor = true; editor = EditorsColors.ExtraDropSev; } } } } if (canShow) { isShowMainForm = false; mainForm.BecomeVisible = isShowMainForm; mainForm.callonShow = editor; } else { isShowMainForm = load_WorldTargets_Editor = load_Precinct_Editor = load_Region_Editor = load_DynObjects_Editor = load_elementsEditor = load_gameShopEditor = load_taskEditor = load_npcEditor = load_aiPolicyEditor = load_domainEditor = load_packView = true; } } catch { isShowMainForm = load_WorldTargets_Editor = load_Precinct_Editor = load_Region_Editor = load_DynObjects_Editor = load_elementsEditor = load_gameShopEditor = load_taskEditor = load_npcEditor = load_aiPolicyEditor = load_domainEditor = load_packView = true; } } } } if (!isShowMainForm) { Program.StandAlone = true; } else { Program.StandAlone = false; } if (load_extraDrop_Editor) { SplashScreen.ExtraDropEditor = new ExtraDropSave(); if (path != null && path.Length > 0 && File.Exists(path) && Path.GetExtension(path).ToLower().Equals(".sev")) { SplashScreen.ExtraDropEditor.isAutoOpen = true; SplashScreen.ExtraDropEditor.autoOpenPath = path; } await Task.Factory.StartNew(() => { this.Invoke(new MethodInvoker(delegate { SplashScreen.ExtraDropEditor.Show(); SplashScreen.ExtraDropEditor.WindowState = FormWindowState.Minimized; SplashScreen.ExtraDropEditor.ShowInTaskbar = SplashScreen.ExtraDropEditor.ShowIcon = true; SplashScreen.ExtraDropEditor.Opacity = 100; SplashScreen.ExtraDropEditor.progress_bar2 += mainForm.progress_bar; SplashScreen.ExtraDropEditor.SetStyle(pref.color[(int)EditorsColors.ExtraDropSev], pref.teme[(int)EditorsColors.ExtraDropSev], 255); GC.KeepAlive(SplashScreen.ExtraDropEditor); })); }); } if (load_DynObjects_Editor) { SplashScreen.dynObjectsEditor = new DynObjectsEditor(); if (path != null && path.Length > 0 && File.Exists(path) && Path.GetExtension(path).ToLower().Equals(".data")) { SplashScreen.dynObjectsEditor.isAutoOpen = true; SplashScreen.dynObjectsEditor.autoOpenPath = path; } await Task.Factory.StartNew(() => { this.Invoke(new MethodInvoker(delegate { SplashScreen.dynObjectsEditor.Show(); SplashScreen.dynObjectsEditor.WindowState = FormWindowState.Minimized; SplashScreen.dynObjectsEditor.ShowInTaskbar = SplashScreen.dynObjectsEditor.ShowIcon = true; SplashScreen.dynObjectsEditor.Opacity = 100; SplashScreen.dynObjectsEditor.progress_bar2 += mainForm.progress_bar; SplashScreen.dynObjectsEditor.SetStyle(pref.color[(int)EditorsColors.DynObjects_Editor], pref.teme[(int)EditorsColors.DynObjects_Editor], 255); GC.KeepAlive(SplashScreen.dynObjectsEditor); })); }); } if (load_WorldTargets_Editor) { SplashScreen.worldTargetsEditor = new WorldTargetsEditor(); if (path != null && path.Length > 0 && File.Exists(path) && Path.GetExtension(path).ToLower().Equals(".txt")) { SplashScreen.worldTargetsEditor.isAutoOpen = true; SplashScreen.worldTargetsEditor.autoOpenPath = path; } await Task.Factory.StartNew(() => { this.Invoke(new MethodInvoker(delegate { SplashScreen.worldTargetsEditor.Show(); SplashScreen.worldTargetsEditor.WindowState = FormWindowState.Minimized; SplashScreen.worldTargetsEditor.ShowInTaskbar = SplashScreen.worldTargetsEditor.ShowIcon = true; SplashScreen.worldTargetsEditor.Opacity = 100; SplashScreen.worldTargetsEditor.progress_bar2 += mainForm.progress_bar; SplashScreen.worldTargetsEditor.SetStyle(pref.color[(int)EditorsColors.WorldTargets_Editor], pref.teme[(int)EditorsColors.WorldTargets_Editor], 255); GC.KeepAlive(SplashScreen.worldTargetsEditor); })); }); } if (load_Region_Editor) { SplashScreen.regionEditor = new RegionEditor(); if (path != null && path.Length > 0 && File.Exists(path)) { SplashScreen.regionEditor.isAutoOpen = true; SplashScreen.regionEditor.autoOpenPath = path; } await Task.Factory.StartNew(() => { this.Invoke(new MethodInvoker(delegate { SplashScreen.regionEditor.Show(); SplashScreen.regionEditor.WindowState = FormWindowState.Minimized; SplashScreen.regionEditor.ShowInTaskbar = SplashScreen.regionEditor.ShowIcon = true; SplashScreen.regionEditor.Opacity = 100; SplashScreen.regionEditor.progress_bar2 += mainForm.progress_bar; SplashScreen.regionEditor.SetStyle(pref.color[(int)EditorsColors.Region_Editor], pref.teme[(int)EditorsColors.Region_Editor], 255); GC.KeepAlive(SplashScreen.regionEditor); })); }); } if (load_Precinct_Editor) { SplashScreen.precinctEditor = new PrecinctEditor(); if (path != null && path.Length > 0 && File.Exists(path)) { SplashScreen.precinctEditor.isAutoOpen = true; SplashScreen.precinctEditor.autoOpenPath = path; } await Task.Factory.StartNew(() => { this.Invoke(new MethodInvoker(delegate { SplashScreen.precinctEditor.Show(); SplashScreen.precinctEditor.WindowState = FormWindowState.Minimized; SplashScreen.precinctEditor.ShowInTaskbar = SplashScreen.precinctEditor.ShowIcon = true; SplashScreen.precinctEditor.Opacity = 100; SplashScreen.precinctEditor.progress_bar2 += mainForm.progress_bar; SplashScreen.precinctEditor.SetStyle(pref.color[(int)EditorsColors.Precinct_Editor], pref.teme[(int)EditorsColors.Precinct_Editor], 255); GC.KeepAlive(SplashScreen.precinctEditor); })); }); } if (load_elementsEditor) { SplashScreen.elementsEditor = new ElementsEditor(); if (path != null && path.Length > 0 && File.Exists(path) && Path.GetExtension(path).ToLower().Equals(".data")) { SplashScreen.elementsEditor.isAutoOpen = true; SplashScreen.elementsEditor.autoOpenPath = path; } await Task.Factory.StartNew(() => { this.Invoke(new MethodInvoker(delegate { SplashScreen.elementsEditor.Show(); SplashScreen.elementsEditor.WindowState = FormWindowState.Minimized; SplashScreen.elementsEditor.ShowInTaskbar = SplashScreen.elementsEditor.ShowIcon = true; SplashScreen.elementsEditor.Opacity = 100; SplashScreen.elementsEditor.progress_bar2 += mainForm.progress_bar; SplashScreen.elementsEditor.SetStyle(pref.color[(int)EditorsColors.Elements_Editor], pref.teme[(int)EditorsColors.Elements_Editor], 255); GC.KeepAlive(SplashScreen.elementsEditor); })); }); } if (load_gameShopEditor) { SplashScreen.gameShopEditor = new GameShopEditor(); if (path != null && path.Length > 0 && File.Exists(path) && Path.GetExtension(path).ToLower().Equals(".data")) { SplashScreen.gameShopEditor.isAutoOpen = true; SplashScreen.gameShopEditor.autoOpenPath = path; } await Task.Factory.StartNew(() => { this.Invoke(new MethodInvoker(delegate { SplashScreen.gameShopEditor.Show(); SplashScreen.gameShopEditor.WindowState = FormWindowState.Minimized; SplashScreen.gameShopEditor.ShowInTaskbar = SplashScreen.gameShopEditor.ShowIcon = true; SplashScreen.gameShopEditor.Opacity = 100; SplashScreen.gameShopEditor.progress_bar2 += mainForm.progress_bar; SplashScreen.gameShopEditor.SetStyle(pref.color[(int)EditorsColors.Shop_Editor], pref.teme[(int)EditorsColors.Shop_Editor], 255); GC.KeepAlive(SplashScreen.gameShopEditor); })); }); } if (load_taskEditor) { SplashScreen.taskEditor = new TaskEditor(); if (path != null && path.Length > 0 && File.Exists(path) && Path.GetExtension(path).ToLower().Equals(".data")) { SplashScreen.taskEditor.isAutoOpen = true; SplashScreen.taskEditor.autoOpenPath = path; } await Task.Factory.StartNew(() => { this.Invoke(new MethodInvoker(delegate { SplashScreen.taskEditor.Show(); SplashScreen.taskEditor.WindowState = FormWindowState.Minimized; SplashScreen.taskEditor.ShowInTaskbar = SplashScreen.taskEditor.ShowIcon = true; SplashScreen.taskEditor.Opacity = 100; SplashScreen.taskEditor.progress_bar2 += mainForm.progress_bar; SplashScreen.taskEditor.SetStyle(pref.color[(int)EditorsColors.Tasks_Editor], pref.teme[(int)EditorsColors.Tasks_Editor], 255); GC.KeepAlive(SplashScreen.taskEditor); })); }); } if (load_npcEditor) { SplashScreen.npcEditor = new NpcEditor(); if (path != null && path.Length > 0 && File.Exists(path) && Path.GetExtension(path).ToLower().Equals(".data")) { SplashScreen.npcEditor.isAutoOpen = true; SplashScreen.npcEditor.autoOpenPath = path; } await Task.Factory.StartNew(() => { this.Invoke(new MethodInvoker(delegate { SplashScreen.npcEditor.Show(); SplashScreen.npcEditor.WindowState = FormWindowState.Minimized; SplashScreen.npcEditor.ShowInTaskbar = SplashScreen.npcEditor.ShowIcon = true; SplashScreen.npcEditor.Opacity = 100; SplashScreen.npcEditor.progress_bar2 += mainForm.progress_bar; SplashScreen.npcEditor.SetStyle(pref.color[(int)EditorsColors.NPC_Editor], pref.teme[(int)EditorsColors.NPC_Editor], 255); GC.KeepAlive(SplashScreen.npcEditor); })); }); } if (load_aiPolicyEditor) { SplashScreen.aiPolicyEditor = new AiPolicyEditor(); if (path != null && path.Length > 0 && File.Exists(path) && Path.GetExtension(path).ToLower().Equals(".data")) { SplashScreen.aiPolicyEditor.isAutoOpen = true; SplashScreen.aiPolicyEditor.autoOpenPath = path; } await Task.Factory.StartNew(() => { this.Invoke(new MethodInvoker(delegate { SplashScreen.aiPolicyEditor.Show(); SplashScreen.aiPolicyEditor.WindowState = FormWindowState.Minimized; SplashScreen.aiPolicyEditor.ShowInTaskbar = SplashScreen.aiPolicyEditor.ShowIcon = true; SplashScreen.aiPolicyEditor.Opacity = 100; SplashScreen.aiPolicyEditor.progress_bar2 += mainForm.progress_bar; SplashScreen.aiPolicyEditor.SetStyle(pref.color[(int)EditorsColors.Policy_Editor], pref.teme[(int)EditorsColors.Policy_Editor], 255); GC.KeepAlive(SplashScreen.aiPolicyEditor); })); }); } if (load_domainEditor) { SplashScreen.domainEditor = new DomainEditor(); if (path != null && path.Length > 0 && File.Exists(path) && Path.GetExtension(path).ToLower().Equals(".data")) { SplashScreen.domainEditor.isAutoOpen = true; SplashScreen.domainEditor.autoOpenPath = path; } await Task.Factory.StartNew(() => { this.Invoke(new MethodInvoker(delegate { SplashScreen.domainEditor.Show(); SplashScreen.domainEditor.WindowState = FormWindowState.Minimized; SplashScreen.domainEditor.ShowInTaskbar = SplashScreen.domainEditor.ShowIcon = true; SplashScreen.domainEditor.Opacity = 100; SplashScreen.domainEditor.progress_bar2 += mainForm.progress_bar; SplashScreen.domainEditor.SetStyle(pref.color[(int)EditorsColors.Domain_Editor], pref.teme[(int)EditorsColors.Domain_Editor], 255); GC.KeepAlive(SplashScreen.domainEditor); })); }); } if (load_packView) { SplashScreen.packView = new PackView(); if (path != null && path.Length > 0 && File.Exists(path) && Path.GetExtension(path).ToLower().Equals(".pck")) { SplashScreen.packView.autoLoad = true; SplashScreen.packView.autoOpenPath = path; } await Task.Factory.StartNew(() => { this.Invoke(new MethodInvoker(delegate { SplashScreen.packView.Show(); SplashScreen.packView.WindowState = FormWindowState.Minimized; SplashScreen.packView.ShowInTaskbar = SplashScreen.packView.ShowIcon = true; SplashScreen.packView.Opacity = 100; SplashScreen.packView.progress_bar2 += mainForm.progress_bar; SplashScreen.packView.SetStyle(pref.color[(int)EditorsColors.Pck_Editor], pref.teme[(int)EditorsColors.Pck_Editor], 255); GC.KeepAlive(SplashScreen.packView); })); }); } while (!DatabaseManager.Loaded) { } mainForm.CustomThing += Form1_FormClosing; new JAnimate().FadeOutForm(this, 20, showMainMenu); } else { this.Hide(); } }
public OutputHandlerUtil(DownloadForm downloadForm) { this.downloadForm = downloadForm; }
void browser_DownloadBegin(object sender, FileDownloadBeginEventArgs args) { DownloadForm frm = new DownloadForm(args.Download); }
private void InitDownloadAndInstallProcess(IAppCast item) { DownloadForm downloadForm = new DownloadForm(this, item); downloadForm.ShowDialog(); }
private async void CreateProjectBtn_Click(object sender, EventArgs e) { string newPath = Convert.ToString(locTextBox.PathText.Text); if (preExistCheck.Checked) { if (!Directory.Exists(newPath) || GeneralFunctions.IsValidExtremeProject(newPath) || !GeneralFunctions.IsValidSAMPFolder(newPath)) { MessageBox.Show( Convert.ToString(translations.StartupForm_CreateProjectBtn_Click_InvalidSampFolder)); return; } else { //Create the default file if (!File.Exists(newPath + "/gamemodes/" + nameTextBox.Text + ".pwn")) { File.WriteAllText( newPath + "/gamemodes/" + nameTextBox.Text + ".pwn", Convert.ToString(Properties.Resources.newfileTemplate)); } //Fill pawnctl data Program.MainForm.CurrentProject.SampCtlData = new PawnJson() { entry = "gamemodes\\" + nameTextBox.Text + ".pwn", output = "gamemodes\\" + nameTextBox.Text + ".amx", user = Environment.UserName, repo = nameTextBox.Text, dependencies = new List <string>() { "sampctl/samp-stdlib" }, builds = new List <BuildInfo>() { new BuildInfo() { name = "main", args = Program.SettingsForm.GetCompilerArgs().Split(' ').ToList() } }, runtime = new RuntimeInfo() { version = verListBox.SelectedItem?.ToString() ?? "latest" }, }; Program.MainForm.CurrentProject.ProjectName = nameTextBox.Text; Program.MainForm.CurrentProject.ProjectPath = newPath; Program.MainForm.CurrentProject.ProjectVersion = _versionHandler.CurrentVersion; Program.MainForm.CurrentProject.CreateTables(); //Create the tables of the db. Program.MainForm.CurrentProject.SaveInfo(); //Write the default extremeStudio config. Program.MainForm.CurrentProject.CopyGlobalConfig(); Program.MainForm.CurrentProject.LoadSampCtlData(); //to ensure pawno/includes is there. //Ensure the packages are ready DownloadForm frm = new DownloadForm { progressBar1 = { Style = ProgressBarStyle.Continuous }, descLabel = { Text = translations.StartupForm_CreateProjectBtn_Click_Ensuring_packages } }; frm.Show(); Enabled = false; await SampCtl.SendCommand(Path.Combine(Application.StartupPath, "sampctl.exe"), newPath, "p ensure"); frm.Close(); Enabled = true; AddNewRecent( Convert.ToString(Program.MainForm.CurrentProject.ProjectPath)); //Add it to the recent list. Program.MainForm.Show(); _isClosedProgram = true; Close(); } } else { //Add to the path folder name. if (nameTextBox.Text.IsValidFileName() == false) { MessageBox.Show( Convert.ToString(translations.StartupForm_CreateProjectBtn_Click_InvalidName)); return; } newPath = Path.Combine(Convert.ToString(locTextBox.PathText.Text), Convert.ToString(nameTextBox.Text)); if (!string.IsNullOrEmpty(newPath) && Directory.Exists(newPath) == false) { Directory.CreateDirectory(newPath); } //Check if entered path exist. if (Directory.Exists(newPath) && File.Exists( newPath + "/extremeStudio.config") == false) { if (verListBox.SelectedIndex != -1) { //Create directories. Directory.CreateDirectory(newPath + "/gamemodes"); Directory.CreateDirectory(newPath + "/plugins"); Directory.CreateDirectory(newPath + "/scriptfiles"); //Create the default file File.WriteAllText( newPath + "/gamemodes/" + nameTextBox.Text + ".pwn", Convert.ToString(Properties.Resources.newfileTemplate)); //Fill pawnctl data Program.MainForm.CurrentProject.SampCtlData = new PawnJson() { entry = "gamemodes\\" + nameTextBox.Text + ".pwn", output = "gamemodes\\" + nameTextBox.Text + ".amx", user = Environment.UserName, repo = nameTextBox.Text, dependencies = new List <string>() { "sampctl/samp-stdlib" }, builds = new List <BuildInfo>() { new BuildInfo() { name = "main", args = Program.SettingsForm.GetCompilerArgs().Split(' ').ToList() } }, runtime = new RuntimeInfo() { version = verListBox.SelectedItem.ToString() }, }; Program.MainForm.CurrentProject.ProjectName = nameTextBox.Text; Program.MainForm.CurrentProject.ProjectPath = newPath; Program.MainForm.CurrentProject.ProjectVersion = _versionHandler.CurrentVersion; Program.MainForm.CurrentProject.CreateTables(); //Create the tables of the db. Program.MainForm.CurrentProject.SaveInfo(); //Write the default extremeStudio config. Program.MainForm.CurrentProject.CopyGlobalConfig(); //Ensure the packages are ready DownloadForm frm = new DownloadForm { progressBar1 = { Style = ProgressBarStyle.Marquee }, descLabel = { Text = translations.StartupForm_CreateProjectBtn_Click_Ensuring_packages } }; frm.Show(); Enabled = false; await SampCtl.SendCommand(Path.Combine(Application.StartupPath, "sampctl.exe"), newPath, "p ensure"); frm.Close(); Enabled = true; AddNewRecent( Convert.ToString(Program.MainForm.CurrentProject.ProjectPath)); //Add it to the recent list. Program.MainForm.Show(); _isClosedProgram = true; Close(); } else { MessageBox.Show( Convert.ToString(translations.StartupForm_CreateProjectBtn_Click_NoSampSelected)); return; } } else { MessageBox.Show(Convert.ToString(translations.StartupForm_CreateProjectBtn_Click_DirError)); return; } } }