Exemplo n.º 1
0
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");

            // Configure API key authorization: Apikey
            Configuration.Default.AddApiKey("Apikey", "YOUR-KEY-HERE");

            // Specify your private cloud endpoint
            Configuration.Default.BasePath = "http://cloudmersiveprivatecloud.westus.cloudapp.azure.com";


            var apiInstance = new ScanApi();
            var inputFile   = new System.IO.FileStream("C:\\temp\\document2.pdf", System.IO.FileMode.Open); // System.IO.Stream | Input file to perform the operation on.

            try
            {
                // Scan a file for viruses
                VirusScanResult result = apiInstance.ScanFile(inputFile);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling ScanApi.ScanFile: " + e.Message);
            }
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            Console.WriteLine("Starting...");

            var files = Directory.EnumerateFiles("C:\\temp");

            foreach (var file in files)
            {
                // Configure API key authorization: Apikey
                Configuration.Default.AddApiKey("Apikey", "e4c8ad3b-335b-4082-a297-f3153da07770");



                var apiInstance = new ScanApi();
                using (var inputFile = new System.IO.FileStream(file, System.IO.FileMode.Open))
                {
                    try
                    {
                        // Scan a file for viruses
                        VirusScanResult result = apiInstance.ScanFile(inputFile);
                        Debug.WriteLine(JsonConvert.SerializeObject(result));
                    }
                    catch (Exception e)
                    {
                        Debug.Print("Exception when calling ScanApi.ScanFile: " + e.Message);
                    }
                }
            }
        }
Exemplo n.º 3
0
        public bool?CloudmersiveScan(IFormFile file)
        {
            Configuration.Default.AddApiKey("Apikey", _configuration["CloudmersiveKey"]);
            var apiInstance = new ScanApi();

            VirusScanResult result = new VirusScanResult();

            try
            {
                // Scan a file for viruses
                result = apiInstance.ScanFile(file.OpenReadStream());
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling ScanApi.ScanFile: " + e.Message);
            }

            return(result.CleanResult);
        }