Esempio n. 1
0
        /// <summary>
        /// 创建新的案例项目文件。
        /// </summary>
        /// <param name="caseInfo">案例信息。</param>
        /// <returns>CPConfiguration 类型实例。</returns>
        public static CPConfiguration Create(CaseInfo caseInfo)
        {
            XDocument doc           = XmlEmbeddedResourceResolver.GetXmlTemplate("CaseProjectTemplate.cp");
            XElement  propertyGroup = doc.Root.Element("PropertyGroup");

            propertyGroup.Element("Id").Value     = caseInfo.Id;
            propertyGroup.Element("Name").Value   = caseInfo.Name ?? String.Empty;
            propertyGroup.Element("Number").Value = caseInfo.Number ?? String.Empty;
            propertyGroup.Element("Type").Value   = caseInfo.Type ?? String.Empty;
            propertyGroup.Element("Author").Value = caseInfo.Author ?? String.Empty;
            caseInfo.Timestamp = DateTime.Now;
            propertyGroup.Element("Timestamp").Value = caseInfo.Timestamp.ToString("s");

            try
            {
                return(new CPConfiguration(doc, true));
            }
            catch (FormatException)
            {
                return(null);
            }
            catch (Exception)
            {
                return(null);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// 创建新的提取配置文件。
        /// </summary>
        /// <param name="type">设备类型。</param>
        /// <returns>DPConfiguration 类型实例。</returns>
        public static DPConfiguration Create(String type)
        {
            XDocument doc = XmlEmbeddedResourceResolver.GetXmlTemplate("DeviceExtractionProjectTemplate.dp");

            return(new DPConfiguration(type, doc));
        }