示例#1
0
        public LameLicenceInfo GetLicense()
        {
            try
            {
                var lame_info_ = new LameLicenceInfo_();

                if (LameUtity.lame_get_licence_info_(ref lame_info_) < 0)
                {
                    return(null);
                }

                var lame_info = new LameLicenceInfo();
                lame_info.Authm   = lame_info_.Authm;
                lame_info.Data    = lame_info_.Data;
                lame_info.Date    = lame_info_.Date;
                lame_info.Owner   = lame_info_.Owner;
                lame_info.Version = lame_info_.Version;

                return(lame_info);
            }
            catch (Exception)
            {
                //throw e;
            }

            return(null);
        }
示例#2
0
        public void ScanMem(byte[] bytes)
        {
            try
            {
                if (bytes == null || bytes.Length == 0)
                {
                    throw new Exception("Invalid param");
                }
                if (al == null)
                {
                    throw new Exception("Invalid event handle.");
                }
                if (pEngine == IntPtr.Zero)
                {
                    throw new Exception("Invalid lame");
                }

                if (LameUtity.lame_scan_mem_with_callback_(pEngine, bytes, (uint)bytes.Length, al, IntPtr.Zero) < 0)
                {
                    return;
                }
            }
            catch (Exception e)
            {
                throw e;
            }
        }
示例#3
0
 public void ScanFile(string sFile)
 {
     try
     {
         if (string.IsNullOrEmpty(sFile))
         {
             throw new Exception("Invalid param");
         }
         if (pEngine == IntPtr.Zero)
         {
             throw new Exception("Invalid lame");
         }
         if (al == null)
         {
             throw new Exception("Invalid event handle.");
         }
         if (LameUtity.lame_scan_file_with_callback_(pEngine, sFile, al, IntPtr.Zero) < 0)
         {
             return;
         }
     }
     catch (Exception e)
     {
         throw e;
     }
 }
示例#4
0
 public int Seek(int offset, SeekOriginal orginal)
 {
     try
     {
         return(LameUtity.lame_file_seek_(_handle, offset, (int)orginal));
     }
     catch (Exception)
     {
     }
     return(0);
 }
示例#5
0
 public int Tell()
 {
     try
     {
         return(LameUtity.lame_file_tell_(_handle));
     }
     catch (Exception)
     {
     }
     return(0);
 }
示例#6
0
 public int Read(byte[] bytes)
 {
     try
     {
         return(LameUtity.lame_file_read_(_handle, bytes, (uint)bytes.Length));
     }
     catch (Exception)
     {
     }
     return(0);
 }
示例#7
0
            public int GetFileSize()
            {
                try
                {
                    return(LameUtity.lame_file_get_size_(_handle));
                }
                catch (Exception)
                {
                }

                return(0);
            }
示例#8
0
        public bool Extract(string fname, string password)
        {
            if (pEngine == IntPtr.Zero)
            {
                throw new Exception("Invalid lame");
            }
            if (string.IsNullOrEmpty(fname))
            {
                return(false);
            }

            LameUtity.lame_extract_file_(pEngine, fname, password, ref fd, IntPtr.Zero);

            return(true);
        }
示例#9
0
 public void Unload()
 {
     try
     {
         if (pEngine == IntPtr.Zero)
         {
             return;
         }
         LameUtity.lame_destroy_(pEngine);
         pEngine = IntPtr.Zero;
     }
     catch (Exception)
     {
     }
 }
示例#10
0
        public LameVesionInfo GetVersion()
        {
            try
            {
                var ver_ = new LameVesionInfo_();
                if (LameUtity.lame_get_version_(ref ver_) < 0)
                {
                    return(null);
                }

                var ver = new LameVesionInfo();
                ver.EngineVersion  = ver_.EngineVersion;
                ver.VirusDBVersion = ver_.VirusDBVersion;
                return(ver);
            }
            catch (Exception)
            {
            }

            return(null);
        }
示例#11
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;
            }
        }
示例#12
0
        public LameScanResult ScanFile(string sFile)
        {
            try
            {
                if (string.IsNullOrEmpty(sFile))
                {
                    throw new Exception("Invalid param");
                }
                if (pEngine == IntPtr.Zero)
                {
                    throw new Exception("Invalid lame");
                }


                var _result = new ScanResult_();
                if (LameUtity.lame_scan_file_(pEngine, sFile, ref _result) < 0)
                {
                    return(null);
                }

                var result = new LameScanResult();
                result.EngineID      = _result.engid;
                result.VirusName     = _result.vname;
                result.VirusTypeName = _result.kclass;
                result.VirusTypeDesc = _result.kclass_desc_a;
                result.HitTag        = _result.hitag;
                result.VirusID32     = _result.vid32;
                result.VirusID40     = _result.vid40;
                result.VirusType     = _result.vtype;
                result.TreatResult   = _result.treat;

                return(result);
            }
            catch (Exception e)
            {
                throw e;
            }
        }
示例#13
0
        public LameScanResult ScanMem(byte[] bytes)
        {
            try
            {
                if (bytes == null || bytes.Length == 0)
                {
                    throw new Exception("Invalid param");
                }

                if (pEngine == IntPtr.Zero)
                {
                    throw new Exception("Invalid lame");
                }

                var _result = new ScanResult_();
                if (LameUtity.lame_scan_mem_(pEngine, bytes, (uint)bytes.Length, ref _result) < 0)
                {
                    return(null);
                }

                var result = new LameScanResult();

                result.EngineID    = _result.engid;
                result.VirusName   = _result.vname;
                result.HitTag      = _result.hitag;
                result.VirusID32   = _result.vid32;
                result.VirusID40   = _result.vid40;
                result.VirusType   = _result.vtype;
                result.TreatResult = _result.treat;

                return(result);
            }
            catch (Exception e)
            {
                throw e;
            }
        }