Beispiel #1
0
            internal void Process()
            {
                foreach (var metaAttr in Reflect.FindMembers <BlockMetaAttribute>(Type, CommandAttributeSearch))
                {
                    MetaInfo info = new MetaInfo();
                    info.Name = metaAttr.Attribute.Name;
                    if (info.Process(metaAttr.Info))
                    {
                        if (m_MetaCommands.ContainsKey(info.Name))
                        {
                            info.Dispose();
                            Debug.LogErrorFormat("[BlockMetaCache] Multiple instances of command '{0}' on type '{1}'", info.Name, Type.Name);
                            continue;
                        }

                        m_MetaCommands.Add(info.Name, info);
                    }
                    else
                    {
                        Debug.LogErrorFormat("[BlockMetaCache] Command '{0}' on type '{1}' is not valid", info.Name, Type.Name);
                    }
                }

                foreach (var contentAttr in Reflect.FindMembers <BlockContentAttribute>(Type, ContentAttributeSearch))
                {
                    ContentInfo info = new ContentInfo();
                    info.Mode          = contentAttr.Attribute.Mode;
                    info.LineSeparator = contentAttr.Attribute.LineSeparator;
                    if (info.Process(contentAttr.Info))
                    {
                        if (info.Mode == BlockContentMode.LineByLine && !info.IsMethod())
                        {
                            Debug.LogWarningFormat("[BlockMetaCache] Content command '{0}' on type '{1}' is field or property - cannot set method to LineByLine", info.Name, Type.Name);
                            info.Mode = BlockContentMode.BatchContent;
                        }

                        m_ContentCommand = info;
                        break;
                    }
                    else
                    {
                        Debug.LogErrorFormat("[BlockMetaCache] Content command '{0}' on type '{1}' is not valid", info.Name, Type.Name);
                    }
                }
            }