protected override ResourceSaveOperation CreateSaveOperationForItem(IStorage storage, CatalogContext context, CatalogItem item, CancellationToken cancellationToken)
        {
            // This method decides what to do with the item.
            // If it's a RegistrationMakerCatalogItem and it already exists, then don't write content.
            var registrationMakerCatalogItem = item as RegistrationMakerCatalogItem;
            if (registrationMakerCatalogItem != null)
            {
                var content = item.CreateContent(Context); // note: always do this first
                var resourceUri = item.GetItemAddress();

                var saveOperation = new ResourceSaveOperation();
                saveOperation.ResourceUri = resourceUri;

                if (!registrationMakerCatalogItem.IsExistingItem && content != null)
                {
                    saveOperation.SaveTask = storage.Save(resourceUri, content, cancellationToken);
                }
                else
                {
                    Trace.WriteLine(string.Format("Resource {0} already exists. Skipping.", resourceUri), "Debug");
                }

                return saveOperation;
            }

            return base.CreateSaveOperationForItem(storage, context, item, cancellationToken);
        }
Example #2
0
 internal void SetStartCell(CatalogItem cell)
 {
     foreach (DataRow row in Table.Rows)
         {
         row[START_CELL_COLUMN_NAME] = cell.Id;
         }
 }
Example #3
0
 public static string GetPathFor(Resolution resolution, CatalogItem item) {
     var folder = GetFolderForResolution(resolution);
     if (item.Model == null) {
         return null;
     }
     var path = Path.Combine(folder, string.Format("{0}.png", item.Model.name));
     return path.Replace('\\', '/');
 }
    public void Initialize(CatalogItem itemInfo)
    {
        myInfo = itemInfo;

        displayNameText.text = itemInfo.DisplayName;
        descriptionText.text = itemInfo.Description;
        priceText.text = itemInfo.VirtualCurrencyPrices[GameConstants.inGameCurrencyID].ToString();
    }
Example #5
0
 public BarcodeData()
 {
     Nomenclature = new CatalogItem();
     Party = new CatalogItem();
     Cell = new CatalogItem();
     Tray = new CatalogItem();
     Liner = new CatalogItem();
 }
Example #6
0
 public Content(CatalogItem type, string[] commandParams)
 {
     this.Type = type;
     this.Title = commandParams[(int)ItemInformation.Title];
     this.Author = commandParams[(int)ItemInformation.Author];
     this.Size = Int64.Parse(commandParams[(int)ItemInformation.Size]);
     this.URL = commandParams[(int)ItemInformation.Url]; 
 }
Example #7
0
    public void Initialize(uint price, CatalogItem item)
    {
        Button newButton   = Instantiate(itemButton);
        
        transformItemImage = newButton.GetComponentInChildren<Transform>().Find("ItemImage");
        itemImage          = transformItemImage.GetComponent<Image>();
        priceText          = newButton.GetComponentInChildren<Text>();
        holder             = newButton.GetComponent<ContentHolder>();        

        holder.catalogItem = item;
        holder.itemClass   = item.ItemClass;
        priceText.text     = price.ToString();

        if (item.ItemClass == "Skin")
        {
            itemImage.sprite = SkinImageList[indexSkinSprite];
            holder.skin = PlayFabGameBridge.Instance.skins[item.ItemId];

            if (!PlayFabGameBridge.Instance.boughtSkins.ContainsKey(holder.catalogItem.ItemId))
            {
                itemImage.color = new Color(0.1f, 0.1f, 0.1f, 1f); 
                holder.skin.isBought = false;
            }
            else
            {
                itemImage.color = Color.white;
                holder.skin.isBought = true;
            }
                
            newButton.transform.SetParent(skinContentPanel.transform);
            indexSkinSprite++;

        }

        if (item.ItemClass == "Missile")
        {
            itemImage.sprite = MissileImageList[indexMissileSprite];
            holder.missile = PlayFabGameBridge.Instance.missiles[item.ItemId];

            if (!PlayFabGameBridge.Instance.boughtMissiles.ContainsKey(holder.catalogItem.ItemId))
            {
				itemImage.color = new Color(0.1f, 0.1f, 0.1f, 1f); 
				holder.missile.isBought = false;
            }
            else
            {
                itemImage.color = Color.white;
                holder.missile.isBought = true;
            }
                                 
            newButton.transform.SetParent(missileContentPanel.transform);
            indexMissileSprite++;

        }

        itemImages.Add(item.ItemId, itemImage);
        itemContentHolders.Add(item.ItemId, holder);
    }
    public void Initialize(StoreScreen_OLD screenManager, CatalogItem info)
    {   
        this.screenManager = screenManager;
        this.myInfo = info;

        itemNameText.text = myInfo.DisplayName;
        itemDescriptionText.text = myInfo.Description;
        itemPriceText.text = myInfo.VirtualCurrencyPrices["1"].ToString();
    }
