public bool Initialize(string taskName, IDictionary <string, TaskPropertyInfo> parameterGroup, string taskBody, IBuildEngine taskFactoryLoggingHost) { var projectFileDirectory = Path.GetDirectoryName(taskFactoryLoggingHost.ProjectFileOfTaskNode); var thisAssemblyDirectory = Path.GetDirectoryName(this.GetType().Assembly.Location); _assemblyResolver.BeginResolving(thisAssemblyDirectory, projectFileDirectory); try { var engine = Ruby.CreateEngine(); _taskScriptScope = engine.CreateScope(); _taskScriptScope.ExecuteEmbeddedScript(RubyTaskScript); var rubyTaskBody = TaskBodyParser.Parse(taskBody); var scriptFile = projectFileDirectory.CombinePath(rubyTaskBody.Script).ToFullPath(); var scriptContents = _fileSystem.GetFileContent(scriptFile); _taskScriptScope.Execute(scriptContents); _taskClass = engine.Runtime.Globals.GetVariable(taskName); } catch (Exception) { _assemblyResolver.Dispose(); throw; } return(true); }
public void TestFolderPathOfInvalidFormatNoFolders() { string folderPath = @"\\[email protected]"; List <string> folders; string store; TaskBodyParser.ParseStoreAndFolders(folderPath, out store, out folders); }
public void TestFolderPathWithSubjectIncluded() { string line = @"MailLink=\\[email protected]\Inbox:ENTRY_ID:GUID-GUID:Re:Re:Re:This was original subject"; string entryId; string folderPath; string guid; string subject; TaskBodyParser.GetFolderPathAndEntryId(line, out folderPath, out entryId, out guid, out subject); Assert.AreEqual("Re:Re:Re:This was original subject", subject); }
public void TestLineWithoutEntryId() { //\\[email protected]\ByggR\Driftsättningar\Enköping //\\[email protected]\Inbox string line = @"MailLink=\\[email protected]\Inbox"; string entryId; string folderPath; string guid; string subject; TaskBodyParser.GetFolderPathAndEntryId(line, out folderPath, out entryId, out guid, out subject); }
public void TestFolderPathOneLevel() { //\\[email protected]\ByggR\Driftsättningar\Enköping //\\[email protected]\Inbox string folderPath = @"\\[email protected]\Inbox"; List <string> folders; string store; TaskBodyParser.ParseStoreAndFolders(folderPath, out store, out folders); Assert.AreEqual("*****@*****.**", store); Assert.AreEqual(1, folders.Count); Assert.AreEqual("Inbox", folders[0]); }
public void TestSimpleCorrectLine() { //\\[email protected]\ByggR\Driftsättningar\Enköping //\\[email protected]\Inbox string line = @"MailLink=\\[email protected]\Inbox:ENTRY_ID:GUID-GUID"; string entryId; string folderPath; string guid; string subject; TaskBodyParser.GetFolderPathAndEntryId(line, out folderPath, out entryId, out guid, out subject); Assert.AreEqual(@"\\[email protected]\Inbox", folderPath); Assert.AreEqual("ENTRY_ID", entryId); Assert.AreEqual("GUID-GUID", guid); }
private void ThisAddIn_SelectionChange() { if (Application.ActiveExplorer().Selection.Count > 0) { var item = Application.ActiveExplorer().Selection[1]; if (item is TaskItem) { TaskItem taskItem = item as TaskItem; _taskPaneControl.Subject = taskItem.Subject; _taskPaneControl.FolderPath = ""; _taskPaneControl.EntryId = ""; TaskBodyParser taskBodyParser = new TaskBodyParser(taskItem, Application.Session.Stores as Stores); var messages = taskBodyParser.ParseBody(); _taskPaneControl.SetLinkedMessages(messages); } else if (item is MailItem) { MailItem mailItem = item as MailItem; _taskPaneControl.Subject = mailItem.Subject; _taskPaneControl.FolderPath = GetFolderPathForMailItem(mailItem); UserProperty userProperty = Utils.GetGtdGuidFromMailItem(mailItem); if (userProperty != null) { _taskPaneControl.EntryId = userProperty.Value.ToString(); } else { _taskPaneControl.EntryId = mailItem.EntryID; } //_taskPaneControl.EntryId = guid; _taskPaneControl.ClearLinkedMessages(); } } }