public void OnOutputUpdatableVersionListData(Platform platform, string versionListPath, int versionListLength, int versionListHashCode, int versionListZipLength, int versionListZipHashCode)
        {
            if (string.IsNullOrEmpty(m_outputDirectory))
            {
                return;
            }
            string platformName    = GetPlatformVersion(platform) + "Version.txt";
            string versionInfoPath = Path.Combine(m_outputDirectory, platformName);

            if (File.Exists(versionInfoPath))
            {
                File.Delete(versionInfoPath);
            }

            EditorVersion editorVersion = new EditorVersion();

            editorVersion.VersionListLength       = versionListLength;
            editorVersion.VersionListHashCode     = versionListHashCode;
            editorVersion.VersionListZipLength    = versionListZipLength;
            editorVersion.VersionListZipHashCode  = versionListZipHashCode;
            editorVersion.ForceUpdateGame         = false;
            editorVersion.InternalResourceVersion = m_internalResourceVersion;
            editorVersion.LatestGameVersion       = "0.1.0";
            editorVersion.UpdatePrefixUri         = "http://192.168.8.157/RemoteResource/{0}";
            editorVersion.END_OF_JSON             = "";
            File.WriteAllText(versionInfoPath, EditorJsonUtility.ToJson(editorVersion, true));
        }
Example #2
0
        internal static bool TryGetEditorInfo(EditorVersion editorVersion, out Version vsVersion, out string vsInstallDirectory)
        {
            var majorVersion = EditorVersionUtil.GetMajorVersionNumber(editorVersion);

            return(majorVersion < 15
                ? TryGetEditorInfoLegacy(majorVersion, out vsVersion, out vsInstallDirectory)
                : TryGetEditorInfoWillow(majorVersion, out vsVersion, out vsInstallDirectory));
        }
Example #3
0
        public static int GetMajorVersionNumber(EditorVersion version)
        {
            switch (version)
            {
            case EditorVersion.Vs2012: return(11);

            case EditorVersion.Vs2013: return(12);

            case EditorVersion.Vs2015: return(14);

            case EditorVersion.Vs2017: return(15);

            default: throw new Exception($"Unexpected enum value {version}");
            }
        }
Example #4
0
        internal static bool TryGetEditorInfo(out EditorVersion editorVersion, out Version vsVersion, out string vsvsInstallDirectory)
        {
            foreach (var e in EditorVersionUtil.All)
            {
                if (TryGetEditorInfo(e, out vsVersion, out vsvsInstallDirectory))
                {
                    editorVersion = e;
                    return(true);
                }
            }

            vsVersion            = default;
            vsvsInstallDirectory = null;
            editorVersion        = default;
            return(false);
        }
Example #5
0
        private static int GetVersionNumber(EditorVersion version)
        {
            switch (version)
            {
            case EditorVersion.Vs2010: return(10);

            case EditorVersion.Vs2012: return(11);

            case EditorVersion.Vs2013: return(12);

            case EditorVersion.Vs2015: return(14);

            default:
                throw new Exception(string.Format("Unexpected enum value {0}", version));
            }
        }
Example #6
0
        /// <summary>
        /// Load the list of editor assemblies into the specified catalog list.  This method will
        /// throw on failure
        /// </summary>
        private static IEnumerable <ComposablePartCatalog> GetEditorCatalogs(EditorVersion editorVersion)
        {
            string version;
            string installDirectory;

            if (!TryGetEditorInfo(editorVersion, out version, out installDirectory))
            {
                throw new Exception("Unable to calculate the version of Visual Studio installed on the machine");
            }

            if (!TryLoadInteropAssembly(installDirectory))
            {
                var message = string.Format("Unable to load the interop assemblies.  Install directory is: {0}", installDirectory);
                throw new Exception(message);
            }

            // Load the core editor compontents from the GAC
            var versionInfo = string.Format(", Version={0}, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL", version);

            foreach (var name in EditorComponents)
            {
                var simpleName    = name.Substring(0, name.Length - 4);
                var qualifiedName = simpleName + versionInfo;

                Assembly assembly;
                try
                {
                    assembly = Assembly.Load(qualifiedName);
                }
                catch (Exception e)
                {
                    var msg = string.Format("Unable to load editor dependency {0}", name);
                    throw new Exception(msg, e);
                }

                yield return(new AssemblyCatalog(assembly));
            }
        }
