Пример #1
0
        public IHttpActionResult Delete(int lookupID, string feedid, string feedvalue)
        {
            try
            {
                throw new NotImplementedException("This endpoint is not currently fleshed out");
            }
            catch (Exception Ex)
            {
                DEUtilities.LogMessage(string.Format("[{0}] {1}", System.Reflection.MethodBase.GetCurrentMethod().Name, Ex.Message), DEUtilities.LogLevel.Error, Ex);
                return(Content(HttpStatusCode.NotImplemented, ""));
            }

            /*
             * // This code will simply delete all of the feeds, not a specific one
             * try
             * {
             *    if (!dbDal.DeletedRuleFeed(lookupID))
             *    {
             *      return this.StatusCode(HttpStatusCode.InternalServerError);
             *    }
             * }
             * catch (NpgsqlException e)
             * {
             *    return Content(HttpStatusCode.InternalServerError, "Database error occurred");
             * }
             * catch (Exception e)
             * {
             *    return Content(HttpStatusCode.InternalServerError, "Failed to delete the source value rule");
             * }
             * return Ok();*/
        }
Пример #2
0
        /// <summary>
        /// Archives a DE Message
        /// </summary>
        /// <param name="de">DE message to archive</param>
        /// <param name="sourceip">Source IP Address of the message</param>
        public bool ArchiveDE(DEv1_0 de, string sourceip)
        {
            bool              wasSuccessful     = false;
            NpgsqlCommand     command           = null;
            NpgsqlTransaction sqlTrans          = null;
            NpgsqlConnection  currentConnection = null;

            try
            {
                currentConnection = GetDatabaseConnection();
                if (OpenConnection(currentConnection) == false)
                {
                    return(wasSuccessful);
                }
                sqlTrans            = currentConnection.BeginTransaction();
                command             = currentConnection.CreateCommand();
                command.Transaction = sqlTrans;

                //add DE first
                //assumes calling function will wrap this in a try catch block
                //allows the error to be thrown to the calling function
                int iHash = DEUtilities.ComputeDELookupID(de);

                string sTable   = QualifiedTableName(TableNames.MessageArchive);
                string sColumns = MessageArchiveColumns.DELookupID + "," + MessageArchiveColumns.DistributionID + "," + MessageArchiveColumns.SenderID + "," +
                                  MessageArchiveColumns.DateTimeSent + "," + MessageArchiveColumns.SenderIP + "," + MessageArchiveColumns.DateTimeLogged + "," + MessageArchiveColumns.DE;
                command.CommandText = "INSERT INTO " + sTable + " (" + sColumns + ") VALUES (@DEHash, @DistributionID, @SenderID, @DateTimeSent, @SourceIP, @DateTimeLogged, @DEv1_0)";
                command.Parameters.Clear();
                AddParameter(command, NpgsqlDbType.Integer, "DEHash", iHash);
                AddParameter(command, NpgsqlDbType.Text, "DistributionID", de.DistributionID);
                AddParameter(command, NpgsqlDbType.Text, "SenderID", de.SenderID);
                AddParameter(command, NpgsqlDbType.TimestampTZ, "DateTimeSent", de.DateTimeSent);
                AddParameter(command, NpgsqlDbType.Text, "SourceIP", sourceip);
                AddParameter(command, NpgsqlDbType.TimestampTZ, "DateTimeLogged", DateTime.UtcNow);
                AddParameter(command, NpgsqlDbType.Xml, "DEv1_0", de.ToString());
                Log.Debug(command.CommandText);
                command.ExecuteNonQuery();
                sqlTrans.Commit();
                wasSuccessful = true;
            }
            catch (Exception Ex)
            {
                Log.Error("General Error in AddedDEToCache()", Ex);
                this.WasRolledBackTransaction(sqlTrans);
            }
            finally
            {
                CloseConnection(currentConnection);
            }

            return(wasSuccessful);
        }
