/// <inheritdoc cref="MorphologyProvider.FindWord"/>
        public override MorphologyEntry[] FindWord
        (
            string word
        )
        {
            ManagedClient64 client   = Client.ThrowIfNull("Client");
            string          database = Database.ThrowIfNull("Database");


            client.PushDatabase(database);
            try
            {
                IrbisRecord[] records = client.SearchRead
                                        (
                    "\"K={0}\"",
                    word
                                        );
                MorphologyEntry[] result = records
                                           .Select(r => MorphologyEntry.Parse(r))
                                           .ToArray();

                return(result);
            }
            finally
            {
                client.PopDatabase();
            }
        }
        public static List <ReaderInfo> LoadReaders
        (
            [NotNull] ManagedClient64 client,
            [NotNull] List <ReaderInfo> readers,
            [NotNull] string dbName
        )
        {
            if (ReferenceEquals(client, null))
            {
                throw new ArgumentNullException("client");
            }
            if (ReferenceEquals(readers, null))
            {
                throw new ArgumentNullException("readers");
            }
            if (string.IsNullOrEmpty(dbName))
            {
                throw new ArgumentNullException("dbName");
            }

            try
            {
                client.PushDatabase(dbName);
                readers.Capacity += client.GetMaxMfn();

                BatchRecordReader batch = new BatchRecordReader
                                          (
                    client,
                    1500
                                          );

                Parallel.ForEach
                (
                    batch,
                    record =>
                {
                    if (!record.Deleted)
                    {
                        ReaderInfo reader
                            = ReaderInfo.Parse(record);
                        lock (readers)
                        {
                            readers.Add(reader);
                        }
                    }
                }
                );
            }
            finally
            {
                client.PopDatabase();
            }

            return(readers);
        }
Esempio n. 3
0
 public IrbisHandler()
 {
     try
     {
         client = new ManagedClient64();
         client.ParseConnectionString("host=127.0.0.1;port=8888; user=СПА;password=1;");
         client.Connect();
         client.PushDatabase("MPDA");
         Console.WriteLine("Connected to irbis_server successfully");
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex);
     }
 }
Esempio n. 4
0
 internal void Connect()
 {
     try
     {
         if (connected)
         {
             Disconnect();
         }
         client.ParseConnectionString("host=127.0.0.1;port=8888; user=a; password=1;");
         client.Connect();
         client.PushDatabase("MPDA");
         connected = true;
         Console.WriteLine("Connected!");
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.ToString() + "Error!");
     }
 }
Esempio n. 5
0
 internal void Connect(string database, string login, string password)
 {
     try
     {
         if (connected)
         {
             Disconnect();
         }
         client.ParseConnectionString("host=127.0.0.1;port=8888; user="******";password="******";");
         //client.ParseConnectionString("host=194.169.10.3;port=8888; user="******";password="******";");
         client.Connect();
         client.PushDatabase(database);
         connected = true;
         MessageBox.Show("Connected!");
     }
     catch (Exception ex)
     {
         logging.WriteLine("ERROR DURING CONNECTION!");
         logging.WriteLine(ex.StackTrace);
         logging.WriteLine(ex.ToString());
         MessageBox.Show("Error!");
     }
 }