Example #9
0
    public void OnCancel()
    {
        if (selected != null) {
            selected.SetSelection(false);
            selected = null;
        }

        canceled = true;
        UIManager.HideCatalog();
    }
Example #10
0
 public IAsyncResult BeginGetCatalogItemNotes(CatalogItem catalogItem, Identification identification, AsyncCallback callback, object state)
 {
     logger.Log(LogLevel.Trace, AppLib.GetCaller(logger));
     if (AppLib.VerifyToken(identification.Token) <= 0)
     {
         throw new FaultException<ServiceFault>(new ServiceFault("Invalid Authentication", "Authorization"), new FaultReason("Unauthorized"));
     }
     var task = Task<SmartCollection<CatalogNote>>.Factory.StartNew(process => DoGetCatalogItemNotes(catalogItem, identification), state);
     return task.ContinueWith(res => callback(task));
 }
Example #11
0
    public void SetSelected(CatalogItem item)
    {
        if (selected != null)
            selected.SetSelection(false);

        selected = item;
        if (selected != null && selected.Item != null) {
            Debug.Log("Object layer " + objectsLayer.value);
            selected.Item.gameObject.layer = objectsLayer;
        }
    }
Example #12
0
        public static bool CanGiftItem(CatalogItem Item)
        {
            if (!Item.Data.AllowGift || Item.IsLimited || Item.Amount > 1 || Item.Data.ItemName.ToLower().StartsWith("cf_") || Item.Data.ItemName.ToLower().StartsWith("cfc_") ||
                Item.Data.InteractionType == InteractionType.BADGE || (Item.Data.Type != 's' && Item.Data.Type != 'i') || Item.CostDiamonds > 0 ||
                Item.Data.InteractionType == InteractionType.TELEPORT || Item.Data.InteractionType == InteractionType.DEAL)
                return false;

            if (Item.Data.IsRare)
                return false;

            if (PetUtility.IsPet(Item.Data.InteractionType))
                return false;
            return true;
        }
Example #13
0
 public Texture2D GetImageFor(CatalogItem item) {
     var path = GetPathFor(_resolution, item);
     if (path == null) {
         return null;
     }
     path = path.Substring(0, path.LastIndexOf(".", StringComparison.Ordinal)); // remove extension
     if (_imageCache.ContainsKey(path)) {
         return _imageCache[path];
     }
     var texture = Resources.Load<Texture2D>(path);
     if (texture != null) {
         _imageCache[path] = texture;
     }
     return texture;
 }
