Exemple #1
0
        /// <summary>
        /// Creates a UserUnitLibrary from Usernits so that it can be stored as a singleton with Constants.SetUserUnitLibrary(myLibrary);
        /// UserUnit.Symbol must be defined and UserUnit.UserUnitType (which is the UserUnitName)
        /// </summary>
        /// <param name="user1"></param>
        /// <returns></returns>
        public void SetLibrary(UserUnit user1)
        {
            var library = new UserUnitLibrary();

            library.m_symbolToCompoundMap.Add(user1.Symbol, user1);

            library.m_enumToSymbolMap.Add(user1.UserUnitType, user1.Symbol);

            m_enumToSymbolMap     = library.m_enumToSymbolMap;
            m_symbolToCompoundMap = library.m_symbolToCompoundMap;
            Constants.SetUserUnitLibrary(library);
        }
Exemple #2
0
        /// <summary>
        /// Creates a UserUnitLibrary from Usernits so that it can be stored as a singleton with Constants.SetUserUnitLibrary(myLibrary);
        /// UserUnit.Symbol must be defined and UserUnit.UserUnitType (which is the UserUnitName)
        /// </summary>
        /// <param name="user1"></param>
        /// <returns></returns>
        public void SetLibrary(UserUnit user1, UserUnit user2, UserUnit user3)
        {
            var library = new UserUnitLibrary();

            library.m_symbolToCompoundMap = new Dictionary <string, UserUnit>();
            library.m_symbolToCompoundMap.Add(user1.Symbol, user1);
            library.m_symbolToCompoundMap.Add(user2.Symbol, user2);
            library.m_symbolToCompoundMap.Add(user3.Symbol, user3);

            library.m_enumToSymbolMap = new Dictionary <UserUnitName, string>();
            library.m_enumToSymbolMap.Add(user1.UserUnitType, user1.Symbol);
            library.m_enumToSymbolMap.Add(user2.UserUnitType, user2.Symbol);
            library.m_enumToSymbolMap.Add(user3.UserUnitType, user3.Symbol);

            m_enumToSymbolMap     = library.m_enumToSymbolMap;
            m_symbolToCompoundMap = library.m_symbolToCompoundMap;
            Constants.SetUserUnitLibrary(library);
        }