Add files via upload

IOException: файл открыт другой программой.
This commit is contained in:
Андрей 2020-01-18 19:16:12 +03:00 committed by GitHub
parent 9cfcca7cbb
commit 14d45c3b69
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 153 additions and 92 deletions

View file

@ -45,15 +45,6 @@
this.tabControl1 = new System.Windows.Forms.TabControl(); this.tabControl1 = new System.Windows.Forms.TabControl();
this.tabPage1 = new System.Windows.Forms.TabPage(); this.tabPage1 = new System.Windows.Forms.TabPage();
this.dataGridView1 = new System.Windows.Forms.DataGridView(); this.dataGridView1 = new System.Windows.Forms.DataGridView();
this.tabPage2 = new System.Windows.Forms.TabPage();
this.tabPage3 = new System.Windows.Forms.TabPage();
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
this.button1 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.button3 = new System.Windows.Forms.Button();
this.button4 = new System.Windows.Forms.Button();
this.button5 = new System.Windows.Forms.Button();
this.button6 = new System.Windows.Forms.Button();
this.toCompare = new System.Windows.Forms.DataGridViewCheckBoxColumn(); this.toCompare = new System.Windows.Forms.DataGridViewCheckBoxColumn();
this.Column1 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.Column1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Column2 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.Column2 = new System.Windows.Forms.DataGridViewTextBoxColumn();
@ -63,6 +54,15 @@
this.Column6 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.Column6 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Column7 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.Column7 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Column8 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.Column8 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.tabPage2 = new System.Windows.Forms.TabPage();
this.tabPage3 = new System.Windows.Forms.TabPage();
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
this.button1 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.button3 = new System.Windows.Forms.Button();
this.button4 = new System.Windows.Forms.Button();
this.button5 = new System.Windows.Forms.Button();
this.button6 = new System.Windows.Forms.Button();
this.menuStrip1.SuspendLayout(); this.menuStrip1.SuspendLayout();
this.tabControl1.SuspendLayout(); this.tabControl1.SuspendLayout();
this.tabPage1.SuspendLayout(); this.tabPage1.SuspendLayout();
@ -95,13 +95,13 @@
// обновитьToolStripMenuItem // обновитьToolStripMenuItem
// //
this.обновитьToolStripMenuItem.Name = "обновитьToolStripMenuItem"; this.обновитьToolStripMenuItem.Name = "обновитьToolStripMenuItem";
this.обновитьToolStripMenuItem.Size = new System.Drawing.Size(180, 22); this.обновитьToolStripMenuItem.Size = new System.Drawing.Size(128, 22);
this.обновитьToolStripMenuItem.Text = "Обновить"; this.обновитьToolStripMenuItem.Text = "Обновить";
// //
// выходToolStripMenuItem // выходToolStripMenuItem
// //
this.выходToolStripMenuItem.Name = "выходToolStripMenuItem"; this.выходToolStripMenuItem.Name = "выходToolStripMenuItem";
this.выходToolStripMenuItem.Size = new System.Drawing.Size(180, 22); this.выходToolStripMenuItem.Size = new System.Drawing.Size(128, 22);
this.выходToolStripMenuItem.Text = "Выход"; this.выходToolStripMenuItem.Text = "Выход";
this.выходToolStripMenuItem.Click += new System.EventHandler(this.CloseProgram); this.выходToolStripMenuItem.Click += new System.EventHandler(this.CloseProgram);
// //
@ -121,7 +121,7 @@
this.нижегородскаяОбластьToolStripMenuItem, this.нижегородскаяОбластьToolStripMenuItem,
this.ульяновскаяОбластьToolStripMenuItem}); this.ульяновскаяОбластьToolStripMenuItem});
this.регионToolStripMenuItem.Name = "регионToolStripMenuItem"; this.регионToolStripMenuItem.Name = "регионToolStripMenuItem";
this.регионToolStripMenuItem.Size = new System.Drawing.Size(180, 22); this.регионToolStripMenuItem.Size = new System.Drawing.Size(113, 22);
this.регионToolStripMenuItem.Text = "Регион"; this.регионToolStripMenuItem.Text = "Регион";
// //
// московскаяОбластьToolStripMenuItem // московскаяОбластьToolStripMenuItem
@ -160,14 +160,14 @@
// оНасToolStripMenuItem // оНасToolStripMenuItem
// //
this.оНасToolStripMenuItem.Name = "оНасToolStripMenuItem"; this.оНасToolStripMenuItem.Name = "оНасToolStripMenuItem";
this.оНасToolStripMenuItem.Size = new System.Drawing.Size(180, 22); this.оНасToolStripMenuItem.Size = new System.Drawing.Size(149, 22);
this.оНасToolStripMenuItem.Text = "О нас"; this.оНасToolStripMenuItem.Text = "О нас";
this.оНасToolStripMenuItem.Click += new System.EventHandler(this.оНасToolStripMenuItem_Click); this.оНасToolStripMenuItem.Click += new System.EventHandler(this.оНасToolStripMenuItem_Click);
// //
// оПрограммеToolStripMenuItem // оПрограммеToolStripMenuItem
// //
this.оПрограммеToolStripMenuItem.Name = "оПрограммеToolStripMenuItem"; this.оПрограммеToolStripMenuItem.Name = "оПрограммеToolStripMenuItem";
this.оПрограммеToolStripMenuItem.Size = new System.Drawing.Size(180, 22); this.оПрограммеToolStripMenuItem.Size = new System.Drawing.Size(149, 22);
this.оПрограммеToolStripMenuItem.Text = "О программе"; this.оПрограммеToolStripMenuItem.Text = "О программе";
this.оПрограммеToolStripMenuItem.Click += new System.EventHandler(this.оПрограммеToolStripMenuItem_Click); this.оПрограммеToolStripMenuItem.Click += new System.EventHandler(this.оПрограммеToolStripMenuItem_Click);
// //
@ -211,12 +211,61 @@
this.dataGridView1.Size = new System.Drawing.Size(779, 287); this.dataGridView1.Size = new System.Drawing.Size(779, 287);
this.dataGridView1.TabIndex = 0; this.dataGridView1.TabIndex = 0;
// //
// toCompare
//
this.toCompare.HeaderText = "CMP";
this.toCompare.Name = "toCompare";
this.toCompare.Resizable = System.Windows.Forms.DataGridViewTriState.True;
this.toCompare.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
this.toCompare.ToolTipText = "Сравнение";
this.toCompare.Width = 35;
//
// Column1
//
this.Column1.HeaderText = "Оператор";
this.Column1.Name = "Column1";
//
// Column2
//
this.Column2.HeaderText = "Тариф";
this.Column2.Name = "Column2";
//
// Column3
//
this.Column3.HeaderText = "Звонки (мин)";
this.Column3.Name = "Column3";
//
// Column4
//
this.Column4.HeaderText = "SMS";
this.Column4.Name = "Column4";
//
// Column5
//
this.Column5.HeaderText = "MMS";
this.Column5.Name = "Column5";
//
// Column6
//
this.Column6.HeaderText = "Интернет (МБ/ГБ)";
this.Column6.Name = "Column6";
//
// Column7
//
this.Column7.HeaderText = "Абон. плата";
this.Column7.Name = "Column7";
//
// Column8
//
this.Column8.HeaderText = "Правила";
this.Column8.Name = "Column8";
//
// tabPage2 // tabPage2
// //
this.tabPage2.Location = new System.Drawing.Point(4, 22); this.tabPage2.Location = new System.Drawing.Point(4, 22);
this.tabPage2.Name = "tabPage2"; this.tabPage2.Name = "tabPage2";
this.tabPage2.Padding = new System.Windows.Forms.Padding(3); this.tabPage2.Padding = new System.Windows.Forms.Padding(3);
this.tabPage2.Size = new System.Drawing.Size(730, 287); this.tabPage2.Size = new System.Drawing.Size(775, 287);
this.tabPage2.TabIndex = 1; this.tabPage2.TabIndex = 1;
this.tabPage2.Text = "Сравнение"; this.tabPage2.Text = "Сравнение";
this.tabPage2.UseVisualStyleBackColor = true; this.tabPage2.UseVisualStyleBackColor = true;
@ -226,7 +275,7 @@
this.tabPage3.Controls.Add(this.tableLayoutPanel1); this.tabPage3.Controls.Add(this.tableLayoutPanel1);
this.tabPage3.Location = new System.Drawing.Point(4, 22); this.tabPage3.Location = new System.Drawing.Point(4, 22);
this.tabPage3.Name = "tabPage3"; this.tabPage3.Name = "tabPage3";
this.tabPage3.Size = new System.Drawing.Size(730, 287); this.tabPage3.Size = new System.Drawing.Size(775, 287);
this.tabPage3.TabIndex = 2; this.tabPage3.TabIndex = 2;
this.tabPage3.Text = "Панель сайтов"; this.tabPage3.Text = "Панель сайтов";
this.tabPage3.UseVisualStyleBackColor = true; this.tabPage3.UseVisualStyleBackColor = true;
@ -305,55 +354,6 @@
this.button6.Text = "GitHub - Страница проекта"; this.button6.Text = "GitHub - Страница проекта";
this.button6.UseVisualStyleBackColor = true; this.button6.UseVisualStyleBackColor = true;
// //
// toCompare
//
this.toCompare.HeaderText = "CMP";
this.toCompare.Name = "toCompare";
this.toCompare.Resizable = System.Windows.Forms.DataGridViewTriState.True;
this.toCompare.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
this.toCompare.ToolTipText = "Сравнение";
this.toCompare.Width = 35;
//
// Column1
//
this.Column1.HeaderText = "Оператор";
this.Column1.Name = "Column1";
//
// Column2
//
this.Column2.HeaderText = "Тариф";
this.Column2.Name = "Column2";
//
// Column3
//
this.Column3.HeaderText = "Звонки (мин)";
this.Column3.Name = "Column3";
//
// Column4
//
this.Column4.HeaderText = "SMS";
this.Column4.Name = "Column4";
//
// Column5
//
this.Column5.HeaderText = "MMS";
this.Column5.Name = "Column5";
//
// Column6
//
this.Column6.HeaderText = "Интернет (МБ/ГБ)";
this.Column6.Name = "Column6";
//
// Column7
//
this.Column7.HeaderText = "Абон. плата";
this.Column7.Name = "Column7";
//
// Column8
//
this.Column8.HeaderText = "Правила";
this.Column8.Name = "Column8";
//
// Form1 // Form1
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@ -365,6 +365,7 @@
this.MainMenuStrip = this.menuStrip1; this.MainMenuStrip = this.menuStrip1;
this.Name = "Form1"; this.Name = "Form1";
this.Text = "Tariffs"; this.Text = "Tariffs";
this.Load += new System.EventHandler(this.Form1_Load);
this.menuStrip1.ResumeLayout(false); this.menuStrip1.ResumeLayout(false);
this.menuStrip1.PerformLayout(); this.menuStrip1.PerformLayout();
this.tabControl1.ResumeLayout(false); this.tabControl1.ResumeLayout(false);