Example #14
0
 public void OnFocus() {
     titleContent = new GUIContent("Catalog Editor");
     var newCatalogComponent = Catalog.GetInstance();
     if (_catalog != newCatalogComponent) {
         //probably the scene has changed, let's not keep old data
         _currentCategory = null;
         _currentItem = null;
     }
     _catalog = newCatalogComponent?? Catalog.GetInstance();
     _serializedCatalog = new SerializedObject(_catalog);
     _buttonTemplate = _serializedCatalog.FindProperty("ButtonTemplate");
     _nullTexture = _serializedCatalog.FindProperty("NullTexture");
     _uiWidth = _serializedCatalog.FindProperty("UiWidth");
     _uiItemWidth = _serializedCatalog.FindProperty("UiItemWidth");
     _categories = _serializedCatalog.FindProperty("Categories");
     if (_settingsIcon == null) {
         _settingsIcon = AssetDatabase.LoadAssetAtPath<Texture>("Assets/Exosphir/Textures/EditorTextures/Settings.png");
     }
 }
        public static void GeneratePreviewToFile(CatalogItem item, Resolution resolution = new Resolution()) {
            if (resolution.Width == 0 || resolution.Height == 0) {
                resolution = CatalogItem.DefaultPreviewResolution;
            }
            if (item.Model == null) {
                return;
            }
            var resourcePath = PreviewCache.GetPathFor(resolution, item);
            var fullPath = Path.Combine(PreviewDestinationRoot, resourcePath);
            var folder = Path.GetDirectoryName(fullPath);

            if (folder != null) {
                Directory.CreateDirectory(folder);
            }

            var texture = item.PreviewImage.RenderPreview(resolution.Width, resolution.Height);
            var bytes = texture.EncodeToPNG();
            File.WriteAllBytes(fullPath, bytes);
            Object.DestroyImmediate(texture);
        }
 static void Main(string[] args)
 {
     if (args.Length < 3)
     {
         printUsage();
         Console.ReadLine();
     }
     else
     {
         var rs = new ReportingService2005();
         rs.Credentials = CredentialCache.DefaultCredentials;
         rs.Url = args[0];
         CatalogItem item = new CatalogItem();
         item.Path = args[1];
         List<CatalogItem> items = new List<CatalogItem>();
         items.Add(item);
         string emailAddressMapFile = args[2];
         Dictionary<string, string> emailAddressMap = populateEmailAddressMap(emailAddressMapFile);
         modSubscriptionEmail(rs, items, emailAddressMap);
         Console.WriteLine("\nFinished... Press any key");
         Console.ReadLine();
     }
 }
Example #17
0
 public void CreateCatalogItem(CatalogItem catalogItem)
 {
     throw new NotImplementedException();
 }
Example #18
0
 public void IgnoreSelected()
 {
     selected = null;
 }
 public string GetNewNameForEntity(CatalogItem sceneObject)
 {
     return(GetNewNameForEntity(sceneObject.name));
 }
Example #20
0
        private void clearCell(CatalogItem emptyCell)
        {
            if (!string.Format(@"������ ""{0}"" �������?", emptyCell.Description).Ask()) return;

            if (documentId == 0 && !initDocument())
                {
                return;
                }

            currentCell = emptyCell;
            currentCellPallets.Rows.Clear();

            if (!finishCell()) return;
            currentCell.Clear();
        }
Example #21
0
        private void onPaletSaved(CatalogItem cell, long paletId)
        {
            if (currentCell.Id != cell.Id)
                {
                currentCell = cell;
                currentCellPallets.Rows.Clear();
                }

            currentCellPallets.Rows.Add(paletId);
        }
Example #22
0
 public static bool CanSelectAmount(CatalogItem Item)
 {
     if (Item.IsLimited || Item.Amount > 1 || Item.Data.ItemName.ToLower().StartsWith("cf_") || Item.Data.ItemName.ToLower().StartsWith("cfc_") || !Item.HaveOffer || Item.Data.InteractionType == InteractionType.BADGE || Item.Data.InteractionType == InteractionType.DEAL)
         return false;
     return true;
 }
Example #23
0
 internal static ServerMessage PurchaseOk(CatalogItem itemCatalog, Dictionary<Item, uint> items,
                                          int clubLevel = 1)
 {
     return PurchaseOk(itemCatalog.Id, itemCatalog.Name, itemCatalog.CreditsCost, items, clubLevel,
         itemCatalog.DiamondsCost,
         itemCatalog.DucketsCost, itemCatalog.IsLimited, itemCatalog.LimitedStack, itemCatalog.LimitedSelled);
 }
Example #24
0
 private void startNewIdentification()
 {
     currentWare = new CatalogItem();
     currentParty = new CatalogItem();
     currentLiner = new CatalogItem();
     currentCell = new CatalogItem();
     previousStickerId = 0;
     newStickerId = 0;
     returnWareControls.UnitsCountTextBox.SetNumber(0);
     returnWareControls.PacksCountTextBox.SetNumber(0);
     returnWareControls.LinersCountTextBox.SetNumber(0);
     updateScanPalletLabelText();
     ShowControls(wareIdentificationControls);
 }
