コード例 #1
0
        private async Task AddNewSdk(string sdkPath, bool forced)
        {
            SdkSchema sdkSchema = await sdkExplorer.ExploreSdk(sdkPath, forced).ConfigureAwait(false);

            if (sdkSchema != null)
            {
                sdkContainer.Add(sdkPath, sdkSchema);
            }
        }
コード例 #2
0
        private async Task <bool> AddNewSdk(string sdkPath, bool forced, bool checkForDuplicate = true)
        {
            if (exploringSdk == sdkPath)
            {
                return(false);
            }

            try
            {
                exploringSdk = sdkPath;
                SdkSchema sdkSchema = await sdkExplorer.ExploreSdk(sdkPath, forced).ConfigureAwait(false);

                if (sdkSchema != null)
                {
                    if (checkForDuplicate)
                    {
                        IEnumerable <Target> targets = GetAllTargets();
                        foreach (TargetSchema targetSchema in sdkSchema.Target)
                        {
                            Target target = new Target(targetSchema.name, targetSchema.version);
                            if (targets.Contains(target))
                            {
                                throw new TargetAlreadyInstalledException(target.GetLongFullName());
                            }
                        }
                    }
                    sdkContainer.Add(sdkPath, sdkSchema);
                }
            }
            finally
            {
                exploringSdk = string.Empty;
            }

            return(true);
        }