Build.UpdateVersion.Program.GenerateVersionInfo C# (CSharp) Метод

GenerateVersionInfo() статический приватный Метод

static private GenerateVersionInfo ( System.DateTime now, string file ) : void
now System.DateTime
file string
Результат void
        static void GenerateVersionInfo(DateTime now, string file)
        {
            string version = null;

            if (System.IO.File.Exists(file))
            {
                string[] lines = System.IO.File.ReadAllLines(file);
                if (lines.Length > 0 && !String.IsNullOrEmpty(lines[0]))
                {
                    version = lines[0];
                }
            }

            // If the file does not exist, create it.
            if (version == null)
            {
                version = now.ToString("u").Split(' ')[0];
                System.IO.File.WriteAllLines(file, new string[] { version });
            }
        }