Ejemplo n.º 1
0
 public NuGetUpgraderConfig(
     ITracer tracer,
     LocalGSDConfig localGSDConfig,
     string feedUrl,
     string packageFeedName)
     : this(tracer, localGSDConfig)
 {
     this.FeedUrl         = feedUrl;
     this.PackageFeedName = packageFeedName;
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Try to load a NuGetUpgrader from config settings.
        /// <isConfigured>Flag to indicate whether the system is configured to use a NuGetUpgrader.
        /// A NuGetUpgrader can be set as the Upgrader to use, but it might not be properly configured.
        /// </isConfigured>
        /// <Returns>True if able to load a properly configured NuGetUpgrader<Returns>
        /// </summary>
        public static bool TryCreate(
            ITracer tracer,
            PhysicalFileSystem fileSystem,
            LocalGSDConfig gvfsConfig,
            ICredentialStore credentialStore,
            bool dryRun,
            bool noVerify,
            out NuGetUpgrader nuGetUpgrader,
            out bool isConfigured,
            out string error)
        {
            NuGetUpgraderConfig upgraderConfig = new NuGetUpgraderConfig(tracer, gvfsConfig);

            nuGetUpgrader = null;
            isConfigured  = false;

            if (!upgraderConfig.TryLoad(out error))
            {
                nuGetUpgrader = null;
                return(false);
            }

            if (!(isConfigured = upgraderConfig.IsConfigured(out error)))
            {
                return(false);
            }

            // At this point, we have determined that the system is set up to use
            // the NuGetUpgrader

            if (!upgraderConfig.IsReady(out error))
            {
                return(false);
            }

            nuGetUpgrader = new NuGetUpgrader(
                ProcessHelper.GetCurrentProcessVersion(),
                tracer,
                fileSystem,
                dryRun,
                noVerify,
                upgraderConfig,
                ProductUpgraderInfo.GetAssetDownloadsPath(),
                credentialStore);

            return(true);
        }
Ejemplo n.º 3
0
 public NuGetUpgraderConfig(ITracer tracer, LocalGSDConfig localGSDConfig)
 {
     this.tracer      = tracer;
     this.localConfig = localGSDConfig;
 }
Ejemplo n.º 4
0
 public OrgNuGetUpgraderConfig(ITracer tracer, LocalGSDConfig localGSDConfig)
     : base(tracer, localGSDConfig)
 {
 }
Ejemplo n.º 5
0
        public override void Execute()
        {
            if (!GSDPlatform.Instance.UnderConstruction.SupportsGSDConfig)
            {
                this.ReportErrorAndExit("`gvfs config` is not yet implemented on this operating system.");
            }

            this.localConfig = new LocalGSDConfig();
            string error = null;

            if (this.IsMutuallyExclusiveOptionsSet(out error))
            {
                this.ReportErrorAndExit(error);
            }

            if (this.List)
            {
                Dictionary <string, string> allSettings;
                if (!this.localConfig.TryGetAllConfig(out allSettings, out error))
                {
                    this.ReportErrorAndExit(error);
                }

                const string ConfigOutputFormat = "{0}={1}";
                foreach (KeyValuePair <string, string> setting in allSettings)
                {
                    Console.WriteLine(ConfigOutputFormat, setting.Key, setting.Value);
                }
            }
            else if (!string.IsNullOrEmpty(this.KeyToDelete))
            {
                if (!GSDPlatform.Instance.IsElevated())
                {
                    this.ReportErrorAndExit("`gvfs config` must be run from an elevated command prompt when deleting settings.");
                }

                if (!this.localConfig.TryRemoveConfig(this.KeyToDelete, out error))
                {
                    this.ReportErrorAndExit(error);
                }
            }
            else if (!string.IsNullOrEmpty(this.Key))
            {
                bool valueSpecified = !string.IsNullOrEmpty(this.Value);
                if (valueSpecified)
                {
                    if (!GSDPlatform.Instance.IsElevated())
                    {
                        this.ReportErrorAndExit("`gvfs config` must be run from an elevated command prompt when configuring settings.");
                    }

                    if (!this.localConfig.TrySetConfig(this.Key, this.Value, out error))
                    {
                        this.ReportErrorAndExit(error);
                    }
                }
                else
                {
                    string valueRead = null;
                    if (!this.localConfig.TryGetConfig(this.Key, out valueRead, out error) ||
                        string.IsNullOrEmpty(valueRead))
                    {
                        this.ReportErrorAndExit(error);
                    }
                    else
                    {
                        Console.WriteLine(valueRead);
                    }
                }
            }
            else
            {
                this.ReportErrorAndExit("You must specify an option. Run `gvfs config --help` for details.");
            }
        }