예제 #1
0
/// <summary>
/// Deserialize dictionary
/// </summary>
/// <param name="serializedVersion"></param>
/// <param name="dex"></param>

        public static void Deserialize(string serializedVersion, DictionaryMx dex)
        {
            dex.Initialize();
            DictionaryMx dex2 = Deserialize(serializedVersion);

            foreach (string word in dex2.Words)
            {
                dex.Add(word, dex2.LookupDefinition(word));
            }

            return;
        }
예제 #2
0
/// <summary>
/// Get dictionary associated with a set of root tables
/// </summary>
/// <param name="dictName"></param>
///
        public static DictionaryMx GetDictionary(string dictName)
        {
            if (TableList == null)
            {
                Build();
            }

            bool allRoots   = Lex.Eq(dictName, "Root_Tables");
            bool structs    = Lex.Eq(dictName, "StructureDatabases");
            bool cartridge  = Lex.Eq(dictName, "CartridgeDatabases");
            bool smallWorld = Lex.Eq(dictName, "SmallWorldDatabases");

            DictionaryMx dex = new DictionaryMx();

            dex.Name = dictName;

            foreach (RootTable rt in TableList)
            {
                bool   add  = false;
                string word = rt.Label;
                string def  = rt.MetaTableName;

                if (Lex.Eq(rt.Label, "SmallWorld"))
                {
                    continue;                                                 // ignore this
                }
                if (structs)
                {
                    add = rt.IsStructureTable;
                }

                else if (cartridge)
                {
                    add = rt.CartridgeSearchable;
                }

                else if (smallWorld)
                {
                    add = Lex.IsDefined(rt.SmallWorldDbName);                     // exclude the "SmallWorld" umbrella DB
                }
                else
                {
                    add = true;                  // if dict not one of the definede subsets then include all
                }
                if (add)
                {
                    dex.Add(rt.Label, rt.MetaTableName);
                }
            }

            return(dex);
        }
예제 #3
0
/// <summary>
/// Deserialize dictionary
/// </summary>
/// <param name="serializedVersion"></param>
/// <returns></returns>

        public static DictionaryMx Deserialize(string serializedVersion)
        {
            DictionaryMx dex = new DictionaryMx();

            dex.Initialize();
            string[] sa = serializedVersion.Split('\t');
            dex.Name = sa[0];
            dex.Sql  = sa[1];

            for (int i = 2; i + 1 < sa.Length; i += 2)
            {
                dex.Add(sa[i], sa[i + 1]);
            }

            return(dex);
        }