csharp-classlib-cvs Mailing List for C# ClassLib (Page 2)
Status: Inactive
Brought to you by:
generalpd
You can subscribe to this list here.
2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(25) |
Jun
(7) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
---|
From: Marcel K. <gen...@us...> - 2005-05-03 20:12:54
|
Update of /cvsroot/csharp-classlib/demos/EasyMD5/EasyMD5/Classes In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6387/EasyMD5/EasyMD5/Classes Added Files: clsEasyMD5.cs Log Message: - import of EasyMD5 demo --- NEW FILE: clsEasyMD5.cs --- // C# ClassLib // http://csharp-classlib.sourceforge.net // // // Copyright (C) 2005 Marcel Joachim Kloubert // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License // as published by the Free Software Foundation; either version 2 // of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // using System; using System.IO; using System.Security.Cryptography; using System.Text; namespace CSharp_ClassLib.Cryptography { /*! \brief MD5 class * * Class that contains routines to handle MD5 much easier * * \author generalpd * * \version $Revision: 1.1 $ * * \date 2005-04-18 * * \bug none * * \todo none * * \remarks Last changed by: $Author: generalpd $ in revision $Revision: 1.1 $ on $Date: 2005/05/03 20:12:45 $ * * \note * $Log: clsEasyMD5.cs,v $ * Revision 1.1 2005/05/03 20:12:45 generalpd * - import of EasyMD5 demo * * */ public class EasyMD5 : System.Object { /// MD5 instance private System.Security.Cryptography.MD5CryptoServiceProvider m_oMD5; /// current checksum private byte[] m_bChecksum; /// ASCII encoder private System.Text.ASCIIEncoding m_oASCII; /*! \fn EasyMD5 () * \brief Class constructor that inits all nesessary stuff * * \code * * // Code example * * CSharp_ClassLib.Cryptography.EasyMD5 m_oMD5 = new CSharp_ClassLib.Cryptography.EasyMD5(); * * \endcode * */ public EasyMD5() { this.IntRest(); return; } /*! \fn EasyMD5(byte[] Expression) * \brief Class constructor that inits all nesessary stuff and calculates the MD5 hash from a byte array * * \param Expression The expression * * \code * * // Code example * * byte[] m_bExpression = { 0, 1, 2, 3, 4 }; * CSharp_ClassLib.Cryptography.EasyMD5 m_oMD5 = new CSharp_ClassLib.Cryptography.EasyMD5(m_bExpression); * * \endcode * */ public EasyMD5(byte[] Expression) { this.IntRest(); this.ExpressionBytes = Expression; return; } /*! \fn EasyMD5(System.IO.Stream stream) * \brief Class constructor that inits all nesessary stuff and calculates the MD5 hash from a stream * * \param stream The stream * * \code * * // Code example * * FileStream m_oFileStream = new FileStream("C:\\boot.ini", FileMode.Open); * CSharp_ClassLib.Cryptography.EasyMD5 m_oMD5 = new CSharp_ClassLib.Cryptography.EasyMD5(m_oFileStream); * * \endcode * */ public EasyMD5(System.IO.Stream stream) { this.IntRest(); this.Stream = stream; return; } /*! \fn EasyMD5(string filename) * \brief Class constructor that inits all nesessary stuff and calculates the MD5 hash from a file * * \param filename The full path of the file * * \code * * // Code example * * CSharp_ClassLib.Cryptography.EasyMD5 m_oMD5 = new CSharp_ClassLib.Cryptography.EasyMD5("C:\\boot.ini"); * * \endcode * * \exception System.IO.FileNotFoundException File not found! * */ public EasyMD5(string filename) { this.IntRest(); this.Filename = filename; return; } /*! \property byte[] ChecksumBytes * \brief Returns the current checksum * * \return The checksum * * \code * * // Code example * * byte[] m_bChecksum = m_oMD5.ChecksumBytes; * * \endcode * */ public byte[] ChecksumBytes { get { return this.m_bChecksum; } } /*! \property string ChecksumString * \brief Returns the current checksum * * \return The checksum * * \code * * // Code example * * Console.WriteLine("MD5 hash: " + m_oMD5.ChecksumString); * * \endcode * */ public string ChecksumString { get { return this.ToHexString(this.ChecksumBytes); } } /*! \property byte[] ExpressionBytes * \brief Calculates the checksum of a byte array * * \param value The expression * * \code * * // Code example * * m_oMD5.ExpressionBytes = m_oASCII.GetBytes("Support Mono!"); * Console.WriteLine("MD5 hash: " + m_oMD5.ChecksumString); * * \endcode * */ public byte[] ExpressionBytes { set { this.m_oMD5 = new System.Security.Cryptography.MD5CryptoServiceProvider(); this.m_bChecksum = this.m_oMD5.ComputeHash(value); } } /*! \property string ExpressionString * \brief Calculates the checksum of a string * * \param value The expression * * \code * * // Code example * * m_oMD5.ExpressionString = "Support Mono!"; * Console.WriteLine("MD5 hash: " + m_oMD5.ChecksumString); * * \endcode * */ public string ExpressionString { set { this.ExpressionBytes = m_oASCII.GetBytes(value); } } /*! \property string Filename * \brief Calculates the checksum from a file * * \param value The full path of the file * * \code * * // Code example * * m_oMD5.Filename = "C:\\boot.ini"; * Console.WriteLine("MD5 hash: " + m_oMD5.ChecksumString); * * \endcode * * \exception System.IO.FileNotFoundException File not found! * */ public string Filename { set { if (!System.IO.File.Exists(value.Trim())) // file does not exist! throw ( new System.IO.FileNotFoundException("File was not found!", value.Trim()) ); this.Stream = ( new System.IO.FileStream(value.Trim(), System.IO.FileMode.Open) ); } } /*! \property string Stream * \brief Calculates the checksum from a stream * * \param value The stream instance * * \code * * // Code example * * m_oMD5.Stream = m_oMemoryStream; * Console.WriteLine("MD5 hash: " + m_oMD5.ChecksumString); * * \endcode * */ public System.IO.Stream Stream { set { this.m_oMD5 = new System.Security.Cryptography.MD5CryptoServiceProvider(); this.m_bChecksum = this.m_oMD5.ComputeHash(value); } } /*! \fn void IntRest() * \brief Internal routine to init the rest stuff * */ private void IntRest() { this.m_oMD5 = null; this.m_bChecksum = new byte[0]; this.m_oASCII = new System.Text.ASCIIEncoding(); return; } /*! \fn string ToHexString (byte[] Expression) * \brief Internal routine that converts an expression to a hex string * * \param Expression The expression to convert * * \return The expression as hex string * */ private string ToHexString (byte[] Expression) { if (null == Expression) return ""; int i = 0; byte bHigh = 0; byte bLow = 0; string strBuffer = ""; string strHexString = "0123456789ABCDEF"; for (i = 0; i < Expression.GetLength(0); i++) { // calc the high & the low byte bHigh = (byte)System.Math.Floor((double)Expression[i] / 16.0); bLow = (byte)(Expression[i] % 16); // add the character as 2-character-hex-expression strBuffer += strHexString.Substring(bHigh, 1) + strHexString.Substring(bLow, 1); } return strBuffer; } /*! \fn void Clear () * \brief Clears the MD5 checksum var * */ public void Clear () { this.m_bChecksum = new byte[0]; return; } } } |
From: Marcel K. <gen...@us...> - 2005-05-03 20:12:53
|
Update of /cvsroot/csharp-classlib/demos/EasyMD5/EasyMD5 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6387/EasyMD5/EasyMD5 Added Files: AssemblyInfo.cs EasyMD5.prjx Main.cs Log Message: - import of EasyMD5 demo --- NEW FILE: EasyMD5.prjx --- <Project name="EasyMD5" standardNamespace="EasyMD5" description="" newfilesearch="None" enableviewstate="True" version="1.1" projecttype="C#"> <Contents> <File name=".\Main.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> <File name=".\AssemblyInfo.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> <File name=".\Classes" subtype="Directory" buildaction="Compile" dependson="" data="" /> <File name="..\Classes\clsEasyMD5.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> </Contents> <References /> <DeploymentInformation target="" script="" strategy="File" /> <Configuration runwithwarnings="True" name="Debug"> <CodeGeneration runtime="Mono" compiler="Mcs" compilerversion="Standard" warninglevel="4" nowarn="" includedebuginformation="True" optimize="False" unsafecodeallowed="False" generateoverflowchecks="True" mainclass="" target="Exe" definesymbols="" generatexmldocumentation="False" win32Icon="" noconfig="False" nostdlib="False" /> <Execution commandlineparameters="" consolepause="True" /> <Output directory="..\..\bin\Debug" assembly="EasyMD5" executeScript="" executeBeforeBuild="" executeAfterBuild="" executeBeforeBuildArguments="" executeAfterBuildArguments="" /> </Configuration> <Configurations active="Debug"> <Configuration runwithwarnings="True" name="Debug"> <CodeGeneration runtime="Mono" compiler="Mcs" compilerversion="Standard" warninglevel="4" nowarn="" includedebuginformation="True" optimize="False" unsafecodeallowed="False" generateoverflowchecks="True" mainclass="" target="Exe" definesymbols="" generatexmldocumentation="False" win32Icon="" noconfig="False" nostdlib="False" /> <Execution commandlineparameters="" consolepause="True" /> <Output directory="..\..\bin\Debug" assembly="EasyMD5" executeScript="" executeBeforeBuild="" executeAfterBuild="" executeBeforeBuildArguments="" executeAfterBuildArguments="" /> </Configuration> <Configuration runwithwarnings="True" name="Release"> <CodeGeneration runtime="Mono" compiler="Mcs" compilerversion="Standard" warninglevel="4" nowarn="" includedebuginformation="False" optimize="True" unsafecodeallowed="False" generateoverflowchecks="False" mainclass="" target="Exe" definesymbols="" generatexmldocumentation="False" win32Icon="" noconfig="False" nostdlib="False" /> <Execution commandlineparameters="" consolepause="True" /> <Output directory="..\..\bin\Release" assembly="EasyMD5" executeScript="" executeBeforeBuild="" executeAfterBuild="" executeBeforeBuildArguments="" executeAfterBuildArguments="" /> </Configuration> </Configurations> </Project> --- NEW FILE: Main.cs --- // C# ClassLib (Demos) // http://csharp-classlib.sourceforge.net // // // Copyright (C) 2005 Marcel Joachim Kloubert // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License // as published by the Free Software Foundation; either version 2 // of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // using System; namespace CSharp_ClassLib.Demos.EasyMD5Class { /*! \brief Main class * * Main class * * \author generalpd * * \version $Revision: 1.1 $ * * \date 2005-05-03 * * \bug none * * \todo none * * \remarks Last changed by: $Author: generalpd $ in revision $Revision: 1.1 $ on $Date: 2005/05/03 20:12:45 $ * * \note * $Log: Main.cs,v $ * Revision 1.1 2005/05/03 20:12:45 generalpd * - import of EasyMD5 demo * * * */ public class MainClass { private CSharp_ClassLib.Cryptography.EasyMD5 m_oMD5; public MainClass() { return; } /*! \fn static int Main(string[] args) * \brief Entry point * * \param args Array of command line arguments * * \return Error code (0 => no error; 1 => Exception) * */ public static int Main(string[] args) { // run the demo return ( new CSharp_ClassLib.Demos.EasyMD5Class.MainClass() ).Run(args); } /*! \fn int Run (string[] args) * \brief Non-Static version of Main() * * \param args Array of command line arguments * * \return Error code (0 => no error; 1 => Exception) * */ private int Run (string[] args) { try { // user's input System.String strInputString = ""; // create new instance this.m_oMD5 = new CSharp_ClassLib.Cryptography.EasyMD5(); // user has to enter a string Console.WriteLine( "Enter a string that you want to hash:" ); Console.Write( "> " ); strInputString = Console.ReadLine(); // hash the string this.m_oMD5.ExpressionString =strInputString; // show # of files and sub-dirs that were found Console.WriteLine( "" ); Console.WriteLine("MD5 hash: " + this.m_oMD5.ChecksumString ); // start cleaning System.GC.Collect(); System.GC.WaitForPendingFinalizers(); return 0; } catch (System.Exception e) { // exception Console.WriteLine("EXCEPTION: " + e.Message); return 1; } } } } --- NEW FILE: AssemblyInfo.cs --- using System.Reflection; using System.Runtime.CompilerServices; // Information about this assembly is defined by the following // attributes. // // change them to the information which is associated with the assembly // you compile. [assembly: AssemblyTitle("")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("")] [assembly: AssemblyCopyright("")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // The assembly version has following format : // // Major.Minor.Build.Revision // // You can specify all values by your own or you can build default build and revision // numbers with the '*' character (the default): [assembly: AssemblyVersion("1.0.*")] // The following attributes specify the key for the sign of your assembly. See the // .NET Framework documentation for more information about signing. // This is not required, if you don't want signing let these attributes like they're. [assembly: AssemblyDelaySign(false)] [assembly: AssemblyKeyFile("")] |
From: Marcel K. <gen...@us...> - 2005-05-03 20:12:53
|
Update of /cvsroot/csharp-classlib/demos/EasyMD5 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6387/EasyMD5 Added Files: EasyMD5.cmbx Log Message: - import of EasyMD5 demo --- NEW FILE: EasyMD5.cmbx --- <Combine fileversion="1.0" name="EasyMD5" description=""> <StartMode startupentry="EasyMD5" single="True"> <Execute entry="EasyMD5" type="None" /> </StartMode> <Entries> <Entry filename=".\EasyMD5\.\EasyMD5.prjx" /> </Entries> <Configurations active="Debug"> <Configuration name="Release"> <Entry name="EasyMD5" configurationname="Debug" build="False" /> </Configuration> <Configuration name="Debug"> <Entry name="EasyMD5" configurationname="Debug" build="False" /> </Configuration> </Configurations> </Combine> |
From: Marcel K. <gen...@us...> - 2005-05-03 20:11:15
|
Update of /cvsroot/csharp-classlib/demos/EasyMD5/EasyMD5/Classes In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5740/Classes Log Message: Directory /cvsroot/csharp-classlib/demos/EasyMD5/EasyMD5/Classes added to the repository |
From: Marcel K. <gen...@us...> - 2005-05-03 20:10:51
|
Update of /cvsroot/csharp-classlib/demos/EasyMD5/EasyMD5 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5555/EasyMD5 Log Message: Directory /cvsroot/csharp-classlib/demos/EasyMD5/EasyMD5 added to the repository |
From: Marcel K. <gen...@us...> - 2005-05-03 20:09:52
|
Update of /cvsroot/csharp-classlib/demos/EasyMD5 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5151/EasyMD5 Log Message: Directory /cvsroot/csharp-classlib/demos/EasyMD5 added to the repository |
From: Marcel K. <gen...@us...> - 2005-05-03 17:10:15
|
Update of /cvsroot/csharp-classlib/main/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27268/src Modified Files: AssemblyInfo.cs C# ClassLib.prjx Removed Files: Main.cs Log Message: - set options to mono project & output as library dll --- Main.cs DELETED --- Index: AssemblyInfo.cs =================================================================== RCS file: /cvsroot/csharp-classlib/main/src/AssemblyInfo.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** AssemblyInfo.cs 3 May 2005 12:59:55 -0000 1.1 --- AssemblyInfo.cs 3 May 2005 17:09:55 -0000 1.2 *************** *** 38,41 **** --- 38,44 ---- * \note * $Log$ + * Revision 1.2 2005/05/03 17:09:55 generalpd + * - set options to mono project & output as library dll + * * Revision 1.1 2005/05/03 12:59:55 generalpd * first import *************** *** 52,57 **** // you compile. ! [assembly: AssemblyTitle("C# ClassLib Demo")] ! [assembly: AssemblyDescription("Shows the work of all classes")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Marcel Joachim Kloubert")] --- 55,60 ---- // you compile. ! [assembly: AssemblyTitle("C# ClassLib")] ! [assembly: AssemblyDescription("The C# Class library")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Marcel Joachim Kloubert")] Index: C# ClassLib.prjx =================================================================== RCS file: /cvsroot/csharp-classlib/main/src/C# ClassLib.prjx,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** C# ClassLib.prjx 3 May 2005 12:59:55 -0000 1.1 --- C# ClassLib.prjx 3 May 2005 17:09:55 -0000 1.2 *************** *** 1,5 **** ! <Project name="C# ClassLib" standardNamespace="C__ClassLib" description="" newfilesearch="None" enableviewstate="True" version="1.1" projecttype="C#"> <Contents> - <File name=".\Main.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> <File name=".\AssemblyInfo.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> <File name=".\classes" subtype="Directory" buildaction="Compile" dependson="" data="" /> --- 1,4 ---- ! <Project name="C# ClassLib" standardNamespace="CSharp_ClassLib" description="A set of usefull non-visual C# classes" newfilesearch="None" enableviewstate="True" version="1.1" projecttype="C#"> <Contents> <File name=".\AssemblyInfo.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> <File name=".\classes" subtype="Directory" buildaction="Compile" dependson="" data="" /> *************** *** 15,32 **** <DeploymentInformation target="" script="" strategy="File" /> <Configuration runwithwarnings="True" name="Debug"> ! <CodeGeneration runtime="MsNet" compiler="Csc" compilerversion="" warninglevel="4" nowarn="" includedebuginformation="True" optimize="False" unsafecodeallowed="False" generateoverflowchecks="True" mainclass="" target="Exe" definesymbols="" generatexmldocumentation="False" win32Icon="" noconfig="False" nostdlib="False" /> <Execution commandlineparameters="" consolepause="True" /> ! <Output directory="..\..\bin\Debug" assembly="C# ClassLib" executeScript="" executeBeforeBuild="" executeAfterBuild="" executeBeforeBuildArguments="" executeAfterBuildArguments="" /> </Configuration> <Configurations active="Debug"> <Configuration runwithwarnings="True" name="Debug"> ! <CodeGeneration runtime="MsNet" compiler="Csc" compilerversion="" warninglevel="4" nowarn="" includedebuginformation="True" optimize="False" unsafecodeallowed="False" generateoverflowchecks="True" mainclass="" target="Exe" definesymbols="" generatexmldocumentation="False" win32Icon="" noconfig="False" nostdlib="False" /> <Execution commandlineparameters="" consolepause="True" /> ! <Output directory="..\..\bin\Debug" assembly="C# ClassLib" executeScript="" executeBeforeBuild="" executeAfterBuild="" executeBeforeBuildArguments="" executeAfterBuildArguments="" /> </Configuration> <Configuration runwithwarnings="True" name="Release"> ! <CodeGeneration runtime="MsNet" compiler="Csc" compilerversion="" warninglevel="4" nowarn="" includedebuginformation="False" optimize="True" unsafecodeallowed="False" generateoverflowchecks="False" mainclass="" target="Exe" definesymbols="" generatexmldocumentation="False" win32Icon="" noconfig="False" nostdlib="False" /> <Execution commandlineparameters="" consolepause="True" /> ! <Output directory="..\..\bin\Release" assembly="C# ClassLib" executeScript="" executeBeforeBuild="" executeAfterBuild="" executeBeforeBuildArguments="" executeAfterBuildArguments="" /> </Configuration> </Configurations> --- 14,31 ---- <DeploymentInformation target="" script="" strategy="File" /> <Configuration runwithwarnings="True" name="Debug"> ! <CodeGeneration runtime="Mono" compiler="Mcs" compilerversion="Standard" warninglevel="4" nowarn="" includedebuginformation="True" optimize="False" unsafecodeallowed="False" generateoverflowchecks="True" mainclass="" target="Library" definesymbols="" generatexmldocumentation="False" win32Icon="" noconfig="False" nostdlib="False" /> <Execution commandlineparameters="" consolepause="True" /> ! <Output directory="..\..\bin\Debug" assembly="CSharp_ClassLib" executeScript="" executeBeforeBuild="" executeAfterBuild="" executeBeforeBuildArguments="" executeAfterBuildArguments="" /> </Configuration> <Configurations active="Debug"> <Configuration runwithwarnings="True" name="Debug"> ! <CodeGeneration runtime="Mono" compiler="Mcs" compilerversion="Standard" warninglevel="4" nowarn="" includedebuginformation="True" optimize="False" unsafecodeallowed="False" generateoverflowchecks="True" mainclass="" target="Library" definesymbols="" generatexmldocumentation="False" win32Icon="" noconfig="False" nostdlib="False" /> <Execution commandlineparameters="" consolepause="True" /> ! <Output directory="..\..\bin\Debug" assembly="CSharp_ClassLib" executeScript="" executeBeforeBuild="" executeAfterBuild="" executeBeforeBuildArguments="" executeAfterBuildArguments="" /> </Configuration> <Configuration runwithwarnings="True" name="Release"> ! <CodeGeneration runtime="Mono" compiler="Mcs" compilerversion="Standard" warninglevel="4" nowarn="" includedebuginformation="False" optimize="True" unsafecodeallowed="False" generateoverflowchecks="False" mainclass="" target="Library" definesymbols="" generatexmldocumentation="False" win32Icon="" noconfig="False" nostdlib="False" /> <Execution commandlineparameters="" consolepause="True" /> ! <Output directory="..\..\bin\Release" assembly="CSharp_ClassLib" executeScript="" executeBeforeBuild="" executeAfterBuild="" executeBeforeBuildArguments="" executeAfterBuildArguments="" /> </Configuration> </Configurations> |