private bool TryGetValueByRemovingTheAreaString(AreaDefinition source, string line, out string value)
        {
            // Take the area string as the "substitute" and remove the length in hope...
            value = line.Remove(0, source.AreaString.String.Length);

            return(true);
        }
        private bool TryGetValueByRemovingTheAreaString(AreaDefinition source, string line, out string value)
        {
            // Take the area string as the "substitute" and remove the length in hope...
            value = line.Remove(0, source.AreaString.String.Length);

            return true;
        }
        public AreaLineInformation(AreaDefinition source, string line)
        {
            Value      = GetValueFromLine(source, line);
            AreaString = line.Substring(0, line.Length - Value.Length);

            Value      = Value.Trim();
            AreaString = AreaString.Trim();
        }
        public AreaLineInformation(AreaDefinition source, string line)
        {
            Value = GetValueFromLine(source, line);
            AreaString = line.Substring(0, line.Length - Value.Length);

            Value = Value.Trim();
            AreaString = AreaString.Trim();
        }
Beispiel #5
0
        /// <summary>
        /// Initializes a new instance of the <see cref="AreaTreeNode"/> class.
        /// </summary>
        public AreaTreeNode()
            : base()
        {
            NodeType  = FaxHierarchyTreeNodeType.Area;
            this.Text = "Bereich";

            this.Definition = new AreaDefinition();
            this.Tag        = Definition;
        }
        public string GetValueFromLine(AreaDefinition source, string line)
        {
            string value = null;

            if (!TryGetValueByAssertingSeparator(source, line, out value))
            {
                TryGetValueByRemovingTheAreaString(source, line, out value);
            }

            return(value);
        }
        public string GetValueFromLine(AreaDefinition source, string line)
        {
            string value = null;

            if (!TryGetValueByAssertingSeparator(source, line, out value))
            {
                TryGetValueByRemovingTheAreaString(source, line, out value);
            }

            return value;
        }
        private bool TryGetValueByAssertingSeparator(AreaDefinition source, string line, out string value)
        {
            value = null;

            int iColon = line.IndexOf(source.Separator);
            if (iColon == -1)
            {
                return false;
            }

            iColon += 1;

            value = line.Remove(0, iColon).Trim();
            return true;
        }
        private bool TryGetValueByAssertingSeparator(AreaDefinition source, string line, out string value)
        {
            value = null;

            int iColon = line.IndexOf(source.Separator);

            if (iColon == -1)
            {
                return(false);
            }

            iColon += 1;

            value = line.Remove(0, iColon).Trim();
            return(true);
        }
Beispiel #10
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SectionDefinition"/> class.
        /// </summary>
        /// <param name="element">The XML-element to read the data from.</param>
        public SectionDefinition(XElement element)
            : this()
        {
            this.SectionString.String      = element.TryGetAttributeValue("Text", null);
            this.SectionString.IsContained = element.TryGetAttributeValue("Text-IsContained", true);

            // Parse the areas...
            foreach (XElement areaE in element.Elements("Area"))
            {
                AreaDefinition areaDefinition = new AreaDefinition(areaE);
                if (!areaDefinition.IsValidDefinition())
                {
                    // TODO: Log warning
                    continue;
                }

                this.Areas.Add(areaDefinition);
            }
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="SectionDefinition"/> class.
        /// </summary>
        /// <param name="element">The XML-element to read the data from.</param>
        public SectionDefinition(XElement element)
            : this()
        {
            this.SectionString.String = element.TryGetAttributeValue("Text", null);
            this.SectionString.IsContained = element.TryGetAttributeValue("Text-IsContained", true);

            // Parse the areas...
            foreach (XElement areaE in element.Elements("Area"))
            {
                AreaDefinition areaDefinition = new AreaDefinition(areaE);
                if (!areaDefinition.IsValidDefinition())
                {
                    // TODO: Log warning
                    continue;
                }

                this.Areas.Add(areaDefinition);
            }
        }
Beispiel #12
0
 private bool IsLineAreaRelevant(string line, SectionDefinition currentSection, out AreaDefinition area)
 {
     area = currentSection.GetArea(line);
     return area != null;
 }
Beispiel #13
0
 private void WriteValueToOperation(string value, AreaDefinition area, Operation operation)
 {
     // First check: Check if the object has the property we want right away
     PropertyInfo piLocal = operation.GetType().GetProperty(area.MapToPropertyName, BindingFlags.Public | BindingFlags.Instance | BindingFlags.IgnoreCase);
     if (piLocal != null)
     {
         WriteValueToProperty(value, piLocal, operation);
     }
     else
     {
         PropertyInfo piCustomData = operation.GetType().GetProperty("CustomData");
         WriteValueToCustomData(value, area, piCustomData, operation);
     }
 }
Beispiel #14
0
        private void WriteValueToCustomData(string value, AreaDefinition area, PropertyInfo piCustomData, Operation operation)
        {
            // We know that the CustomData-object is a dictionary with string, object...
            IDictionary<string, object> customData = (IDictionary<string, object>)piCustomData.GetValue(operation, null);

            // If the custom data entry already exists, give a warning and overwrite it
            if (customData.ContainsKey(area.MapToPropertyName))
            {
                Logger.Instance.LogFormat(LogType.Warning, this, "The custom data entry '{0}' does already exist and is being overwritten. Please check your control file if this is the intended behavior!", area.MapToPropertyName);
            }
            customData[area.MapToPropertyName] = value;
        }