Example #25
0
        public IAsyncResult BeginGetWorkLoad(CatalogItem filterItem, SmartCollection<Analyte> filterAnalytes, DateTime beginStartDate, DateTime beginEndDate, Identification identification, AsyncCallback callback, object state)
        {
            logger.Log(LogLevel.Trace, AppLib.GetCaller(logger));
            if (AppLib.VerifyToken(identification.Token) <= 0)
                throw new FaultException<ServiceFault>(new ServiceFault("Invalid Authentication", "Authorization"), new FaultReason("Unauthorized"));

            var task = Task<SmartCollection<SampleTest>>.Factory.StartNew(process => DoGetWorkLoad(filterItem, filterAnalytes, beginStartDate, beginEndDate, identification), state);
            return task.ContinueWith(res => callback(task));
        }
Example #26
0
 public void CreateCatalogItem(CatalogItem catalogItem)
 {
     db.CatalogItems.Add(catalogItem);
     db.SaveChanges();
 }
Example #27
0
 public void UpdateCatalogItem(CatalogItem catalogItem)
 {
     db.Entry(catalogItem).State = EntityState.Modified;
     db.SaveChanges();
 }
Example #28
0
 public void RemoveCatalogItem(CatalogItem catalogItem)
 {
     db.CatalogItems.Remove(catalogItem);
     db.SaveChanges();
 }
Example #29
0
 public void CreateCatalogItem(CatalogItem catalogItem)
 {
     catalogItem.Id = indexGenerator.GetNextSequenceValue(db);
     db.CatalogItems.Add(catalogItem);
     db.SaveChanges();
 }
Example #30
0
 private void AddUriPlaceHolder(CatalogItem item)
 {
     item.PictureUri = _imageService.BuildUrlImage(item);
 }
Example #31
0
 public void UpdateCatalogItem(CatalogItem catalogItem)
 {
     base.Channel.UpdateCatalogItem(catalogItem);
 }
Example #32
0
 public void RemoveCatalogItem(CatalogItem catalogItem)
 {
     base.Channel.RemoveCatalogItem(catalogItem);
 }
Example #33
0
        public SmartCollection<SampleTest> DoGetWorkLoad(CatalogItem filterItem, SmartCollection<Analyte> filterAnalytes, DateTime beginStartDate, DateTime beginEndDate, Identification identification)
        {
            logger.Log(LogLevel.Trace, AppLib.GetCaller(logger));

            using (SampleDAO dao = new SampleDAO()) {
                return dao.GetWorkLoad(filterItem, filterAnalytes, beginStartDate, beginEndDate, identification);
            }
        }
Example #34
0
 public T AddItem(CatalogItem item)
 {
     Request.Items.Add(item);
     return((T)this);
 }
 public static void FillProductUrl(this CatalogItem item, string picBaseUrl, bool azureStorageEnabled)
 {
     item.PictureUri = azureStorageEnabled
            ? picBaseUrl + item.PictureFileName
            : picBaseUrl.Replace("[0]", item.Id.ToString());
 }
Example #36
0
 public bool ContainsImageFor(CatalogItem item) {
     return GetImageFor(item) != null;
 }
