Esempio n. 1
0
    public static bool IsNewApiVersion(JsonData jsonData)
    {
        try
        {
            VersionNumber        versionNumber             = VersionNumber.Parse(jsonData["APIVer"].ToString());
            VersionNumber        currentApiVersionOnDevice = GetCurrentApiVersionOnDevice();
            CompareVersionNumber compareResult             =
                (CompareVersionNumber)currentApiVersionOnDevice.CompareTo(versionNumber);

            switch (compareResult)
            {
            case CompareVersionNumber.MajorGreater:
            case CompareVersionNumber.MinorGreater:
            case CompareVersionNumber.PacthGreater:
            case CompareVersionNumber.Error:
                return(true);

            case CompareVersionNumber.MajorLess:
            case CompareVersionNumber.MinorLess:
            case CompareVersionNumber.PatchLess:
            case CompareVersionNumber.Equal:
                return(false);

            default:
                return(true);
            }
        }
        catch (Exception e)
        {
            Debug.LogError(e);
            return(false);
        }
    }
Esempio n. 2
0
    private void OnCheckVersionMessageResponse(string response)
    {
#if UNITY_EDITOR
        if (Tracking)
        {
            PrintTrack(MethodBase.GetCurrentMethod().Name);
            PrintTrack("response: " + response);
        }
#endif

        _checkVersionMessageRef = null;

        if (string.IsNullOrEmpty(response))
        {
            Initialize();
            return;
        }

        CheckVersionResponseMessage responseMessage = CheckVersionResponseMessage.FromJson(response);
        if (responseMessage == null)
        {
            Initialize();
            return;
        }

        if (responseMessage.Status != BaseOnline.Success)
        {
            Initialize();
            return;
        }

        VersionNumber        currentApiVersionOnDevice = GetCurrentApiVersionOnDevice();
        CompareVersionNumber compareResult             =
            (CompareVersionNumber)currentApiVersionOnDevice.CompareTo(responseMessage.ApiVersion);

        switch (compareResult)
        {
        case CompareVersionNumber.MajorGreater:
        case CompareVersionNumber.MinorGreater:
        case CompareVersionNumber.PacthGreater:
        case CompareVersionNumber.Error:
            Initialize();
            break;

        case CompareVersionNumber.MajorLess:
        case CompareVersionNumber.MinorLess:
        case CompareVersionNumber.PatchLess:
            _updating = false;
            if (_onNewApiVersion != null)
            {
                _onNewApiVersion(currentApiVersionOnDevice, responseMessage.ApiVersion);
            }
            break;

        case CompareVersionNumber.Equal:
            FinishInit(_currentApiClientId, _currentToken);
            break;
        }
    }
Esempio n. 3
0
 /// <summary>
 /// IComparable.CompareTo implementation.
 /// </summary>
 /// <param name="obj">An object to compare with this instance.</param>
 /// <returns>
 /// A 32-bit signed integer that indicates the relative order of the objects being compared. The return value has these meanings: Value Meaning Less than zero This instance is less than obj. Zero This instance is equal to obj. Greater than zero This instance is greater than obj.
 /// </returns>
 /// <exception cref="T:System.ArgumentException">obj is not the same type as this instance. </exception>
 public int CompareTo(object obj)
 {
     if (obj is UpdateEntry)
     {
         UpdateEntry upd = (UpdateEntry)obj;
         if (VersionNumber.CompareTo(upd.VersionNumber) == 0) //Version numbers are equal
         {
             return(Version.CompareTo(upd.Version));
         }
         else
         {
             return(VersionNumber.CompareTo(upd.VersionNumber));
         }
     }
     throw new ArgumentException("object is not a UpdateEntry");
 }