Пример #3
0
        public ActionResult GetEnhancedDetails(int id)
        {
            DEv1_0 de = dbDal.ReadDE(id);

            ContentObject co = de.ContentObjects[0];

            EMLCContent evtHelper = (EMLCContent)DEUtilities.FeedContent(de, co);
            string      addr      = DEUtilities.ReverseGeocodeLookup(evtHelper.Location().Latitude.ToString(), evtHelper.Location().Longitude.ToString());

            DE_Details_ViewModel vm = new DE_Details_ViewModel(evtHelper, addr, de.DateTimeSent);

            // return partial view, not full view
            return(PartialView("DE_View_partial", vm));
        }
Пример #4
0
        public IHttpActionResult FederationRequest([FromBody] FederationRequestDTO federationRequest)
        {
            // If the request is null
            if (federationRequest == null)
            {
                logger.Warn("Empty federation request");
                return(Content(HttpStatusCode.BadRequest, "Empty federation request"));
            }

            logger.Debug(string.Format("Received Federation Request: {0}", federationRequest.ToXMLString()));
            DEv1_0 de = DEUtilities.DeserializeDE(federationRequest.DEXMLElement.ToString());

            FederateDE(de, federationRequest.FedURIs);
            return(this.StatusCode(HttpStatusCode.Accepted));
        }
Пример #5
0
        /// <summary>
        /// Simple constructor
        /// </summary>
        /// <param name="evt">NIEM EM_LC Event</param>
        public EMLCContent(Event evt, string deHash)
        {
            myEvent  = evt;
            myDeHash = deHash;
            ProcessEventDetails();

            try
            {
                xe = XElement.Parse(Properties.Resources.EventTypeCodeList);
            }
            catch (Exception e)
            {
                DEUtilities.LogMessage("Error in creating EMLCContent Content Helper", DEUtilities.LogLevel.Error, e);
                xe = null;
            }
        }
Пример #6
0
        public HttpResponseMessage Validate([FromBody] DEv1_0 value)
        {
            List <string> errorList = null;

            try
            {
                Log.Debug("Checking if DE Message is valid");
                string xml = value.ToString();   // Validates DE portion of message and writes to xml

                bool isValid = Fresh.Global.DEUtilities.ValidateNiemSchema(xml, out errorList);

                if (isValid)
                {
                    DEUtilities.LogMessage("The message is valid", DEUtilities.LogLevel.Info);
                    return(Request.CreateResponse(HttpStatusCode.OK, "Message is valid"));
                }
                else
                {
                    DEUtilities.LogMessage("The message was not valid", DEUtilities.LogLevel.Info);
                    string schemaErrorString = "";

                    foreach (string er in errorList)
                    {
                        schemaErrorString = schemaErrorString + er + "\n";
                    }

                    return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, "The DE was invalid: " + schemaErrorString));
                }
            }
            catch (IOException Ex)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, "The schema files could not be read"));
            }
            catch (FormatException Ex)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, "The schema files could not be parsed"));
            }
            catch (Exception Ex)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, "The message could not be validated"));
            }
        }
Пример #7
0
        public HttpResponseMessage Post([FromBody] FeedDTO value)
        {
            try
            {
                if (value == null)
                {
                    return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, "The request contained no feed data to create."));
                }

                if (value.LookupID == 0 && value.SourceID != null && value.SourceValue != null)
                {
                    int lookupID = DEUtilities.ComputeHash(new List <string> {
                        value.SourceID, value.SourceValue
                    });
                    value.LookupID = lookupID;
                }

                //create a new feed
                if (dbDal.AddedFeed(value))
                {
                    HttpResponseMessage msg = Request.CreateResponse(HttpStatusCode.Created, value);

                    string location = HttpContext.Current.Request.Url + "/" + value.LookupID;
                    msg.Headers.Location = new Uri(location);

                    return(msg);
                }
                else
                {
                    return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, "Error getting feed data."));
                }
            }
            catch (NpgsqlException e)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, "Database error occurred"));
            }
            catch (Exception e)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, "Failed to put get the feeds"));
            }
        }