Example #37
0
        /// <summary>
        /// Composes the item.
        /// </summary>
        /// <param name="item">The item.</param>
        /// <param name="message">The message.</param>
        internal static void ComposeItem(CatalogItem item, ServerMessage message)
        {
            message.AppendInteger(item.Id);
            message.AppendString(item.Name, true);
            message.AppendBool(false);
            message.AppendInteger(item.CreditsCost);

            if (item.DiamondsCost > 0)
            {
                message.AppendInteger(item.DiamondsCost);
                message.AppendInteger(105);
            }
            else
            {
                message.AppendInteger(item.DucketsCost);
                message.AppendInteger(0);
            }
            message.AppendBool(item.GetFirstBaseItem().AllowGift);

            switch (item.Name)
            {
                case "g0 group_product":
                    message.AppendInteger(0);
                    break;

                case "room_ad_plus_badge":
                    message.AppendInteger(1);
                    message.AppendString("b");
                    message.AppendString("RADZZ");
                    break;

                default:
                    if (item.Name.StartsWith("builders_club_addon_") || item.Name.StartsWith("builders_club_time_"))
                    {
                        message.AppendInteger(0);
                    }
                    else if (item.Badge == "")
                    {
                        message.AppendInteger(item.Items.Count);
                    }
                    else
                    {
                        message.AppendInteger(item.Items.Count + 1);
                        message.AppendString("b");
                        message.AppendString(item.Badge);
                    }
                    break;
            }
            foreach (var baseItem in item.Items.Keys)
            {
                if (item.Name == "g0 group_product" || item.Name.StartsWith("builders_club_addon_") || item.Name.StartsWith("builders_club_time_"))
                {
                    break;
                }
                if (item.Name == "room_ad_plus_badge")
                {
                    message.AppendString("");
                    message.AppendInteger(0);
                }
                else
                {
                    message.AppendString(baseItem.Type.ToString());
                    message.AppendInteger(baseItem.SpriteId);

                    if (item.Name.Contains("wallpaper_single") || item.Name.Contains("floor_single") || item.Name.Contains("landscape_single"))
                    {
                        var array = item.Name.Split('_');
                        message.AppendString(array[2]);
                    }
                    else if (item.Name.StartsWith("bot_") || baseItem.InteractionType == Interaction.MusicDisc || item.GetFirstBaseItem().Name == "poster")
                    {
                        message.AppendString(item.ExtraData);
                    }
                    else if (item.Name.StartsWith("poster_"))
                    {
                        var array2 = item.Name.Split('_');
                        message.AppendString(array2[1]);
                    }
                    else if (item.Name.StartsWith("poster "))
                    {
                        var array3 = item.Name.Split(' ');
                        message.AppendString(array3[1]);
                    }
                    else if (item.SongId > 0u && baseItem.InteractionType == Interaction.MusicDisc)
                    {
                        message.AppendString(item.ExtraData);
                    }
                    else
                    {
                        message.AppendString(string.Empty);
                    }

                    message.AppendInteger(item.Items[baseItem]);
                    message.AppendBool(item.IsLimited);
                    if (!item.IsLimited)
                        continue;
                    message.AppendInteger(item.LimitedStack);
                    message.AppendInteger(item.LimitedStack - item.LimitedSelled);
                }
            }
            message.AppendInteger(item.ClubOnly ? 1 : 0);

            if (item.IsLimited || item.FirstAmount != 1)
            {
                message.AppendBool(false);
                return;
            }
            message.AppendBool(item.HaveOffer && !item.IsLimited && !item.Name.StartsWith("bot_"));
        }
Example #38
0
 public void RemoveCatalogItem(CatalogItem catalogItem)
 {
     catalogItems.Remove(catalogItem);
 }
Example #39
0
 private void btnDelete_Click(object sender, EventArgs e)
 {
     CatalogItem.deleteCatalogsItem(itemId);
 }
Example #40
0
 private void AddUriPlaceHolder(CatalogItem item)
 {
     item.PictureUri = $"/Pics/{item.Id}.png";
 }
