public AddIn Load(string fileName) { SD.Log.DebugFormatted( "[AddInManager2.SD] Loading manifest from '{0}'", fileName); return(AddIn.Load(SD.AddInTree, fileName)); }
public void TestSubCodonsWithCondition() { string addInText = @" <AddIn> <Path name = '/Path1'> <Condition name='Equal' string='a' equal='b'> <Sub id='Path2'> <Codon2 id='Sub2'/> </Sub> </Condition> </Path> </AddIn>"; AddIn addIn = AddIn.Load(new StringReader(addInText)); Assert.AreEqual(2, addIn.Paths.Count); Assert.IsNotNull(addIn.Paths["/Path1"]); Assert.AreEqual(1, addIn.Paths["/Path1"].Codons.Count); Assert.AreEqual("Sub", addIn.Paths["/Path1"].Codons[0].Name); Assert.AreEqual("Path2", addIn.Paths["/Path1"].Codons[0].Id); Assert.AreEqual(1, addIn.Paths["/Path1"].Codons[0].Conditions.Length); Assert.IsNotNull(addIn.Paths["/Path1/Path2"]); Assert.AreEqual(1, addIn.Paths["/Path1/Path2"].Codons.Count); Assert.AreEqual("Codon2", addIn.Paths["/Path1/Path2"].Codons[0].Name); Assert.AreEqual("Sub2", addIn.Paths["/Path1/Path2"].Codons[0].Id); Assert.AreEqual(0, addIn.Paths["/Path1/Path2"].Codons[0].Conditions.Length); }
public void TestSimpleCondition() { string addInText = @" <AddIn> <Path name = '/Path1'> <Condition name='Equal' string='a' equal='b'> <Simple id ='Simple' attr='a' attr2='b'/> </Condition> </Path> </AddIn>"; AddIn addIn = AddIn.Load(new StringReader(addInText)); Assert.AreEqual(1, addIn.Paths.Count, "Paths != 1"); ExtensionPath path = addIn.Paths["/Path1"]; Assert.IsNotNull(path); Assert.AreEqual(1, path.Codons.Count); Codon codon = path.Codons[0]; Assert.AreEqual("Simple", codon.Name); Assert.AreEqual("Simple", codon.Id); Assert.AreEqual("a", codon["attr"]); Assert.AreEqual("b", codon["attr2"]); // Test for condition. Assert.AreEqual(1, codon.Conditions.Length); Condition condition = codon.Conditions[0] as Condition; Assert.IsNotNull(condition); Assert.AreEqual("Equal", condition.Name); Assert.AreEqual("a", condition["string"]); Assert.AreEqual("b", condition["equal"]); }
public void TestComplexCondition() { string addInText = @" <AddIn> <Path name = '/Path1'> <ComplexCondition> <And> <Not><Condition name='Equal' string='a' equal='b'/></Not> <Or> <Condition name='Equal' string='a' equal='b'/> <Condition name='Equal' string='a' equal='b'/> <Condition name='Equal' string='a' equal='b'/> </Or> </And> <Simple id ='Simple' attr='a' attr2='b'/> </ComplexCondition> </Path> </AddIn>"; AddIn addIn = AddIn.Load(new StringReader(addInText)); Assert.AreEqual(1, addIn.Paths.Count); ExtensionPath path = addIn.Paths["/Path1"]; Assert.IsNotNull(path); Codon codon = path.Codons.Single(); Assert.AreEqual("Simple", codon.Name); Assert.AreEqual("Simple", codon.Id); Assert.AreEqual("a", codon["attr"]); Assert.AreEqual("b", codon["attr2"]); // Test for condition. Assert.AreEqual(1, codon.Conditions.Length); }
public void TestSubCodonsWithCondition() { string addInText = @" <AddIn> <Path name = '/Path1'> <Condition name='Equal' string='a' equal='b'> <Sub id='Path2'> <Codon2 id='Sub2'/> </Sub> </Condition> </Path> </AddIn>"; AddIn addIn = AddIn.Load(new StringReader(addInText)); Assert.AreEqual(2, addIn.Paths.Count); Assert.IsNotNull(addIn.Paths["/Path1"]); List <Codon> codons1 = addIn.Paths["/Path1"].Codons.ToList(); Assert.AreEqual(1, codons1.Count); Assert.AreEqual("Sub", codons1[0].Name); Assert.AreEqual("Path2", codons1[0].Id); Assert.AreEqual(1, codons1[0].Conditions.Length); Assert.IsNotNull(addIn.Paths["/Path1/Path2"]); List <Codon> codons2 = addIn.Paths["/Path1/Path2"].Codons.ToList(); Assert.AreEqual(1, codons2.Count); Assert.AreEqual("Codon2", codons2[0].Name); Assert.AreEqual("Sub2", codons2[0].Id); Assert.AreEqual(1, codons2[0].Conditions.Length); // condition is inherited into sub-codon }
private void CreateAddIns() { // Create AddIn objects from *.addin files available in this assembly's output directory FakeAddInTree _addInTree = new FakeAddInTree(); using (StreamReader streamReader = new StreamReader(@"TestResources\AddInManager2Test.addin")) { _addIn1 = AddIn.Load(_addInTree, streamReader); } using (StreamReader streamReader = new StreamReader(@"TestResources\AddInManager2Test_New.addin")) { _addIn1_new = AddIn.Load(_addInTree, streamReader); } using (StreamReader streamReader = new StreamReader(@"TestResources\AddInManager2Test_2.addin")) { _addIn2 = AddIn.Load(_addInTree, streamReader); } using (StreamReader streamReader = new StreamReader(@"TestResources\AddInManager2Test_2_New.addin")) { _addIn2_new = AddIn.Load(_addInTree, streamReader); } using (StreamReader streamReader = new StreamReader(@"TestResources\AddInManager2Test_noVersion.addin")) { _addIn_noVersion = AddIn.Load(_addInTree, streamReader); } }
public void TestRuntimeSectionComplexImport() { string addInText = @" <AddIn> <Runtime> <Import assembly = '../bin/SharpDevelop.Base.dll'> <Doozer name='MyDoozer' class = 'ICSharpCode.Core.ClassDoozer'/> <ConditionEvaluator name='MyCompare' class = 'ICSharpCode.Core.CompareCondition'/> <Doozer name='Test' class = 'ICSharpCode.Core.ClassDoozer2'/> <ConditionEvaluator name='Condition2' class = 'Condition2Class'/> </Import> </Runtime> </AddIn>"; AddIn addIn = AddIn.Load(new StringReader(addInText)); Assert.AreEqual(1, addIn.Runtimes.Count); Assert.AreEqual(addIn.Runtimes[0].Assembly, "../bin/SharpDevelop.Base.dll"); Assert.AreEqual(addIn.Runtimes[0].DefinedDoozers.Count, 2); Assert.AreEqual(addIn.Runtimes[0].DefinedDoozers[0].Name, "MyDoozer"); Assert.AreEqual(addIn.Runtimes[0].DefinedDoozers[0].ClassName, "ICSharpCode.Core.ClassDoozer"); Assert.AreEqual(addIn.Runtimes[0].DefinedDoozers[1].Name, "Test"); Assert.AreEqual(addIn.Runtimes[0].DefinedDoozers[1].ClassName, "ICSharpCode.Core.ClassDoozer2"); Assert.AreEqual(addIn.Runtimes[0].DefinedConditionEvaluators.Count, 2); Assert.AreEqual(addIn.Runtimes[0].DefinedConditionEvaluators[0].Name, "MyCompare"); Assert.AreEqual(addIn.Runtimes[0].DefinedConditionEvaluators[0].ClassName, "ICSharpCode.Core.CompareCondition"); Assert.AreEqual(addIn.Runtimes[0].DefinedConditionEvaluators[1].Name, "Condition2"); Assert.AreEqual(addIn.Runtimes[0].DefinedConditionEvaluators[1].ClassName, "Condition2Class"); }
public void SetUpFixture() { RubyMSBuildEngineHelper.InitMSBuildEngine(); List <ProjectBindingDescriptor> bindings = new List <ProjectBindingDescriptor>(); using (TextReader reader = RubyBindingAddInFile.ReadAddInFile()) { AddIn addin = AddIn.Load(reader, String.Empty); bindings.Add(new ProjectBindingDescriptor(AddInHelper.GetCodon(addin, "/SharpDevelop/Workbench/ProjectBindings", "Ruby"))); } ProjectBindingService.SetBindings(bindings); convertProjectCommand = new DerivedConvertProjectToRubyProjectCommand(); parseInfo = new ParseInformation(new DefaultCompilationUnit(new DefaultProjectContent())); convertProjectCommand.ParseInfo = parseInfo; convertProjectCommand.FileServiceDefaultEncoding = Encoding.Unicode; sourceProject = new MockProject(); sourceProject.Directory = @"d:\projects\test"; source = new FileProjectItem(sourceProject, ItemType.Compile, @"src\Program.cs"); targetProject = (RubyProject)convertProjectCommand.CallCreateProject(@"d:\projects\test\converted", sourceProject); target = new FileProjectItem(targetProject, source.ItemType, source.Include); source.CopyMetadataTo(target); textFileSource = new FileProjectItem(sourceProject, ItemType.None, @"src\readme.txt"); textFileTarget = new FileProjectItem(targetProject, textFileSource.ItemType, textFileSource.Include); textFileSource.CopyMetadataTo(textFileTarget); convertProjectCommand.AddParseableFileContent(source.FileName, sourceCode); convertProjectCommand.CallConvertFile(source, target); convertProjectCommand.CallConvertFile(textFileSource, textFileTarget); }
public void SetUp() { string addinXml = "<AddIn name = 'Xml Editor'\r\n" + "author = ''\r\n" + "copyright = 'prj:///doc/copyright.txt'\r\n" + "description = ''\r\n" + "addInManagerHidden = 'preinstalled'>\r\n" + "</AddIn>"; using (StringReader reader = new StringReader(addinXml)) { var addInTree = MockRepository.GenerateStrictMock <IAddInTree>(); AddIn addin = AddIn.Load(addInTree, reader); AddInTreeNode addinTreeNode = new AddInTreeNode(); Properties properties = new Properties(); properties.Set <string>("extensions", " .xml; .xsd "); properties.Set <string>("id", "Xml"); addinTreeNode.AddCodons( new Codon[] { new Codon(addin, "CodeCompletionC#", new Properties(), new ICondition[0]), new Codon(addin, "CodeCompletionXml", properties, new ICondition[0]) }); fileExtensions = new DefaultXmlFileExtensions(addinTreeNode); } }
public void Init() { string addinXml = "<AddIn name = 'Xml Editor'\r\n" + "author = ''\r\n" + "copyright = 'prj:///doc/copyright.txt'\r\n" + "description = ''\r\n" + "addInManagerHidden = 'preinstalled'>\r\n" + "</AddIn>"; using (StringReader reader = new StringReader(addinXml)) { AddIn addin = AddIn.Load(reader); AddInTreeNode addinTreeNode = new AddInTreeNode(); Properties properties1 = new Properties(); properties1.Set <string>("id", ".xml"); properties1.Set <string>("namespaceUri", "http://example.com"); Properties properties2 = new Properties(); properties2.Set <string>("id", ".xsl"); properties2.Set <string>("namespaceUri", "http://example.com/xsl"); properties2.Set <string>("namespacePrefix", "xs"); addinTreeNode.AddCodons( new Codon[] { new Codon(addin, "SchemaAssociation", properties1, new ICondition[0]), new Codon(addin, "SchemaAssociation", properties2, new ICondition[0]) }); schemaAssociations = new DefaultXmlSchemaFileAssociations(addinTreeNode); } }
DefaultXmlSchemaFileAssociations CreateDefaultXmlSchemaFileExtensions() { string addinXml = "<AddIn name = 'Xml Editor'\r\n" + " author = ''\r\n" + " copyright = 'prj:///doc/copyright.txt'\r\n" + " description = ''\r\n" + " addInManagerHidden = 'preinstalled'>\r\n" + "</AddIn>"; using (StringReader reader = new StringReader(addinXml)) { var addInTree = MockRepository.GenerateStrictMock <IAddInTree>(); AddIn addin = AddIn.Load(addInTree, reader); AddInTreeNode addinTreeNode = new AddInTreeNode(); Properties properties = new Properties(); properties.Set <string>("id", ".xml"); properties.Set <string>("namespaceUri", "http://example.com"); properties.Set <string>("namespacePrefix", "e"); addinTreeNode.AddCodons( new Codon[] { new Codon(addin, "SchemaAssociation", properties, new ICondition[0]) }); return(new DefaultXmlSchemaFileAssociations(addinTreeNode)); } }
public void TestSubCodons() { string addInText = @" <AddIn> <Path name = '/Path1'> <Sub id='Path2'> <Codon2 id='Sub2'/> </Sub> </Path> </AddIn>"; AddIn addIn = AddIn.Load(new StringReader(addInText)); Assert.AreEqual(2, addIn.Paths.Count); Assert.IsNotNull(addIn.Paths["/Path1"]); List <Codon> codons1 = addIn.Paths["/Path1"].Codons.ToList(); Assert.AreEqual(1, codons1.Count); Assert.AreEqual("Sub", codons1[0].Name); Assert.AreEqual("Path2", codons1[0].Id); Assert.IsNotNull(addIn.Paths["/Path1/Path2"]); List <Codon> codons2 = addIn.Paths["/Path1/Path2"].Codons.ToList(); Assert.AreEqual(1, codons2.Count); Assert.AreEqual("Codon2", codons2[0].Name); Assert.AreEqual("Sub2", codons2[0].Id); }
public object BuildItem(BuildItemArgs args) { string entityName = args.Codon.Properties["entityName"]; string addinFileName = AppDomain.CurrentDomain.BaseDirectory + "AddIns\\" + "Convert.AddIn"; AddIn addin = AddIn.Load(addinFileName); List <Codon> subItems = GetSubItems(entityName, addin, args); if (subItems.Count <= 0) { return(null); } ICSharpCode.Core.Properties properies = new ICSharpCode.Core.Properties(); properies.Set <string>("id", "CovertGroup"); properies.Set <string>("type", "Group"); properies.Set <string>("label", "${res:ConvertTitle}"); properies.Set <string>("OrderNumber", "99"); properies.Set <string>("builderid", "RibbonPageGroupBuilder"); Codon codon = new Codon(addin, "MenuItem", properies, args.Conditions.ToArray()); args.SubItemNode.AddCodons(subItems); return(new MenuItemDescriptor(args.Caller, codon, args.BuildSubItems <object>(), args.Conditions)); }
AddIn CreateAddIn() { string xml = GetAddInXml(); AddIn addin = AddIn.Load(new StringReader(xml)); addin.FileName = fileName; return(addin); }
public void SetupFixture() { using (TextReader reader = PythonBindingAddInFile.ReadAddInFile()) { addin = AddIn.Load(reader, String.Empty); fileFilterCodon = GetCodon("/SharpDevelop/Workbench/FileFilter", "Python"); pythonMenuCodon = GetCodon("/SharpDevelop/Workbench/MainMenu", "Python"); displayBindingCodon = GetCodon("/SharpDevelop/Workbench/DisplayBindings", "PythonDisplayBinding"); const string runMenuExtensionPath = "/SharpDevelop/Workbench/MainMenu/Python"; pythonRunMenuItemCodon = GetCodon(runMenuExtensionPath, "Run"); pythonWithoutDebuggerRunMenuItemCodon = GetCodon(runMenuExtensionPath, "RunWithoutDebugger"); pythonStopMenuItemCodon = GetCodon(runMenuExtensionPath, "Stop"); fileTemplatesCodon = GetCodon("/SharpDevelop/BackendBindings/Templates", "Python"); optionsPanelCodon = GetCodon("/SharpDevelop/Dialogs/OptionsDialog/ToolsOptions", "PythonOptionsPanel"); parserCodon = GetCodon("/Workspace/Parser", "Python"); additionalMSBuildPropertiesCodon = GetCodon("/SharpDevelop/MSBuildEngine/AdditionalProperties", "PythonBinPath"); languageBindingCodon = GetCodon("/SharpDevelop/Workbench/LanguageBindings", "Python"); projectFileFilterCodon = GetCodon("/SharpDevelop/Workbench/Combine/FileFilter", "PythonProject"); codeCompletionBindingCodon = GetCodon("/AddIns/DefaultTextEditor/CodeCompletion", "Python"); applicationSettingsOptionsCodon = GetCodon("/SharpDevelop/BackendBindings/ProjectOptions/Python", "Application"); buildEventsCodon = GetCodon("/SharpDevelop/BackendBindings/ProjectOptions/Python", "BuildEvents"); compilingOptionsCodon = GetCodon("/SharpDevelop/BackendBindings/ProjectOptions/Python", "CompilingOptions"); debugOptionsCodon = GetCodon("/SharpDevelop/BackendBindings/ProjectOptions/Python", "DebugOptions"); convertCodeCodon = GetCodon("/SharpDevelop/Workbench/MainMenu/Tools/ConvertCode", "ConvertToPython"); pythonFileIconCodon = GetCodon("/Workspace/Icons", "PythonFileIcon"); pythonProjectIconCodon = GetCodon("/Workspace/Icons", "PythonProjectIcon"); convertCSharpProjectCodon = GetCodon("/SharpDevelop/Pads/ProjectBrowser/ContextMenu/ProjectActions/Convert", "CSharpProjectToPythonProjectConverter"); convertVBNetProjectCodon = GetCodon("/SharpDevelop/Pads/ProjectBrowser/ContextMenu/ProjectActions/Convert", "VBNetProjectToPythonProjectConverter"); formattingStrategyCodon = GetCodon("/AddIns/DefaultTextEditor/Formatter/Python", "PythonFormatter"); // Get the PythonBinding runtime. foreach (Runtime runtime in addin.Runtimes) { if (runtime.Assembly == "PythonBinding.dll") { pythonBindingRuntime = runtime; } else if (runtime.Assembly == "$ICSharpCode.FormsDesigner/FormsDesigner.dll") { formsDesignerRuntime = runtime; } } // Get the forms designer dependency. foreach (AddInReference addInRef in addin.Manifest.Dependencies) { if (addInRef.Name == "ICSharpCode.FormsDesigner") { formsDesignerAddInRef = addInRef; break; } } } }
public void TestStackedCondition() { string addInText = @" <AddIn> <Path name = '/Path1'> <Condition name='Equal' string='a' equal='b'> <Condition name='StackedCondition' string='1' equal='2'> <Simple id ='Simple' attr='a' attr2='b'/> </Condition> <Simple id ='Simple2' attr='a' attr2='b'/> </Condition> <Simple id ='Simple3' attr='a' attr2='b'/> </Path> </AddIn>"; AddIn addIn = AddIn.Load(new StringReader(addInText)); Assert.AreEqual(1, addIn.Paths.Count); ExtensionPath path = addIn.Paths["/Path1"]; Assert.IsNotNull(path); Assert.AreEqual(3, path.Codons.Count()); Codon codon = path.Codons.ElementAt(0); Assert.AreEqual("Simple", codon.Name); Assert.AreEqual("Simple", codon.Id); Assert.AreEqual("a", codon["attr"]); Assert.AreEqual("b", codon["attr2"]); // Test for condition Assert.AreEqual(2, codon.Conditions.Length); Condition condition = codon.Conditions[1] as Condition; Assert.IsNotNull(condition); Assert.AreEqual("Equal", condition.Name); Assert.AreEqual("a", condition["string"]); Assert.AreEqual("b", condition["equal"]); condition = codon.Conditions[0] as Condition; Assert.IsNotNull(condition); Assert.AreEqual("StackedCondition", condition.Name); Assert.AreEqual("1", condition["string"]); Assert.AreEqual("2", condition["equal"]); codon = path.Codons.ElementAt(1); Assert.AreEqual(1, codon.Conditions.Length); condition = codon.Conditions[0] as Condition; Assert.IsNotNull(condition); Assert.AreEqual("Equal", condition.Name); Assert.AreEqual("a", condition["string"]); Assert.AreEqual("b", condition["equal"]); codon = path.Codons.ElementAt(2); Assert.AreEqual(0, codon.Conditions.Length); }
IAddInTree CreateAddInTreeWithFormsDesignerAddIn() { IAddInTree addInTree = MockRepository.GenerateStrictMock <IAddInTree>(); AddIn formsDesignerAddIn = AddIn.Load(addInTree, new StringReader(GetFormsDesignerAddInXml())); formsDesignerAddIn.FileName = @"D:\SharpDevelop\AddIns\FormsDesigner\FormsDesigner.addin"; formsDesignerAddIn.Enabled = true; addInTree.Expect(a => a.AddIns).Return(new[] { formsDesignerAddIn }); return(addInTree); }
List <AddIn> GetAddInsList() { AddIn formsDesignerAddIn = AddIn.Load(new StringReader(GetFormsDesignerAddInXml())); formsDesignerAddIn.FileName = @"D:\SharpDevelop\AddIns\FormsDesigner\FormsDesigner.addin"; formsDesignerAddIn.Enabled = true; List <AddIn> addIns = new List <AddIn>(); addIns.Add(formsDesignerAddIn); return(addIns); }
public void SetUpFixture() { PythonMSBuildEngineHelper.InitMSBuildEngine(); List <ProjectBindingDescriptor> bindings = new List <ProjectBindingDescriptor>(); using (TextReader reader = PythonBindingAddInFile.ReadAddInFile()) { AddIn addin = AddIn.Load(reader, String.Empty); bindings.Add(new ProjectBindingDescriptor(AddInHelper.GetCodon(addin, "/SharpDevelop/Workbench/ProjectBindings", "Python"))); } ProjectBindingService.SetBindings(bindings); // Set up IProjectContent so the ConvertProjectToPythonProjectCommand can // locate the startup object and determine it's filename. mockProjectContent = new ICSharpCode.Scripting.Tests.Utils.MockProjectContent(); MockClass mainClass = new MockClass(mockProjectContent, startupObject); mainClass.CompilationUnit.FileName = @"d:\projects\test\src\Main2.cs"; mockProjectContent.SetClassToReturnFromGetClass(startupObject, mainClass); convertProjectCommand = new DerivedConvertProjectToPythonProjectCommand(); convertProjectCommand.ProjectContent = mockProjectContent; convertProjectCommand.FileServiceDefaultEncoding = Encoding.Unicode; Solution solution = new Solution(new MockProjectChangeWatcher()); sourceProject = new MSBuildBasedProject( new ProjectCreateInformation() { Solution = solution, OutputProjectFileName = @"d:\projects\test\source.csproj", ProjectName = "source" }); sourceProject.Parent = solution; sourceProject.SetProperty(null, null, "StartupObject", startupObject, PropertyStorageLocations.Base, true); mainFile = new FileProjectItem(sourceProject, ItemType.Compile, @"src\Main.cs"); targetProject = (PythonProject)convertProjectCommand.CallCreateProject(@"d:\projects\test\converted", sourceProject); convertProjectCommand.CallCopyProperties(sourceProject, targetProject); targetMainFile = new FileProjectItem(targetProject, mainFile.ItemType, mainFile.Include); mainFile.CopyMetadataTo(targetMainFile); main2File = new FileProjectItem(sourceProject, ItemType.Compile, @"src\Main2.cs"); targetMain2File = new FileProjectItem(targetProject, main2File.ItemType, main2File.Include); main2File.CopyMetadataTo(targetMain2File); convertProjectCommand.AddParseableFileContent(mainFile.FileName, mainSource); convertProjectCommand.AddParseableFileContent(main2File.FileName, main2Source); convertProjectCommand.CallConvertFile(mainFile, targetMainFile); convertProjectCommand.CallConvertFile(main2File, targetMain2File); }
public void TestRuntimeSectionImport() { string addInText = @" <AddIn> <Runtime> <Import assembly = 'Test.dll'/> </Runtime> </AddIn>"; AddIn addIn = AddIn.Load(new StringReader(addInText)); Assert.AreEqual(1, addIn.Runtimes.Count); Assert.AreEqual(addIn.Runtimes[0].Assembly, "Test.dll"); }
public void FixtureSetUp() { var addInTree = MockRepository.GenerateStub <IAddInTree>(); addIn = AddIn.Load(addInTree, "CSharpBinding.addin"); registeredIssueProviders = addIn.Paths["/SharpDevelop/ViewContent/TextEditor/C#/IssueProviders"].Codons .Select(c => FindType(c.Properties["class"])).Where(t => t != null).ToList(); NRissueProviders = NRCSharpRefactoring.ExportedTypes.Where(t => t.GetCustomAttribute <IssueDescriptionAttribute>() != null).ToList(); registeredContextActions = addIn.Paths["/SharpDevelop/ViewContent/TextEditor/C#/ContextActions"].Codons .Select(c => FindType(c.Properties["class"])).Where(t => t != null).ToList(); NRcontextActions = NRCSharpRefactoring.ExportedTypes.Where(t => t.GetCustomAttribute <ContextActionAttribute>() != null).ToList(); }
public void TestEmptyPathSection() { string addInText = @" <AddIn> <Path name = '/Path1'/> <Path name = '/Path2'/> <Path name = '/Path1/SubPath'/> </AddIn>"; AddIn addIn = AddIn.Load(new StringReader(addInText)); Assert.AreEqual(3, addIn.Paths.Count); Assert.IsNotNull(addIn.Paths["/Path1"]); Assert.IsNotNull(addIn.Paths["/Path2"]); Assert.IsNotNull(addIn.Paths["/Path1/SubPath"]); }
public void SetUpFixture() { string xml = "<AddIn name='Unit Testing Addin'\r\n" + " author='Matt Ward'\r\n" + " copyright='prj:///doc/copyright.txt'\r\n" + " description='Runs unit tests with Gallio inside SharpDevelop'\r\n" + " addInManagerHidden='preinstalled'>\r\n" + " <Manifest>\r\n" + " <Identity name='ICSharpCode.Gallio'/>\r\n" + " </Manifest>\r\n" + "</AddIn>"; AddIn addin = AddIn.Load(new StringReader(xml)); addin.Enabled = false; addin.FileName = @"d:\sharpdevelop\addins\gallio\Gallio.SharpDevelop.dll"; AddInTree.InsertAddIn(addin); }
void AddDefaultDotNetNodeBuilderToAddinTree() { string xml = "<AddIn name='test'>\r\n" + " <Runtime>\r\n"+ " <Import assembly=':ICSharpCode.SharpDevelop'/>\r\n"+ " </Runtime>\r\n"+ " <Path name = '/SharpDevelop/Views/ProjectBrowser/NodeBuilders'>\r\n"+ " <Class id = 'DefaultBuilder'\r\n"+ " class = 'ICSharpCode.SharpDevelop.Project.DefaultDotNetNodeBuilder'/>\r\n"+ " </Path>\r\n"+ "</AddIn>"; var addin = AddIn.Load(new StringReader(xml), String.Empty, null); addin.Enabled = true; AddInTree.InsertAddIn(addin); }
public void TestAddInProperties() { string addInText = @" <AddIn name = 'SharpDevelop Core' author = 'Mike Krueger' copyright = 'GPL' url = 'http://www.icsharpcode.net' description = 'SharpDevelop core module' version = '1.0.0'/>"; AddIn addIn = AddIn.Load(new StringReader(addInText)); Assert.AreEqual(addIn.Properties["name"], "SharpDevelop Core"); Assert.AreEqual(addIn.Properties["author"], "Mike Krueger"); Assert.AreEqual(addIn.Properties["copyright"], "GPL"); Assert.AreEqual(addIn.Properties["url"], "http://www.icsharpcode.net"); Assert.AreEqual(addIn.Properties["description"], "SharpDevelop core module"); Assert.AreEqual(addIn.Properties["version"], "1.0.0"); }
public void TestSimpleCodon() { string addInText = @" <AddIn> <Path name = '/Path1'> <Simple id ='Simple' attr='a' attr2='b'/> </Path> </AddIn>"; AddIn addIn = AddIn.Load(new StringReader(addInText)); Assert.AreEqual(1, addIn.Paths.Count); Assert.IsNotNull(addIn.Paths["/Path1"]); Assert.AreEqual(1, addIn.Paths["/Path1"].Codons.Count); Assert.AreEqual("Simple", addIn.Paths["/Path1"].Codons[0].Name); Assert.AreEqual("Simple", addIn.Paths["/Path1"].Codons[0].Id); Assert.AreEqual("a", addIn.Paths["/Path1"].Codons[0].Properties["attr"]); Assert.AreEqual("b", addIn.Paths["/Path1"].Codons[0].Properties["attr2"]); }
public void SetUpFixture() { MSBuildEngineHelper.InitMSBuildEngine(); List <LanguageBindingDescriptor> bindings = new List <LanguageBindingDescriptor>(); using (TextReader reader = PythonBindingAddInFile.ReadAddInFile()) { AddIn addin = AddIn.Load(reader, String.Empty); bindings.Add(new LanguageBindingDescriptor(AddInHelper.GetCodon(addin, "/SharpDevelop/Workbench/LanguageBindings", "Python"))); } LanguageBindingService.SetBindings(bindings); mockTextEditorProperties = new MockTextEditorProperties(); convertProjectCommand = new DerivedConvertProjectToPythonProjectCommand(mockTextEditorProperties); mockTextEditorProperties.Encoding = Encoding.Unicode; sourceProject = new MockProject(); sourceProject.Directory = @"d:\projects\test"; source = new FileProjectItem(sourceProject, ItemType.Compile, @"src\Program.cs"); targetProject = (PythonProject)convertProjectCommand.CallCreateProject(@"d:\projects\test\converted", sourceProject); target = new FileProjectItem(targetProject, source.ItemType, source.Include); source.CopyMetadataTo(target); textFileSource = new FileProjectItem(sourceProject, ItemType.None, @"src\readme.txt"); textFileTarget = new FileProjectItem(targetProject, textFileSource.ItemType, textFileSource.Include); textFileSource.CopyMetadataTo(textFileTarget); foreach (ProjectItem item in targetProject.Items) { ReferenceProjectItem reference = item as ReferenceProjectItem; if ((reference != null) && (reference.Name == "IronPython")) { ironPythonReference = reference; break; } } convertProjectCommand.AddParseableFileContent(source.FileName, sourceCode); convertProjectCommand.CallConvertFile(source, target); convertProjectCommand.CallConvertFile(textFileSource, textFileTarget); }
public object BuildItem(BuildItemArgs args) { //string entityName = args.Codon.Properties["entityName"]; string addinFileName = AppDomain.CurrentDomain.BaseDirectory + "AddIns\\" + "TimeTracking.AddIn"; AddIn addin = AddIn.Load(addinFileName); ICSharpCode.Core.Properties properies = new ICSharpCode.Core.Properties(); //properies.Set<string>("id", "TimeTracking"); properies.Set <string>("label", "${res:TimeTracking}"); properies.Set <string>("class", "Katrin.Win.TimeTrackingModule.TimeTracking.TimeTrackingListView"); foreach (var codonPro in args.Codon.Properties.Elements) { if (codonPro == "label") { continue; } properies.Set <string>(codonPro, args.Codon.Properties[codonPro]); } Codon codon = new Codon(addin, "DockPanel", properies, args.Conditions.ToArray()); return(new DockPanelDescriptor(args.Caller, codon)); }
public void TestEmtpyRuntimeSection2() { string addInText = @"<AddIn> <!-- Comment1 --> <Runtime> <!-- Comment2 --> </Runtime> <!-- Comment3 --> </AddIn>"; AddIn addIn = AddIn.Load(new StringReader(addInText)); }
public void TestEmtpyRuntimeSection() { string addInText = @"<AddIn><Runtime/></AddIn>"; AddIn addIn = AddIn.Load(new StringReader(addInText)); }