Пример #1
0
        public void GetSearchScenarios()
        {
            string  configuration = client.ReadTextFile(IrbisPath.System, "irbis_server.ini");
            IniFile iniFile       = IniFile.ParseText <IniFile>(configuration);
            String  IniFileName   = String.Format("{0}{1}\\{1}.INI", iniFile.Get <String>("MAIN", "DataPath", "C:\\IRBIS64\\DATAI\\"), client.Database);

            if (System.IO.File.Exists(IniFileName))
            {
                iniFile = IniFile.ParseFile <IniFile>(IniFileName, Encoding.Default);
            }
            else
            {
                iniFile = IniFile.ParseText <IniFile>(client.Configuration);
            }

            IniFile.Section SearchSection = iniFile.GetSection("SEARCH");

            int itemCount = (SearchSection == null)
                ? 0
                : SearchSection.Get("ItemNumb", 0);

            SearchScenarios = new SearchScenario[itemCount];
            if (SearchSection != null)
            {
                for (int index = 0; index < SearchScenarios.Length; index++)
                {
                    SearchScenario searchScenario;
                    searchScenario.ItemName        = SearchSection.Get("ItemName" + index);
                    searchScenario.ItemPref        = SearchSection.Get("ItemPref" + index);
                    searchScenario.ItemDictionType = (DictionType)SearchSection.Get("ItemDictionType" + index, 0);
                    searchScenario.ItemMenu        = SearchSection.Get("ItemMenu" + index);
                    searchScenario.ItemF8For       = SearchSection.Get("ItemF8For" + index);
                    searchScenario.ItemModByDic    = SearchSection.Get("ItemModByDic" + index);
                    try
                    {
                        searchScenario.ItemTranc = SearchSection.Get <int>("ItemTranc" + index, 0) != 0;
                    }
                    catch
                    {
                        searchScenario.ItemTranc = true;
                    }
                    searchScenario.ItemHint         = SearchSection.Get("ItemHint" + index);
                    searchScenario.ItemModByDicAuto = SearchSection.Get("ItemModByDicAuto" + index);
                    try
                    {
                        searchScenario.ItemLogic = (LogicType)SearchSection.Get <int>("ItemLogic" + index, 0);
                    }
                    catch
                    {
                        searchScenario.ItemLogic = LogicType.Or;
                    }
                    searchScenario.ItemAdv = SearchSection.Get("ItemAdv" + index);
                    searchScenario.ItemPft = SearchSection.Get("ItemPft" + index);

                    SearchScenarios[index] = searchScenario;
                }


                SearchQualifiers = new SearchQualifier[SearchSection.Get("CvalifNumb", 0)];
                for (int index = 0; index < SearchQualifiers.Length; index++)
                {
                    SearchQualifier searchQualifier;
                    searchQualifier.QualifName  = SearchSection.Get("CvalifName" + index);
                    searchQualifier.QualifValue = SearchSection.Get("CvalifValue" + index);
                    SearchQualifiers[index]     = searchQualifier;
                }

                MinLKWLight = SearchSection.Get <int>("MinLKWLight");
            }
        }
        public IrbisSearchEngine(ManagedClient64 client)
        {
            IrbisSearchEngine.client = client;

            IniFile iniFile = IniFile.ParseText <IniFile>(client.Configuration);

            IniFile.Section SearchSection = iniFile.GetSection("SEARCH");

            int itemCount = (SearchSection == null)
                ? 0
                : SearchSection.Get("ItemNumb", 0);

            SearchScenarios = new SearchScenario[itemCount];
            if (SearchSection != null)
            {
                for (int index = 0; index < SearchScenarios.Length; index++)
                {
                    SearchScenario searchScenario;
                    searchScenario.ItemName        = SearchSection.Get("ItemName" + index);
                    searchScenario.ItemPref        = SearchSection.Get("ItemPref" + index);
                    searchScenario.ItemDictionType = (DictionType)SearchSection.Get("ItemDictionType" + index, 0);
                    searchScenario.ItemMenu        = SearchSection.Get("ItemMenu" + index);
                    searchScenario.ItemF8For       = SearchSection.Get("ItemF8For" + index);
                    searchScenario.ItemModByDic    = SearchSection.Get("ItemModByDic" + index);
                    try
                    {
                        searchScenario.ItemTranc = SearchSection.Get <int>("ItemTranc" + index, 0) != 0;
                    }
                    catch
                    {
                        searchScenario.ItemTranc = true;
                    }
                    searchScenario.ItemHint         = SearchSection.Get("ItemHint" + index);
                    searchScenario.ItemModByDicAuto = SearchSection.Get("ItemModByDicAuto" + index);
                    try
                    {
                        searchScenario.ItemLogic = (LogicType)SearchSection.Get <int>("ItemLogic" + index, 0);
                    }
                    catch
                    {
                        searchScenario.ItemLogic = LogicType.Or;
                    }
                    searchScenario.ItemAdv = SearchSection.Get("ItemAdv" + index);
                    searchScenario.ItemPft = SearchSection.Get("ItemPft" + index);

                    SearchScenarios[index] = searchScenario;
                }


                SearchQualifiers = new SearchQualifier[SearchSection.Get("CvalifNumb", 0)];
                for (int index = 0; index < SearchQualifiers.Length; index++)
                {
                    SearchQualifier searchQualifier;
                    searchQualifier.QualifName  = SearchSection.Get("CvalifName" + index);
                    searchQualifier.QualifValue = SearchSection.Get("CvalifValue" + index);
                    SearchQualifiers[index]     = searchQualifier;
                }

                MinLKWLight = SearchSection.Get <int>("MinLKWLight");
            }
        }