Ejemplo n.º 1
0
    private void UpdateVersionInfoText()
    {
        Dictionary <string, string> versionProperties = PropertiesFileParser.ParseText(versionPropertiesTextAsset.text);

        // Show the release number (e.g. release date, or some version number)
        versionProperties.TryGetValue("release", out string release);
        versionProperties.TryGetValue("name", out string releaseName);
        string displayName = releaseName.IsNullOrEmpty() ? release : releaseName;

        semanticVersionText.text = "Version: " + displayName;

        // Show the commit hash of the build
        versionProperties.TryGetValue("commit_hash", out string commitHash);
        commitHashText.text = "Commit: " + commitHash;

        // Show the build timestamp only for development builds
        if (Debug.isDebugBuild)
        {
            versionProperties.TryGetValue("build_timestamp", out string buildTimeStamp);
            buildTimeStampText.text = "Build timestamp: " + buildTimeStamp;
        }
        else
        {
            buildTimeStampText.text = "";
        }
    }
Ejemplo n.º 2
0
    private void CheckForNewVersion(string remoteVersionFileContent)
    {
        Dictionary <string, string> remoteVersionProperties = PropertiesFileParser.ParseText(remoteVersionFileContent);
        Dictionary <string, string> localVersionProperties  = PropertiesFileParser.ParseText(localVersionTextAsset.text);

        remoteVersionProperties.TryGetValue("release", out string remoteRelease);
        if (settings.IgnoredReleases.Contains("all") ||
            settings.IgnoredReleases.Contains(remoteRelease))
        {
            // The user did opt-out for notifications about this release or new releases in general.
            Debug.Log("Ignoring new release: " + remoteRelease);
            return;
        }

        localVersionProperties.TryGetValue("release", out string localRelease);

        try
        {
            if (CompareVersionString(localRelease, remoteRelease) < 0)
            {
                // (localRelease is smaller)
                // or ((localRelease is equal to remoteRelease) and (localBuildTimeStamp is smaller))
                CreateNewVersionAvailableDialog(remoteVersionProperties);
            }
            else
            {
                Debug.Log($"No new release available (localRelease: {localRelease}, remoteRelease: {remoteRelease})");
            }
        }
        catch (CompareVersionException ex)
        {
            Debug.LogException(ex);
        }
    }
Ejemplo n.º 3
0
    private void CheckForNewVersion()
    {
        Dictionary <string, string> remoteVersionProperties = PropertiesFileParser.ParseText(remoteVersionFileContent);
        Dictionary <string, string> localVersionProperties  = PropertiesFileParser.ParseText(localVersionTextAsset.text);

        remoteVersionProperties.TryGetValue("release", out string remoteRelease);
        if (settings.IgnoredReleases.Contains("all") ||
            settings.IgnoredReleases.Contains(remoteRelease))
        {
            // The user did opt-out for notifications about this release or new releases in general.
            Debug.Log("Ignoring new release: " + remoteRelease);
            return;
        }

        localVersionProperties.TryGetValue("release", out string localRelease);

        remoteVersionProperties.TryGetValue("build_timestamp", out string remoteBuildTimeStamp);
        localVersionProperties.TryGetValue("build_timestamp", out string localBuildTimeStamp);

        // Remove all non-digit characters, then compare the resulting numbers
        // This makes it possible to compare version names
        // in multiple formats such as 2020-04-05, 2020-04-05-devbuild, 0.1.5, 2017.04+
        int.TryParse(Regex.Replace(remoteRelease, @"[^\d]", ""), out int remoteReleaseNumber);
        int.TryParse(Regex.Replace(localRelease, @"[^\d]", ""), out int localReleaseNumber);

        int.TryParse(Regex.Replace(remoteBuildTimeStamp, @"[^\d]", ""), out int remoteBuildTimeStampNumber);
        int.TryParse(Regex.Replace(localBuildTimeStamp, @"[^\d]", ""), out int localBuildTimeStampNumber);

        if (localReleaseNumber < remoteReleaseNumber ||
            (localReleaseNumber == remoteReleaseNumber &&
             localBuildTimeStampNumber < remoteBuildTimeStampNumber))
        {
            ShowNewVersionAvailableDialog(remoteVersionProperties);
        }
    }
Ejemplo n.º 4
0
 private void LoadColorsFromText(string text)
 {
     loadedColorRawStringValues = PropertiesFileParser.ParseText(text);
     loadedColorRawStringValues.ForEach(entry =>
     {
         // Replace reference to other color
         string colorHexValue = ReplaceColorReferences(entry.Value);
         Color32 loadedColor  = Colors.CreateColor(colorHexValue);
         loadedColors.Add(entry.Key, loadedColor);
     });
 }
Ejemplo n.º 5
0
    void Start()
    {
        Dictionary <string, string> versionProperties = PropertiesFileParser.ParseText(versionPropertiesTextAsset.text);

        // Show the release number (e.g. release date, or some version number)
        versionProperties.TryGetValue("release", out string release);
        releaseUiText.text = "Release: " + release;

        // Show the build timestamp only for development builds
        if (Debug.isDebugBuild)
        {
            versionProperties.TryGetValue("build_timestamp", out string buildTimeStamp);
            buildTimeStampUiText.text = "Build: " + buildTimeStamp;
        }
        else
        {
            buildTimeStampUiText.gameObject.SetActive(false);
        }
    }
    private void UpdateVersionInfoText()
    {
        Dictionary <string, string> versionProperties = PropertiesFileParser.ParseText(versionPropertiesTextAsset.text);

        // Show the release number (e.g. release date, or some version number)
        versionProperties.TryGetValue("release", out string release);
        semanticVersionText.text = TranslationManager.GetTranslation(R.Messages.version, "value", release);

        // Show the commit hash of the build
        versionProperties.TryGetValue("commit_hash", out string commitHash);
        commitHashText.text = TranslationManager.GetTranslation(R.Messages.commit, "value", commitHash);

        // Show the build timestamp only for development builds
        if (Debug.isDebugBuild)
        {
            versionProperties.TryGetValue("build_timestamp", out string buildTimeStamp);
            buildTimeStampText.text = TranslationManager.GetTranslation(R.Messages.buildTimeStamp, "value", buildTimeStamp);
        }
        else
        {
            buildTimeStampText.text = "";
        }
    }
Ejemplo n.º 7
0
 private static void LoadPropertiesFromText(string text, Dictionary <string, string> targetDictionary)
 {
     targetDictionary.Clear();
     PropertiesFileParser.ParseText(text).ForEach(entry => targetDictionary.Add(entry.Key, entry.Value));
 }