本文整理汇总了C#中PackageVersion类的典型用法代码示例。如果您正苦于以下问题:C# PackageVersion类的具体用法?C# PackageVersion怎么用?C# PackageVersion使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PackageVersion类属于命名空间,在下文中一共展示了PackageVersion类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Upgrade
public void Upgrade(AssetMigrationContext context, string dependencyName, PackageVersion currentVersion, PackageVersion targetVersion, YamlMappingNode yamlAssetNode, PackageLoadingAssetFile assetFile)
{
dynamic asset = new DynamicYamlMapping(yamlAssetNode);
// upgrade the asset
UpgradeAsset(context, currentVersion, targetVersion, asset, assetFile);
SetSerializableVersion(asset, dependencyName, targetVersion);
// upgrade its base
var baseBranch = asset[Asset.BaseProperty];
if (baseBranch != null)
{
UpgradeBase(context, dependencyName, currentVersion, targetVersion, baseBranch, assetFile);
}
// upgrade base parts
var basePartsBranch = asset[Asset.BasePartsProperty] as DynamicYamlArray;
if (basePartsBranch != null)
{
foreach (dynamic assetBase in basePartsBranch)
{
UpgradeBase(context, dependencyName, currentVersion, targetVersion, assetBase, assetFile);
}
}
}
示例2: Upgrade
public void Upgrade(AssetMigrationContext context, string dependencyName, PackageVersion currentVersion, PackageVersion targetVersion, YamlMappingNode yamlAssetNode, PackageLoadingAssetFile assetFile)
{
dynamic asset = new DynamicYamlMapping(yamlAssetNode);
// upgrade the asset
var baseBranch = asset[Asset.BaseProperty];
var basePartsBranch = asset[Asset.BasePartsProperty] as DynamicYamlArray;
// Detect in what kind of override context we are
var overrideHint = (baseBranch != null || (basePartsBranch != null && basePartsBranch.Node.Children.Count > 0))
? OverrideUpgraderHint.Derived
: OverrideUpgraderHint.Unknown;
// Upgrade the asset
UpgradeAsset(context, currentVersion, targetVersion, asset, assetFile, overrideHint);
SetSerializableVersion(asset, dependencyName, targetVersion);
// Upgrade its base
if (baseBranch != null)
{
UpgradeBase(context, dependencyName, currentVersion, targetVersion, baseBranch, assetFile);
}
// Upgrade base parts
if (basePartsBranch != null)
{
foreach (dynamic assetBase in basePartsBranch)
{
UpgradeBase(context, dependencyName, currentVersion, targetVersion, assetBase, assetFile);
}
}
}
示例3: UpgradeAsset
protected override void UpgradeAsset(AssetMigrationContext context, PackageVersion currentVersion, PackageVersion targetVersion, dynamic asset, PackageLoadingAssetFile assetFile)
{
if (asset.Source != null)
asset.Source = DynamicYamlEmpty.Default;
if (asset.SourceHash != null)
asset.SourceHash = DynamicYamlEmpty.Default;
}
示例4: OnRequestDownload
public void OnRequestDownload(PackageVersion version)
{
if (RequestDownload != null)
{
RequestDownload(this.Model, version);
}
}
示例5: PackageVersionRange
/// <summary>
/// Initializes a new instance of the <see cref="PackageVersionRange"/> class.
/// </summary>
/// <param name="version">The exact version.</param>
public PackageVersionRange(PackageVersion version)
{
IsMinInclusive = true;
IsMaxInclusive = true;
MinVersion = version;
MaxVersion = version;
}
示例6: UpgradeAsset
protected override void UpgradeAsset(AssetMigrationContext context, PackageVersion currentVersion, PackageVersion targetVersion, dynamic asset, PackageLoadingAssetFile assetFile)
{
// Introduction of MaterialInstance
var material = asset.Type.Material;
if (material != null)
{
asset.Type.MaterialInstance = new YamlMappingNode();
asset.Type.MaterialInstance.Material = material;
asset.Type.Material = DynamicYamlEmpty.Default;
}
var type = asset.Type.Node as YamlMappingNode;
if (type != null && type.Tag == "!CubeProceduralModel")
{
// Size changed from scalar to vector3
var size = asset.Type.Size as DynamicYamlScalar;
if (size != null)
{
var vecSize = new YamlMappingNode
{
{ new YamlScalarNode("X"), new YamlScalarNode(size.Node.Value) },
{ new YamlScalarNode("Y"), new YamlScalarNode(size.Node.Value) },
{ new YamlScalarNode("Z"), new YamlScalarNode(size.Node.Value) }
};
vecSize.Style = YamlStyle.Flow;
asset.Type.Size = vecSize;
}
}
}
示例7: PackageDownloadHandle
public PackageDownloadHandle(DynamoViewModel dynamoViewModel, Greg.Responses.PackageHeader header, PackageVersion version)
{
this.dynamoViewModel = dynamoViewModel;
this.Header = header;
this.DownloadPath = "";
this.VersionName = version.version;
}
示例8: PackageStore
/// <summary>
/// Initializes a new instance of the <see cref="PackageStore"/> class.
/// </summary>
/// <exception cref="System.InvalidOperationException">Unable to find a valid Xenko installation path</exception>
private PackageStore(string installationPath = null, string defaultPackageName = "Xenko", string defaultPackageVersion = XenkoVersion.CurrentAsText)
{
// TODO: these are currently hardcoded to Xenko
DefaultPackageName = defaultPackageName;
DefaultPackageVersion = new PackageVersion(defaultPackageVersion);
defaultPackageDirectory = DirectoryHelper.GetPackageDirectory(defaultPackageName);
// 1. Try to use the specified installation path
if (installationPath != null)
{
if (!DirectoryHelper.IsInstallationDirectory(installationPath))
{
throw new ArgumentException("Invalid Xenko installation path [{0}]".ToFormat(installationPath), "installationPath");
}
globalInstallationPath = installationPath;
}
// 2. Try to resolve an installation path from the path of this assembly
// We need to be able to use the package manager from an official Xenko install as well as from a developer folder
if (globalInstallationPath == null)
{
globalInstallationPath = DirectoryHelper.GetInstallationDirectory(DefaultPackageName);
}
// If there is no root, this is an error
if (globalInstallationPath == null)
{
throw new InvalidOperationException("Unable to find a valid Xenko installation or dev path");
}
// Preload default package
var logger = new LoggerResult();
var defaultPackageFile = DirectoryHelper.GetPackageFile(defaultPackageDirectory, DefaultPackageName);
defaultPackage = Package.Load(logger, defaultPackageFile, GetDefaultPackageLoadParameters());
if (defaultPackage == null)
{
throw new InvalidOperationException("Error while loading default package from [{0}]: {1}".ToFormat(defaultPackageFile, logger.ToText()));
}
defaultPackage.IsSystem = true;
// A flag variable just to know if it is a bare bone development directory
isDev = defaultPackageDirectory != null && DirectoryHelper.IsRootDevDirectory(defaultPackageDirectory);
// Check if we are in a root directory with store/packages facilities
if (NugetStore.IsStoreDirectory(globalInstallationPath))
{
packagesDirectory = UPath.Combine(globalInstallationPath, (UDirectory)NugetStore.DefaultGamePackagesDirectory);
store = new NugetStore(globalInstallationPath);
}
else
{
// We should exit from here if NuGet is not configured.
MessageBox.Show($"Unexpected installation. Cannot find a proper NuGet configuration for [{defaultPackageName}] in [{globalInstallationPath}]", "Installation Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
Environment.Exit(1);
}
}
示例9: UpgradeBase
private void UpgradeBase(AssetMigrationContext context, string dependencyName, PackageVersion currentVersion, PackageVersion targetVersion, dynamic assetBase, PackageLoadingAssetFile assetFile)
{
var baseAsset = assetBase[nameof(AssetBase.Asset)];
if (baseAsset != null)
{
UpgradeAsset(context, currentVersion, targetVersion, baseAsset, assetFile);
SetSerializableVersion(baseAsset, dependencyName, targetVersion);
}
}
示例10: Upgrade
public void Upgrade(AssetMigrationContext context, string dependencyName, PackageVersion currentVersion, PackageVersion targetVersion, YamlMappingNode yamlAssetNode, PackageLoadingAssetFile assetFile)
{
dynamic asset = new DynamicYamlMapping(yamlAssetNode);
var baseBranch = asset["~Base"];
if (baseBranch != null)
asset["~Base"] = DynamicYamlEmpty.Default;
AssetUpgraderBase.SetSerializableVersion(asset, dependencyName, targetVersion);
}
示例11: Upgrade
public void Upgrade(AssetMigrationContext context, string dependencyName, PackageVersion currentVersion, PackageVersion targetVersion, YamlMappingNode yamlAssetNode, PackageLoadingAssetFile assetFile)
{
dynamic asset = new DynamicYamlMapping(yamlAssetNode);
AssetUpgraderBase.SetSerializableVersion(asset, dependencyName, targetVersion);
// Move Test4 to Test5
asset.Test5 = asset.Test4;
asset.Test4 = DynamicYamlEmpty.Default;
}
示例12: UpgradeAsset
protected override void UpgradeAsset(AssetMigrationContext context, PackageVersion currentVersion, PackageVersion targetVersion, dynamic asset, PackageLoadingAssetFile assetFile)
{
var hierarchy = asset.Hierarchy;
var entities = (DynamicYamlArray)hierarchy.Entities;
foreach (dynamic entity in entities)
{
var components = entity.Components;
var spriteComponent = components["SpriteComponent.Key"];
if (spriteComponent != null)
spriteComponent.RemoveChild("ExtrusionMethod");
}
}
示例13: SetSerializableVersion
public static void SetSerializableVersion(dynamic asset, string dependencyName, PackageVersion value)
{
if (asset.IndexOf(nameof(Asset.SerializedVersion)) == -1)
{
asset.SerializedVersion = new YamlMappingNode();
// Ensure that it is stored right after the asset Id
asset.MoveChild(nameof(Asset.SerializedVersion), asset.IndexOf(nameof(Asset.Id)) + 1);
}
asset.SerializedVersion[dependencyName] = value;
}
示例14: UpgradeAsset
protected override void UpgradeAsset(AssetMigrationContext context, PackageVersion currentVersion, PackageVersion targetVersion, dynamic asset, PackageLoadingAssetFile assetFile, OverrideUpgraderHint overrideHint)
{
var hierarchy = asset.Hierarchy;
var entities = (DynamicYamlArray)hierarchy.Entities;
foreach (dynamic entity in entities)
{
var components = entity.Components;
var modelComponent = components["ModelComponent.Key"];
if (modelComponent != null)
modelComponent.RemoveChild("DrawOrder");
}
}
示例15: UpgradeAsset
protected override void UpgradeAsset(AssetMigrationContext context, PackageVersion currentVersion, PackageVersion targetVersion, dynamic asset, PackageLoadingAssetFile assetFile)
{
foreach (var modelMaterial in asset.Materials)
{
var material = modelMaterial.Material;
if (material != null)
{
modelMaterial.MaterialInstance = new YamlMappingNode();
modelMaterial.MaterialInstance.Material = material;
modelMaterial.Material = DynamicYamlEmpty.Default;
}
}
}