예제 #1
0
        public void ChangeVersion(SemVer.Version newVersion)
        {
            if (newVersion is null)
            {
                throw new ArgumentNullException(Resources._newVersion);
            }
            var conf = configProvider.GetConfig();

            if (conf is null)
            {
                throw new ConfigException(Resources.ConfigNotFound);
            }
            if (conf.Info is null)
            {
                throw new ConfigException(Resources.ConfigInfoIsNull);
            }
            var shared = configProvider.GetSharedConfig();
            // Call extra modification to config as necessary
            var tmp = conf.Info.Version;

            conf.Info.Version = newVersion;
            if (shared != null && shared.Config != null && shared.Config.Info != null)
            {
                shared.Config.Info.Version = newVersion;
            }
            try
            {
                OnConfigVersionChanged?.Invoke(this, conf, newVersion);
            }
            catch
            {
                conf.Info.Version = tmp;
                if (shared != null && shared.Config != null && shared.Config.Info != null)
                {
                    shared.Config.Info.Version = tmp;
                }
                throw;
            }
            configProvider.Commit();
            // Perform extra modification
            OnVersionChanged?.Invoke(this, newVersion);
            // Changes the version of the package.
            // Grabs the config, modifies the version, commits it
            // Changes the version in Android.mk to match
        }
예제 #2
0
 private void ChangeVersion(string version)
 {
     OnVersionChanged?.Invoke(version);
 }