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; }
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; }
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); }