.NET 4.x Delphi 7 to c#
Формулировка задачи:
как вот эту строчку перевести на c#
if (i mod 200)=0 then Application.ProcessMessages();
Решение задачи: «.NET 4.x Delphi 7 to c#»
textual
Листинг программы
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using System.IO;
using System.Security.Cryptography;
namespace FromDelphiToCSharp
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private string MD5Digest(string data)
{
MD5 md5Hash = new MD5CryptoServiceProvider();
byte[] result = md5Hash.ComputeHash(Encoding.Default.GetBytes(data));
StringBuilder sb = new StringBuilder();
for (int i = 0; i < result.Length; i++)
sb.Append(result[i].ToString("X2"));
return sb.ToString();
}
private void button1_Click(object sender, EventArgs e)
{
List<string> list = new List<string>();
list.AddRange(File.ReadAllLines("1.txt"));
list.AddRange(File.ReadAllLines("2.txt"));
list.AddRange(File.ReadAllLines("3.txt"));
string s = string.Empty;
string a = string.Empty;
textBox1.Text = textBox1.Text.ToUpper();
for (int i = 0; i < list.Count; i++)
{
s = list[i];
a = MD5Digest(s);
if (a == textBox1.Text)
{
textBox2.Text = s;
break;
}
}
}
}
}