예제 #1
0
 protected virtual void Dispose(bool disposing)
 {
     s_instance = null;
     if (IsLoaded)
     {
         UnsafeNativeMethods.Teardown();
         IsLoaded = false;
     }
     if (IsParserLoaded)
     {
         UnsafeNativeMethods.TeardownParser();
         IsParserLoaded = false;
     }
     if (IsLanguageClassifierLoaded)
     {
         UnsafeNativeMethods.TeardownLanguageClassifier();
         IsLanguageClassifierLoaded = false;
     }
     if (_DataDirPtr != IntPtr.Zero)
     {
         Marshal.FreeHGlobal(_DataDirPtr);
         _DataDirPtr = IntPtr.Zero;
     }
 }
예제 #2
0
 public static LibPostal GetInstance(string dataDir)
 {
     return(s_instance ?? (s_instance = new LibPostal(dataDir)));
 }