示例#1
0
        public void AddAddonComponentEntry(string[] args)
        {
            if (args.Length < 4)
            {
                Console.WriteLine("AddonComponentEntry error: expected at least 4 args but had " + args.Length + ": " +
                                  args);
                return;
            }

            // format is x y z visible hue
            int  itemID  = args[0].StartsWith("0x") ? Convert.ToInt32(args[0].Substring(2), 16) : int.Parse(args[0]);
            int  x       = args[1].StartsWith("0x") ? Convert.ToInt32(args[1].Substring(2), 16) : int.Parse(args[1]);
            int  y       = args[2].StartsWith("0x") ? Convert.ToInt32(args[2].Substring(2), 16) : int.Parse(args[2]);
            int  z       = args[3].StartsWith("0x") ? Convert.ToInt32(args[3].Substring(2), 16) : int.Parse(args[3]);
            int  hue     = 0;
            bool visible = true;

            if (args.Length > 4)
            {
                visible = args[4] == "1";
            }
            if (args.Length > 5)
            {
                hue = args[5].StartsWith("0x") ? Convert.ToInt32(args[5].Substring(2), 16) : int.Parse(args[5]);
            }
            RareAddonComponentEntry newEntry = new RareAddonComponentEntry(itemID, x, y, z, hue, visible);

            Components.Add(newEntry);
        }
示例#2
0
        public void AddAddonComponentEntry(string[] args)
        {
            if (args.Length < 4)
            {
                Console.WriteLine("AddonComponentEntry error: expected at least 4 args but had " + args.Length + ": " +
                                  args);
                return;
            }

            // format is x y z visible hue
            int itemID = args[0].StartsWith("0x") ? Convert.ToInt32(args[0].Substring(2), 16) : int.Parse(args[0]);
            int x = args[1].StartsWith("0x") ? Convert.ToInt32(args[1].Substring(2), 16) : int.Parse(args[1]);
            int y = args[2].StartsWith("0x") ? Convert.ToInt32(args[2].Substring(2), 16) : int.Parse(args[2]);
            int z = args[3].StartsWith("0x") ? Convert.ToInt32(args[3].Substring(2), 16) : int.Parse(args[3]);
            int hue = 0;
            bool visible = true;
            if (args.Length > 4)
            {
                visible = args[4] == "1";
            }
            if (args.Length > 5)
            {
                hue = args[5].StartsWith("0x") ? Convert.ToInt32(args[5].Substring(2), 16) : int.Parse(args[5]);
            }
            RareAddonComponentEntry newEntry = new RareAddonComponentEntry(itemID, x, y, z, hue, visible);
            Components.Add(newEntry);
        }