Пример #8
0
        public HttpResponseMessage Put(int lookupID, [FromBody] DEv1_0 value)
        {
            string errMsg; // Holds error message

            //--- Validating the DE
            if (DEUtilities.ValidateDE(value, out errMsg) == false)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, errMsg));
            }

            //--- Checking if Update or Add

            // If false we are creating a DE. If true, this is an update.
            bool deExists;

            try
            {
                deExists = dbDal.DEExists(value);

                if (deExists)
                {
                    DEUtilities.LogMessage(string.Format("The DE with lookupID {0} exists.  This is an update.", lookupID), DEUtilities.LogLevel.Debug);
                }
                else
                {
                    DEUtilities.LogMessage(string.Format("The DE with lookupID {0} does not exist.  We are adding a new DE.", lookupID), DEUtilities.LogLevel.Debug);
                }
            }
            catch (NpgsqlException e)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, "Database error occurred."));
            }
            catch (Exception e)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, "Error occurred when validating the request."));
            }

            try
            {
                bool wasSuccessful = dbDal.PutDE(value);

                // If the operation was a success
                if (wasSuccessful)
                {
                    if (this.ArchiveEnabled)
                    {
                        string clientAddress = HttpContext.Current.Request.UserHostAddress;
                        archiveDal.ArchiveDE(value, clientAddress);
                    }

                    // If this was an update
                    if (deExists)
                    {
                        return(Request.CreateResponse(HttpStatusCode.OK, "Success"));
                    }
                    else // If this was an add
                    {
                        HttpResponseMessage msg = Request.CreateResponse(HttpStatusCode.Created, value);

                        // Getting location for new DE
                        string location = "" + HttpContext.Current.Request.Url;

                        if (!(location.Contains("" + lookupID)))
                        {
                            location = location.TrimEnd('/') + "/" + lookupID;
                        }

                        msg.Headers.Location = new Uri(location);

                        return(msg);
                    }
                }
                else // If the operation failed
                {
                    // If this was an update
                    if (deExists)
                    {
                        errMsg = "Error occurred when updating the DE";
                    }
                    else // If this was an add
                    {
                        errMsg = "Error occurred when adding the DE";
                    }

                    return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, errMsg));
                }
            }
            catch (NpgsqlException e)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, "Database error occurred"));
            }
            catch (InvalidOperationException e)
            {
                if (deExists)
                {
                    return(Request.CreateErrorResponse(HttpStatusCode.Conflict, "This was not a valid update.  Make sure the updated DE message is valid and the most recent update."));
                }
                else
                {
                    return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, "Failed to add the DE"));
                }
            }
            catch (FederationException e)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, "Error occurred when federating the DE"));
            }
            catch (Exception e)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, "Failed to add the DE"));
            }
        }
Пример #9
0
        public HttpResponseMessage Post([FromBody] DEv1_0 value)
        {
            // Not a Valid DE Message
            if (value == null)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, "The message was not a valid format.  The DE could not be created"));
            }

            string erMsg;

            if (DEUtilities.ValidateDE(value, out erMsg) == false)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, erMsg));
            }

            // Getting DE lookup ID
            int deID = DEUtilities.ComputeDELookupID(value);

            if (value.DistributionType == TypeValue.Update)
            {
                return(Put(deID, value));
            }
            else if (value.DistributionType == TypeValue.Cancel)
            {
                if (this.ArchiveEnabled)
                {
                    string clientAddress = HttpContext.Current.Request.UserHostAddress;
                    archiveDal.ArchiveDE(value, clientAddress);
                }

                return(Delete(deID));
            }
            else if (value.DistributionType == TypeValue.Report)
            {
                try
                {
                    if (dbDal.CreatedDE(value, out deID))
                    {
                        DELiteDTO retVal = new DELiteDTO();
                        retVal.LookupID       = deID;
                        retVal.DateTimeSent   = value.DateTimeSent;
                        retVal.DistributionID = value.DistributionID;
                        retVal.SenderID       = value.SenderID;
                        this.CreatedAtRoute("GetSingleDERule", new
                        {
                            lookupID = deID
                        }, value);
                        if (this.ArchiveEnabled)
                        {
                            string clientAddress = HttpContext.Current.Request.UserHostAddress;
                            archiveDal.ArchiveDE(value, clientAddress);
                        }
                        return(Request.CreateResponse(HttpStatusCode.Created, retVal));
                    }
                    else
                    {
                        // something went wrong
                        return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, "The DE could not be created"));
                    }
                }
                catch (ArgumentNullException e)
                {
                    return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, "The DE was invalid"));
                }
                catch (NpgsqlException e)
                {
                    return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, "Database error occurred"));
                }
                catch (FederationException e)
                {
                    return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, "Error occurred when federating the DE"));
                }
                catch (Exception e)
                {
                    return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, "Error occurred when adding the DE"));
                }
            }
            else
            {
                return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, "Unsupported DE Distribution Type Found"));
            }
        }
