Esempio n. 1
0
        public void setHashTable(string Key, HashtableSerailizable htable)
        {
            if (m_client == null)
            {
                return;
            }
            string xml = MyXmlSerializer.XmlSerializeToString(htable);

            m_client.Store(StoreMode.Set, Key, xml);
        }
Esempio n. 2
0
        // Serialize whole hash tables
        public HashtableSerailizable getHashTable(string Key)
        {
            HashtableSerailizable htable = null;

            if (m_client != null)
            {
                //string xml = m_client.Get<string>(Key);
                object obj = m_client.Get(Key);
                string xml = "";
                if (obj != null)
                {
                    xml = obj.ToString();
                }
                htable = (HashtableSerailizable)MyXmlSerializer.XmlDeserializeFromString(xml, typeof(HashtableSerailizable));
            }
            return(htable);
        }
Esempio n. 3
0
        public void tick_chemistry(bool full)
        {
            if (m_cBus != null)
            {
                if (full)
                {
                    Halflifes = m_cBus.getHashTable("ChemHalflifes");
                    while (Halflifes == null)
                    {
                        Application.DoEvents();
                        Halflifes = m_cBus.getHashTable("ChemHalflifes");
                    }
                    Settings = m_cBus.getHashTable("ChemSettings");
                    IORules  = m_cBus.getHashTable("ChemIORules");

                    Stack stk = new Stack();
                    foreach (string key in IORules.Keys)
                    {
                        stk.Push(key);
                    }
                    while (stk.Count > 0)
                    {
                        string key = (string)stk.Pop();
                        if (IORules[key].GetType() == typeof(string))
                        {
                            IORules[key] = SoupIORuleProxy.Parse((string)IORules[key]);
                        }
                    }
                }
                BlackBoard            = m_cBus.getHashTable("ChemBlackBoard");
                subsumptionBlackBoard = m_cBus.getHashTable("ChemsubsumptionBlackBoard");
                Chemicals             = m_cBus.getHashTable("ChemChemicals");
            }
            biochemticks++;
            // Notify interested parties
            foreach (string k in chemWatchers.Keys)
            {
                chemUpdateWatcher watcher = (chemUpdateWatcher)chemWatchers[k];
                if (watcher != null)
                {
                    watcher();
                }
            }
        }