public ProjectOptionsPanelWidget(MonoDevelop.Projects.Project project) { Gtk.ListStore store; Gtk.CellRendererText cr; this.Build(); this.project = (VBProject)project; cr = new Gtk.CellRendererText(); store = new Gtk.ListStore(typeof(string)); store.AppendValues(GettextCatalog.GetString("Executable")); store.AppendValues(GettextCatalog.GetString("Library")); store.AppendValues(GettextCatalog.GetString("Executable with GUI")); store.AppendValues(GettextCatalog.GetString("Module")); compileTargetCombo.Model = store; compileTargetCombo.PackStart(cr, true); compileTargetCombo.AddAttribute(cr, "text", 0); compileTargetCombo.Active = (int)this.project.CompileTarget; compileTargetCombo.Changed += delegate(object sender, EventArgs e) { entryMainClass.Sensitive = compileTargetCombo.Active != (int)CompileTarget.Library && compileTargetCombo.Active != (int)CompileTarget.Module; }; store = new Gtk.ListStore(typeof(string)); store.AppendValues("WindowsForms"); store.AppendValues("Windows"); store.AppendValues("Console"); txtMyType.Model = store; txtMyType.TextColumn = 0; switch (this.project.MyType) { case "WindowsForms": txtMyType.Active = 0; break; case "Windows": txtMyType.Active = 1; break; case "Console": txtMyType.Active = 2; break; case null: case "": break; default: txtMyType.AppendText(this.project.MyType); txtMyType.Active = 3; break; } cr = new Gtk.CellRendererText(); store = new Gtk.ListStore(typeof(string)); store.AppendValues("Binary"); store.AppendValues("Text"); cmbOptionCompare.Model = store; cmbOptionCompare.PackStart(cr, true); cmbOptionCompare.AddAttribute(cr, "text", 0); cmbOptionCompare.Active = this.project.BinaryOptionCompare ? 0 : 1; cr = new Gtk.CellRendererText(); store = new Gtk.ListStore(typeof(string)); store.AppendValues("On"); store.AppendValues("Off"); cmbOptionExplicit.Model = store; cmbOptionExplicit.PackStart(cr, true); cmbOptionExplicit.AddAttribute(cr, "text", 0); cmbOptionExplicit.Active = this.project.OptionExplicit ? 0 : 1; cr = new Gtk.CellRendererText(); store = new Gtk.ListStore(typeof(string)); store.AppendValues("On"); store.AppendValues("Off"); cmbOptionInfer.Model = store; cmbOptionInfer.PackStart(cr, true); cmbOptionInfer.AddAttribute(cr, "text", 0); cmbOptionInfer.Active = this.project.OptionInfer ? 0 : 1; cr = new Gtk.CellRendererText(); store = new Gtk.ListStore(typeof(string)); store.AppendValues("On"); store.AppendValues("Off"); cmbOptionStrict.Model = store; cmbOptionStrict.PackStart(cr, true); cmbOptionStrict.AddAttribute(cr, "text", 0); cmbOptionStrict.Active = this.project.OptionStrict ? 0 : 1; // Codepage string foundEncoding = null; string currentCodepage = this.project.CodePage; foreach (TextEncoding e in TextEncoding.SupportedEncodings) { if (e.CodePage == -1) { continue; } if (e.Id == currentCodepage) { foundEncoding = e.Id; } cmbCodePage.AppendText(e.Id); } if (foundEncoding != null) { cmbCodePage.Entry.Text = foundEncoding; } else if (!string.IsNullOrEmpty(currentCodepage)) { cmbCodePage.Entry.Text = currentCodepage; } entryMainClass.Entry.Text = this.project.StartupObject; iconEntry.Path = this.project.ApplicationIcon; }
string GenerateOptions (DotNetProjectConfiguration configuration, VBCompilerParameters compilerparameters, VBProject projectparameters, string outputFileName) { var project = configuration.ParentItem; StringBuilder sb = new StringBuilder (); sb.AppendFormat ("\"-out:{0}\"", outputFileName); sb.AppendLine (); sb.AppendLine ("-nologo"); sb.AppendLine ("-utf8output"); sb.AppendLine ("-quiet"); sb.AppendFormat ("-debug:{0}", compilerparameters.DebugType); sb.AppendLine (); if (compilerparameters.Optimize) sb.AppendLine ("-optimize+"); if (projectparameters.OptionStrict) sb.AppendLine ("-optionstrict+"); else sb.AppendLine ("-optionstrict-"); if (projectparameters.OptionExplicit) sb.AppendLine ("-optionexplicit+"); else sb.AppendLine ("-optionexplicit-"); if (projectparameters.BinaryOptionCompare) sb.AppendLine ("-optioncompare:binary"); else sb.AppendLine ("-optioncompare:text"); if (projectparameters.OptionInfer) sb.AppendLine ("-optioninfer+"); else sb.AppendLine ("-optioninfer-"); string mytype = projectparameters.MyType; if (!string.IsNullOrEmpty (mytype)) { sb.AppendFormat ("-define:_MYTYPE=\\\"{0}\\\"", mytype); sb.AppendLine (); } string win32IconPath = projectparameters.ApplicationIcon; if (!string.IsNullOrEmpty (win32IconPath) && File.Exists (win32IconPath)) { sb.AppendFormat ("\"-win32icon:{0}\"", win32IconPath); sb.AppendLine (); } if (!string.IsNullOrEmpty (projectparameters.CodePage)) { TextEncoding enc = TextEncoding.GetEncoding (projectparameters.CodePage); sb.AppendFormat ("-codepage:{0}", enc.CodePage); sb.AppendLine (); } if (!string.IsNullOrEmpty (project.DefaultNamespace)) { sb.AppendFormat ("-rootnamespace:{0}", project.DefaultNamespace); sb.AppendLine (); } if (!string.IsNullOrEmpty (compilerparameters.DefineConstants)) { sb.AppendFormat ("\"-define:{0}\"", compilerparameters.DefineConstants); sb.AppendLine (); } if (compilerparameters.DefineDebug) sb.AppendLine ("-define:DEBUG=-1"); if (compilerparameters.DefineTrace) sb.AppendLine ("-define:TRACE=-1"); if (compilerparameters.WarningsDisabled) { sb.AppendLine ("-nowarn"); } else if (!string.IsNullOrEmpty (compilerparameters.NoWarn)) { sb.AppendFormat ("-nowarn:{0}", compilerparameters.NoWarn); sb.AppendLine (); } if (!string.IsNullOrEmpty (compilerparameters.WarningsAsErrors)) { sb.AppendFormat ("-warnaserror+:{0}", compilerparameters.WarningsAsErrors); sb.AppendLine (); } if (configuration.SignAssembly) { if (File.Exists (configuration.AssemblyKeyFile)) { sb.AppendFormat ("\"-keyfile:{0}\"", configuration.AssemblyKeyFile); sb.AppendLine (); } } if (configuration.DelaySign) sb.AppendLine ("-delaySign"); if (!string.IsNullOrEmpty (compilerparameters.DocumentationFile)) { sb.AppendFormat ("\"-doc:{0}\"", compilerparameters.DocumentationFile); sb.AppendLine (); } if (!string.IsNullOrEmpty (projectparameters.StartupObject) && projectparameters.StartupObject != "Sub Main") { sb.Append ("-main:"); sb.Append (projectparameters.StartupObject); sb.AppendLine (); } if (compilerparameters.RemoveIntegerChecks) sb.AppendLine ("-removeintchecks+"); if (!string.IsNullOrEmpty (compilerparameters.AdditionalParameters)) { sb.Append (compilerparameters.AdditionalParameters); sb.AppendLine (); } switch (configuration.CompileTarget) { case CompileTarget.Exe: sb.AppendLine ("-target:exe"); break; case CompileTarget.WinExe: sb.AppendLine ("-target:winexe"); break; case CompileTarget.Library: sb.AppendLine ("-target:library"); break; case CompileTarget.Module: sb.AppendLine ("-target:module"); break; default: throw new NotSupportedException("unknown compile target:" + configuration.CompileTarget); } return sb.ToString(); }
string GenerateOptions(DotNetProjectConfiguration configuration, VBCompilerParameters compilerparameters, VBProject projectparameters, string outputFileName) { var project = configuration.ParentItem; StringBuilder sb = new StringBuilder(); sb.AppendFormat("\"-out:{0}\"", outputFileName); sb.AppendLine(); sb.AppendLine("-nologo"); sb.AppendLine("-utf8output"); sb.AppendLine("-quiet"); sb.AppendFormat("-debug:{0}", compilerparameters.DebugType); sb.AppendLine(); if (compilerparameters.Optimize) { sb.AppendLine("-optimize+"); } if (projectparameters.OptionStrict) { sb.AppendLine("-optionstrict+"); } else { sb.AppendLine("-optionstrict-"); } if (projectparameters.OptionExplicit) { sb.AppendLine("-optionexplicit+"); } else { sb.AppendLine("-optionexplicit-"); } if (projectparameters.BinaryOptionCompare) { sb.AppendLine("-optioncompare:binary"); } else { sb.AppendLine("-optioncompare:text"); } if (projectparameters.OptionInfer) { sb.AppendLine("-optioninfer+"); } else { sb.AppendLine("-optioninfer-"); } string mytype = projectparameters.MyType; if (!string.IsNullOrEmpty(mytype)) { sb.AppendFormat("-define:_MYTYPE=\\\"{0}\\\"", mytype); sb.AppendLine(); } string win32IconPath = projectparameters.ApplicationIcon; if (!string.IsNullOrEmpty(win32IconPath) && File.Exists(win32IconPath)) { sb.AppendFormat("\"-win32icon:{0}\"", win32IconPath); sb.AppendLine(); } if (!string.IsNullOrEmpty(projectparameters.CodePage)) { TextEncoding enc = TextEncoding.GetEncoding(projectparameters.CodePage); sb.AppendFormat("-codepage:{0}", enc.CodePage); sb.AppendLine(); } if (!string.IsNullOrEmpty(project.DefaultNamespace)) { sb.AppendFormat("-rootnamespace:{0}", project.DefaultNamespace); sb.AppendLine(); } if (!string.IsNullOrEmpty(compilerparameters.DefineConstants)) { sb.AppendFormat("\"-define:{0}\"", compilerparameters.DefineConstants); sb.AppendLine(); } if (compilerparameters.DefineDebug) { sb.AppendLine("-define:DEBUG=-1"); } if (compilerparameters.DefineTrace) { sb.AppendLine("-define:TRACE=-1"); } if (compilerparameters.WarningsDisabled) { sb.AppendLine("-nowarn"); } else if (!string.IsNullOrEmpty(compilerparameters.NoWarn)) { sb.AppendFormat("-nowarn:{0}", compilerparameters.NoWarn); sb.AppendLine(); } if (!string.IsNullOrEmpty(compilerparameters.WarningsAsErrors)) { sb.AppendFormat("-warnaserror+:{0}", compilerparameters.WarningsAsErrors); sb.AppendLine(); } if (configuration.SignAssembly) { if (File.Exists(configuration.AssemblyKeyFile)) { sb.AppendFormat("\"-keyfile:{0}\"", configuration.AssemblyKeyFile); sb.AppendLine(); } } if (configuration.DelaySign) { sb.AppendLine("-delaySign"); } if (!string.IsNullOrEmpty(compilerparameters.DocumentationFile)) { sb.AppendFormat("\"-doc:{0}\"", compilerparameters.DocumentationFile); sb.AppendLine(); } if (!string.IsNullOrEmpty(projectparameters.StartupObject) && projectparameters.StartupObject != "Sub Main") { sb.Append("-main:"); sb.Append(projectparameters.StartupObject); sb.AppendLine(); } if (compilerparameters.RemoveIntegerChecks) { sb.AppendLine("-removeintchecks+"); } if (!string.IsNullOrEmpty(compilerparameters.AdditionalParameters)) { sb.Append(compilerparameters.AdditionalParameters); sb.AppendLine(); } switch (configuration.CompileTarget) { case CompileTarget.Exe: sb.AppendLine("-target:exe"); break; case CompileTarget.WinExe: sb.AppendLine("-target:winexe"); break; case CompileTarget.Library: sb.AppendLine("-target:library"); break; case CompileTarget.Module: sb.AppendLine("-target:module"); break; default: throw new NotSupportedException("unknown compile target:" + configuration.CompileTarget); } return(sb.ToString()); }