コード例 #1
0
        private static CVariable GetRedProperty(IEditableVariable cvar, string propertyName)
        {
            foreach (var member in REDReflection.GetMembers(cvar))
            {
                try
                {
                    var redname = REDReflection.GetREDNameString(member);
                    if (redname != propertyName)
                    {
                        continue;
                    }

                    var prop  = cvar.accessor[cvar, member.Name];
                    var cprop = prop as CVariable;

                    return(cprop);
                }
                catch (Exception e)
                {
                    Console.WriteLine(e);
                    throw;
                }
            }

            return(null);
        }
コード例 #2
0
        private void InstantiateAllRedProps()
        {
            foreach (var item in this.GetREDMembers(true))
            {
                var o = accessor[this, item.Name];
                if (o is CVariable cvar)
                {
                }
                else // is null
                {
                    var att = item.GetMemberAttribute <REDAttribute>();
                    // instantiate
                    var vartype = REDReflection.GetREDTypeString(item.Type, att.Flags);
                    var varname = REDReflection.GetREDNameString(item);

                    var newvar = CR2WTypeManager.Create(vartype, varname, this.cr2w, this);     // create new variable and parent to this
                    if (newvar != null)
                    {
                        accessor[this, item.Name] = newvar;
                    }
                }
            }
        }