Пример #1
0
        private void ConvertFileElement(XElement element)
        {
            if (null == element.Attribute("Id"))
            {
                XAttribute attribute = element.Attribute("Name");

                if (null == attribute)
                {
                    attribute = element.Attribute("Source");
                }

                if (null != attribute)
                {
                    string name = Path.GetFileName(attribute.Value);

                    if (this.OnError(ConverterTestType.AssignAnonymousFileId, element, "The file id is being updated to '{0}' to ensure it remains the same as the default", name))
                    {
                        IEnumerable <XAttribute> attributes = element.Attributes().ToList();
                        element.RemoveAttributes();
                        element.Add(new XAttribute("Id", Common.GetIdentifierFromName(name)));
                        element.Add(attributes);
                    }
                }
            }
        }
Пример #2
0
 /// <summary>
 /// Create an identifier based on passed file name
 /// </summary>
 /// <param name="name">File name to generate identifer from</param>
 /// <returns></returns>
 public string CreateIdentifierFromFilename(string filename)
 {
     return(Common.GetIdentifierFromName(filename));
 }