Skip to content

v1.0.0.0 | Initial Working Version

Choose a tag to compare

@AdamRaichu AdamRaichu released this 16 Apr 01:39
· 1 commit to main since this release

Important

This plugin connects to the GitHub API to check if your strings.txt file is older than the version in a GitHub repository. This connection is opt-in (and required for the plugin to work), so the plugin will not do anything unless you open settings and enable Update Check? under the Strings File Updater tab.

Note

The default strings.txt is from one of my other repos, which is designed for SWBF2. There are plenty of strings for other games, but feel free to configure for your own game.

The default date is 2025-04-01 (YYYY-MM-DD) so ig change it to a lower one if you're setting it up to a different repo.

Version comparison logic if you're curious
        public bool needUpdate(string remoteVersion)
        {
            // Get the local version from the config
            string localVersion = Config.Get<string>("SFU.lastUpdated", "2025-04-01");

            string[] _splitRemoteVersion = remoteVersion.Split("-".ToCharArray());
            string[] _splitLocalVersion = localVersion.Split("-".ToCharArray());
            int[] splitRemoteVersion = new int[3];
            int[] splitLocalVersion = new int[3];

            if (_splitRemoteVersion.Length != 3)
            {
                return true;
            }
            if (_splitLocalVersion.Length != 3)
            {
                return true;
            }

            // convert to numbers
            for (int i = 0; i < _splitRemoteVersion.Length; i++)
            {
                splitRemoteVersion[i] = int.Parse(_splitRemoteVersion[i]);
                splitLocalVersion[i] = int.Parse(_splitLocalVersion[i]);
            }

            // compare remote version and local version
            if (splitRemoteVersion[0] > splitLocalVersion[0])
            {
                return true;
            }
            if (splitRemoteVersion[0] < splitLocalVersion[0])
            {
                return false;
            }
            if (splitRemoteVersion[1] > splitLocalVersion[1])
            {
                return true;
            }
            if (splitRemoteVersion[1] < splitLocalVersion[1])
            {
                return false;
            }
            if (splitRemoteVersion[2] > splitLocalVersion[2])
            {
                return true;
            }
            // last check is unnecessary

            return false;
        }