View file

@ -1,4 +1,6 @@
using System; using System;
using System.IO;
using System.Net;
using System.Windows.Forms; using System.Windows.Forms;
namespace Tariffs namespace Tariffs
@ -28,5 +30,80 @@ namespace Tariffs
ProgramHelp f2 = new ProgramHelp(); ProgramHelp f2 = new ProgramHelp();
f2.Show(); f2.Show();
} }
private void Form1_Load(object sender, EventArgs e)
{
WebClient client = new WebClient();
String remoteFile = "https://tariffslist.000webhostapp.com/list.txt";
if (!File.Exists("list.txt"))
{
_ = File.Create("list.txt");
}
try
{
client.DownloadFile(remoteFile, "list.txt");
}
catch (WebException)
{
String clickedButton = MessageBox.Show("Не удалось получить сведения о тарифах с сервера.\n" +
"Поиск кэшированного файла...",
"Ошибка", MessageBoxButtons.AbortRetryIgnore,
MessageBoxIcon.Error).ToString();
if (clickedButton == "Abort")
{
Close();
}
if (clickedButton == "Retry")
{
try
{
client.DownloadFile(remoteFile, "list.txt");
}
catch (WebException)
{
_ = MessageBox.Show("Возможно, у Вас нет подключения к Интернету,\n" +
"или адрес к веб-серверу был неверно указан разработчиком.\n" +
"Приложение будет закрыто.",
"Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
Close();
}
}
if (clickedButton == "Ignore")
{
if (File.Exists("list.txt"))
{
StreamReader s = new StreamReader("list.txt");
String firstcode = s.ReadLine();
if (!(firstcode == "Tariffs"))
{
_ = MessageBox.Show("Неверный тип файла!\n\n" +
"Так как невозможно загрузить тарифы,\n" +
"Приложение будет закрыто.",
"Ошибка",
MessageBoxButtons.OK,
MessageBoxIcon.Warning);
s.Close();
Close();
}
s.Close();
}
else
{
_ = MessageBox.Show("Файл почему-то не найден!\n" +
"Приложение будет закрыто.",
"Ошибка",
MessageBoxButtons.OK,
MessageBoxIcon.Error);
Close();
}
}
}
StreamReader listfile = new StreamReader("list.txt");
listfile.Close();
}
} }
} }

