private void _Worker ( object state ) { int[] chunk = (int[])state; //foreach (int mfn in chunk) //{ // IrbisRecord record = new IrbisRecord{Mfn = mfn}; // _PutRecord(record); //} //_event.Set(); using (ManagedClient64 client = new ManagedClient64()) { client.ParseConnectionString(ConnectionString); client.Connect(); BatchRecordReader batch = new BatchRecordReader ( client, chunk ); foreach (IrbisRecord record in batch) { _PutRecord(record); } } _event.Set(); }
public string Get ( string name, ManagedClient64 client ) { string result; if (!_dictionary.TryGetValue(name, out result)) { if (client != null) { result = client.ReadTextFile(name); } } if (string.IsNullOrEmpty(result)) { result = null; } if (result == null) { _dictionary.Remove(name); } else { _dictionary[name] = result; } return(result); }
private void _Worker ( object state ) { int[] chunk = (int[])state; using (ManagedClient64 client = new ManagedClient64()) { client.ParseConnectionString(ConnectionString); client.Connect(); BatchRecordFormatter batch = new BatchRecordFormatter ( client, chunk, Format ); foreach (string line in batch) { _PutLine(line); } } _event.Set(); }
/// <summary> /// Disconnect. /// </summary> public static void DisconnectRetry ( this ManagedClient64 client ) { Try(client.Dispose); }
public static IrbisUpperCaseTable FromServer ( [NotNull] ManagedClient64 connection, [NotNull] string fileName ) { string text = connection.ReadTextFile ( IrbisPath.System, fileName ); if (string.IsNullOrEmpty(text)) { throw new IrbisException ( "No file " + fileName ); } IrbisUpperCaseTable result = ParseText ( IrbisEncoding.Ansi, text ); return(result); }
/// <summary> /// Конструктор. /// </summary> public RecordExtractor ( ManagedClient64 client ) : this(client, null) { }
public static ChairInfo[] Read ( [NotNull] ManagedClient64 client, [NotNull] string fileName ) { if (ReferenceEquals(client, null)) { throw new ArgumentNullException("client"); } if (string.IsNullOrEmpty(fileName)) { throw new ArgumentNullException("fileName"); } string chairText = client.ReadTextFile ( IrbisPath.MasterFile, fileName ); ChairInfo[] result = Parse(chairText); return(result); }
/// <summary> /// Contructor. /// </summary> public MorphologyEngine ( [NotNull] ManagedClient64 client, [NotNull] string prefix, [NotNull] string database ) { if (ReferenceEquals(client, null)) { throw new ArgumentNullException("client"); } if (string.IsNullOrEmpty(prefix)) { throw new ArgumentNullException("prefix"); } if (string.IsNullOrEmpty(database)) { throw new ArgumentNullException("database"); } _client = client; _provider = new IrbisMorphologyProvider ( prefix, database, client ); }
/// <summary> /// Initializes a new instance of the <see cref="RecordBuffer" /> class. /// </summary> /// <param name="client">The client.</param> public RecordBuffer ( ManagedClient64 client ) : this(client, 10) { }
/// <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(); } }
/// <summary> /// No operation. /// </summary> public static void NopRetry ( this ManagedClient64 client ) { Try(client.NoOp); }
/// <summary> /// Конструктор. /// </summary> public BatchRecordFormatter ( [NotNull] ManagedClient64 client, int batchSize, [NotNull] IEnumerable <int> range, [NotNull] string format ) { if (ReferenceEquals(client, null)) { throw new ArgumentNullException("client"); } if (batchSize < 1) { throw new ArgumentOutOfRangeException("batchSize"); } if (ReferenceEquals(range, null)) { throw new ArgumentNullException("range"); } if (string.IsNullOrEmpty(format)) { throw new ArgumentNullException("format"); } Client = client; BatchSize = batchSize; Format = format; _InitializePackages(range); }
/// <summary> /// Конструктор. /// </summary> public BatchRecordFormatter ( [NotNull] ManagedClient64 client, [NotNull] string format, [NotNull] string query, params object[] args ) { if (ReferenceEquals(client, null)) { throw new ArgumentNullException("client"); } if (string.IsNullOrEmpty(format)) { throw new ArgumentNullException("format"); } if (string.IsNullOrEmpty(query)) { throw new ArgumentNullException("query"); } Client = client; BatchSize = DefaultBatchSize; Format = format; int[] found = Client.Search(query, args); _InitializePackages(found); }
public static bool TryLogin2 ( this ManagedClient64 client, IWin32Window owner ) { while (Login2(client, owner)) { try { client.Connect(); if (client.Connected) { return(true); } } // ReSharper disable once EmptyGeneralCatchClause catch { return(false); } } return(false); }
/// <summary> /// Constructor. /// </summary> public IrbisAlphabetTable ( ManagedClient64 client ) : this(client, FileName) { }
public GlobalCorrector ( ManagedClient64 client ) : this() { Client = client; }
public PftCache ( ManagedClient64 client ) : this() { Client = client; }
/// <summary> /// Constructor. /// </summary> public GblBuilder ( [NotNull] ManagedClient64 client ) : this() { Client = client; }
public GblBuilder ( ManagedClient64 client ) : this() { Client = client; }
/// <summary> /// Initializes a new instance of the /// <see cref="IrbisCommadEventArgs" /> class. /// </summary> /// <param name="client">The client.</param> public IrbisCommadEventArgs ( ManagedClient64 client ) { Client = client; RetryCount = client.RetryCount; }
/// <summary> /// Connect to the server. /// </summary> public static void ConnectRetry ( this ManagedClient64 client ) { Action action = client.Connect; Try(action); }
/// <summary> /// Get max MFN. /// </summary> public static int GetMaxMfnRetry ( this ManagedClient64 client ) { Func <int> func = client.GetMaxMfn; return(Try(func)); }
public static IrbisExecutive FromConnectionString ( string connectionString ) { ManagedClient64 client = new ManagedClient64(); client.ParseConnectionString(connectionString); return(new IrbisExecutive(client)); }
public GblBuilder ( ManagedClient64 client, string database ) : this() { Client = client; Database = database; }
public static IrbisMenu Read ( ManagedClient64 client, string name ) { string text = client.ReadTextFile(name); return(ParseText(text)); }
/// <summary> /// Initializes a new instance of the /// <see cref="IrbisCommadEventArgs" /> class. /// </summary> /// <param name="client">The client.</param> /// <param name="exception">The exception.</param> public IrbisCommadEventArgs ( ManagedClient64 client, IrbisException exception ) { Client = client; RetryCount = client.RetryCount; Exception = exception; }
/// <summary> /// Write the record. /// </summary> public static void WriteRecordRetry ( this ManagedClient64 client, IrbisRecord record ) { Action <IrbisRecord, bool, bool> action = client.WriteRecord; Try(action, record, false, true); }
/// <summary> /// Search. /// </summary> public static int[] SearchRetry ( this ManagedClient64 client, string expression ) { Func <string, object[], int[]> func = client.Search; return(Try(func, expression, new object[0])); }
/// <summary> /// Read text file. /// </summary> public static string ReadTextFileRetry ( this ManagedClient64 client, string specification ) { Func <string, string> func = client.ReadTextFile; return(Try(func, specification)); }
/// <summary> /// Read record from server. /// </summary> public static IrbisRecord ReadRecordRetry ( this ManagedClient64 client, int mfn ) { Func <int, IrbisRecord> func = client.ReadRecord; return(Try(func, mfn)); }