Пример #10
0
        /// <summary>
        /// Base method, writes to stream
        /// </summary>
        /// <param name="type">type of object to write</param>
        /// <param name="value">object to write</param>
        /// <param name="writeStream">stream to write to</param>
        /// <param name="content">stuff</param>
        public override void WriteToStream(Type type, object value, Stream writeStream, HttpContent content)
        {
            DEv1_0 de  = value as DEv1_0;
            Event  evt = null;

            try
            {
                if (de != null)
                {
                    ContentObject co = de.ContentObjects[0];

                    EMLCContent evtHelper = (EMLCContent)DEUtilities.FeedContent(de, co);

                    var settings = new XmlWriterSettings();
                    settings.Indent             = false;
                    settings.OmitXmlDeclaration = false;

                    XmlWriter writer = XmlWriter.Create(writeStream, settings);
                    writer.WriteStartElement("html"); //html
                    writer.WriteStartElement("head"); //head
                    writer.WriteStartElement("meta");
                    writer.WriteAttributeString("charset", "UTF-8");

                    // We're returning some DE-related HTML, so set up the page to refresh every 5 seconds
                    // This is not a good way to do it long term.
                    //writer.WriteAttributeString("http-equiv", "refresh");
                    //string contentValue = $"5; URL={HttpContext.Current.Request.Url}";
                    //writer.WriteAttributeString("content", contentValue);

                    writer.WriteEndElement();         //meta
                    writer.WriteElementString("title", "TEST");
                    writer.WriteEndElement();         //head

                    writer.WriteStartElement("body"); //start body

                    writer.WriteStartElement("div");  //start div 1
                    writer.WriteAttributeString("style", "background-color:black;color:white;padding:5px;");

                    #region table
                    writer.WriteStartElement("table"); //start table
                    writer.WriteAttributeString("style", "color:white;");
                    #region row 1
                    writer.WriteStartElement("tr");  //start row

                    writer.WriteStartElement("td");  //start cell
                    writer.WriteAttributeString("style", "padding:15px;");
                    writer.WriteStartElement("img"); //start image
                    writer.WriteAttributeString("src", evtHelper.IconURL());
                    writer.WriteAttributeString("alt", evtHelper.FriendlyName());
                    writer.WriteEndElement();       //end image
                    writer.WriteEndElement();       //end cell

                    writer.WriteStartElement("td"); //start cell
                    writer.WriteElementString("h1", evtHelper.Title());
                    writer.WriteEndElement();       //end cell
                    writer.WriteEndElement();       //end row
                    #endregion row 1

                    #region row 2
                    writer.WriteStartElement("tr"); //start row
                    writer.WriteStartElement("td"); //start cell

                    writer.WriteAttributeString("colspan", "2");
                    writer.WriteValue(evtHelper.FriendlyName());

                    writer.WriteEndElement(); //end cell
                    writer.WriteEndElement(); //end row
                    #endregion row 2
                    writer.WriteEndElement(); //end table
                    #endregion table


                    writer.WriteEndElement(); //end div 1

                    // Loop through each kind of details and append HTML for each one
                    if (evtHelper.ResourceDetails != null)
                    {
                        foreach (ResourceDetail rd in evtHelper.ResourceDetails)
                        {
                            string sColor = "color:black";

                            writer.WriteStartElement("p"); //start paragraph
                            writer.WriteAttributeString("style", sColor);

                            if (rd.Status.PrimaryStatus == ResourcePrimaryStatusCodeList.Available)
                            {
                                sColor = "color:green";
                            }
                            else if (rd.Status.PrimaryStatus == ResourcePrimaryStatusCodeList.ConditionallyAvailable)
                            {
                                sColor = "color:yellow";
                            }
                            else if (rd.Status.PrimaryStatus == ResourcePrimaryStatusCodeList.NotAvailable)
                            {
                                sColor = "color:red";
                            }

                            writer.WriteElementString("p", "Latitude/Longitude: " + evtHelper.Location().Latitude.ToString() + ", " + evtHelper.Location().Longitude.ToString());
                            //writer.WriteElementString("p", "Lon: " + evtHelper.Location().Latitude.ToString());
                            string addr = DEUtilities.ReverseGeocodeLookup(evtHelper.Location().Latitude.ToString(), evtHelper.Location().Longitude.ToString());

                            if (string.IsNullOrWhiteSpace(addr))
                            {
                                addr = "Not Found";
                            }

                            writer.WriteElementString("p", "Address: " + addr); //+ some reverse lookup;

                            writer.WriteRaw("Primary Status: <span style=\"font-weight:bold;" + sColor + "\"> " + rd.Status.PrimaryStatus.ToString() + "</ span>" + " ");
                            writer.WriteEndElement(); //end paragraph
                        }
                    }

                    if (evtHelper.IncidentDetails != null)
                    {
                        foreach (IncidentDetail id in evtHelper.IncidentDetails)
                        {
                            string sColor = "color:black";

                            writer.WriteStartElement("p"); //start paragraph
                            writer.WriteAttributeString("style", sColor);
                            if (id.Status.PrimaryStatus == IncidentPrimaryStatusCodeList.Active)
                            {
                                sColor = "color:green";
                            }
                            else if (id.Status.PrimaryStatus == IncidentPrimaryStatusCodeList.Pending)
                            {
                                sColor = "color:orange";
                            }

                            string addr = "Not Found";
                            writer.WriteElementString("p", "Latitude/Longitude: " + evtHelper.Location().Latitude.ToString() + ", " + evtHelper.Location().Longitude.ToString());

                            if (id.LocationExtension != null && id.LocationExtension.Address != null)
                            {
                                addr = id.LocationExtension.Address.ToString();
                            }
                            else
                            {
                                //writer.WriteElementString("p", "Lon: " + evtHelper.Location().Latitude.ToString());
                                addr = DEUtilities.ReverseGeocodeLookup(evtHelper.Location().Latitude.ToString(), evtHelper.Location().Longitude.ToString());

                                if (string.IsNullOrWhiteSpace(addr))
                                {
                                    addr = "Not Found";
                                }
                            }
                            writer.WriteElementString("p", "Address: " + addr); //+ some reverse lookup;

                            writer.WriteRaw("Primary Status: <span style=\"font-weight:bold;" + sColor + "\"> " + id.Status.PrimaryStatus.ToString() + "</ span>" + " ");
                            writer.WriteEndElement(); //end paragraph
                        }
                    }

                    if (evtHelper.SensorDetails != null)
                    {
                        foreach (SensorDetail sensor in evtHelper.SensorDetails)
                        {
                            string sColor = "color:black;";

                            writer.WriteStartElement("p"); //start paragraph
                            writer.WriteAttributeString("style", sColor);
                            writer.WriteRaw("Sensor ID: " + sensor.ID + " ");
                            writer.WriteEndElement();      //end paragraph

                            writer.WriteStartElement("p"); //start paragraph
                            writer.WriteAttributeString("style", sColor);

                            if (sensor.Status == SensorStatusCodeList.Normal)
                            {
                                sColor = "color:green";
                            }
                            else if (sensor.Status == SensorStatusCodeList.LowPower)
                            {
                                sColor = "color:orange";
                            }
                            else if (sensor.Status == SensorStatusCodeList.Error)
                            {
                                sColor = "color:red";
                            }
                            else if (sensor.Status == SensorStatusCodeList.Sleeping)
                            {
                                sColor = "color:gray";
                            }
                            writer.WriteRaw("Primary Status: <span style=\"font-weight:bold;" + sColor + "\"> " + sensor.Status.ToString() + "</ span>" + " ");
                            writer.WriteEndElement(); //end paragraph

                            //assumes at least one item of device details is present
                            if (sensor.DeviceDetails != null)
                            {
                                CreateSensorDeviceInfo(writer, sensor.DeviceDetails);
                            }

                            if (sensor.PowerDetails != null)
                            {
                                CreateSensorPowerInfo(writer, sensor.PowerDetails);
                            }

                            if (sensor.PhysiologicalDetails != null)
                            {
                                CreateSensorPhysiologicalInfo(writer, sensor.PhysiologicalDetails);
                            }

                            if (sensor.EnvironmentalDetails != null)
                            {
                                CreateSensorEnvironmentalInfo(writer, sensor.EnvironmentalDetails);
                            }

                            if (sensor.LocationDetails != null)
                            {
                                CreateSensorLocationInfo(writer, sensor.LocationDetails);
                            }
                        }
                    }
                    writer.WriteEndElement(); //end body

                    writer.WriteEndElement(); //end html

                    writer.Flush();

                    writer.Close();
                }
            }
            catch (Exception e)
            {
                DEUtilities.LogMessage("An error occurred when trying to parse the DE", DEUtilities.LogLevel.Error);
                CreateErrorInfo(writeStream);
            }
        }
