Exemplo n.º 1
0
        /// <summary>
        /// Get item for type and identifier.
        /// </summary>
        /// <param name="type">Type of item.</param>
        /// <param name="ident">Identifier of item.</param>
        /// <returns>Unspecified common item.</returns>
        public IItem get(ItemType type, Ident ident)
        {
            bool isFull = (ident.guid != null && ident.item != null);

            switch (type)
            {
            case ItemType.EW:
            {
                // check with part from identifier
                IItem item = itemEW.FirstOrDefault(i => (isFull && ident.guid.CompareGuids(i.Key.guid) && ident.item == i.Key.item) ||
                                                   (!isFull && ident.guid != null && ident.guid.CompareGuids(i.Key.guid)) ||
                                                   (!isFull && ident.item != null && ident.item == i.Key.item)
                                                   ).Value;

                if (item == null && isFull)
                {
                    itemEW[ident] = new ItemEW();
                    return(itemEW[ident]);
                }
                else if (item == null && ident.item == Settings._.DefaultOWPItem)      //TODO:
                {
                    return(new ItemEW());
                }
                else if (item == null)
                {
                    throw new NotFoundException("OWP Items-EW: The '{0}:{1}' is not found.", ident.guid, ident.item);
                }
                return(item);
            }
            }
            throw new NotFoundException("OWP Items: Type '{0}' is not supported.", type);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Get item for type and identifier.
        /// </summary>
        /// <param name="type">Type of item.</param>
        /// <param name="ident">Identifier of item.</param>
        /// <returns>Unspecified common item.</returns>
        public IItem get(ItemType type, Ident ident)
        {
            bool isFull = (ident.guid != null && ident.item != null);
            switch(type)
            {
                case ItemType.EW:
                {
                    // check with part from identifier
                    IItem item = itemEW.FirstOrDefault(i => (isFull && ident.guid.CompareGuids(i.Key.guid) && ident.item == i.Key.item)
                                                                || (!isFull && ident.guid != null && ident.guid.CompareGuids(i.Key.guid))
                                                                || (!isFull && ident.item != null && ident.item == i.Key.item)
                                                      ).Value;

                    if(item == null && isFull) {
                        itemEW[ident] = new ItemEW();
                        return itemEW[ident];
                    }
                    else if(item == null && ident.item == Settings._.DefaultOWPItem) { //TODO:
                        return new ItemEW();
                    }
                    else if(item == null) {
                        throw new NotFoundException("OWP Items-EW: The '{0}:{1}' is not found.", ident.guid, ident.item);
                    }
                    return item;
                }
            }
            throw new NotFoundException("OWP Items: Type '{0}' is not supported.", type);
        }
Exemplo n.º 3
0
 public void extractTest3()
 {
     string rawdata = @"11>windows\Search.cpp(2246): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int";
     ItemEW target = new ItemEW();
     target.updateRaw(rawdata);
     Assert.IsTrue(target.ErrorsCount == 1);
     Assert.IsTrue(target.WarningsCount < 1);
 }
Exemplo n.º 4
0
 public void extractTest2()
 {
     string rawdata = @"9>C:\VC\atlmfc\include\atlhost.h(422): warning C4505: 'ATL::CAxHostWindow::AddRef' : unreferenced local function has been removed";
     ItemEW target = new ItemEW();
     target.updateRaw(rawdata);
     Assert.IsTrue(target.ErrorsCount < 1);
     Assert.IsTrue(target.WarningsCount == 1);
 }