Example #1
0
        /// <summary>
        /// Sets H72 Parameter for Node
        /// </summary>
        /// <param name="H72Node">TAS H72 Node</param>
        /// <param name="Name">Parameter Name</param>
        /// <param name="Value">Parameter Value</param>
        /// <returns name="H72Parameter">Parameter</returns>
        /// <search>
        /// TAS, H72, H72Node, H72 Node, SetParameter, Set Parameter, set parameter, setparameter, seth72parameter,
        /// </search>
        public static H72Parameter SetParameter(H72Node H72Node, string Name, object Value)
        {
            H72Parameter aH72Parameter = H72Node.pH72ParameterList.Find(x => x.Name == Name);

            if (aH72Parameter == null)
            {
                aH72Parameter = new H72Parameter(Name);
                H72Node.pH72ParameterList.Add(aH72Parameter);
            }
            aH72Parameter.Value = Value;

            return(aH72Parameter);
        }
Example #2
0
        /// <summary>
        /// Gets H72 Parameter Value by given name
        /// </summary>
        /// <param name="H72Node">TAS H72 Node</param>
        /// <param name="Name">Parameter Name</param>
        /// <returns name="Value">Parameter value</returns>
        /// <search>
        /// TAS, H72, H72Node, H72 Node, GetParameterValueByName, Get Parameter Value By Name, getparametervaluebyname, get parameter value by name
        /// </search>
        public static object GetParameterValueByName(H72Node H72Node, string Name)
        {
            H72Parameter aH72Parameter = H72Node.pH72ParameterList.Find(x => x.Name == Name);

            if (aH72Parameter != null)
            {
                return(aH72Parameter.Value);
            }
            else
            {
                return(null);
            }
        }
 /// <summary>
 /// Gets Value of H72 Parameter
 /// </summary>
 /// <param name="H72Parameter">H72 Parameter</param>
 /// <returns name="Value">Parameter value</returns>
 /// <search>
 /// TAS, H72Parameter, H72 Parameter, h72parameter, get value, value, Value, GetValue
 /// </search>
 public static object GetValue(H72Parameter H72Parameter)
 {
     return(H72Parameter.pValue);
 }
 /// <summary>
 /// Gets Name of H72 Parameter
 /// </summary>
 /// <param name="H72Parameter">H72 Parameter</param>
 /// <returns name="Name">Parameter Name</returns>
 /// <search>
 /// TAS, H72Parameter, H72 Parameter, h72parameter, get name, name, Name, GetName
 /// </search>
 public static string GetName(H72Parameter H72Parameter)
 {
     return(H72Parameter.pName);
 }
 /// <summary>
 /// Sets Value of H72 Parameter
 /// </summary>
 /// <param name="H72Parameter">H72 Parameter</param>
 /// <param name="Value">H72 Parameter Value</param>
 /// <returns name="H72Parameter">H72 Parameter</returns>
 /// <search>
 /// TAS, H72Parameter, H72 Parameter, h72parameter, set value, value, Value, SetValue
 /// </search>
 public static H72Parameter SetValue(H72Parameter H72Parameter, object Value)
 {
     H72Parameter.pValue = Value;
     return(H72Parameter);
 }
Example #6
0
        internal H72Node(string[] Lines, int StartIndex, out int EndIndex)
        {
            EndIndex          = StartIndex + 1;
            pName             = null;
            pH72NodeList      = null;
            pH72ParameterList = null;
            if (Lines.Length > StartIndex)
            {
                string aLine        = Lines[StartIndex];
                string aTrimmedLine = aLine.TrimStart();
                if (aTrimmedLine.StartsWith("["))
                {
                    pH72NodeList      = new List <H72Node>();
                    pH72ParameterList = new List <H72Parameter>();
                    pName             = aTrimmedLine.TrimEnd();
                    if (pName.Length > 1)
                    {
                        pName = pName.Substring(1, pName.Length - 2);
                    }
                    int aNestingIndex = aLine.Length - aTrimmedLine.Length;
                    EndIndex = StartIndex + 1;
                    while (EndIndex < Lines.Length)
                    {
                        aLine = Lines[EndIndex];
                        if (!string.IsNullOrEmpty(aLine) || !string.IsNullOrWhiteSpace(aLine))
                        {
                            aTrimmedLine = aLine.TrimStart();
                            int aCurrentNestingIndex = aLine.Length - aTrimmedLine.Length;

                            if (aCurrentNestingIndex < aNestingIndex)
                            {
                                break;
                            }

                            if (aTrimmedLine.StartsWith("["))
                            {
                                if (aCurrentNestingIndex == aNestingIndex)
                                {
                                    break;
                                }

                                int     aNewEndIndex = 0;
                                H72Node aH72Node     = new H72Node(Lines, EndIndex, out aNewEndIndex);
                                if (aH72Node.pName != null)
                                {
                                    pH72NodeList.Add(aH72Node);
                                }
                                EndIndex = aNewEndIndex - 1;
                            }
                            else if (aTrimmedLine.Contains("="))
                            {
                                aTrimmedLine = aTrimmedLine.TrimEnd();
                                int aIndex = aTrimmedLine.IndexOf('=');
                                if (aIndex > 0)
                                {
                                    H72Parameter aH72Parameter = new H72Parameter(aTrimmedLine.Substring(0, aIndex), aTrimmedLine.Substring(aIndex + 1));
                                    pH72ParameterList.Add(aH72Parameter);
                                }
                            }
                            else if (aTrimmedLine.StartsWith("*"))
                            {
                                EndIndex++;
                                if (EndIndex < Lines.Length)
                                {
                                    aTrimmedLine = aTrimmedLine.TrimEnd();
                                    H72Parameter aH72Parameter = new H72Parameter(aTrimmedLine, Lines[EndIndex].Trim());
                                    pH72ParameterList.Add(aH72Parameter);
                                }
                            }
                        }
                        EndIndex++;
                    }
                }
            }
        }