示例#1
0
 public void Unload()
 {
     try
     {
         if (pEngine == IntPtr.Zero)
         {
             return;
         }
         LameUtity.lame_destroy_(pEngine);
         pEngine = IntPtr.Zero;
     }
     catch (Exception)
     {
     }
 }
示例#2
0
        public bool Load(VirusLib lib)
        {
            try
            {
                if (lib == null)
                {
                    throw new Exception("Invalid Param.");
                }

                if (lib.vdb_handle == IntPtr.Zero)
                {
                    throw new Exception("Invalid VirusLib.");
                }

                pEngine = LameUtity.lame_create_(lib.vdb_handle);
                if (pEngine == IntPtr.Zero)
                {
                    throw new Exception("Faild to create lame.");
                }

                foreach (var s in params_lst)
                {
                    LameUtity.lame_param_set_(pEngine, s);
                }

                if (LameUtity.lame_init_(pEngine) < 0)
                {
                    LameUtity.lame_destroy_(pEngine);
                    pEngine = IntPtr.Zero;
                    throw new Exception("Faild to init lame.");
                }

                _vlib = lib;
                return(true);
            }
            catch (Exception e)
            {
                throw e;
            }
        }