Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        public void TestFolderPathOfInvalidFormatNoFolders()
        {
            string        folderPath = @"\\[email protected]";
            List <string> folders;
            string        store;

            TaskBodyParser.ParseStoreAndFolders(folderPath, out store, out folders);
        }
Exemplo n.º 3
0
        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);
        }
Exemplo n.º 4
0
        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);
        }
Exemplo n.º 5
0
        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]);
        }
Exemplo n.º 6
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);
        }
Exemplo n.º 7
0
        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();
                }
            }
        }