Exemplo n.º 1
0
        public override ConversionType GetVersion(ConversionTarget project)
        {
            ConversionType conversionType;

            if (!project.IsProject)
            {
                return(ConversionType.Unsupported);
            }
            using (IEnumerator <IProjectItemData> enumerator = project.ProjectStore.GetItems("Reference").GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    IProjectItemData current      = enumerator.Current;
                    AssemblyName     assemblyName = ProjectConverterBase.GetAssemblyName(current.Value);
                    if (assemblyName == null || !this.IsOverqualifiedSdkAssembly(current, assemblyName))
                    {
                        continue;
                    }
                    conversionType = ConversionType.BlendSdk3;
                    return(conversionType);
                }
                return(ConversionType.Unknown);
            }
            return(conversionType);
        }
Exemplo n.º 2
0
 private bool HandleVersion4Upgrade(IProjectStore projectStore)
 {
     if (!projectStore.GetItems("Reference").Any <IProjectItemData>((IProjectItemData reference) => {
         if (string.Equals(reference.Value, "System.Xaml", StringComparison.OrdinalIgnoreCase))
         {
             return(true);
         }
         if (string.IsNullOrEmpty(reference.Value) || reference.Value.IndexOf("System.Xaml", StringComparison.OrdinalIgnoreCase) == -1)
         {
             return(false);
         }
         AssemblyName assemblyName = ProjectConverterBase.GetAssemblyName(reference.Value);
         if (assemblyName == null)
         {
             return(false);
         }
         if (assemblyName.Name.Equals("System.Xaml", StringComparison.OrdinalIgnoreCase))
         {
             return(true);
         }
         return(false);
     }))
     {
         IProjectItemData projectItemDatum = projectStore.AddItem("Reference", "System.Xaml");
         if (projectItemDatum == null)
         {
             return(false);
         }
         if (!projectItemDatum.SetItemMetadata("RequiredTargetFramework", "v4.0"))
         {
             return(false);
         }
     }
     return(true);
 }
Exemplo n.º 3
0
 protected override bool UpgradeProject(IProjectStore projectStore, ConversionType initialVersion, ConversionType targetVersion)
 {
     if (targetVersion != ConversionType.BlendSdk4)
     {
         return(false);
     }
     foreach (IProjectItemData item in projectStore.GetItems("Reference"))
     {
         AssemblyName assemblyName = ProjectConverterBase.GetAssemblyName(item.Value);
         if (assemblyName == null || !this.IsOverqualifiedSdkAssembly(item, assemblyName))
         {
             continue;
         }
         string   path = projectStore.DocumentReference.Path;
         string   updateItemMetadataAction = StringTable.UpdateItemMetadataAction;
         object[] value = new object[] { "Include", "Reference", item.Value, item.Value, assemblyName.Name };
         ProjectLog.LogSuccess(path, updateItemMetadataAction, value);
         item.Value = assemblyName.Name;
     }
     return(true);
 }