Exemple #1
0
        private void CollectOutlets(IIBReferenceResolver resolver)
        {
            IBDictionary dict = this.Find <IBDictionary>("outlets");

            if (dict == null)
            {
                return;
            }

            foreach (String key in dict.Keys)
            {
                IBString itemKey = dict[key] as IBString;
                if (itemKey == null)
                {
                    continue;
                }

                IIBItem     itemValue = dict[key];
                IBReference reference = itemValue as IBReference;
                if ((resolver != null) && (reference != null))
                {
                    itemValue = resolver.ResolveReference(reference);
                }
                this.outlets.Add(new IBOutletDescriptor(key, itemValue.ToString()));
            }
        }
Exemple #2
0
        public override void Finish(IIBReferenceResolver resolver)
        {
            base.Finish(resolver);

            if (this.usesXmlCoder)
            {
                IIBItem item1  = this.Find <IIBItem>("dict.sortedKeys");
                IBArray keys   = this.DereferenceItem(resolver, item1) as IBArray;
                IIBItem item2  = this.Find <IIBItem>("dict.values");
                IBArray values = this.DereferenceItem(resolver, item2) as IBArray;
                if (keys != null && values != null)
                {
                    for (int i = 0; i < keys.Count; i++)
                    {
                        IBString key   = keys[i] as IBString;
                        IIBItem  value = values[i];
                        if (key != null)
                        {
                            this.Add(key.ToString(), value);
                        }
                    }
                }
                else
                {
                    throw new Exception("It seems that the parsing has really gone wrong. Can't find either keys or values...");
                }
            }
            else if (this.Value.Count > 0)
            {
                bool useKeyValuePair;

                // Probe for the keys used.
                IIBItem item = this[0];
                useKeyValuePair = item.Key.StartsWith("NS.key.");

                if (useKeyValuePair)
                {
                    for (int i = 0; i < this.Value.Count;)
                    {
                        IIBItem keyItem   = this[i++];
                        IIBItem valueItem = this[i++];
                        this.Add(keyItem.ToString(), valueItem);
                    }
                }
                else
                {
                    for (int i = 0; i < this.Value.Count; i++)
                    {
                        item = this[i];
                        this.Add(item.Key, item);
                    }
                }
            }
        }
Exemple #3
0
        /// <summary>
        ///   Finishes the population of this instance.
        /// </summary>
        public override void Finish(IIBReferenceResolver resolver)
        {
            base.Finish(resolver);

            IBString className = this.Find <IBString>("classname", StringComparison.OrdinalIgnoreCase);

            this.ClassName = className != null ? className.Value : String.Empty;
            IBString superclassName = this.Find <IBString>("superclassname", StringComparison.OrdinalIgnoreCase);

            this.SuperClassName = superclassName != null ? superclassName.Value : String.Empty;

            this.CollectActions(resolver);
            this.CollectOutlets(resolver);
        }