class Program
{
static void Main(string[] args)
{
// отправитель - устанавливаем адрес и отображаемое в письме имя
MailAddress from = new MailAddress("somemail@gmail.com", "Tom");
// кому отправляем
MailAddress to = new MailAddress("somemail@yandex.ru");
// создаем объект сообщения
MailMessage m = new MailMessage(from, to);
// тема письма
m.Subject = "Тест";
// текст письма
m.Body = "<h2>Письмо-тест работы smtp-клиента</h2>";
// письмо представляет код html
m.IsBodyHtml = true;
// адрес smtp-сервера и порт, с которого будем отправлять письмо
SmtpClient smtp = new SmtpClient("smtp.gmail.com", 587);
// логин и пароль
smtp.Credentials = new NetworkCredential("somemail@gmail.com", "mypassword");
smtp.EnableSsl = true;
smtp.Send(m);
Console.Read();
}
}
class Program
{
static void Main(string[] args)
{
SendEmailAsync().GetAwaiter();
Console.Read();
}
private static async Task SendEmailAsync()
{
MailAddress from = new MailAddress("somemail@gmail.com", "Tom");
MailAddress to = new MailAddress("somemail@yandex.ru");
MailMessage m = new MailMessage(from, to);
m.Subject = "Тест";
m.Body = "Письмо-тест 2 работы smtp-клиента";
SmtpClient smtp = new SmtpClient("smtp.gmail.com", 587);
smtp.Credentials = new NetworkCredential("somemail@gmail.com", "mypassword");
smtp.EnableSsl = true;
await smtp.SendMailAsync(m);
Console.WriteLine("Письмо отправлено");
}
}
public Form1()
{
InitializeComponent();
}
private void button2_Click(object sender, EventArgs e)
{
string search = textBox2.Text;
int index = listBox1.Items.IndexOf(search);
listBox1.SelectedIndex = index;
}
}
byte[] ByteCrypt = ASCIIEncoding
string strout = UTF8Encoding
byte[] pass = ASCIIEncoding.Unicode.GetBytes(TBpass.Text);
RC4 encoder = new RC4(pass);
string textCrypt = TBtext.Text;
byte[] ByteCrypt = ASCIIEncoding.Unicode.GetBytes(textCrypt);
byte[] result = encoder.Encode(ByteCrypt, ByteCrypt.Length);
string strout = ASCIIEncoding.Unicode.GetString(result, 0, result.Length); // UTF8Encoding поменять на ASCIIEncoding
TBtext.Text = strout;
byte[] key = ASCIIEncoding.ASCII.GetBytes("Key");
RC4 encoder = new RC4(key);
string testString = "Plaintext";
byte[] testBytes = ASCIIEncoding.ASCII.GetBytes(testString);
byte[] result = encoder.Encode(testBytes, testBytes.Length);
RC4 decoder = new RC4(key);
byte[] decryptedBytes = decoder.Decode(result, result.Length);
string decryptedString = ASCIIEncoding.ASCII.GetString(decryptedBytes);
private string my_string = "что-то";
private string my_string = "что-то";
public string My_String { get { return my_string ; } }
private string my_string = "что-то";
public string My_String { get { return my_string ; } set { my_string = value; }}
//получить данные из my_string (get)
var temp = My_String;
//записать/установить/изменить данные в my_string (set)
My_String = "я тебя изменяю"; // в этом случае в будет не my_string = "что-то", а my_string = "я тебя изменяю"
ArrayList
без весомой на то необходимости. Поэтому компилятор не смог вас предупредить, что ArrayList
состоит из ArrayList
'ов, в котором строки (двумерный массив строк), а не просто строк.ArrayList
необходимо использовать типизированный динамический массивList<string>
.public void Click_OpenFile()
{
string fileName = form1.OpenFie();
IList<string[]> aL = ParseFile(fileName);
foreach (var line in aL)
{
// Снова собираем токены в строки
MessageBox.Show(string.Join(" ", line));
}
}
// Читаем файл и построчно парсим его
private IList<string[]> ParseFile(string fileName)
{
if (string.IsNullOrEmpty(fileName))
{
throw new ArgumentNullException(nameof(fileName));
}
if (!File.Exists(fileName))
{
throw new ArgumentException($"There is no file {fileName}!");
}
string[] fileContent = File.ReadAllLines(result);
var aL = new List<string[]>(fileContent.Length);
foreach (var line in fileContent)
{
aL.Add(ParseString(line));
}
return aL;
}
// Разбиваем строки на токены
private string[] ParseString(string s)
{
const char delimiter = '|';
return s.Split(delimiter);
}
StartCoroutine(SlowScale());
IEnumerator SlowScale()
{
for (float q = 1f; q < 2f; q += .1f;)
{
transform.localScale = new Vector3(q, q, q);
yield return new WaitForSeconds(.05f)
}
}
Lightmap is a way of generating textures that simulate lighting of your game environment. Lightmaps are baked during compiling (when you build lights) and are overlaid on top of geometry (bsp and custom static meshes) to simulate lighting and shadows.