Example #41
0
 private void onCellScan(CatalogItem scannedCell)
 {
     if (scannedCell.Id == startBarcodeData.Cell.Id)
         {
         if (startBarcodeData.PreviousStickerCode == 0)
             {
             notifyCellUpdated();
             }
         else if ("����� ������ ����� � ������?".Ask())
             {
             currentBarcodeData.PreviousStickerCode = 0;
             notifyCellUpdated();
             }
         }
     else if (string.Format(@"��������� ������ ������ � ������ ""{0}""?", scannedCell.Description).Ask())
         {
         currentBarcodeData.Cell.CopyFrom(scannedCell);
         currentBarcodeData.PreviousStickerCode = 0;
         notifyCellUpdated();
         }
 }
        static CatalogItem CreateCatalogItem(string[] column, string[] headers, Dictionary <String, int> catalogTypeIdLookup, Dictionary <String, int> catalogBrandIdLookup)
        {
            if (column.Count() != headers.Count())
            {
                throw new Exception($"column count '{column.Count()}' not the same as headers count'{headers.Count()}'");
            }

            string catalogTypeName = column[Array.IndexOf(headers, "catalogtypename")].Trim('"').Trim();

            if (!catalogTypeIdLookup.ContainsKey(catalogTypeName))
            {
                throw new Exception($"type={catalogTypeName} does not exist in catalogTypes");
            }

            string catalogBrandName = column[Array.IndexOf(headers, "catalogbrandname")].Trim('"').Trim();

            if (!catalogBrandIdLookup.ContainsKey(catalogBrandName))
            {
                throw new Exception($"type={catalogTypeName} does not exist in catalogTypes");
            }

            string priceString = column[Array.IndexOf(headers, "price")].Trim('"').Trim();

            if (!Decimal.TryParse(priceString, NumberStyles.AllowDecimalPoint, CultureInfo.InvariantCulture, out Decimal price))
            {
                throw new Exception($"price={priceString}is not a valid decimal number");
            }

            var catalogItem = new CatalogItem()
            {
                CatalogTypeId   = catalogTypeIdLookup[catalogTypeName],
                CatalogBrandId  = catalogBrandIdLookup[catalogBrandName],
                Description     = column[Array.IndexOf(headers, "description")].Trim('"').Trim(),
                Name            = column[Array.IndexOf(headers, "name")].Trim('"').Trim(),
                Price           = price,
                PictureFileName = column[Array.IndexOf(headers, "picturefilename")].Trim('"').Trim(),
            };

            int availableStockIndex = Array.IndexOf(headers, "availablestock");

            if (availableStockIndex != -1)
            {
                string availableStockString = column[availableStockIndex].Trim('"').Trim();
                if (!String.IsNullOrEmpty(availableStockString))
                {
                    if (int.TryParse(availableStockString, out int availableStock))
                    {
                        catalogItem.AvailableStock = availableStock;
                    }
                    else
                    {
                        throw new Exception($"availableStock={availableStockString} is not a valid integer");
                    }
                }
            }

            int restockThresholdIndex = Array.IndexOf(headers, "restockthreshold");

            if (restockThresholdIndex != -1)
            {
                string restockThresholdString = column[restockThresholdIndex].Trim('"').Trim();
                if (!String.IsNullOrEmpty(restockThresholdString))
                {
                    if (int.TryParse(restockThresholdString, out int restockThreshold))
                    {
                        catalogItem.RestockThreshold = restockThreshold;
                    }
                    else
                    {
                        throw new Exception($"restockThreshold={restockThreshold} is not a valid integer");
                    }
                }
            }

            int maxStockThresholdIndex = Array.IndexOf(headers, "maxstockthreshold");

            if (maxStockThresholdIndex != -1)
            {
                string maxStockThresholdString = column[maxStockThresholdIndex].Trim('"').Trim();
                if (!String.IsNullOrEmpty(maxStockThresholdString))
                {
                    if (int.TryParse(maxStockThresholdString, out int maxStockThreshold))
                    {
                        catalogItem.MaxStockThreshold = maxStockThreshold;
                    }
                    else
                    {
                        throw new Exception($"maxStockThreshold={maxStockThreshold} is not a valid integer");
                    }
                }
            }

            int onReorderIndex = Array.IndexOf(headers, "onreorder");

            if (onReorderIndex != -1)
            {
                string onReorderString = column[onReorderIndex].Trim('"').Trim();
                if (!String.IsNullOrEmpty(onReorderString))
                {
                    if (bool.TryParse(onReorderString, out bool onReorder))
                    {
                        catalogItem.OnReorder = onReorder;
                    }
                    else
                    {
                        throw new Exception($"onReorder={onReorderString} is not a valid boolean");
                    }
                }
            }

            return(catalogItem);
        }
 public void BuyItem(CatalogItem item)
 {
     PlayFabManager.instance.BuyItemWithVirtualCurrency(item, OnBuySuccess);
 }
