2004-04-20 Sebastien Pouliot <sebastien@ximian.com>
authorSebastien Pouliot <sebastien@ximian.com>
Tue, 20 Apr 2004 12:36:32 +0000 (12:36 -0000)
committerSebastien Pouliot <sebastien@ximian.com>
Tue, 20 Apr 2004 12:36:32 +0000 (12:36 -0000)
* ASN1.cs: Added SaveToFile for easier debugging. Patch from
Jesper Pedersen.

svn path=/trunk/mcs/; revision=25725

mcs/class/corlib/Mono.Security/ASN1.cs
mcs/class/corlib/Mono.Security/ChangeLog

index 6ed5f53a5e406e3e4691c9e1d7cd20995356a90f..09e4b2dcb00407365cde4040af6c6dd86473bb02 100644 (file)
@@ -12,6 +12,7 @@
 
 using System;
 using System.Collections;
+using System.IO;
 using System.Text;
 
 namespace Mono.Security {
@@ -263,7 +264,6 @@ namespace Mono.Security {
                        }
                }
 
-
                public override string ToString()
                {
                        string lineSeperator = Environment.NewLine;
@@ -290,5 +290,18 @@ namespace Mono.Security {
                        }
                        return hexLine.ToString ();
                }
+
+               public void SaveToFile (string filename)
+               {
+                       if (filename == null)
+                               throw new ArgumentNullException ("filename");
+
+                       using (FileStream fs = File.OpenWrite (filename)) {
+                               byte[] data = GetBytes ();
+                               fs.Write (data, 0, data.Length);
+                               fs.Flush ();
+                               fs.Close ();
+                       }
+               }
        }
 }
index 4a80d79c86f228fca35f0f1ebe923cbfcdeb63e0..8d9cae944fc2ec05acc502c104a74c51d2bdf34a 100644 (file)
@@ -1,5 +1,7 @@
 2004-04-20  Sebastien Pouliot  <sebastien@ximian.com>
 
+       * ASN1.cs: Added SaveToFile for easier debugging. Patch from
+       Jesper Pedersen.
        * StrongName.cs: Removed compilation warning (unused variable).
 
 2004-04-08  Bernie Solomon  <bernard@ugsolutions.com>