예제 #1
0
        /// <summary>
        /// Clone this instance.
        /// </summary>
        /// <returns>
        /// <c><see cref="Akira.CatalogData`1"/></c></returns>
        public virtual CatalogData <T> Clone()
        {
            Platforms p = this.platform;
            Dictionary <Platforms, T> dic = new Dictionary <Platforms, T> ();

            this.platform = Platforms.Default;
            T rtd = this;

            dic.Add(Platforms.Default, rtd);
            int i;
            int d = 1;

            for (i = 0; i < 10; i++)
            {
                this.platform = (Platforms)(d << i);
                T rt = this;
                if (!(rt as object).Equals(rtd as object))
                {
                    dic.Add((Platforms)(d << i), rt);
                }
            }
            CatalogData <T> rct = new CatalogData <T> (dic);

            this.platform = p;
            return(rct);
        }
예제 #2
0
        public static CatalogData <T> operator -(dynamic t, CatalogData <T> ct)
        {
            Platforms p = ct.platform;
            Dictionary <Platforms, T> dic = new Dictionary <Platforms, T> ();

            ct.platform = Platforms.Default;
            T rtd = ct;

            dic.Add(Platforms.Default, rtd);
            int i;
            int d = 1;

            for (i = 0; i < 10; i++)
            {
                ct.platform = (Platforms)(d << i);
                T rt = ct;
                if (!(rt as object).Equals(rtd as object))
                {
                    dic.Add((Platforms)(d << i), rt);
                }
            }
            if (ct.obj.ContainsKey(p))
            {
                dic.Remove(p);
                dic.Add(p, t - ct.obj [p]);
            }
            else
            {
                dic.Remove(Platforms.Default);
                dic.Add(Platforms.Default, t - ct.obj [Platforms.Default]);
            }
            CatalogData <T> rct = new CatalogData <T> (dic);

            ct.platform = p;
            return(rct);
        }