Example #44
0
        private CatalogItem ParseJToken_Catalog(JsonObject thread, int pagenumber, string board)
        {
            CatalogItem ci = new CatalogItem();

            //post number - no
            ci.ID = Convert.ToInt32(thread["no"]);

            // post time - now
            ci.Time = Common.ParseUTC_Stamp(Convert.ToInt32(thread["time"]));

            //name
            if (thread["name"] != null)
            {
                ci.Name = thread["name"].ToString();
            }
            else
            {
                ci.Name = "";
            }

            if (thread["com"] != null)
            {
                ci.Comment = thread["com"].ToString();
            }
            else
            {
                ci.Comment = "";
            }

            if (thread["trip"] != null)
            {
                ci.Trip = thread["trip"].ToString();
            }
            else
            {
                ci.Trip = "";
            }

            if (thread["id"] != null)
            {
                ci.PosterID = thread["id"].ToString();
            }
            else
            {
                ci.PosterID = "";
            }

            if (thread["filename"] != null)
            {
                PostFile pf = new PostFile();
                pf.filename      = thread["filename"].ToString();
                pf.ext           = thread["ext"].ToString().Replace(".", "");
                pf.height        = Convert.ToInt32(thread["h"]);
                pf.width         = Convert.ToInt32(thread["w"]);
                pf.thumbW        = Convert.ToInt32(thread["tn_w"]);
                pf.thumbH        = Convert.ToInt32(thread["tn_h"]);
                pf.owner         = ci;
                pf.thumbnail_tim = thread["tim"].ToString();
                pf.board         = board;

                pf.hash = thread["md5"].ToString();
                pf.size = Convert.ToInt32(thread["fsize"]);

                ci.File = pf;
            }

            if (thread["last_replies"] != null)
            {
                JsonArray li = (JsonArray)thread["last_replies"];

                List <GenericPost> repl = new List <GenericPost>();

                foreach (JsonObject j in li)
                {
                    repl.Add(ParseReply(j, board)); // HACK: parent must not be null.
                }

                ci.trails = repl.ToArray();
            }

            if (thread["bumplimit"] != null)
            {
                ci.BumpLimit = Convert.ToInt32(thread["bumplimit"]);
            }
            else
            {
                ci.BumpLimit = 300; //most common one
            }

            if (thread["imagelimit"] != null)
            {
                ci.ImageLimit = Convert.ToInt32(thread["imagelimit"]);
            }
            else
            {
                ci.ImageLimit = 150;
            }

            ci.image_replies = Convert.ToInt32(thread["images"]);
            ci.text_replies  = Convert.ToInt32(thread["replies"]);
            ci.page_number   = pagenumber;

            return(ci);

            /*{
             * "tim": 1385141348984,
             * "time": 1385141348,
             * "resto": 0,
             * "bumplimit": 0,
             * "imagelimit": 0,
             * "omitted_posts": 1,
             * "omitted_images": 0,*/
        }
 public ActionResult Post([FromBody] CatalogItem catalogItem)
 {
     _catalogRepository.InsertCatalogItem(catalogItem);
     return(CreatedAtAction(nameof(Get), new { id = catalogItem.Id }, catalogItem));
 }
Example #46
0
        private bool selectingItem(DataTable table, out CatalogItem selectedItem)
        {
            var itemsList = table.ToItemsList();
            if (itemsList.Count > 1)
                {
                if (!SelectFromList(itemsList, -1, 40, out selectedItem))
                    {
                    selectedItem = new CatalogItem();
                    return false;
                    }
                }
            else
                {
                selectedItem = itemsList.First();
                }

            return true;
        }
