Ejemplo n.º 1
0
        public override bool RemoveItem(IProjectItemData item)
        {
            MSBuildProjectItemData mSBuildProjectItemDatum = item as MSBuildProjectItemData;

            if (mSBuildProjectItemDatum == null || mSBuildProjectItemDatum.ProjectItem.IsImported)
            {
                return(false);
            }
            bool flag = this.MsBuildProject.RemoveItem(mSBuildProjectItemDatum.ProjectItem);

            if (!flag)
            {
                string   path                    = base.DocumentReference.Path;
                string   unknownError            = StringTable.UnknownError;
                string   removeProjectItemAction = StringTable.RemoveProjectItemAction;
                object[] itemType                = new object[] { item.ItemType, item.Value };
                ProjectLog.LogError(path, unknownError, removeProjectItemAction, itemType);
            }
            else
            {
                string   str = base.DocumentReference.Path;
                string   removeProjectItemAction1 = StringTable.RemoveProjectItemAction;
                object[] objArray = new object[] { item.ItemType, item.Value };
                ProjectLog.LogSuccess(str, removeProjectItemAction1, objArray);
            }
            return(flag);
        }
Ejemplo n.º 2
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);
        }
Ejemplo n.º 3
0
        private bool IsOverqualifiedSdkAssembly(IProjectItemData reference, AssemblyName referenceAssemblyName)
        {
            bool flag;

            List <AssemblyName> .Enumerator enumerator = this.GetBlendSdkAssemblies().GetEnumerator();
            try
            {
                while (enumerator.MoveNext())
                {
                    AssemblyName current        = enumerator.Current;
                    byte[]       publicKeyToken = referenceAssemblyName.GetPublicKeyToken();
                    if (!string.Equals(current.Name, referenceAssemblyName.Name, StringComparison.OrdinalIgnoreCase) || !(referenceAssemblyName.Version == null) && !current.Version.Equals(referenceAssemblyName.Version) || publicKeyToken != null && (int)publicKeyToken.Length != 0 && !ProjectAssemblyHelper.ComparePublicKeyTokens(current.GetPublicKeyToken(), publicKeyToken))
                    {
                        continue;
                    }
                    flag = !string.Equals(reference.Value, referenceAssemblyName.Name, StringComparison.OrdinalIgnoreCase);
                    return(flag);
                }
                return(false);
            }
            finally
            {
                ((IDisposable)enumerator).Dispose();
            }
            return(flag);
        }
Ejemplo n.º 4
0
        private void Update()
        {
            IProjectItemData wpfToolkitReference = this.GetWpfToolkitReference();

            if (wpfToolkitReference == null)
            {
                return;
            }
            string directoryName = Path.GetDirectoryName(this.projectStore.DocumentReference.Path);

            string[] strArrays = new string[] { "ApplicationDefinition", "Page", "Content" };
            for (int i = 0; i < (int)strArrays.Length; i++)
            {
                IEnumerable <IProjectItemData> items = this.projectStore.GetItems(strArrays[i]);
                if (items != null)
                {
                    foreach (IProjectItemData item in items)
                    {
                        this.currentXamlPath = Path.Combine(directoryName, item.Value);
                        this.UpdateToolkitXmlNamespace();
                    }
                }
            }
            this.projectStore.RemoveItem(wpfToolkitReference);
        }
Ejemplo n.º 5
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);
 }
Ejemplo n.º 6
0
        private IProjectItemData GetWpfToolkitReference()
        {
            IProjectItemData projectItemDatum;
            IEnumerable <IProjectItemData> items = this.projectStore.GetItems("Reference");

            if (items == null)
            {
                return(null);
            }
            using (IEnumerator <IProjectItemData> enumerator = items.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    IProjectItemData current = enumerator.Current;
                    string           value   = current.Value;
                    if (string.IsNullOrEmpty(value))
                    {
                        continue;
                    }
                    if (string.Compare(value, "WpfToolkit", StringComparison.OrdinalIgnoreCase) != 0)
                    {
                        if (!value.StartsWith("WpfToolkit,", StringComparison.OrdinalIgnoreCase))
                        {
                            continue;
                        }
                        projectItemDatum = current;
                        return(projectItemDatum);
                    }
                    else
                    {
                        projectItemDatum = current;
                        return(projectItemDatum);
                    }
                }
                return(null);
            }
            return(projectItemDatum);
        }
Ejemplo n.º 7
0
 public virtual bool RemoveItem(IProjectItemData item)
 {
     return(false);
 }
Ejemplo n.º 8
0
 public bool RemoveItem(IProjectItemData item)
 {
     return(this.NestedStore.RemoveItem(item));
 }