You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
61 lines
2.1 KiB
61 lines
2.1 KiB
using ClassLib000.Walker;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace ConsoleCore
|
|
{
|
|
class RobotFiler
|
|
{
|
|
internal static void SaveFile(string sFileName, Appartment app)
|
|
{
|
|
File.WriteAllText(sFileName, app.GetContent(), Encoding.UTF8);
|
|
// byte[] bt = Encoding.UTF8.GetBytes(app.GetContent());
|
|
// File.WriteAllBytes(sFileName, bt);
|
|
}
|
|
|
|
internal static void WriteLargeStream(string sFileName, int gb)
|
|
{
|
|
byte[] bt = new byte[] { 67, 67, 67 };
|
|
using (Stream file = File.Create(sFileName, 1024 * 64, FileOptions.DeleteOnClose))
|
|
{
|
|
DateTime dtFrom = DateTime.Now;
|
|
Console.WriteLine($"{dtFrom:HHmmss}");
|
|
long ll = ((long)1024) * 1024 * 1024 * gb;
|
|
for (long ii = 0; ii < ll; ii++)
|
|
{
|
|
file.Write(bt);
|
|
// file.WriteByte(67);
|
|
}
|
|
DateTime dtTo = DateTime.Now;
|
|
TimeSpan ts = dtTo - dtFrom;
|
|
Console.WriteLine($"{sFileName}: {ts.TotalSeconds} sec");
|
|
Console.ReadKey();
|
|
}
|
|
}
|
|
|
|
internal static void WriteLargeText(string sFileName, long rowCount)
|
|
{
|
|
byte[] bt = new byte[] { 67, 67, 67 };
|
|
using (Stream file = File.Create(sFileName, 1024 * 64, FileOptions.DeleteOnClose))
|
|
{
|
|
DateTime dtFrom = DateTime.Now;
|
|
Console.WriteLine($"{dtFrom:HHmmss}");
|
|
using (StreamWriter writer = new StreamWriter(file, Encoding.UTF8))
|
|
{
|
|
for (long ii = 0; ii < rowCount; ii++)
|
|
{
|
|
writer.WriteLine($"{dtFrom:HHmmss}");
|
|
}
|
|
}
|
|
DateTime dtTo = DateTime.Now;
|
|
TimeSpan ts = dtTo - dtFrom;
|
|
Console.WriteLine($"{sFileName}: {ts.TotalSeconds} sec");
|
|
Console.ReadKey();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|