/// <summary> /// Pull and return the Ginger Version (in String format) which the Solution file was created with /// </summary> /// <param name="xmlFilePath"></param> /// <param name="xml"></param> /// <returns></returns> public static string GetSolutonFileGingerVersion(string xmlFilePath, string xml = "") { string fileVersion; //get the XML if needed if (string.IsNullOrEmpty(xml)) { using (StreamReader reader = new StreamReader(xmlFilePath)) { //get XML reader.ReadLine();//no need first line xml = reader.ReadLine(); if (xml != null) { if (xml.ToLower().Contains("version") == false)//to handle new line gap in some old xml's { xml = reader.ReadLine(); } } else { Reporter.ToLog(eLogLevel.WARN, string.Format("Failed to get the Ginger Version of the file: '{0}'", xmlFilePath)); } } } //get the version based on XML type (new/old repository item type) if (string.IsNullOrEmpty(xml) == false) { if (RepositorySerializer.IsLegacyXmlType(xml) == true) { fileVersion = RepositorySerializer.GetXMLGingerVersion(xml, xmlFilePath); if (fileVersion == "3.0.0.0") { fileVersion = fileVersion + "Beta"; } } else { fileVersion = NewRepositorySerializer.GetXMLGingerVersion(xml, xmlFilePath);//New XML type } if (fileVersion == null) { Reporter.ToLog(eLogLevel.WARN, string.Format("Failed to get the Ginger Version of the file: '{0}'", xmlFilePath)); } return(fileVersion); } else { Reporter.ToLog(eLogLevel.WARN, string.Format("Failed to get the Ginger Version of the file: '{0}'", xmlFilePath)); return(null); } }