Verify() public method

public Verify ( ) : bool
return bool
Ejemplo n.º 1
0
        /// <summary>
        /// Scans a single file
        /// </summary>
        /// <param name="s1">The input file name</param>
        /// <param name="s2">The output file name</param>
        private static void ScanSingle(string s1, string s2)
        {
            bool read = false;
            bool verified = false;

            try
            {
                FileInfo f = new FileInfo(s2);

                if (!Directory.Exists(f.DirectoryName))
                {
                    Directory.CreateDirectory(f.DirectoryName);
                }
            }
            catch (Exception e)
            {
                throw new DirectoryNotFoundException(e.Message);
            }

            SwfFile file = new SwfFile();

            try
            {
                using (FileStream fs = File.OpenRead(s1))
                {
                    Console.WriteLine(" Reading: " + s1);
                    file.Read(fs);
                    Console.WriteLine(" Reading successfull");
                    read = true;
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(" Read error : " + e.Message + Environment.NewLine);
            }

            if (read)
            {
                Console.WriteLine(" Verifiying: " + s1);

                try
                {
                    file.Verify();
                    Console.WriteLine(" Verifiying successfull");
                    verified = true;
                }
                catch (Exception e)
                {
                    Console.WriteLine(" Verifiy error : " + e.Message + Environment.NewLine);

                }
            }

            if (read && verified)
            {
                Console.WriteLine(" Writing: " + s2);

                try
                {
                    using (FileStream fs = File.OpenWrite(s2))
                    {
                        file.Write(fs);
                        Console.WriteLine(" Writing successfull" + Environment.NewLine);
                    }
                }
                catch (Exception e)
                {
                    Console.WriteLine(" Write error : " + e.Message + Environment.NewLine);
                }
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Overwrites a single file with a scanned copy
        /// </summary>
        /// <param name="s">The input file</param>
        private static void ScanSingle(string s)
        {
            bool read = false;
            bool verified = false;

            SwfFile file = new SwfFile();

            try
            {
                using (FileStream fs = File.OpenRead(s))
                {
                    file.Read(fs);
                    Console.WriteLine(" Reading successfull");
                    read = true;
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(" Read error : " + e.Message + Environment.NewLine);
            }

            if (read)
            {
                Console.WriteLine(" Verifiying: " + s);

                try
                {
                    file.Verify();
                    Console.WriteLine(" Verifiying successfull");
                    verified = true;
                }
                catch (Exception e)
                {
                    Console.WriteLine(" Verifiy error : " + e.Message + Environment.NewLine);

                }
            }

            if (read && verified)
            {
                Console.WriteLine(" Writing: " + s);

                try
                {
                    using (FileStream fs = File.OpenWrite(s))
                    {
                        file.Write(fs);
                        Console.WriteLine(" Writing successfull" + Environment.NewLine);
                    }
                }
                catch (Exception e)
                {
                    Console.WriteLine(" Write error : " + e.Message + Environment.NewLine);
                }
            }
        }