This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var code = @"class C { }"; | |
var classDeclaration = code.astTree() | |
.compilationUnit() | |
.classes().first(); | |
classDeclaration.replace(classDeclaration.add("M".methodDeclaration())) | |
.formatedCode(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//for a UserControl (in fact any control that implements System.ComponentModel.Component) | |
var userControl = new UserControl(); | |
//we can get the current mapped event handlers | |
userControl.eventHandlers(); | |
//its signature | |
userControl.eventHandlers_MethodSignatures(); | |
//remove one by using the static field name | |
userControl.remove_EventHandler("EVENT_SELECTEDINDEXCHANGED"); | |
//or use this one specifically mapped to the SelectedIndexChanged event | |
userControl.remove_Event_SelectedIndexChanged |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This file is part of the OWASP O2 Platform (http://www.owasp.org/index.php/OWASP_O2_Platform) and is released under the Apache 2.0 License (http://www.apache.org/licenses/LICENSE-2.0) | |
using System; | |
using System.IO; | |
using System.Collections; | |
using System.Collections.Generic; | |
using System.Runtime.InteropServices; | |
using System.Windows.Forms; | |
using System.Text; | |
using O2.Interfaces.O2Core; | |
using O2.Kernel; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static Form clientSize(this Form form, int width, int height) | |
{ | |
return (Form)form.invokeOnThread(() => | |
{ | |
form.ClientSize = new Size(width, height); | |
return form; | |
}); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var textBox = panel.add_TextBox(true); | |
textBox.set_Text("hello world"); | |
var label = (Label)textBox.castViaTypeConfusion<Label>(); | |
return label.FlatStyle.str(); // will return a value that depends on some part of the TextBox object raw value | |
//return textBox.FlatStyle; // doesn't compile: System.Windows.Forms.TextBox' does not contain a definition for 'FlatStyle' and no extension method 'FlatStyle' accepting a first argument of type | |
//O2File:_Extra_methods_TypeConfusion.cs |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var _script = (script as object).castViaTypeConfusion<ascx_Simple_Script_Editor>(); | |
_script.execute(); | |
return _script.Code; | |
//O2Tag_SetInvocationParametersToDynamic | |
//O2Tag_DontUseCachedAssemblyIfAvailable | |
//O2Tag_DontAddExtraO2Files | |
//O2File:ascx_Simple_Script_Editor.cs.o2 | |
//O2File:_Extra_methods_TypeConfusion.cs |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
iCalResult.cs(34,33): error CS0115: 'NerdDinner.Controllers.iCalResult.WriteFile(System.Web.HttpResponseBase)': no suitable method found to override | |
iCalResult.cs(14,18): error CS0534: 'NerdDinner.Controllers.iCalResult' does not implement inherited abstract member 'System.Web.Mvc.FileResult.WriteFile(System.Web.HttpResponseBase)' | |
RSSResult.cs(33,33): error CS0115: 'NerdDinner.Controllers.RssResult.WriteFile(System.Web.HttpResponseBase)': no suitable method found to override | |
RSSResult.cs(12,18): error CS0534: 'NerdDinner.Controllers.RssResult' does not implement inherited abstract member 'System.Web.Mvc.FileResult.WriteFile(System.Web.HttpResponseBase)' | |
AccountController.cs(70,18): error CS8000: This language feature ('missing type') is not yet implemented in Roslyn. | |
AccountController.cs(158,31): error CS8000: This language feature ('missing type') is not yet implemented in Roslyn. | |
DinnersController.cs(39,73): error CS8000: This language feature ('Expression Trees') is not yet implemented in Roslyn. | |
DinnersCo |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var file = "NodePadIcon.ico".tempFile(); | |
var icon = "http://upload.wikimedia.org/wikipedia/commons/e/ef/Gartoon-Gedit-icon.png".uri().download(false) | |
.bitmap().asIcon(); | |
using (FileStream fs = new FileStream(file, FileMode.Create)) | |
icon.Save(fs); | |
panel.add_PictureBox().open(file); | |
return file; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//var topPanel = "{name}".popupWindow(700,400); | |
var topPanel = panel.clear().add_Panel(); | |
var textBox = topPanel.add_TextBox(true) | |
.set_Text("hello world").wordWrap(true); | |
Action<string> openFile = | |
(file)=> textBox.set_Text(file.fileContents()); | |
Action saveFile = | |
()=> textBox.get_Text().saveAs(topPanel.askUserForFileToSave("")); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var vsixPackage = O2_FluentSharp_VSIXPackage.vsixPackage; // this is a reference to an Package object | |
var ivsSolution = (IVsSolution)Package.GetGlobalService(typeof(IVsSolution)); | |
var dte = (EnvDTE80.DTE2)Package.GetGlobalService(typeof(EnvDTE.DTE)); | |
var errorListProvider = new ErrorListProvider(vsixPackage); | |
var errorText = "this is a test item"; | |
var errorCategory = TaskErrorCategory.Error; | |
//Get first project details | |
var proj = dte.Solution.Projects.Item(1); |