Beispiel #1
0
        /// <summary>
        /// Ordena os scripts por funcao: Modules, Services e Controllers
        /// </summary>
        /// <param name="context"></param>
        /// <param name="files"></param>
        /// <returns></returns>
        public IEnumerable<BundleFile> OrderFiles(BundleContext context, IEnumerable<BundleFile> files)
        {
            var modules = new List<BundleFile>();
            var services = new List<BundleFile>();
            var controllers = new List<BundleFile>();

            foreach (var item in files)
            {
                if (item.VirtualFile.Name.Contains("service"))
                {
                    services.Add(item);
                }
                else if (item.VirtualFile.Name.Contains("controller"))
                {
                    controllers.Add(item);
                }
                else
                {
                    modules.Add(item);
                }
            }

            var allFiles = new List<BundleFile>();

            allFiles.AddRange(modules);
            allFiles.AddRange(services);
            allFiles.AddRange(controllers);

            return allFiles;
        }
		/// <summary> 
		/// Sets a mapped property value and mark its source path as applied
		/// </summary>
		/// <param name="element">Object on which to set the property</param>
		/// <param name="propertyName">Name of the property</param> 
		/// <param name="propertyValue">Value of the property</param>
		/// <param name="sourcePath">Source mapping path for the property to be set</param> 
		/// <param name="deserializer">Current deserializer</param> 
//		private static void SetEpmProperty(object element, string propertyName, object propertyValue, string sourcePath, EpmContentDeSerializerBase deserializer)
//		{
//			 deserializer.Updatable.SetValue(element, propertyName, propertyValue);
//			 deserializer.PropertiesApplied.AddAppliedProperty(sourcePath, false);
//		}

		/// <summary>
		/// Initializes all properties for the resource type, to be used by Properties getter. 
		/// </summary> 
		/// <returns>Collection of properties exposed by this resource type.</returns>
		private ReadOnlyCollection<ResourceProperty> InitializeProperties()
		{
			if (this.allProperties == null)
			{
				ReadOnlyCollection<ResourceProperty> readOnlyAllProps;
				List<ResourceProperty> allProps = new List<ResourceProperty>();
				if (this.BaseType != null)
				{
					allProps.AddRange(this.BaseType.Properties);
				}

				allProps.AddRange(this.PropertiesDeclaredOnThisType);
				readOnlyAllProps = new ReadOnlyCollection<ResourceProperty>(allProps);

				if (!this.isReadOnly)
				{
					return readOnlyAllProps;
				}

				this.allProperties = readOnlyAllProps;
			}

			Debug.Assert(this.isReadOnly, "Propeties - at this point, the resource type must be readonly");
			return this.allProperties;
		}