Example #1
0
        private static void UpdateFileReference(BaseReference f, string targetFrameworkVersion)
        {
            if (String.IsNullOrEmpty(f.ResolvedPath))
            {
                throw new FileNotFoundException(null, f.SourcePath);
            }
            string hash;
            long   size;

            if (string.IsNullOrEmpty(targetFrameworkVersion))
            {
                Util.GetFileInfo(f.ResolvedPath, out hash, out size);
            }
            else
            {
                Util.GetFileInfo(f.ResolvedPath, targetFrameworkVersion, out hash, out size);
            }
            f.Hash = hash;
            f.Size = size;
            if (String.IsNullOrEmpty(f.TargetPath))
            {
                if (!String.IsNullOrEmpty(f.SourcePath))
                {
                    f.TargetPath = BaseReference.GetDefaultTargetPath(f.SourcePath);
                }
                else
                {
                    f.TargetPath = BaseReference.GetDefaultTargetPath(Path.GetFileName(f.ResolvedPath));
                }
            }
        }
 private bool ResolveFile(BaseReference f, string[] searchPaths)
 {
     if (f == null)
     {
         return(false);
     }
     f.ResolvedPath = this.ResolvePath(f.SourcePath, searchPaths);
     if (!string.IsNullOrEmpty(f.ResolvedPath))
     {
         return(true);
     }
     f.ResolvedPath = this.ResolvePath(f.TargetPath, searchPaths);
     return(!string.IsNullOrEmpty(f.ResolvedPath));
 }
 public int Compare(object x, object y)
 {
     if ((x != null) && (y != null))
     {
         if (!(x is BaseReference) || !(y is BaseReference))
         {
             return(0);
         }
         BaseReference reference  = x as BaseReference;
         BaseReference reference2 = y as BaseReference;
         if ((reference.SortName != null) && (reference2.SortName != null))
         {
             return(reference.SortName.CompareTo(reference2.SortName));
         }
     }
     return(0);
 }
Example #4
0
            public int Compare(object x, object y)
            {
                if (x == null || y == null)
                {
                    Debug.Fail("Comparing null objects");
                    return(0);
                }
                if (!(x is BaseReference) || !(y is BaseReference))
                {
                    Debug.Fail("Comparing objects that are not BaseReferences");
                    return(0);
                }

                BaseReference xRef = x as BaseReference;
                BaseReference yRef = y as BaseReference;

                if (xRef.SortName == null || yRef.SortName == null)
                {
                    Debug.Fail("Objects do not have a SortName");
                    return(0);
                }

                return(xRef.SortName.CompareTo(yRef.SortName));
            }
        private static void UpdateFileReference(BaseReference f)
        {
            string str;
            long   num;

            if (string.IsNullOrEmpty(f.ResolvedPath))
            {
                throw new FileNotFoundException(null, f.SourcePath);
            }
            Util.GetFileInfo(f.ResolvedPath, out str, out num);
            f.Hash = str;
            f.Size = num;
            if (string.IsNullOrEmpty(f.TargetPath))
            {
                if (!string.IsNullOrEmpty(f.SourcePath))
                {
                    f.TargetPath = BaseReference.GetDefaultTargetPath(f.SourcePath);
                }
                else
                {
                    f.TargetPath = BaseReference.GetDefaultTargetPath(Path.GetFileName(f.ResolvedPath));
                }
            }
        }
 private void SetItemAttributes(ITaskItem item, BaseReference file)
 {
     string targetPath = item.GetMetadata(ItemMetadataNames.targetPath);
     if (!String.IsNullOrEmpty(targetPath))
         file.TargetPath = targetPath;
     else
         file.TargetPath = Path.IsPathRooted(file.SourcePath) || file.SourcePath.StartsWith("..", StringComparison.Ordinal) ? Path.GetFileName(file.SourcePath) : file.SourcePath;
     file.Group = item.GetMetadata("Group");
     file.IsOptional = !String.IsNullOrEmpty(file.Group);
     if (Util.CompareFrameworkVersions(TargetFrameworkVersion, Constants.TargetFrameworkVersion35) >= 0)
         file.IncludeHash = ConvertUtil.ToBoolean(item.GetMetadata("IncludeHash"), true);
 }
 private void SetItemAttributes(ITaskItem item, BaseReference file)
 {
     string metadata = item.GetMetadata("TargetPath");
     if (!string.IsNullOrEmpty(metadata))
     {
         file.TargetPath = metadata;
     }
     else
     {
         file.TargetPath = (Path.IsPathRooted(file.SourcePath) || file.SourcePath.StartsWith("..", StringComparison.Ordinal)) ? Path.GetFileName(file.SourcePath) : file.SourcePath;
     }
     file.Group = item.GetMetadata("Group");
     file.IsOptional = !string.IsNullOrEmpty(file.Group);
     if (Util.CompareFrameworkVersions(this.TargetFrameworkVersion, "v3.5") >= 0)
     {
         file.IncludeHash = ConvertUtil.ToBoolean(item.GetMetadata("IncludeHash"), true);
     }
 }
 private bool ResolveFile(BaseReference f, string[] searchPaths)
 {
     if (f == null)
     {
         return false;
     }
     f.ResolvedPath = this.ResolvePath(f.SourcePath, searchPaths);
     if (!string.IsNullOrEmpty(f.ResolvedPath))
     {
         return true;
     }
     f.ResolvedPath = this.ResolvePath(f.TargetPath, searchPaths);
     return !string.IsNullOrEmpty(f.ResolvedPath);
 }
 private static void UpdateFileReference(BaseReference f)
 {
     string str;
     long num;
     if (string.IsNullOrEmpty(f.ResolvedPath))
     {
         throw new FileNotFoundException(null, f.SourcePath);
     }
     Util.GetFileInfo(f.ResolvedPath, out str, out num);
     f.Hash = str;
     f.Size = num;
     if (string.IsNullOrEmpty(f.TargetPath))
     {
         if (!string.IsNullOrEmpty(f.SourcePath))
         {
             f.TargetPath = BaseReference.GetDefaultTargetPath(f.SourcePath);
         }
         else
         {
             f.TargetPath = BaseReference.GetDefaultTargetPath(Path.GetFileName(f.ResolvedPath));
         }
     }
 }
Example #10
0
        private static void UpdateFileReference(BaseReference f, string targetFrameworkVersion)
        {
            if (String.IsNullOrEmpty(f.ResolvedPath))
                throw new FileNotFoundException(null, f.SourcePath);
            string hash;
            long size;

            if (string.IsNullOrEmpty(targetFrameworkVersion))
            {
                Util.GetFileInfo(f.ResolvedPath, out hash, out size);
            }
            else
            {
                Util.GetFileInfo(f.ResolvedPath, targetFrameworkVersion, out hash, out size);
            }
            f.Hash = hash;
            f.Size = size;
            if (String.IsNullOrEmpty(f.TargetPath))
            {
                if (!String.IsNullOrEmpty(f.SourcePath))
                    f.TargetPath = BaseReference.GetDefaultTargetPath(f.SourcePath);
                else
                    f.TargetPath = BaseReference.GetDefaultTargetPath(Path.GetFileName(f.ResolvedPath));
            }
        }