public static void Info(string message, string clipboard = null) { using (var info = new MessageForm(message, 0, clipboard)) info.ShowDialog(); }
private void InfoButton_Click(object sender, EventArgs e) { using (var info = new MessageForm("ShortCutes v" + Updater.ProgramFileVersion + "\n\nDeveloped by: Haruki1707\nGitHub: https://github.com/Haruki1707/ShortCutes", 5, "https://github.com/Haruki1707/ShortCutes")) info.ShowDialog(); }
public static void Error(string message) { using (var error = new MessageForm(message, 1)) error.ShowDialog(); }
private void Compile(string code) { Cursor = Cursors.WaitCursor; Application.UseWaitCursor = true; string message = "Shortcut created!\nExecute shortcut?"; string Filename = Shortcutbox.Text; string emupath = Edirbox.Text + "ShortCutes"; if (!Directory.Exists(emupath)) { Directory.CreateDirectory(emupath); } emupath += @"\"; string Output = emupath + Filename + ".exe"; CompilerParameters parameters = new CompilerParameters(new[] { "mscorlib.dll", "System.Core.dll", "System.dll", "System.Windows.Forms.dll", "System.Drawing.dll", "System.Runtime.InteropServices.dll" }) { CompilerOptions = "-win32icon:" + temppath + "temp.ico \n -target:winexe " + "\n -resource:" + temppath + @"temp.png" + "\n -resource:" + temppath + @"loading.gif", GenerateExecutable = true, OutputAssembly = Output }; CompilerResults results = new CSharpCodeProvider().CompileAssemblyFromSource(parameters, code); if (results.Errors.Count > 0) { string errors = null; foreach (CompilerError CompErr in results.Errors) { errors = errors + "Line number " + CompErr.Line + ", Error Number: " + CompErr.ErrorNumber + ", '" + CompErr.ErrorText + ";" + Environment.NewLine; } MessageForm.Error(errors); Cursor = Cursors.Default; Application.UseWaitCursor = false; return; } if (!Directory.Exists(appdata + SelectedEmu.Name)) { Directory.CreateDirectory(appdata + SelectedEmu.Name); } if (SelectedShortCuteHis == -1) { new ShortCute(Filename, Edirbox.Text + SelectedEmu.Exe, Gdirbox.Text, appdata + SelectedEmu.Name + @"\" + $"{Filename}.png"); } else { var shortcute = XmlDocSC.ShortCutes[SelectedShortCuteHis]; if (shortcute.Name != Filename) { File.Delete(emupath + shortcute.Name + ".exe"); File.Delete(Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + $"\\{shortcute.Name}.lnk"); File.Delete(shortcute.Image); } shortcute.Name = Filename; shortcute.EmuPath = Edirbox.Text + SelectedEmu.Exe; shortcute.GamePath = Gdirbox.Text; shortcute.Image = appdata + SelectedEmu.Name + @"\" + $"{Filename}.png"; message = message.Replace("created", "modified"); SelectedShortCuteHis = -1; Thread order = new Thread(XmlDocSC.SortList); order.Start(); } File.Copy(temppath + "tempORIGINAL.png", appdata + SelectedEmu.Name + @"\" + $"{Filename}.png", true); if (DesktopCheck.Checked) { object shDesktop = (object)"Desktop"; IWshRuntimeLibrary.WshShell shell = new IWshRuntimeLibrary.WshShell(); string shortcutAddress = (string)shell.SpecialFolders.Item(ref shDesktop) + @"\" + Filename + ".lnk"; IWshRuntimeLibrary.IWshShortcut shortcut = (IWshRuntimeLibrary.IWshShortcut)shell.CreateShortcut(shortcutAddress); shortcut.Description = "ShortCute for " + Filename; shortcut.TargetPath = Output; shortcut.WorkingDirectory = emupath; shortcut.Save(); } Cursor = Cursors.Default; Application.UseWaitCursor = false; if (MessageForm.Success(message)) { var starto = new Process(); starto.StartInfo.FileName = Output; starto.StartInfo.WorkingDirectory = emupath; starto.Start(); } }