Esempio n. 4
0
    private void OnInitMessageResponse(string response)
    {
#if UNITY_EDITOR
        if (Tracking)
        {
            PrintTrack(MethodBase.GetCurrentMethod().Name);
            PrintTrack("response: " + response);
        }
#endif

        _initializeAppMessageRef = null;

        if (string.IsNullOrEmpty(response))
        {
            FinishInit();
            return;
        }

        InitializeAppResponseMessage responseMessage = InitializeAppResponseMessage.FromJson(response);
        if (responseMessage == null)
        {
            FinishInit();
            return;
        }

        VersionNumber        currentApiVersionOnDevice = GetCurrentApiVersionOnDevice();
        CompareVersionNumber compareResult             =
            (CompareVersionNumber)currentApiVersionOnDevice.CompareTo(responseMessage.ApiVersion);

        if (compareResult == CompareVersionNumber.Equal)
        {
            _currentApiClientId = responseMessage.ApiclientId;
            _currentToken       = responseMessage.Token;
            FinishInit(responseMessage.ApiclientId, responseMessage.Token);
        }
        else
        {
            _updating = false;
            if (_onNewApiVersion != null)
            {
                _onNewApiVersion(currentApiVersionOnDevice, responseMessage.ApiVersion);
            }
        }
    }
        public void ShouldBeEqual(VersionNumber a, VersionNumber b)
        {
            (a > b).Should().BeFalse();
            (b < a).Should().BeFalse();

            (a < b).Should().BeFalse();
            (b > a).Should().BeFalse();

            (a != b).Should().BeTrue();
            (a == b).Should().BeFalse();

            a.CompareTo(b).Should().Be(0);
            a.Equals(b).Should().BeTrue();

            if (b != null)
            {
                b.CompareTo(a).Should().Be(0);
                b.Equals(a).Should().BeTrue();
            }
        }
Esempio n. 6
0
    private int CompareTo([CanBeNull] object obj)
    {
        //Returns 1 if this > object, 0 if this=object and -1 if this< object
        if (obj is null)
        {
            return(1);
        }

        if (!(obj is Release otherUpdateVersion))
        {
            throw new ArgumentException("Object is not a UpdateVersion");
        }

        //Extract Version Numbers and then compare them
        if (VersionNumber.CompareTo(otherUpdateVersion.VersionNumber) != 0)
        {
            return(VersionNumber.CompareTo(otherUpdateVersion.VersionNumber));
        }

        //We have the same version - now we have to get tricky and look at the extension (rc1, beta2 etc)
        //if both have no extension then they are the same
        if (string.IsNullOrWhiteSpace(Prerelease) && string.IsNullOrWhiteSpace(otherUpdateVersion.Prerelease))
        {
            return(0);
        }

        //If either are not present then you can assume they are FINAL versions and trump any rx1 verisons
        if (string.IsNullOrWhiteSpace(Prerelease))
        {
            return(1);
        }

        if (string.IsNullOrWhiteSpace(otherUpdateVersion.Prerelease))
        {
            return(-1);
        }

        //We have 2 suffixes
        //Compare alphabetically alpha1 < alpha2 < beta1 < beta2 < rc1 < rc2 etc
        return(string.Compare(Prerelease, otherUpdateVersion.Prerelease, StringComparison.OrdinalIgnoreCase));
    }
Esempio n. 7
0
        public int CompareTo(ProductVersion other)
        {
            var versionNumberComparison = VersionNumber.CompareTo(other.VersionNumber);

            //If the version numbers are equal
            if (versionNumberComparison == 0)
            {
                //Versions without a VersionSuffix do have a higher priority
                if (VersionSuffix == "" && other.VersionSuffix != "")
                {
                    return(1);
                }

                if (other.VersionSuffix == "" && VersionSuffix != "")
                {
                    return(-1);
                }

                if (String.Compare(VersionSuffix, other.VersionSuffix, StringComparison.Ordinal) == 0)
                {
                    return(0);
                }

                if (String.Compare(VersionSuffix, other.VersionSuffix, StringComparison.Ordinal) < 0)
                {
                    return(-1);
                }

                if (String.Compare(VersionSuffix, other.VersionSuffix, StringComparison.Ordinal) > 0)
                {
                    return(1);
                }
            }

            //The version numbers are not equal -> no comparison of the suffix necessary
            return(versionNumberComparison);
        }
 public int CompareTo(Version other)
 {
     // ensure versions are ordered from lowest version number to highest
     return(VersionNumber.CompareTo(other.VersionNumber));
 }
