/// <summary> /// Opens all available annotators associated with the specified record file. /// </summary> /// <param name="annotators">An array holding the returned annotator objects.</param> /// <param name="record">Record's name.</param> public static void OpenAll(Annotator[] annotators, string record) { var ret = PInvoke.annopen(record, annotators, (int)annotators.Length); if (ret == -3) { throw new InvalidOperationException("Failure: Unable to open input annotation file."); } else if (ret == -4) { throw new InvalidOperationException("Failure: Unable to open output annotation file."); } else if (ret == -5) { throw new InvalidOperationException("Failure: Illegal Stat specified for annotation file."); } foreach (var annotator in annotators) { var annot = annotator; RegisterAnnotator(annot); } }
/// <summary> /// Opens the annotator associated with the specified record for read access. /// </summary> /// <param name="record">The name of the record to be opened.</param> /// <param name="keepOldOpen">Specifies whether or not you want to keep the already opened annotators in memory.</param> public void Open(string record, bool keepOldOpen) { if (IsOpen) { throw new InvalidOperationException("Annotator already opened."); } var keepOldAnnotatorsStr = record; if (keepOldOpen) { if (!record.StartsWith("+")) { keepOldAnnotatorsStr = string.Format("+{0}", record); } } else { Annotator.CloseAll(); } var ret = PInvoke.annopen(keepOldAnnotatorsStr, ref this, 1); if (ret == -3) { throw new InvalidOperationException("Failure: Unable to open input annotation file."); } else if (ret == -4) { throw new InvalidOperationException("Failure: Unable to open output annotation file."); } else if (ret == -5) { throw new InvalidOperationException("Failure: Illegal Stat specified for annotation file."); } RegisterAnnotator(this); }