Esempio n. 1
0
        static void UpdateVersion()
        {
            var path   = FRPackagerPaths.GetRecorderVersionFilePath();
            var script = File.ReadAllText(path);

            var tag         = "public const string Version = ";
            var startOffset = script.IndexOf(tag);
            var endOffset   = script.IndexOf("\"", startOffset + tag.Length + 1);

            var pattern = script.Substring(startOffset, endOffset - startOffset);

            startOffset = pattern.LastIndexOf(".");
            var newValue = pattern.Substring(0, startOffset + 1) + DateTime.Now.ToString("yyMMdd-hh");

            script = script.Replace(pattern, newValue);
            File.WriteAllText(path, script);
        }
        static void UpdateVersion(int delta)
        {
            var path   = FRPackagerPaths.GetRecorderVersionFilePath();
            var script = File.ReadAllText(path);

            var tag         = "public static int BuildNumber";
            var startOffset = script.IndexOf(tag);

            var endOffset = script.IndexOf(";", startOffset);
            var pattern   = script.Substring(startOffset, endOffset - startOffset);

            RecorderVersion.BuildNumber += delta;
            script = script.Replace(pattern, string.Format("public static int BuildNumber = {0}", RecorderVersion.BuildNumber));
            File.WriteAllText(path, script);
            AssetDatabase.Refresh();

            Debug.Log("Version Tag set to: " + RecorderVersion.Tag);
        }