Esempio n. 9
0
    private void ShowBuildUI(string platform)
    {
        versionPart = EditorGUILayout.Foldout(versionPart, "已打版本");
        if (versionPart)
        {
            var versionList = GetVersions(m_ExportAssetBundleDir + platform + "/Version");
            if (versionList != null && versionList.Count > 0)
            {
                GUILayoutOption[] options =
                {
                    GUILayout.Width(150),
                    GUILayout.Height(20),
                };

                EditorGUILayout.BeginVertical();
                EditorGUILayout.Space();

                foreach (var v in versionList)
                {
                    if (!m_VersionMap.ContainsKey(v.ToString()))
                    {
                        m_VersionMap.Add(v.ToString(), -1);
                    }

                    var selectIndex = m_VersionMap[v.ToString()];
                    selectIndex = GUILayout.SelectionGrid(selectIndex, new string[] { v.ToString() }, 1);
                    m_VersionMap[v.ToString()] = selectIndex;

                    if (selectIndex == 0)
                    {
                        EditorGUILayout.BeginHorizontal();
                        EditorGUILayout.Space();

                        if (GUILayout.Button("浏览", options))
                        {
                            WindowsOSUtility.ExploreFile(m_ExportAssetBundleDir + platform + "/Version/" + v.ToString());
                        }

                        if (GUILayout.Button("检查ab包大小", options))
                        {
                            AssetBundleBuilder.CheckAssetBundleSize(m_ExportAssetBundleDir + platform + "/Version/" + v, ".pkg");
                        }

                        if (GUILayout.Button("取消查看", options))
                        {
                            m_VersionMap[v.ToString()] = -1;
                            Repaint();
                        }

                        if (GUILayout.Button("拷贝到StreamingAssets", options))
                        {
                            var targetPath = Application.dataPath + "/StreamingAssets/" + UGCoreConfig.MiddleFilePathName;
                            EditorFileUtility.ClearDirectory(targetPath);
                            EditorFileUtility.CopyDirectory(m_ExportAssetBundleDir + platform + "/Version/" + v.ToString(), targetPath);
                            AssetDatabase.Refresh();
                            WindowsOSUtility.ExploreFile(targetPath);
                        }

                        if (GUILayout.Button("拷贝到persistentDataPath", options))
                        {
                            var targetPath = Application.persistentDataPath + "/" + UGCoreConfig.MiddleFilePathName + "/" + UGCoreConfig.ResourcesFolderName;
                            EditorFileUtility.ClearDirectory(targetPath);
                            EditorFileUtility.CopyDirectory(m_ExportAssetBundleDir + platform + "/Version/" + v.ToString(), targetPath);
                            AssetDatabase.Refresh();
                            WindowsOSUtility.ExploreFile(targetPath);
                        }

                        if (GUILayout.Button("删除版本", options))
                        {
                            Directory.Delete(m_ExportAssetBundleDir + platform + "/Version/" + v.ToString(), true);
                            Repaint();
                        }
                        EditorGUILayout.Space();
                        EditorGUILayout.EndHorizontal();
                        EditorGUILayout.Space();
                    }
                }

                EditorGUILayout.Space();
                EditorGUILayout.EndVertical();
            }
        }

        patchPart = EditorGUILayout.Foldout(patchPart, "已打补丁");
        if (patchPart)
        {
            var patchList = GetPatches(m_ExportAssetBundleDir + platform + "/Patches");
            if (patchList != null && patchList.Count > 0)
            {
                GUILayoutOption[] options =
                {
                    GUILayout.Width(150),
                    GUILayout.Height(20),
                };

                EditorGUILayout.BeginVertical();
                EditorGUILayout.Space();

                foreach (var p in patchList)
                {
                    if (!m_VersionMap.ContainsKey(p.ToString()))
                    {
                        m_VersionMap.Add(p.ToString(), -1);
                    }

                    var selectIndex = m_VersionMap[p.ToString()];
                    selectIndex = GUILayout.SelectionGrid(selectIndex, new string[] { p.ToString() }, 1);
                    m_VersionMap[p.ToString()] = selectIndex;

                    if (selectIndex == 0)
                    {
                        EditorGUILayout.BeginHorizontal();
                        EditorGUILayout.Space();

                        if (GUILayout.Button("浏览", options))
                        {
                            WindowsOSUtility.ExploreFile(m_ExportAssetBundleDir + platform + "/Patches/" + p);
                        }

                        if (GUILayout.Button("取消查看", options))
                        {
                            m_VersionMap[p.ToString()] = -1;
                            Repaint();
                        }

                        if (GUILayout.Button("删除补丁", options))
                        {
                            Directory.Delete(m_ExportAssetBundleDir + platform + "/Patches/" + p, true);
                            Repaint();
                        }

                        EditorGUILayout.Space();
                        EditorGUILayout.EndHorizontal();
                        EditorGUILayout.Space();
                    }
                }

                EditorGUILayout.Space();
                EditorGUILayout.EndVertical();
            }
        }

        GUIContent[] guiBuildObjs =
        {
            new GUIContent("打版本"),
            new GUIContent("打补丁"),
        };

        GUILayout.BeginHorizontal();
        GUILayout.FlexibleSpace();
        m_BuildOperation = (BuildOperation)GUILayout.Toolbar((int)m_BuildOperation, guiBuildObjs);
        GUILayout.FlexibleSpace();
        GUILayout.EndHorizontal();

        if (m_BuildOperation == BuildOperation.Version)
        {
            m_CreateVersion = EditorGUILayout.TextField("打包版本号:", m_CreateVersion);

            GUILayoutOption[] options =
            {
                GUILayout.Width(150),
                GUILayout.Height(26),
            };
            GUILayout.FlexibleSpace();
            GUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();
            if (GUILayout.Button("重新打包版本(慎用)", options))
            {
                var versionNumber = ValidVersion(m_CreateVersion);
                if (versionNumber == null)
                {
                    GetWindow <AssetBundleBuildEditor>().ShowNotification(new GUIContent("版本名称不符合规范,请重新输入"));
                    return;
                }

                if (!Directory.Exists(m_ExportAssetBundleDir + platform + "/Version/" + versionNumber))
                {
                    GetWindow <AssetBundleBuildEditor>().ShowNotification(new GUIContent("版本号未经过打包,请使用打包版本选项来打包"));
                    return;
                }

                CreateVersion(m_ExportAssetBundleDir + platform + "/Version/" + versionNumber, true);
                WindowsOSUtility.ExploreFile(m_ExportAssetBundleDir + platform + "/Version/" + versionNumber);
            }
            if (GUILayout.Button("打包版本", options))
            {
                var versionNumber = ValidVersion(m_CreateVersion);
                if (versionNumber == null)
                {
                    GetWindow <AssetBundleBuildEditor>().ShowNotification(new GUIContent("版本名称不符合规范,请重新输入"));
                    return;
                }

                if (Directory.Exists(m_ExportAssetBundleDir + platform + "/Version/" + versionNumber))
                {
                    GetWindow <AssetBundleBuildEditor>().ShowNotification(new GUIContent("版本目录已经存在,请选择新的版本号或者清除现有的版本号目录"));
                    return;
                }

                var versionList = GetVersions(m_ExportAssetBundleDir + platform + "/Version");
                if (versionList != null && versionList.Count > 0)
                {
                    if (VersionNumber.CompareTo(versionList[versionList.Count - 1], versionNumber) > 0)
                    {
                        GetWindow <AssetBundleBuildEditor>().ShowNotification(new GUIContent("当前版本号低于最新的版本号,无法打包,请重新选择版本号"));
                        return;
                    }
                }

                CreateVersion(m_ExportAssetBundleDir + platform + "/Version/" + versionNumber);
                WindowsOSUtility.ExploreFile(m_ExportAssetBundleDir + platform + "/Version/" + versionNumber);
            }
            GUILayout.EndHorizontal();
        }
        else if (m_BuildOperation == BuildOperation.Patch)
        {
            var versionList = GetVersions(m_ExportAssetBundleDir + platform + "/Version");
            if (versionList != null && versionList.Count > 0)
            {
                List <string> versionStringList = new List <string>();
                foreach (var v in versionList)
                {
                    versionStringList.Add(v.ToString());
                }
                GUILayout.BeginHorizontal();
                EditorGUILayout.Space();

                GUILayout.BeginVertical();
                EditorGUILayout.LabelField("低版本");
                m_lowVersion = EditorGUILayout.Popup(m_lowVersion, versionStringList.ToArray());
                GUILayout.EndVertical();

                GUILayout.FlexibleSpace();

                GUILayout.BeginVertical();
                EditorGUILayout.LabelField("高版本");
                m_highVersion = EditorGUILayout.Popup(m_highVersion, versionStringList.ToArray());
                GUILayout.EndVertical();

                EditorGUILayout.Space();
                GUILayout.EndHorizontal();

                GUILayoutOption[] options =
                {
                    GUILayout.Width(150),
                    GUILayout.Height(26),
                };
                GUILayout.FlexibleSpace();
                GUILayout.BeginHorizontal();
                GUILayout.FlexibleSpace();

                if (GUILayout.Button("打补丁", options))
                {
                    if (VersionNumber.CompareTo(versionList[m_lowVersion], versionList[m_highVersion]) >= 0)
                    {
                        GetWindow <AssetBundleBuildEditor>().ShowNotification(new GUIContent("低版本号不能大于等于高版本号"));
                        return;
                    }

                    var patchName = versionList[m_lowVersion] + "-" + versionList[m_highVersion];

                    var fileMd5LowVersion =
                        AssetBundleBuilder.GetFilesMD5(
                            m_ExportAssetBundleDir + platform + "/Version/" + versionList[m_lowVersion], ".pkg");

                    var fileMd5HighVersion =
                        AssetBundleBuilder.GetFilesMD5(
                            m_ExportAssetBundleDir + platform + "/Version/" + versionList[m_highVersion], ".pkg");

                    Dictionary <string, string> lowVersionAssets = new Dictionary <string, string>();
                    foreach (var v in fileMd5LowVersion)
                    {
                        var str = v.Key.Replace(Path.GetFullPath(m_ExportAssetBundleDir + platform + "/Version/" + versionList[m_lowVersion] + "/"), "");
                        lowVersionAssets.Add(str, v.Value);
                    }

                    Dictionary <string, string> highVersionAssets = new Dictionary <string, string>();
                    foreach (var v in fileMd5HighVersion)
                    {
                        var str = v.Key.Replace(Path.GetFullPath(m_ExportAssetBundleDir + platform + "/Version/" + versionList[m_highVersion] + "/"), "");
                        highVersionAssets.Add(str, v.Value);
                    }

                    Dictionary <string, string> resultAssets = new Dictionary <string, string>();
                    foreach (var v in highVersionAssets)
                    {
                        if (!lowVersionAssets.ContainsKey(v.Key))
                        {
                            resultAssets.Add(v.Key, v.Value);
                        }
                        else
                        {
                            if (lowVersionAssets[v.Key] != v.Value)
                            {
                                resultAssets.Add(v.Key, v.Value);
                            }
                        }
                    }

                    if (resultAssets.Count == 0)
                    {
                        GetWindow <AssetBundleBuildEditor>().ShowNotification(new GUIContent("两个版本之间没有差异,无需生成补丁"));
                        return;
                    }

                    EditorFileUtility.ClearDirectory(m_ExportAssetBundleDir + platform + "/Patches/" + patchName);

                    foreach (var v in resultAssets)
                    {
                        var sourceFileName = m_ExportAssetBundleDir + platform + "/Version/" +
                                             versionList[m_highVersion] + "/" + v.Key;
                        var targetFileName = m_ExportAssetBundleDir + platform + "/Patches/" + patchName + "/" + v.Key;
                        if (!Directory.Exists(Path.GetDirectoryName(targetFileName)))
                        {
                            Directory.CreateDirectory(Path.GetDirectoryName(targetFileName));
                        }

                        File.Copy(sourceFileName, targetFileName);
                    }

                    var targetPath = m_ExportAssetBundleDir + platform + "/Patches/" + patchName + "/";
                    AssetBundleBuilder.PackPatches(targetPath, patchName, targetPath, ".pkg");
                    WindowsOSUtility.ExploreFile(targetPath);
                }
                GUILayout.EndHorizontal();
            }
        }

        if (m_OldBuildOperation != m_BuildOperation)
        {
            m_lowVersion  = 0;
            m_highVersion = 0;
        }

        m_OldBuildOperation = m_BuildOperation;
    }
