예제 #1
0
        _Entry release(_Entry entry)
        {
            if (entry.prev != null)
            {
                D.assert(this._head != entry);
                entry.prev.next = entry.next;
            }
            else
            {
                D.assert(this._head == entry);
                this._head = entry.next;
            }

            if (entry.next != null)
            {
                D.assert(this._tail != entry);
                entry.next.prev = entry.prev;
            }
            else
            {
                D.assert(this._tail == entry);
                this._tail = entry.prev;
            }

            return(entry);
        }
예제 #2
0
        public void Dispose()
        {
            D.assert(this.validate);

            // just remove the references, Image will dispose by themselves.
            this._entryCount = 0;
            this._head       = this._tail = null;
        }
예제 #3
0
 void attachToHead(_Entry entry)
 {
     entry.prev = null;
     entry.next = this._head;
     if (this._head != null)
     {
         this._head.prev = entry;
     }
     else
     {
         this._tail = entry;
     }
     this._head = entry;
 }
예제 #4
0
        /// <summary>
        /// See above (several methods) for a comment showing example expected content.
        /// In theory this will handle plain content as well, but it will produce just a single dictionary in that case.
        /// The main scenario assumes a javascript object to be expanded into multiple fields posted in multipart form and
        /// named with dotted chains reflecting their original position.
        /// </summary>
        /// <returns></returns>
        protected Dictionary <string, object> ReconstructFromMultipart()
        {
            var form = _HttpContext.Request?.Form;
            Dictionary <string, _Entry> elements = new Dictionary <string, _Entry>();

            if (form != null)
            {
                foreach (var kv in form)
                {
                    elements.Add(kv.Key, new _Entry(kv.Value));
                }
                var files = form.Files;
                if (files != null)
                {
                    foreach (var ff in files)
                    {
                        if (elements.ContainsKey(ff.Name))
                        {
                            elements[ff.Name].Files.Add(ff);
                        }
                        else
                        {
                            elements.Add(ff.Name, new _Entry(ff));
                        }
                    }
                }
            }
            var result = new Dictionary <string, object>();

            string[] parts = null;
            if (elements.Count > 0)
            {
                foreach (var kv in elements)
                {
                    _Entry entry = kv.Value;
                    parts = kv.Key.Split('.');

                    /*
                     *  Although the client should not typically pass arrays as values, this may happen and may be useful
                     *  if consumed through resolvers. So we support it - see in _Entry.Value for details.
                     */
                    SetInStructure(result, parts, entry.Value);
                }
                return(result);
            }
            else
            {
                return(result);
            }
        }
예제 #5
0
        void add(_Key key, Image image)
        {
            if (this._entryCount == this.maxEntries)
            {
                D.assert(this._tail != null);
                this.release(this._tail);
                this._entryCount--;
            }

            var entry = new _Entry {
                key = key, image = image
            };

            this.attachToHead(entry);
            this._entryCount++;
        }
예제 #6
0
        public AnimHandle Play(AnimType.ActionData action)
        {
            var player = new AnimPlayer();
            var handle = player.Play(m_skeleton, action);

            if (handle == null)
            {
                return(null);
            }

            var entry = new _Entry()
            {
                Player = player,
                Handle = handle,
            };

            m_entryList.Add(entry);

            return(handle);
        }