Below are snippets for RRSands.

ranking Sort Sort   |   date Sort Sort   |   member Sort Sort
Syndication

8
Date Submitted Fri. Feb. 17th, 2006 3:49 PM
Revision 1
Beginner RRSands
Tags CSharp | Document | Execute | Launch | Run
Comments 0 comments
This snip opens any kind of document (e.g. .PDF, .DOC, .C, .HTM, etc.) using the default application associated with it. This relies on starting a new process with the .UseShellExecute property set to true.

The main overloaded function OpenDoc(filename) will open any associated document using the default OPEN verb. If you are trying to edit a file, for example, a command file, then you need should call OpenDoc with the "EDIT" verb. Some associations also a "PRINT" verb.

Since the return result is a System.Diagnostics.Process object, you can also monitor or kill the process.

Example:
OpenDoc("C:\\SomeDocumentation.pdf");
OpenDoc("C:\\AWebPage.htm", "EDIT");
OpenDoc("C:\\Test.txt", "PRINT");
System.Diagnostics.Process doc = OpenDoc("C:\\WebPage.htm");
11
Date Submitted Fri. Feb. 17th, 2006 4:49 PM
Revision 1
Beginner RRSands
Tags CSharp | Encryption | Security
Comments 0 comments
From RSA Security's website:
"RC4 is a stream cipher designed by Rivest for RSA Data Security (now RSA Security). It is a variable key-size stream cipher with byte-oriented operations. The algorithm is based on the use of a random permutation. Analysis shows that the period of the cipher is overwhelmingly likely to be greater than 10^100. Eight to sixteen machine operations are required per output byte, and the cipher can be expected to run very quickly in software. Independent analysts have scrutinized the algorithm and it is considered secure."

This implementation encodes the byte stream to be encrypted "in-place".

Example:
Byte[] Key = new Byte[5] { 12, 34, 22, 12, 32 };
Byte[] B = new Byte[10] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
// Examine B array before and after this next call.
RC4(ref B, Key);
// Examine B array before and after this next call.
RC4(ref B, Key);
7
Date Submitted Mon. Feb. 20th, 2006 7:04 PM
Revision 1
Beginner RRSands
Tags Clipboard | CSharp | NETCF2.0
Comments 0 comments
Prior to NETCF 2.0, this was a royal pain. Now, it's pretty straight-forward.

These three related functions provide basic Clipboard operations for text. While not terribly useful by themselves, they become more useful when attached to a field's context menu or, better yet, implemented in a custom control.