Esempio n. 10
0
        private static void InternalCheckForUpdate(VersionNumber currentVersion, bool showInfoWhenNoUpgrade)
        {
            RegistryKey registryKey = Registry.CurrentUser.OpenSubKey(Const.PRODUCT_REG_KEY);
            string      dontShowUpdateForVersion = null;

            if (registryKey != null)
            {
                dontShowUpdateForVersion =
                    registryKey.GetValue(Const.PRODUCT_REG_KEY_VALUE_DONT_SHOW_UPDATE_VERSION) as string;
                registryKey.Close();
            }

            Action showErrorAction = () => MessageBox.Show("Error getting information about new version, please try again later.", "Error",
                                                           MessageBoxButtons.OK,
                                                           MessageBoxIcon.Error);

            synchronizationContext = SynchronizationContext.Current;

            WebClient client = new WebClient();
            Uri       uri    = new Uri(string.Format(CHECK_VERSION_URL_FORMAT, SERVER_FOR_UPDATES, currentVersion, debugMode ? "debug" : "!"));

            client.DownloadStringCompleted += delegate(object sender, DownloadStringCompletedEventArgs args)
            {
                try
                {
                    if (!args.Cancelled && args.Error == null)
                    {
                        bool hasNewVersionInfo = !string.IsNullOrEmpty(args.Result);

                        try
                        {
                            ProductVersionDto latestProductVersion = hasNewVersionInfo ? ProductVersionDto.FromXml(args.Result) : null;
                            if (latestProductVersion != null)
                            {
                                VersionNumber latestProductVersionId = new VersionNumber(latestProductVersion.Version);
                                if (latestProductVersionId.CompareTo(currentVersion) == 1)
                                {
                                    var versionsToSkip = ParseVersionsToSkip(dontShowUpdateForVersion);

                                    bool skipNewVersion     = versionsToSkip.Any(latestProductVersionId.Equals);
                                    bool canShowUpgradeForm = versionsToSkip.Count == 0 || !skipNewVersion;

                                    if (canShowUpgradeForm || showInfoWhenNoUpgrade)
                                    {
                                        synchronizationContext.Post(
                                            state =>
                                            ShowNewUpdateAvailableForm((Tuple <VersionNumber, ProductVersionDto, bool>)state),
                                            new Tuple <VersionNumber, ProductVersionDto, bool>(currentVersion,
                                                                                               latestProductVersion, skipNewVersion));
                                    }
                                }
                            }
                            else
                            {
                                if (showInfoWhenNoUpgrade)
                                {
                                    ProductVersionDto dummpyProductVersion = new ProductVersionDto(currentVersion.ToString());
                                    FormProductUpdate.DialogShow(currentVersion, dummpyProductVersion, false);
                                }
                            }
                        }
                        catch
                        {
                            showErrorAction();
                        }
                    }
                    else
                    {
                        showErrorAction();
                    }
                }
                finally
                {
                    alreadyExecuted = false;
                }
            };
            client.DownloadStringAsync(uri);
        }
