Exemple #1
0
        public ActionData(IFile file, IActionPropertySet inputSet, OptionList options)
        {           
            m_file = file;
            m_actionProps = new ActionPropertySet(inputSet);

            IActionProperty actionPropertyName = new ActionProperty("FileName", typeof(System.String), PropertyDisplayType.Default, false, false, m_file.FileName, true);
            IActionProperty actionPropertyDisplay = new ActionProperty("DisplayName", typeof(System.String), PropertyDisplayType.Default, false, false, m_file.DisplayName, true);
            IActionProperty actionPropertyType = new ActionProperty("FileType", typeof(System.String), PropertyDisplayType.Default, false, false, FileTypeBridge.GetFileType(m_file.FileType), true);

            m_actionProps.SystemProperties["FileName"] = actionPropertyName;
            m_actionProps.SystemProperties["DisplayName"] = actionPropertyDisplay;
            m_actionProps.SystemProperties["FileType"] = actionPropertyType;

            m_properties["FileName"] = actionPropertyName.Value.ToString();
            m_properties["DisplayName"] = actionPropertyDisplay.Value.ToString();
            m_properties["FileType"] = actionPropertyType.Value.ToString();

			foreach (KeyValuePair<string, IActionProperty> prop in m_actionProps)
			{
				if (options.Contains(prop.Key))
					prop.Value.Value = options[prop.Key].Checked;
			}

			if (m_actionProps.ContainsKey("HandleFootnotesHiddenData") && options.Contains("Footnotes") && options["Footnotes"].Checked)
			{
				m_actionProps["HandleFootnotesHiddenData"].Value = true;
			}

            FileName = m_file.FileName;
        }
		public Stream ExecuteMime(IActionData3 data, ActionPropertySet aProperties)
        {
			if (aProperties.ContainsKey(AbortOnExecuteActionStringTable.Abort))
                throw new AbortActionException("Abort as requested");

			return data.Content;
        }
		public string Execute(IActionData3 input, ActionPropertySet aProperties)
        {
			if (aProperties.ContainsKey(AbortOnExecuteActionStringTable.Abort))
                throw new AbortActionException("Abort as requested");
            
            return input.FileName;
        }
        /// <summary>
        /// This method provides the logic for the merging engine-specific properties.
        /// </summary>
        /// <returns>Merged engine properties</returns>
        private ActionPropertySet MergeEngineProperties(ActionPropertySet[] sets)
        {
            ActionPropertySet merged = new ActionPropertySet();

            foreach (ActionPropertySet aps in sets)
            {

                foreach (string key in aps.Keys)
                {
                    if (Array.IndexOf(m_engineProperties, key) < 0)
                        continue;

                    if (!merged.ContainsKey(key))
                    {
                        //First pass - just add.
                        merged[key] = aps[key].Clone();
                    }
                    else
                    {
                        //Merge.
                        IActionProperty source = aps[key];
						ActionProperty dest = (ActionProperty)merged[key];

                        dest.Override = source.Override && dest.Override;
                        dest.Visible = source.Visible || dest.Visible;

                        switch( key )
                        {
                            case "EXECUTE":
                                dest.Value = (bool)source.Value || (bool)dest.Value;
                                break;

                            case "transparent":
                                dest.Value = (bool)source.Value && (bool)dest.Value;
                                break;
                            case "autoexpand":
                                dest.Value = (bool)source.Value || (bool)dest.Value;
                                break;
                            default:
                                throw new ArgumentOutOfRangeException("Unsupported property was added to the property set.");
                        }
                    }
                }
            }

            return merged;
        }