internal FileReferenceCollection(FileReference[] array)
 {
     if (array != null)
     {
         this.list.AddRange(array);
     }
 }
 public void Remove(FileReference file)
 {
     this.list.Remove(file);
 }
 public FileReference Add(FileReference file)
 {
     this.list.Add(file);
     return file;
 }
		public FileReference Add (string path)
		{
			FileReference fr = new FileReference (path);
			list.Add (fr);
			return fr;
		}
Example #5
0
        private void ValidateFileAssociations()
        {
            if (FileAssociations.Count > 0)
            {
                if (FileAssociations.Count > Constants.MaxFileAssociationsCount)
                {
                    OutputMessages.AddErrorMessage("GenerateManifest.FileAssociationsCountExceedsMaximum", Constants.MaxFileAssociationsCount.ToString(CultureInfo.CurrentUICulture));
                }

                Dictionary <string, FileAssociation> usedExtensions = new Dictionary <string, FileAssociation>(StringComparer.OrdinalIgnoreCase);
                foreach (FileAssociation fileAssociation in FileAssociations)
                {
                    if (string.IsNullOrEmpty(fileAssociation.Extension) ||
                        string.IsNullOrEmpty(fileAssociation.Description) ||
                        string.IsNullOrEmpty(fileAssociation.ProgId) ||
                        string.IsNullOrEmpty(fileAssociation.DefaultIcon))
                    {
                        OutputMessages.AddErrorMessage("GenerateManifest.FileAssociationMissingAttribute");
                    }
                    if (!string.IsNullOrEmpty(fileAssociation.Extension))
                    {
                        if (fileAssociation.Extension[0] != '.')
                        {
                            OutputMessages.AddErrorMessage("GenerateManifest.FileAssociationExtensionMissingLeadDot");
                        }
                        if (fileAssociation.Extension.Length > Constants.MaxFileAssociationExtensionLength)
                        {
                            OutputMessages.AddErrorMessage("GenerateManifest.FileAssociationExtensionTooLong", fileAssociation.Extension, Constants.MaxFileAssociationExtensionLength.ToString(CultureInfo.CurrentUICulture));
                        }
                        if (!usedExtensions.ContainsKey(fileAssociation.Extension))
                        {
                            usedExtensions.Add(fileAssociation.Extension, fileAssociation);
                        }
                        else
                        {
                            OutputMessages.AddErrorMessage("GenerateManifest.FileAssociationsDuplicateExtensions", fileAssociation.Extension);
                        }
                    }
                    if (!string.IsNullOrEmpty(fileAssociation.DefaultIcon))
                    {
                        FileReference defaultIconReference = null;
                        foreach (FileReference fileReference in FileReferences)
                        {
                            if (fileReference.TargetPath.Equals(fileAssociation.DefaultIcon, StringComparison.Ordinal))
                            {
                                defaultIconReference = fileReference;
                                break;
                            }
                        }
                        if (defaultIconReference == null || !string.IsNullOrEmpty(defaultIconReference.Group))
                        {
                            OutputMessages.AddErrorMessage("GenerateManifest.FileAssociationDefaultIconNotInstalled", fileAssociation.DefaultIcon);
                        }
                    }
                }

                if (!TrustInfo.IsFullTrust)
                {
                    OutputMessages.AddErrorMessage("GenerateManifest.FileAssociationsApplicationNotFullTrust");
                }
                if (EntryPoint == null)
                {
                    OutputMessages.AddErrorMessage("GenerateManifest.FileAssociationsNoEntryPoint");
                }
            }
        }
 internal FileReferenceCollection(FileReference[] array)
 {
     if (array == null)
         return;
     _list.AddRange(array);
 }
 public FileReference Add(FileReference file)
 {
     _list.Add(file);
     return(file);
 }
 public void Remove(FileReference file)
 {
     _list.Remove(file);
 }