Esempio n. 1
0
            public void Scan1(clsItemName liste, Program pp)
            {
                List <MyInventoryItem> c3 = new List <MyInventoryItem>();

                thisBlock.GetInventory().GetItems(c3);
                thisBlock.CustomData = STORAGETAG + "\n";
                foreach (MyInventoryItem e1 in c3)
                {
                    thisBlock.CustomData += "+ " + liste.ContainsKey(e1, pp).rd + "\n";
                }
            }
Esempio n. 2
0
 public void Scan3(clsItemName liste, Program pp)
 {
     for (int k1 = 0; k1 < thisBlock.InventoryCount; k1++)
     {
         List <MyInventoryItem> c3 = new List <MyInventoryItem>();
         thisBlock.GetInventory(k1).GetItems(c3);
         thisBlock.CustomData = STORAGETAG + "\n";
         foreach (MyInventoryItem e1 in c3)
         {
             clsItem itm = new clsItem(e1);
             thisBlock.CustomData += $"Add(\"{itm.rs}\",\"{itm.rt}\");\n";
         }
     }
 }
Esempio n. 3
0
            /// <summary>
            /// zeigt alle im Inventar enthaltenen Items an
            /// </summary>
            public void Scan2(clsItemName liste, Program p1)
            {
                List <MyInventoryItem> c3 = new List <MyInventoryItem>();

                thisBlock.GetInventory(0).GetItems(c3);
                thisBlock.CustomData = STORAGETAG + "\n";
                foreach (MyInventoryItem e1 in c3)
                {
                    p1.Echo(new clsItem(e1).ToString());
                    clsItem b1 = liste.ContainsKey(e1, p1);

                    thisBlock.CustomData += $"+{(int)e1.Amount} {b1.rd}\n";
                }
            }
Esempio n. 4
0
        void Main(string argument, UpdateType updateSource)
        {
            Echo(DateTime.Now.ToString("s"));

            switch (argument.ToLower())
            {
            case "start": Runtime.UpdateFrequency = UpdateFrequency.Update100; Echo("Start"); break;

            case "stop": Runtime.UpdateFrequency = UpdateFrequency.None; Echo("Stop"); break;

            case "scan": findAllBlocks(); Echo($"Scan all -- {STORAGETAG} --"); allBlocks.ForEach(x => Echo(x.CustomName)); break;
            }
            if (Runtime.UpdateFrequency != UpdateFrequency.None)
            {
                findAllBlocks();
                foreach (IMyTerminalBlock e1 in allBlocks)
                {
                    // Echo("--" + e1.CustomName);
                    if (e1.CustomData.Contains("scan1"))
                    {
                        Scan((item) => { clsItemName b1 = new clsItemName(item); return($"+ {b1.rd}"); });
                    }
                    if (e1.CustomData.Contains("scan2"))
                    {
                        Scan((item) => { clsItemName b1 = new clsItemName(item); return($"+ {(int)item.Amount} {b1.rd}"); });
                    }
                    if (e1.CustomData.Contains("scan3"))
                    {
                        Scan((item) => { clsItemName b1 = new clsItemName(item); return($"new clsItemName(\"{b1.rs}\",\"{b1.rt}\");"); });
                    }
                }

                foreach (IMyTerminalBlock a1 in allBlocks)
                {
                    Echo($"-{a1.CustomName}\n");
                    for (int nr = 0; nr < a1.InventoryCount; nr++)
                    {
                        IMyInventory a2 = a1.GetInventory(nr);

                        List <MyInventoryItem> a3 = new List <MyInventoryItem>(); a2.GetItems(a3);
                        foreach (MyInventoryItem a4 in a3)
                        {
                            clsItem a5 = new clsItem(a1, a2, a4);
                            Echo($"--{a5}\n");
                        }
                    }
                }
            }
            // Echo(Runtime.UpdateFrequency.ToString());
        }
Esempio n. 5
0
 /// <summary>
 /// findet alle Items von allen Blocks
 /// </summary>
 public void findAllItem(clsItemName ItemsConf)
 {
     allItems.Clear();
     foreach (clsBlock b1 in allBlocks)
     {
         for (int i1 = 0; i1 < b1.thisBlock.InventoryCount; i1++)
         {
             int                    pos = 0;
             IMyInventory           i2  = b1.thisBlock.GetInventory(i1);
             List <MyInventoryItem> i3  = new List <MyInventoryItem>();
             i2.GetItems(i3);
             foreach (MyInventoryItem i4 in i3)
             {
                 clsItem i5   = new clsItem(i4, i2);
                 clsItem name = ItemsConf.ContainsKey(i5.id);
                 i5.rd   = name.rd;
                 i5.pos1 = pos++;
                 allItems.Add(i5);
             }
         }
     }
 }
Esempio n. 6
0
 public clsItem(MyInventoryItem v)
 {
     itemName = new clsItemName(item = v);
 }
Esempio n. 7
0
 public clsItem(string rS, string rT, string rD = null)
 {
     itemName = new clsItemName(rS, rT, rD);
 }