Example #47
0
        private async Task <CatalogItem> ProcessCatalogItem(GetItemApiParameters apiParams, MediaScraper scraper, CatalogItem local)
        {
            var entry = await scraper.GetAsync(new Uri(apiParams.Url));

            if (local != null)
            {
                entry.Watching = local.Watching;
            }
            AppContext.LocalScraper.SetLocalMedia(entry);

            await SyncEntries(local, entry);

            return(entry);
        }
    public static void AddInventoryItem(ItemInstance newItem, List <FMInventoryItem> invItems, CatalogItem catalogItem)
    {
        Debug.Log("inventory items count " + invItems.Count);
        //add to inventry
        FMInventoryItem iItem = invItems.Find(x => x.CatalogID.Equals(newItem.ItemInstanceId));

        //if the item was already in inventory
        if (iItem != null && catalogItem.IsStackable)
        {
            iItem.Amount += 1;
            return;
        }

        //else, we add it to the inventory
        if (iItem == null)
        {
            invItems.Add(CreateInventoryItem(catalogItem, newItem));
            Debug.Log("added to inventory items");
        }
    }
Example #49
0
 public bool TryGetImageFor(CatalogItem item, out Texture2D image) {
     image = GetImageFor(item);
     return image != null;
 }
Example #50
0
 public async Task Update(CatalogItem model)
 {
     var         uri     = UriHelper.CombineUri(GlobalSetting.Instance.GatewayShoppingEndpoint, $"{ApiUrlBase}/items/update");
     CatalogItem catalog = await _requestProvider.PostAsync(uri, model);
 }
Example #51
0
        public async Task DeleteCatalogAsync(CatalogItem catalogItem)
        {
            var uri = UriHelper.CombineUri(GlobalSetting.Instance.GatewayShoppingEndpoint, $"{ApiUrlBase}/items/delete/{catalogItem.Id}");

            await _requestProvider.DeleteAsync(uri);
        }
    public void AfterUnlock(UnlockContainerItemResult result)
    {
        // build our list for displaying the container results
        List <ContainerResultItem> items = new List <ContainerResultItem>();
        int counts = 0;

        foreach (var award in result.GrantedItems)
        {
            string      awardIcon            = "Default";
            CatalogItem catItem              = PF_GameData.catalogItems.Find((i) => { return(i.ItemId == award.ItemId); });
            Dictionary <string, string> kvps = PlayFabSimpleJson.DeserializeObject <Dictionary <string, string> >(catItem.CustomData);
            //kvps.TryGetValue("icon", out awardIcon);

            items.Add(new ContainerResultItem()
            {
                displayIcon = new Sprite(),//GameController.Instance.iconManager.GetIconById(awardIcon),
                displayName = award.DisplayName
            });

            if (counts < 5)
            {
                UnpackedItemPrefab[counts].gameObject.SetActive(true);
                UnpackedItemPrefab[counts].BtnInitialize(new Sprite(), award.DisplayName, (int)award.UsesIncrementedBy);
            }
            else
            {
                return;
            }

            counts++;
        }

        if (result.VirtualCurrency != null)
        {
            foreach (var award in result.VirtualCurrency)
            {
                items.Add(new ContainerResultItem()
                {
                    displayIcon = new Sprite(),//GameController.Instance.iconManager.GetIconById(award.Key),
                    displayName = string.Format("{1} Award: {0}", award.Value, award.Key)
                });

                if (counts < 5)
                {
                    UnpackedItemPrefab[counts].gameObject.SetActive(true);
                    UnpackedItemPrefab[counts].BtnInitialize(new Sprite(), award.Key, (int)award.Value);
                }
                else
                {
                    return;
                }

                counts++;
            }
            PF_PlayerData.GetUserAccountInfo();
        }
        else
        {
            Debug.LogError("check plz");
            //CatalogItem catRef = PF_GameData.catalogItems.Find((i) => { return i.ItemId == this.selectedItem.ItemId; });
            //if (catRef.Container.VirtualCurrencyContents.Count > 0)
            //{
            //    foreach (var vc in catRef.Container.VirtualCurrencyContents)
            //    {
            //        items.Add(new ContainerResultItem()
            //        {
            //            displayIcon = GameController.Instance.iconManager.GetIconById(vc.Key),
            //            displayName = string.Format("{1} Award: {0}", vc.Value, vc.Key)
            //        });
            //    }
            //}
        }

        gameObject.SetActive(true);

        DialogCanvasController.RequestInventoryPrompt();
    }