Esempio n. 1
0
 public void UpdateHeader()
 {
     RepositoryItemHeader.Version++;
     RepositoryItemHeader.GingerVersion = GingerVersion.GetCurrentVersion();
     RepositoryItemHeader.LastUpdateBy  = Environment.UserName;
     RepositoryItemHeader.LastUpdate    = DateTime.UtcNow;
 }
Esempio n. 2
0
        /// <summary>
        /// Checks the Ginger version in the file and compare it to current Ginger version.
        /// returns 0 if file was created with the same version, -1 if created with lower version and 1 if created with newer version
        /// </summary>
        /// <param name="FileName"></param>
        /// <returns></returns>
        public static int CompareRepoFileVersionToCurrent(string FileName, ref string fileVersion)
        {
            //TODO: return code should be enum not int to make it easy read
            string line1, line2;

            using (StreamReader reader = new StreamReader(FileName))
            {
                line1 = reader.ReadLine();
                line2 = reader.ReadLine();

                long currentVersion = GingerVersion.GetCurrentVersionAsLong();
                fileVersion = GetXMLVersion(line2);
                long fileXmlVersion = GetXMLVersionAsLong(line2);

                if (currentVersion == fileXmlVersion)
                {
                    return(0); //same version
                }
                else if (currentVersion > fileXmlVersion)
                {
                    return(-1); //File is from lower version
                }
                else if (currentVersion < fileXmlVersion)
                {
                    return(1); //File is from newer version
                }
                else
                {
                    return(-2);//failed to identify and compare the version
                }
            }
        }
Esempio n. 3
0
        public void InitHeader()
        {
            RepositoryItemHeader = new RepositoryItemHeader()
            {
                Created       = GetUTCDateTime(),
                CreatedBy     = Environment.UserName,
                GingerVersion = GingerVersion.GetCurrentVersion(),
                LastUpdate    = GetUTCDateTime()

                                //TODO: other fields
            };
        }