예제 #1
0
        private void ExtractParams(
            string code,
            StringCollection paramNames,
            ICollection <ObjectViewParameterLoader> paramLoaders)
        {
            int nameStart = 0;
            int nameEnd   = 0;

            for (int startIndex = 0; StrUtils.FindNameInVb(code, startIndex, ref nameStart, ref nameEnd); startIndex = nameEnd)
            {
                string str1 = code.Substring(nameStart, nameEnd - nameStart);
                if (str1.EndsWith("Property", StringComparison.InvariantCultureIgnoreCase))
                {
                    string name = str1.Substring(0, str1.Length - 8);
                    string str2 = name + "Property";
                    if (!paramNames.Contains(str2) && ObjectViewParameterLoader.CanCreate(this.FObjectView, name))
                    {
                        paramNames.Add(str2);
                        paramLoaders?.Add(ObjectViewParameterLoader.Create(this.FObjectView, name));
                    }
                }
            }
            paramNames.Add("ThisObject");
            paramLoaders?.Add((ObjectViewParameterLoader) new ObjectViewThisObjectLoader());
        }
        public static ObjectViewParameterLoader Create(
            MetadataObjectView view,
            string name)
        {
            ObjectViewParameterLoader viewParameterLoader1 = ObjectViewIdLoader.TryCreate(view, name);

            if (viewParameterLoader1 != null)
            {
                return(viewParameterLoader1);
            }
            ObjectViewParameterLoader viewParameterLoader2 = ObjectViewPropertyLoader.TryCreate(view, name);

            if (viewParameterLoader2 != null)
            {
                return(viewParameterLoader2);
            }
            return(ObjectViewVirtualPropertyLoader.TryCreate(view, name) ?? throw new Exception("Невозможно создать загрузчик значения параметра для \"" + name + "\""));
        }