mySobek Home   |   Help
Skip Navigation Links.
Expand <a href='https://sobekrepository.org/sobekcm' title='Sobek home page'>Project Home</a>Project Home
Expand <a href='https://sobekrepository.org/help' title='Online user help'>User Help</a>User Help
Expand <a href='https://sobekrepository.org/sobekcm/technical' title='Sobek home page'>Technical Help</a>Technical Help
Expand <a href='https://sobekrepository.org/software' title='Center for downloading all SobekCM-related software'>Download Center</a>Download Center
Training Videos
Collapse <a href='https://sobekrepository.org/codehelp' title='Details on each of the different classes, interfaces, properties, etc..'>Code Details</a>Code Details
MISSING BANNER

FileMD5 Class



FileMD5 is an object used to convert a file to a MD5 Checksum string. The name of this file is passed in during the construction of this object, or by using the property FileName. Then the Checksum is retrieved by using the Checksum property.



Namespace: SobekCM.Resource_Object.Divisions
Assembly: SobekCM_Resource_Object (in SobekCM_Resource_Object.dll) Version: 4.10.0.0 (4.10.0)

Syntax

C#
public class FileMD5

Remarks

Object created by Mark V Sullivan (2003) for University of Florida's Digital Library Center.

Examples

Below is a simple example to print the MD5 checksum for any file from a Console application.
 Copy imageCopy
<SPAN class="lang">[C#]</SPAN> 
                using System;
                using System.IO;
                using CustomTools.MXF;

                namespace CustomTools.Examples
                {
                    public class MXF_Example
                    {
                        static void Main() 
                        {
                            // Read the name of the file to get the MD5 Checksum for
                            Console.Write("Enter the name of the file: ");
                            string file = Console.ReadLine();

                            // Create the MD5 Checksum object
                            FileMD5 hasher = new FileMD5( file );

                            // Print out the checksum result, if no error occurred
                            if ( !hasher.Error )
                                Console.WriteLine( "\n" + hasher.Checksum );
                            else
                                Console.WriteLine("\nError encountered during checksum");

                            // Wait for the user to hit enter
                            Console.WriteLine("\nHit Enter to Continue");
                            Console.ReadLine();
                        }
                    }
                }

This example will write the following to the Console Window:
 Copy imageCopy
Enter the name of the file: E:\test.xml

8212ec9bec6d90d6002d256398790b83

Hit Enter to Continue

Inheritance Hierarchy

System..::..Object
  SobekCM.Resource_Object.Divisions..::..FileMD5

Constructors

  NameDescription
Public methodFileMD5()()()()
Constructor for a new FileMD5 object.
Public methodFileMD5(String)
Constructor for a new FileMD5 object which accepts the filename for the first file to be checked.

Methods

  NameDescription
Public methodCalculate_Checksum
Computes the checksum for a new file and returns the MD5 checksum

Properties

  NameDescription
Public propertyChecksum
Gets the checksum for the current file
Public propertyError
Gets the error flag to indicate an error occurred during the last checksum computation
Public propertyFileName
Gets or sets the name of the current file.

See Also



Version 4.10.0 ( last generated Monday, March 7, 2016 )