// constructor public U2DictReader(UniSession uSession, string fileName) { _uSession = uSession; try { uFile = _uSession.CreateUniDictionary(fileName); usl = _uSession.CreateUniSelectList(0); usl.Select(uFile); string[] keys = usl.ReadListAsStringArray(); _uds = uFile.ReadRecords(keys); } catch (UniSessionException e) // unisession file not exists { if (e.ErrorCode == 14002) { Console.WriteLine("U2 file not found"); } else { // dont know, so rethrow throw; } } }
public Boolean openDict(String fileName) { _lastError = String.Empty; if (_openFiles.ContainsKey("DICT " + fileName)) { return(true); } lock (_syncCall) { try { UniFile f = _sess.CreateUniDictionary(fileName); _openFiles.Add("DICT " + fileName, f); } catch (Exception ex) { _lastError = ex.Message; return(false); } return(true); } }