Example #7
0
        /// <summary>
        /// Load the list of editor assemblies into the specified catalog list.  This method will
        /// throw on failure
        /// </summary>
        private static IEnumerable<ComposablePartCatalog> GetEditorCatalogs(EditorVersion editorVersion)
        {
            string version;
            string installDirectory;
            if (!TryGetEditorInfo(editorVersion, out version, out installDirectory))
            {
                throw new Exception("Unable to calculate the version of Visual Studio installed on the machine");
            }

            if (!TryLoadInteropAssembly(installDirectory))
            {
                var message = string.Format("Unable to load the interop assemblies.  Install directory is: {0}", installDirectory);
                throw new Exception(message);
            }

            // Load the core editor compontents from the GAC
            var versionInfo = string.Format(", Version={0}, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL", version);
            foreach (var name in EditorComponents)
            {
                var simpleName = name.Substring(0, name.Length - 4);
                var qualifiedName = simpleName + versionInfo;

                Assembly assembly;
                try
                {
                    assembly = Assembly.Load(qualifiedName);
                }
                catch (Exception e)
                {
                    var msg = string.Format("Unable to load editor dependency {0}", name);
                    throw new Exception(msg, e);
                }

                yield return new AssemblyCatalog(assembly);
            }
        }
Example #8
0
        public static string GetShortVersionString(EditorVersion version)
        {
            var number = GetMajorVersionNumber(version);

            return(string.Format("{0}.0", number));
        }
Example #9
0
 private static string GetShortVersionString(EditorVersion version)
 {
     var number = GetVersionNumber(version);
     return string.Format("{0}.0", number);
 }
Example #10
0
 private static int GetVersionNumber(EditorVersion version)
 {
     switch (version)
     {
         case EditorVersion.Vs2010: return 10;
         case EditorVersion.Vs2012: return 11;
         case EditorVersion.Vs2013: return 12;
         case EditorVersion.Vs2015: return 14;
         default:
             throw new Exception(string.Format("Unexpected enum value {0}", version));
     }
 }
Example #11
0
 private static bool TryGetEditorInfo(EditorVersion editorVersion, out string fullVersion, out string installDirectory)
 {
     var shortVersion = GetShortVersionString(editorVersion);
     return TryGetEditorInfoCore(shortVersion, out fullVersion, out installDirectory);
 }
Example #12
0
 public void EditorVersionTests_Older()
 {
     Assert.True(EditorVersion.IsEditorOlderThan("2019.2.10f1", "2020.1.1f1"));
     Assert.True(EditorVersion.IsEditorOlderThan("2019.2.10f1", "2019.3.1f1"));
     Assert.True(EditorVersion.IsEditorOlderThan("2019.2.10f1", "2019.2.11f1"));
 }
Example #13
0
 public void EditorVersionTests_Newer()
 {
     Assert.False(EditorVersion.IsEditorOlderThan("2019.2.10f1", "2018.100.100f1"));
     Assert.False(EditorVersion.IsEditorOlderThan("2019.2.10f1", "2019.1.100f1"));
     Assert.False(EditorVersion.IsEditorOlderThan("2019.2.10f1", "2019.2.1f1"));
 }
Example #14
0
 public void EditorVersionTests_Equals()
 {
     Assert.False(EditorVersion.IsEditorOlderThan("2019.1.10f1", "2019.1.10f1"));
 }
Example #15
0
        private static bool TryGetEditorInfo(EditorVersion editorVersion, out string fullVersion, out string installDirectory)
        {
            var shortVersion = GetShortVersionString(editorVersion);

            return(TryGetEditorInfoCore(shortVersion, out fullVersion, out installDirectory));
        }
Example #16
0
        public static string GetShortVersionString(EditorVersion version)
        {
            var number = GetMajorVersionNumber(version);

            return($"{number}.0");
        }