コード例 #1
0
ファイル: ITextUtils.cs プロジェクト: sillsdev/WorldPad
		/// <summary>
		/// Executes in two distinct scenarios.
		///
		/// 1. If disposing is true, the method has been called directly
		/// or indirectly by a user's code via the Dispose method.
		/// Both managed and unmanaged resources can be disposed.
		///
		/// 2. If disposing is false, the method has been called by the
		/// runtime from inside the finalizer and you should not reference (access)
		/// other managed objects, as they already have been garbage collected.
		/// Only unmanaged resources can be disposed.
		/// </summary>
		/// <param name="disposing"></param>
		/// <remarks>
		/// If any exceptions are thrown, that is fine.
		/// If the method is being done in a finalizer, it will be ignored.
		/// If it is thrown by client code calling Dispose,
		/// it needs to be handled by fixing the bug.
		///
		/// If subclasses override this method, they should call the base implementation.
		/// </remarks>
		protected virtual void Dispose(bool disposing)
		{
			//Debug.WriteLineIf(!disposing, "****************** " + GetType().Name + " 'disposing' is false. ******************");
			// Must not be run more than once.
			if (m_isDisposed)
				return;

			if (disposing)
			{
				if (RebuildingConcordanceWordforms)
					RebuildingConcordanceWordforms = false;	// don't get rid of m_wfi until we do this.
			}
			// Bad idea to do this here, since one can't access C# objects in this context,
			// which is what the property will try to do.
			//if (RebuildingConcordanceWordforms)
			//	RebuildingConcordanceWordforms = false;	// don't get rid of m_wfi until we do this.
			m_cadTwfic = null;
			m_cadPunct = null;
			m_punctAnnotations = null;
			m_wordforms = null;
			m_wordformAnnotationPossibilities = null;
			m_paragraphTextScanner = null;
			m_paraRealAnnIds = null;
			m_paraRealWfIds = null;
			m_paraRealTwfics = null;
			m_unusedPunctuationAnnotations = null;
			m_unusedTwficAnnotations = null;
			m_unusedSegmentAnnotations = null;
			m_realParagraphSegmentAnnotations = null;
			m_realParagraphPunctuationAnnotations = null;
			m_realParagraphWordforms = null;
			m_realParagraphTwficAnnotations = null;
			m_annotations = null;
			m_paraIdsParsed = null;
			m_wfi = null;
			m_lp = null;
			m_wordMaker = null;
			m_tssPara = null;
			m_para = null;
			m_hvosStText = null;
			m_hvosStTxtPara = null;
			m_cache = null;

			m_isDisposed = true;
		}
コード例 #2
0
ファイル: ITextUtils.cs プロジェクト: sillsdev/WorldPad
		private void Init(FdoCache cache)
		{
			m_cache = cache;
			kflidOccurrences = WfiWordform.OccurrencesFlid(m_cache);
			kflidConcordanceWordforms = WordformInventory.ConcordanceWordformsFlid(m_cache);
			m_lp = Cache.LangProject;
			m_paragraphTextScanner = new WordMaker(null, cache.LanguageWritingSystemFactoryAccessor);
			m_wfi = m_lp.WordformInventoryOA;
			// Identify the tag used for the virtual property that is the form of a punctuation
			// annotation.
			m_tagPunct = CmBaseAnnotation.StringValuePropId(m_cache);
			m_cadPunct = CmAnnotationDefn.Punctuation(m_cache);
			m_cadTwfic = CmAnnotationDefn.Twfic(m_cache);
			m_tagRealForm = InterlinVc.TwficRealFormTag(cache);
			m_tagLowercaseForm = InterlinVc.MatchingLowercaseWordForm(cache);
		}