Example #1
0
        /// <summary>
        /// Checks a set of actions for conflicts (ie. different actions producing the same output items)
        /// </summary>
        /// <param name="Actions">The set of actions to check</param>
        public static void CheckForConflicts(IEnumerable <Action> Actions)
        {
            bool bResult = true;

            Dictionary <FileItem, Action> ItemToProducingAction = new Dictionary <FileItem, Action>();

            foreach (Action Action in Actions)
            {
                foreach (FileItem ProducedItem in Action.ProducedItems)
                {
                    Action ExistingAction;
                    if (ItemToProducingAction.TryGetValue(ProducedItem, out ExistingAction))
                    {
                        bResult &= ExistingAction.CheckForConflicts(Action);
                    }
                    else
                    {
                        ItemToProducingAction.Add(ProducedItem, Action);
                    }
                }
            }

            if (!bResult)
            {
                throw new BuildException("Action graph is invalid; unable to continue. See log for additional details.");
            }
        }
        /// <summary>
        /// Creates a new instance of the <see cref="FileUploadStreamProvider" /> class with the specified configuration settings.
        /// </summary>
        /// <param name="settings">The <see cref="UploadStreamProviderElement" /> object that holds the configuration settings.</param>
        public FileUploadStreamProvider(UploadStreamProviderElement settings)
            : base(settings)
		{
			_location = Settings.Parameters["location"];

			if (_location == null)
			{
				// TODO: fix up
				throw new Exception("location must be specified for SlickUpload file provider");
			}
			else if (!Path.IsPathRooted(_location))
			{
				_location = HostingEnvironment.MapPath(_location);
			}

			string existingActionString = Settings.Parameters["existingAction"];

			if (!string.IsNullOrEmpty(existingActionString))
				_existingAction = (ExistingAction)Enum.Parse(typeof(ExistingAction), existingActionString, true);
			else
				_existingAction = ExistingAction.Exception;

            string fileNameMethodString = Settings.Parameters["fileNameMethod"];

            if (!string.IsNullOrEmpty(fileNameMethodString))
                _fileNameMethod = (FileNameMethod)Enum.Parse(typeof(FileNameMethod), fileNameMethodString, true);
            else
                _fileNameMethod = FileNameMethod.Client;

            _erroredLocation = Settings.Parameters["erroredLocation"];

            if (!string.IsNullOrEmpty(_erroredLocation) && !Path.IsPathRooted(_erroredLocation))
                _location = HostingEnvironment.MapPath(_erroredLocation);
		}
Example #3
0
        /// <summary>
        /// Creates a new instance of the <see cref="FileUploadStreamProvider" /> class with the specified configuration settings.
        /// </summary>
        /// <param name="settings">The <see cref="UploadStreamProviderElement" /> object that holds the configuration settings.</param>
        public FileUploadStreamProvider(UploadStreamProviderElement settings)
            : base(settings)
        {
            _location = Settings.Parameters["location"];

            if (_location == null)
            {
                // TODO: fix up
                throw new Exception("location must be specified for SlickUpload file provider");
            }
            else if (!Path.IsPathRooted(_location))
            {
                _location = HostingEnvironment.MapPath(_location);
            }

            string existingActionString = Settings.Parameters["existingAction"];

            if (!string.IsNullOrEmpty(existingActionString))
            {
                _existingAction = (ExistingAction)Enum.Parse(typeof(ExistingAction), existingActionString, true);
            }
            else
            {
                _existingAction = ExistingAction.Exception;
            }

            string fileNameMethodString = Settings.Parameters["fileNameMethod"];

            if (!string.IsNullOrEmpty(fileNameMethodString))
            {
                _fileNameMethod = (FileNameMethod)Enum.Parse(typeof(FileNameMethod), fileNameMethodString, true);
            }
            else
            {
                _fileNameMethod = FileNameMethod.Client;
            }

            _erroredLocation = Settings.Parameters["erroredLocation"];

            if (!string.IsNullOrEmpty(_erroredLocation) && !Path.IsPathRooted(_erroredLocation))
            {
                _location = HostingEnvironment.MapPath(_erroredLocation);
            }
        }