Ejemplo n.º 1
0
        /// <summary>
        /// Load Informations about a specific Want
        /// </summary>
        /// <param name="guid">The GUID of the want</param>
        /// <returns>A Want Information Structure</returns>
        public static WantInformation LoadWant(uint guid)
        {
            LoadCache();
            if (wantcache == null)
            {
                wantcache = cachefile.Map;
            }

            if (wantcache.ContainsKey(guid))
            {
                object          o = wantcache[guid];
                WantInformation wf;
                if (o.GetType() == typeof(WantInformation))
                {
                    wf = (WantInformation)o;
                }
                else
                {
                    wf = WantCacheInformation.LoadWant((WantCacheItem)o);
                }

                return(wf);
            }
            else
            {
                WantInformation wf = new WantInformation(guid);
                wantcache[guid] = wf;
                cachefile.AddItem(wf);
                return(wf);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Load Informations about a specific Want
        /// </summary>
        /// <param name="guid">The GUID of the want</param>
        /// <returns>A Want Information Structure</returns>
        public static WantCacheInformation LoadWant(SimPe.Cache.WantCacheItem wci)
        {
            WantCacheInformation ret = new WantCacheInformation();

            ret.icon = wci.Icon;
            ret.name = wci.Name;
            ret.guid = wci.Guid;

            XWant w = new XWant();

            SimPe.PackedFiles.Wrapper.CpfItem i = new SimPe.PackedFiles.Wrapper.CpfItem(); i.Name = "id"; i.UIntegerValue = wci.Guid; w.AddItem(i, true);
            i = new SimPe.PackedFiles.Wrapper.CpfItem(); i.Name = "folder"; i.StringValue = wci.Folder; w.AddItem(i, true);
            i = new SimPe.PackedFiles.Wrapper.CpfItem(); i.Name = "score"; i.IntegerValue = wci.Score; w.AddItem(i, true);
            i = new SimPe.PackedFiles.Wrapper.CpfItem(); i.Name = "influence"; i.IntegerValue = wci.Influence; w.AddItem(i, true);
            i = new SimPe.PackedFiles.Wrapper.CpfItem(); i.Name = "objectType"; i.StringValue = wci.ObjectType; w.AddItem(i, true);

            ret.wnt = w;

            return(ret);
        }