Esempio n. 11
0
 public int CompareTo(YamlVersion other)
 {
     return(VersionNumber.CompareTo(other.VersionNumber));
 }
Esempio n. 12
0
 private void CompareToTestAssert(VersionNumber v1, VersionNumber v2, int expectedValue)
 {
     Assert.AreEqual(v1.CompareTo(v2), expectedValue,
                     String.Format("VersionNumber.CompareTo: [{0}].CompareTo([{1}]) returned {2}. Expected: {3}",
                                   v1.ToString(), v2.ToString(), v1.CompareTo(v2), expectedValue));
 }
Esempio n. 13
0
 /// <summary>
 /// Compares the current <see cref="Version"/> object to a specified object and returns an indication of their relative values.
 /// </summary>
 /// <param name="version">An object to compare, or <see cref="null"/>.</param>
 /// <returns>A signed integer that indicates the relative values of the two objects, as shown in the following table.</returns>
 public int CompareTo(object version)
 {
     return(VersionNumber.CompareTo(version));
 }
Esempio n. 14
0
 /// <summary>
 /// Compares the current <see cref="Version"/> object to a specified <see cref="Version"/> object and returns an indication of their relative values.
 /// </summary>
 /// <param name="value">A <see cref="Version"/> object to compare to the current <see cref="Version"/> object, or <see cref="null"/>.</param>
 /// <returns>A signed integer that indicates the relative values of the two objects, as shown in the following table.</returns>
 public int CompareTo(Version value)
 {
     return(VersionNumber.CompareTo(value.VersionNumber));
 }
