Beispiel #1
0
        /// <summary>
        /// Basic object information, such as Type, ID, Name
        /// </summary>
        /// <param name="Lines">Array of textlines</param>
        /// <param name="Target">Current ALObject instance</param>
        public void GetObjectInfo(string line, out IALObject Target)
        {
            Target = new ALObject();

            if (!string.IsNullOrEmpty(line))
            {
                var items = Regex.Match(line, ObjectHeaderPattern, RegexOptions.IgnoreCase | RegexOptions.Multiline);
                var type  = items.Groups[1].Value.ToEnum <ALObjectType>();
                var idTxt = items.Groups[2].Value;

                Target    = ALObjectTypeMap.CreateInstance(type);
                Target.Id = 0;
                if (!String.IsNullOrEmpty(idTxt))
                {
                    Target.Id = int.Parse(items.Groups[2].Value);
                }
                var nameParts = items.Groups[3].Value.Split(" extends ");
                if (nameParts.Length < 2)
                {
                    nameParts = items.Groups[3].Value.Split(" implements ");
                }
                Target.Name = nameParts[0].Replace("\"", "").Trim();
                Target.Type = type;
            }

            OnGetObjectInfo(line, Target);
        }
Beispiel #2
0
        /// <summary>
        /// Basic object information, such as Type, ID, Name
        /// </summary>
        /// <param name="Lines">Array of textlines</param>
        /// <param name="Target">Current ALObject instance</param>
        public void GetObjectInfo(IEnumerable <string> Lines, out IALObject Target)
        {
            Target = new ALObject();
            var line = Lines
                       .Where(w => Regex.IsMatch(w.ToLower(), ObjectHeaderPattern, RegexOptions.IgnoreCase | RegexOptions.Multiline))
                       .FirstOrDefault();

            GetObjectInfo(line, out Target);
        }