Пример #1
0
 public static NetItem[] Parse(string data)
 {
     NetItem[] inventory = new NetItem[maxNetInventory];
     int i;
     for (i = 0; i < maxNetInventory; i++)
     {
         inventory[i] = new NetItem();
     }
     string[] items = data.Split('~');
     i = 0;
     foreach (string item in items)
     {
         string[] idata = item.Split(',');
         inventory[i].netID = int.Parse(idata[0]);
         inventory[i].stack = int.Parse(idata[1]);
         inventory[i].prefix = int.Parse(idata[2]);
         i++;
     }
     return inventory;
 }
Пример #2
0
 public static string ToString(NetItem[] inventory)
 {
     string inventoryString = "";
     for (int i = 0; i < maxNetInventory; i++)
     {
         if (i != 0)
             inventoryString += "~";
         inventoryString += inventory[i].netID;
         if (inventory[i].netID != 0)
         {
             inventoryString += "," + inventory[i].stack;
             inventoryString += "," + inventory[i].prefix;
         }
         else
         {
             inventoryString += ",0,0";
         }
     }
     return inventoryString;
 }
Пример #3
0
        public static NetItem[] Parse(string data)
        {
            NetItem[] inventory = new NetItem[maxNetInventory];
            int       i;

            for (i = 0; i < maxNetInventory; i++)
            {
                inventory[i] = new NetItem();
            }
            string[] items = data.Split('~');
            i = 0;
            foreach (string item in items)
            {
                string[] idata = item.Split(',');
                inventory[i].netID  = int.Parse(idata[0]);
                inventory[i].stack  = int.Parse(idata[1]);
                inventory[i].prefix = int.Parse(idata[2]);
                i++;
            }
            return(inventory);
        }