Wrong file (txt)

This commit is contained in:
Mikhail Abramov 2018-03-08 20:32:23 +04:00 committed by GitHub
parent c06007be3a
commit 8712b8cee0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
@ -32,7 +32,6 @@ namespace WindowsFormsApplication1
private void Form1_Load(object sender, EventArgs e)
{
/*int i=0;
for (; i < 10; i++)
{
PictureBox pic2 = new PictureBox();
@ -75,9 +74,9 @@ namespace WindowsFormsApplication1
private void button4_Click(object sender, EventArgs e)
{
//Список всех файлов папки
//Создаешь из них массив (или список)
//Выбираешь рандомный номер
//Ñïèñîê âñåõ ôàéëîâ ïàïêè
//Ñîçäàåøü èç íèõ ìàññèâ (èëè ñïèñîê)
//Âûáèðàåøü ðàíäîìíûé íîìåð
//pictureBox1.Image = Image.FromFile("kartinka.jpg");
}
@ -118,7 +117,7 @@ namespace WindowsFormsApplication1
{
string filename = saveFileDialog1.FileName;
//filename.Replace("Вася", "Лох")
//filename.Replace("Âàñÿ ÍÅ", "Ëîõ")
file_beginning(filename);
//file_forser(filename);
sinus(filename);
@ -132,77 +131,76 @@ namespace WindowsFormsApplication1
}
File.Copy("kartinka.jpg", adres_papki + "\\Personaj.bmp", true);
MessageBox.Show("Файл сохранен");
MessageBox.Show("Ôàéë ñîõðàíåí");
}
}
private void sinus(string filename)
{
File.AppendAllText(filename, Environment.NewLine);
File.AppendAllText(filename, Environment.NewLine);
File.AppendAllText(filename, " HDC texture = txLoadImage(\"Pictures\\Personaj.bmp\");" + Environment.NewLine);
File.AppendAllText(filename, " double textureX = 50;" + Environment.NewLine);
File.AppendAllText(filename, " double textureY = 50;" + Environment.NewLine);
File.AppendAllText(filename, " double nomer_kadra = 0;" + Environment.NewLine);
File.AppendAllText(filename, Environment.NewLine);
File.AppendAllText(filename, " while (!GetAsyncKeyState(VK_ESCAPE));" + Environment.NewLine);
File.AppendAllText(filename, " {" + Environment.NewLine);
File.AppendAllText(filename, " txSetColor(TX_RED);" + Environment.NewLine);
File.AppendAllText(filename, " txSetFillColor(TX_RED);" + Environment.NewLine);
File.AppendAllText(filename, " double textureX = 50;" + Environment.NewLine);
File.AppendAllText(filename, " double textureY = 50;" + Environment.NewLine);
File.AppendAllText(filename, " double nomer_kadra = 0;" + Environment.NewLine);
File.AppendAllText(filename, Environment.NewLine);
File.AppendAllText(filename, " while (!GetAsyncKeyState(VK_ESCAPE))" + Environment.NewLine);
File.AppendAllText(filename, " {" + Environment.NewLine);
File.AppendAllText(filename, " txSetColor(TX_RED);" + Environment.NewLine);
File.AppendAllText(filename, " txSetFillColor(TX_RED);" + Environment.NewLine);
File.AppendAllText(filename, " txRectangle(0, 0, txGetExtentX(), txGetExtentY());" + Environment.NewLine);
File.AppendAllText(filename, Environment.NewLine);
File.AppendAllText(filename, " textureX++;" + Environment.NewLine);
File.AppendAllText(filename, " textureY = 300 + 150 * sin(textureX / 10);" + Environment.NewLine);
File.AppendAllText(filename, Environment.NewLine);
File.AppendAllText(filename, " textureX++;" + Environment.NewLine);
File.AppendAllText(filename, " textureY = 300 + 150 * sin(textureX / 10);" + Environment.NewLine);
File.AppendAllText(filename, " txTransparentBlt(txDC(), textureX, textureY, 55, 86, texture, 55 * nomer_kadra, 0, RGB(0, 255, 255));" + Environment.NewLine);
File.AppendAllText(filename, Environment.NewLine);
File.AppendAllText(filename, " nomer_kadra++;" + Environment.NewLine);
File.AppendAllText(filename, " if (nomer_kadra > 2)" + Environment.NewLine);
File.AppendAllText(filename, " {" + Environment.NewLine);
File.AppendAllText(filename, " nomer_kadra = 0;" + Environment.NewLine);
File.AppendAllText(filename, " }" + Environment.NewLine);
File.AppendAllText(filename, " txSleep(10);" + Environment.NewLine);
File.AppendAllText(filename, " }" + Environment.NewLine);
File.AppendAllText(filename, "}" + Environment.NewLine);
File.AppendAllText(filename, Environment.NewLine);
File.AppendAllText(filename, "txDeleteDC(texture);" + Environment.NewLine);
File.AppendAllText(filename, Environment.NewLine);
File.AppendAllText(filename, " nomer_kadra++;" + Environment.NewLine);
File.AppendAllText(filename, " if (nomer_kadra > 2)" + Environment.NewLine);
File.AppendAllText(filename, " {" + Environment.NewLine);
File.AppendAllText(filename, " nomer_kadra = 0;" + Environment.NewLine);
File.AppendAllText(filename, " }" + Environment.NewLine);
File.AppendAllText(filename, " txSleep(10);" + Environment.NewLine);
File.AppendAllText(filename, " }" + Environment.NewLine);
File.AppendAllText(filename, "}" + Environment.NewLine);
File.AppendAllText(filename, Environment.NewLine);
File.AppendAllText(filename, "txDeleteDC(texture);" + Environment.NewLine);
}
private void circle(string filename)
{
File.AppendAllText(filename, Environment.NewLine);
File.AppendAllText(filename, "txCreateWindow(800, 600)"+ Environment.NewLine);
File.AppendAllText(filename, "HDC texture = txLoadImage(\"Pictures\\Personaj.bmp);" + Environment.NewLine);
File.AppendAllText(filename, "double textureX = 50"+ Environment.NewLine);
File.AppendAllText(filename, "double textureY = 50"+ Environment.NewLine);
File.AppendAllText(filename, "double angle = 0"+ Environment.NewLine);
File.AppendAllText(filename, "double nomer_kadra = 0"+ Environment.NewLine);
File.AppendAllText(filename, "while (!GetAsyncKeyState(VK_ESCAPE))"+ Environment.NewLine);
File.AppendAllText(filename, "{"+ Environment.NewLine);
File.AppendAllText(filename, "txSetColor(TX_RED)"+ Environment.NewLine);
File.AppendAllText(filename, "txSetFillColor(TX_RED)"+ Environment.NewLine);
File.AppendAllText(filename, "txRectangle(0, 0, txGetExtentX(), txGetExtentY())"+ Environment.NewLine);
File.AppendAllText(filename, "angle++"+ Environment.NewLine);
File.AppendAllText(filename, "textureX = 500 + 200 * cos (angle / 10)"+ Environment.NewLine);
File.AppendAllText(filename, "textureY = 300 + 200 * sin (angle / 10)"+ Environment.NewLine);
File.AppendAllText(filename, "txTransparentBlt(txDC(), textureX, textureY, 55, 86, texture, 55 * nomer_kadra, 0, RGB(0, 255, 255))"+ Environment.NewLine);
File.AppendAllText(filename, "nomer_kadra++"+ Environment.NewLine);
File.AppendAllText(filename, "if (nomer_kadra > 2)"+ Environment.NewLine);
File.AppendAllText(filename, "{"+ Environment.NewLine);
File.AppendAllText(filename, "nomer_kadra = 0"+ Environment.NewLine);
File.AppendAllText(filename, "}"+ Environment.NewLine);
File.AppendAllText(filename, "txSleep(10)"+ Environment.NewLine);
File.AppendAllText(filename, "}"+ Environment.NewLine);
File.AppendAllText(filename, "txDeleteDC(texture)"+ Environment.NewLine);
File.AppendAllText(filename, "return 0"+ Environment.NewLine);
File.AppendAllText(filename, "}"+ Environment.NewLine);
File.AppendAllText(filename, Environment.NewLine);
File.AppendAllText(filename, "txCreateWindow(800, 600);"+ Environment.NewLine);
File.AppendAllText(filename, Environment.NewLine);
File.AppendAllText(filename, " HDC texture = txLoadImage(\"Pictures\\Personaj.bmp);" + Environment.NewLine);
File.AppendAllText(filename, Environment.NewLine);
File.AppendAllText(filename, " double textureX = 50;"+ Environment.NewLine);
File.AppendAllText(filename, " double textureY = 50;"+ Environment.NewLine);
File.AppendAllText(filename, " double angle = 0;"+ Environment.NewLine);
File.AppendAllText(filename, " double nomer_kadra = 0;"+ Environment.NewLine);
File.AppendAllText(filename, Environment.NewLine);
File.AppendAllText(filename, " while (!GetAsyncKeyState(VK_ESCAPE))"+ Environment.NewLine);
File.AppendAllText(filename, " {"+ Environment.NewLine);
File.AppendAllText(filename, " txSetColor(TX_RED);"+ Environment.NewLine);
File.AppendAllText(filename, " txSetFillColor(TX_RED);"+ Environment.NewLine);
File.AppendAllText(filename, " txRectangle(0, 0, txGetExtentX(), txGetExtentY());"+ Environment.NewLine);
File.AppendAllText(filename, Environment.NewLine);
File.AppendAllText(filename, " angle++;"+ Environment.NewLine);
File.AppendAllText(filename, " textureX = 500 + 200 * cos (angle / 10);"+ Environment.NewLine);
File.AppendAllText(filename, " textureY = 300 + 200 * sin (angle / 10);"+ Environment.NewLine);
File.AppendAllText(filename, " txTransparentBlt(txDC(), textureX, textureY, 55, 86, texture, 55 * nomer_kadra, 0, RGB(0, 255, 255));"+ Environment.NewLine);
File.AppendAllText(filename, Environment.NewLine);
File.AppendAllText(filename, " nomer_kadra++;"+ Environment.NewLine);
File.AppendAllText(filename, Environment.NewLine);
File.AppendAllText(filename, " if (nomer_kadra > 2)"+ Environment.NewLine);
File.AppendAllText(filename, " {"+ Environment.NewLine);
File.AppendAllText(filename, " nomer_kadra = 0;"+ Environment.NewLine);
File.AppendAllText(filename, " }"+ Environment.NewLine);
File.AppendAllText(filename, Environment.NewLine);
File.AppendAllText(filename, " txSleep(10);"+ Environment.NewLine);
File.AppendAllText(filename, " }"+ Environment.NewLine);
File.AppendAllText(filename, Environment.NewLine);
File.AppendAllText(filename, "txDeleteDC(texture);"+ Environment.NewLine);
File.AppendAllText(filename, Environment.NewLine);
File.AppendAllText(filename, "return 0;"+ Environment.NewLine);
File.AppendAllText(filename, "}"+ Environment.NewLine);
}
@ -213,7 +211,7 @@ namespace WindowsFormsApplication1
string filename = openFileDialog1.FileName;
string fileText =File.ReadAllText(filename);
nazvanieTextBox.Text = fileText;
MessageBox.Show("Файл открыт");
MessageBox.Show("Ôàéë îòêðûò");
}
private void textBox6_TextChanged(object sender, EventArgs e)
@ -243,7 +241,7 @@ namespace WindowsFormsApplication1
string filename = openFileDialog1.FileName;
string fileText =File.ReadAllText(filename);
nazvanieTextBox.Text = fileText;
//MessageBox.Show("Файл открыт");
//MessageBox.Show("Ôàéë îòêðûò");
PictureBoxBackground.Image = Image.FromFile("kartinka.jpg");
}