ClrPlus.Scripting.MsBuild.Packaging.NugetPackage.GetOrCreateProject C# (CSharp) Method

GetOrCreateProject() private method

private GetOrCreateProject ( string projectFileExtension, string frameworkVariant ) : ProjectPlus
projectFileExtension string
frameworkVariant string
return ProjectPlus
        internal ProjectPlus GetOrCreateProject(string projectFileExtension, string frameworkVariant)
        {
            frameworkVariant = frameworkVariant.WhenNullOrEmpty("native");

            switch (projectFileExtension) {
                case "targets":
                    if (!_targets.ContainsKey(frameworkVariant)) {
                        Event<Verbose>.Raise("NugetPackage.GetOrCreateProject", "Creating .targets for [{0}] in role [{1}].", frameworkVariant, PkgRole);
                        _targets.Add(frameworkVariant, new ProjectPlus(this, "{0}.targets".format(_pkgName)));
                    }
                    return _targets[frameworkVariant];

                case "props":
                    if (!_props.ContainsKey(frameworkVariant)) {
                        Event<Verbose>.Raise("NugetPackage.GetOrCreateProject", "Creating .props for [{0}] in role [{1}].", frameworkVariant, PkgRole);
                        _props.Add(frameworkVariant, new ProjectPlus(this, "{0}.props".format(_pkgName)));
                    }
                    return _props[frameworkVariant];
            }

            throw new ClrPlusException("Unknown project extension '{0}' ".format(projectFileExtension));
        }