View file

@ -147,33 +147,6 @@
<metadata name="Column8.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <metadata name="Column8.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value> <value>True</value>
</metadata> </metadata>
<metadata name="toCompare.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Column1.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Column2.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Column3.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Column4.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Column5.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Column6.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Column7.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Column8.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>37</value> <value>37</value>
</metadata> </metadata>

Binary file not shown.

Binary file not shown.

View file

@ -8,3 +8,13 @@ C:\Users\user\source\repos\Tariffs\Tariffs\obj\Debug\Tariffs.Properties.Resource
C:\Users\user\source\repos\Tariffs\Tariffs\obj\Debug\Tariffs.csproj.GenerateResource.cache C:\Users\user\source\repos\Tariffs\Tariffs\obj\Debug\Tariffs.csproj.GenerateResource.cache
C:\Users\user\source\repos\Tariffs\Tariffs\obj\Debug\Tariffs.exe C:\Users\user\source\repos\Tariffs\Tariffs\obj\Debug\Tariffs.exe
C:\Users\user\source\repos\Tariffs\Tariffs\obj\Debug\Tariffs.pdb C:\Users\user\source\repos\Tariffs\Tariffs\obj\Debug\Tariffs.pdb
C:\Users\Acer\VisualStudio\source\repos\Tariff\Tariffs\bin\Debug\Tariffs.exe.config
C:\Users\Acer\VisualStudio\source\repos\Tariff\Tariffs\bin\Debug\Tariffs.exe
C:\Users\Acer\VisualStudio\source\repos\Tariff\Tariffs\bin\Debug\Tariffs.pdb
C:\Users\Acer\VisualStudio\source\repos\Tariff\Tariffs\obj\Debug\Tariffs.csprojAssemblyReference.cache
C:\Users\Acer\VisualStudio\source\repos\Tariff\Tariffs\obj\Debug\Tariffs.Form1.resources
C:\Users\Acer\VisualStudio\source\repos\Tariff\Tariffs\obj\Debug\Tariffs.ProgramHelp.resources
C:\Users\Acer\VisualStudio\source\repos\Tariff\Tariffs\obj\Debug\Tariffs.Properties.Resources.resources
C:\Users\Acer\VisualStudio\source\repos\Tariff\Tariffs\obj\Debug\Tariffs.csproj.GenerateResource.cache
C:\Users\Acer\VisualStudio\source\repos\Tariff\Tariffs\obj\Debug\Tariffs.exe
C:\Users\Acer\VisualStudio\source\repos\Tariff\Tariffs\obj\Debug\Tariffs.pdb

Binary file not shown.

Binary file not shown.