Esempio n. 15
0
    private void OnCheckVersionMessageResponse(string response)
    {
#if UNITY_EDITOR
        if (Tracking)
        {
            PrintTrack(MethodBase.GetCurrentMethod().Name);
            PrintTrack("response: " + response);
        }
#endif

        _checkVersionMessageRef = null;

        if (string.IsNullOrEmpty(response))
        {
            FinishUpdate(false);
            return;
        }

        CheckVersionResponseMessage responseMessage = CheckVersionResponseMessage.FromJson(response);
        if (responseMessage == null)
        {
            FinishUpdate(false);
            return;
        }

        if (!Directory.Exists(_dlcPath))
        {
            UpdateFull(responseMessage.UrlDlcFull);
            return;
        }

        VersionNumber        currentDLCVersionOnDevice = GetCurrentDLCVersionOnDevice();
        CompareVersionNumber compareResult             =
            (CompareVersionNumber)currentDLCVersionOnDevice.CompareTo(responseMessage.DlcVersion);

        // If dlc version on client greater than dlc version on server,
        // it's fatal error, must update full
        // If major version change, update full
        // else update version by version
        switch (compareResult)
        {
        case CompareVersionNumber.MajorGreater:
        case CompareVersionNumber.MinorGreater:
        case CompareVersionNumber.PacthGreater:
        case CompareVersionNumber.MajorLess:
            UpdateFull(responseMessage.UrlDlcFull);
            break;

        case CompareVersionNumber.MinorLess:
        case CompareVersionNumber.PatchLess:
            UpdateVersionByVersion();
            break;

        case CompareVersionNumber.Error:
            FinishUpdate(false);
            break;

        case CompareVersionNumber.Equal:
            FinishUpdate(true);
            break;
        }
    }