Пример #11
0
        /// <summary>
        /// Parses through the Icon File looking for a match on type and icon filename
        /// </summary>
        /// <param name="groupName">Group of icons to look for</param>
        /// <returns>Icon Fully Qualified Path</returns>
        private string GetIconFilename(string groupName)
        {
            string    iconFilename = "";
            IconSet   niemIcons    = null;
            IconGroup group        = null;

            //sanity check
            if (IconConfig.Icons != null)
            {
                foreach (IconSet iset in IconConfig.Icons.Sets)
                {
                    if (iset.KindofSet.Equals("NIEM", StringComparison.InvariantCultureIgnoreCase))
                    {
                        niemIcons = iset;
                        break;
                    }
                }

                if (niemIcons != null)
                {
                    foreach (IconGroup iGroup in niemIcons.Groups)
                    {
                        if (iGroup.KindofGroup.Equals(groupName, StringComparison.InvariantCultureIgnoreCase))
                        {
                            group = iGroup;
                            break;
                        }
                    }

                    if (group != null)
                    {
                        string   resourceType = myEvent.EventTypeDescriptor.CodeValue.ToString();
                        string[] splitType    = resourceType.Split('_');

                        string temp = "";
                        //TODO:assumes file extension is .png, need to fix later

                        //this loop strips off the right most subtype when looking for a match
                        //on file name
                        //For Exmample: ALS Ambulance type is
                        //ATOM_GRDTRK_EQT_GRDVEH_CVLVEH_EM_EMS_AMBULANCE_ALS
                        //each pass removes the right most subtype until either a match is found
                        //or beginning of the string is hit (which isn't good)
                        //ATOM_GRDTRK_EQT_GRDVEH_CVLVEH_EM_EMS_AMBULANCE_ALS
                        //ATOM_GRDTRK_EQT_GRDVEH_CVLVEH_EM_EMS_AMBULANCE
                        //ATOM_GRDTRK_EQT_GRDVEH_CVLVEH_EM_EMS
                        //ATOM_GRDTRK_EQT_GRDVEH_CVLVEH_EM
                        //...
                        for (int i = splitType.Length; i >= 0; i--)
                        {
                            temp = String.Join("_", splitType, 0, i) + ".png";

                            DEUtilities.LogMessage("Searching for icon filename: " + temp + " in NIEM group: " + groupName, DEUtilities.LogLevel.Debug);

                            if (group.Filenames.Contains(temp))
                            {
                                iconFilename = group.RootFolder + @"/" + temp;
                                break;
                            }
                        }

                        if (string.IsNullOrWhiteSpace(iconFilename))
                        {
                            DEUtilities.LogMessage("Icon filename not found for: " + resourceType, DEUtilities.LogLevel.Error);
                        }
                    }
                }
            }
            return(iconFilename);
        }