internal string GetResourceId(IResourceHandler resourceHandler)
 {
     if (string.IsNullOrEmpty(resourceId))
     {
         return(resourceHandler.GetDefaultResourceId(this));
     }
     return(resourceId);
 }
Exemple #2
0
 void MigrateResourceIds(IResourceHandler oldHandler, IResourceHandler newHandler)
 {
     if (oldHandler.GetType() != newHandler.GetType())
     {
         // If the file format has a default resource handler different from the one
         // choosen for this project, then all resource ids must be converted
         foreach (ProjectFile file in Files)
         {
             if (file.Subtype == Subtype.Directory)
             {
                 continue;
             }
             string oldId      = file.GetResourceId(oldHandler);
             string newId      = file.GetResourceId(newHandler);
             string newDefault = newHandler.GetDefaultResourceId(file);
             if (oldId != newId)
             {
                 if (newDefault == oldId)
                 {
                     file.ResourceId = null;
                 }
                 else
                 {
                     file.ResourceId = oldId;
                 }
             }
             else
             {
                 if (newDefault == oldId)
                 {
                     file.ResourceId = null;
                 }
             }
         }
     }
 }
		void MigrateResourceIds (IResourceHandler oldHandler, IResourceHandler newHandler)
		{
			if (oldHandler.GetType () != newHandler.GetType ()) {
				// If the file format has a default resource handler different from the one
				// choosen for this project, then all resource ids must be converted
				foreach (ProjectFile file in Files.Where (f => f.BuildAction == BuildAction.EmbeddedResource)) {
					if (file.Subtype == Subtype.Directory)
						continue;
					string oldId = file.GetResourceId (oldHandler);
					string newId = file.GetResourceId (newHandler);
					string newDefault = newHandler.GetDefaultResourceId (file);
					if (oldId != newId) {
						if (newDefault == oldId)
							file.ResourceId = null;
						else
							file.ResourceId = oldId;
					} else {
						if (newDefault == oldId)
							file.ResourceId = null;
					}
				}
			}
		}
		internal string GetResourceId (IResourceHandler resourceHandler)
		{
			if (string.IsNullOrEmpty (resourceId))
				return resourceHandler.GetDefaultResourceId (this);
			return resourceId;
		}