示例#1
0
        public static string UpgradeSolutionXMLFile(string xmlFilePath, string xml = "")
        {
            if (string.IsNullOrEmpty(xml))
            {
                xml = File.ReadAllText(xmlFilePath);
            }

            long xmlGingerVersion = SolutionUpgrade.GetSolutonFileGingerVersionAsLong(xmlFilePath, xml);

            if (xmlGingerVersion <= 0)
            {
                return(null);                      //failed to get the version
            }
            XMLConverterBase.eGingerFileType FileType = XMLConverterBase.GetGingerFileTypeFromFilename(xmlFilePath);

            return(Upgrade(FileType, xml, xmlGingerVersion, xmlFilePath));
        }
示例#2
0
        public static string UpgradeSolutionXMLFileIfNeeded(string xmlFilePath, string xml = "")
        {
            if (string.IsNullOrEmpty(xml))
            {
                xml = File.ReadAllText(xmlFilePath);
            }

            long xmlGingerVersion = SolutionUpgrade.GetSolutonFileGingerVersionAsLong(xmlFilePath, xml);

            if (xmlGingerVersion <= 0)
            {
                return(null);                      //failed to get the version
            }
            if (RepositorySerializer.GetCurrentGingerVersionAsLong() > xmlGingerVersion)
            {
                //upgrade
                GingerCore.XMLConverters.XMLConverterBase.eGingerFileType FileType = XMLConverterBase.GetGingerFileTypeFromFilename(xmlFilePath);
                return(Upgrade(FileType, xml, xmlGingerVersion, xmlFilePath));
            }
            else
            {
                return(xml);
            }
        }