Using system;
Using system. drawing;
Using system. collections;
Using system. componentmodel;
Using system. Windows. forms;
Using system. Data;
Using system. IO;
Using system. Threading;
Using system. diagnostics;
Namespace windowsapplication1
{
/// <Summary>
/// Summary of form1.
/// </Summary>
Public class form1: system. Windows. Forms. Form
{
/// <Summary>
/// Required designer variables.
/// </Summary>
Private system. componentmodel. Container components = NULL;
Public static bool writing = false;
Public static string filename = @ "C: \ 1.dat ";
Static byte Index = 10;
Public form1 ()
{
//
// Required for Windows Form Designer support
//
Initializecomponent ();
//
// Todo: add Any constructor code after initializecomponent calls
//
}
/// <Summary>
/// Clear all resources in use.
/// </Summary>
Protected override void dispose (bool disposing)
{
If (disposing)
{
If (components! = NULL)
{
Components. Dispose ();
}
}
Base. Dispose (disposing );
}
# Region code generated by Windows Form Designer
/// <Summary>
/// The designer supports the required methods-do not use the code editor to modify
/// Content of this method.
/// </Summary>
Private void initializecomponent ()
{
This. components = new system. componentmodel. Container ();
This. size = new system. Drawing. Size (300,300 );
This. Text = "form1 ";
}
# Endregion
/// <Summary>
/// Main entry point of the application.
/// </Summary>
[Stathread]
Static void main ()
{
For (INT I = 0; I <1; I ++)
{
// File. Create ("C: \ AA", 1024*1024*1024 );
// Fileinfo AA = new fileinfo ("C: \ AA ");
// Filestream FS = new filestream (
Streamwriter Sw = new streamwriter ("C: \ AA", true, system. Text. encoding. utf8, 1024*1024 );
}
For (byte I = 0; I <3; I ++)
{
Writefile ();
// Threadstart strat = new threadstart (writefile );
// Thread = new thread (strat );
// Thread. Start ();
}
Application. Run (New form1 ());
}
Public static void writefile ()
{
Index ++;
Byte num = index;
Byte [] bytes = new byte [1024*1024*1024];
For (INT I = 0; I <1024; I ++)
{
Bytes [I] = num;
}
While (writing = true)
{
Application. doevents ();
}
Writing = true;
Filestream FS = new filestream (filename, filemode. openorcreate, fileaccess. Write );
FS. Seek (Num-1) * 1024, 0 );
FS. Write (bytes, 0, bytes. Length );
FS. Close ();
Writing = false;
Debug. writeline (Num + "end ");
}
}
}