Форум программистов, компьютерный форум, киберфорум
C# для начинающих
Войти
Регистрация
Восстановить пароль
Карта форума Темы раздела Блоги Сообщество Поиск Заказать работу  
 
Рейтинг 5.00/3: Рейтинг темы: голосов - 3, средняя оценка - 5.00
0 / 0 / 0
Регистрация: 09.06.2018
Сообщений: 8
1

Ошибка при перезагрузке консоли

25.06.2018, 21:43. Показов 573. Ответов 9
Метки нет (Все метки)

Author24 — интернет-сервис помощи студентам
Здравствуйте, у меня возникла проблема при использовании
C#
1
2
Process.Start(Assembly.GetExecutingAssembly().Location);
                Environment.Exit(0);
Возникает ошибка:необратимая ошибка system.io.filenotfoundexception.
Что делать, может есть другой способ перезагрузить консоль?
0
Programming
Эксперт
94731 / 64177 / 26122
Регистрация: 12.04.2006
Сообщений: 116,782
25.06.2018, 21:43
Ответы с готовыми решениями:

Ошибка при запуске с консоли
Запускаю с консоли. Нужно чтоб заработал оператор if при вводе без дополнительных...

Ошибка при преобразование типа строки из консоли в double
Есть переменная типа double, ввожу её значение с консоли, сразу же выбивает ошибку. Как правильно...

Ошибка при перезагрузке
День добрый.У меня на ноутбуке ASUS K50IJ при перезагрузке пишет:A disk read error occurred.Press...

Ошибка при выключении/перезагрузке
Сказали что скорее всего это из-за жесткого диска (стоит 2 (80гб и 500гб), но и когда стоял только...

9
TheGreatCornholio
1254 / 732 / 285
Регистрация: 30.07.2015
Сообщений: 2,408
25.06.2018, 21:48 2
Зачем?
0
0 / 0 / 0
Регистрация: 09.06.2018
Сообщений: 8
25.06.2018, 21:56  [ТС] 3
Цитата Сообщение от Woldemar89 Посмотреть сообщение
Зачем?
В смысле зачем?
0
TheGreatCornholio
1254 / 732 / 285
Регистрация: 30.07.2015
Сообщений: 2,408
25.06.2018, 21:57 4
Цитата Сообщение от DogiPlus Посмотреть сообщение
Что делать, может есть другой способ перезагрузить консоль?
Цитата Сообщение от DogiPlus Посмотреть сообщение
В смысле зачем?
****я?
Зачем перезагружать консоль? Если вы имели ввиду консольное приложение конечно и его перезагрузку.
0
629 / 41 / 25
Регистрация: 25.04.2017
Сообщений: 510
25.06.2018, 21:58 5
DogiPlus, а что делает ваше приложение?
0
0 / 0 / 0
Регистрация: 09.06.2018
Сообщений: 8
25.06.2018, 22:05  [ТС] 6
Вот исходный код.
C#
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
using System;
using System.IO;
using System.Reflection;
using System.Diagnostics;
 
namespace UnKODER
{
    class Program
    {
        static void Main(string[] args)
        {
            Directory.CreateDirectory("D:\\DogiGame\\UnKoder");
 
            int Color = 1;
            int Menu;
            int Sett;
 
 
            if (File.Exists("D:\\DogiGame\\UnKoder\\Red.txt"))
            {
                Color = 1;
            }
            if (File.Exists("D:\\DogiGame\\UnKoder\\Blue.txt"))
            {
                Color = 2;
            }
            if (File.Exists("D:\\DogiGame\\UnKoder\\Black.txt"))
            {
                Color = 3;
            }
            if (File.Exists("D:\\DogiGame\\UnKoder\\Yellow.txt"))
            {
                Color = 4;
            }
            if (File.Exists("D:\\DogiGame\\UnKoder\\White.txt"))
            {
                Color = 5;
            }
            if (File.Exists("D:\\DogiGame\\UnKoder\\Gren.txt"))
            {
                Color = 6;
            }
            if (File.Exists("D:\\DogiGame\\UnKoder\\Green.txt"))
            {
                Color = 7;
            }
 
            if (Color == 1)
            {
                //intro
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine("");
                Console.WriteLine(" ________         ______          _______        ____ ");
                System.Threading.Thread.Sleep(100);
                Console.WriteLine("|  ____  x      x   __   x      x   ____  x     |    |");
                System.Threading.Thread.Sleep(100);
                Console.WriteLine("| |     x x    |  x    x  |    |  x     x_|     |____|");
                System.Threading.Thread.Sleep(100);
                Console.WriteLine("| |     | |    | |      | |    |  |              ____ ");
                System.Threading.Thread.Sleep(100);
                Console.WriteLine("| |     | |    | |      | |    |  |    ____     |    |");
                System.Threading.Thread.Sleep(100);
                Console.WriteLine("| |     | |    | |      | |    |  |   |_   |    |    |");
                System.Threading.Thread.Sleep(100);
                Console.WriteLine("| |     | |    | |      | |    |  |     |  |    |    |");
                System.Threading.Thread.Sleep(100);
                Console.WriteLine("| |_____x x    |  x __ x  |    |   x __ x x     |    |");
                System.Threading.Thread.Sleep(100);
                Console.WriteLine("|________x      x ______ x      x ______ x      |____|");
                System.Threading.Thread.Sleep(100);
                Console.WriteLine("");
                Console.ResetColor();
            }
            if (Color == 2)
            {
                //intro
                Console.ForegroundColor = ConsoleColor.Blue;
                Console.WriteLine("");
                Console.WriteLine(" ________         ______          _______        ____ ");
                System.Threading.Thread.Sleep(100);
                Console.WriteLine("|  ____  x      x   __   x      x   ____  x     |    |");
                System.Threading.Thread.Sleep(100);
                Console.WriteLine("| |     x x    |  x    x  |    |  x     x_|     |____|");
                System.Threading.Thread.Sleep(100);
                Console.WriteLine("| |     | |    | |      | |    |  |              ____ ");
                System.Threading.Thread.Sleep(100);
                Console.WriteLine("| |     | |    | |      | |    |  |    ____     |    |");
                System.Threading.Thread.Sleep(100);
                Console.WriteLine("| |     | |    | |      | |    |  |   |_   |    |    |");
                System.Threading.Thread.Sleep(100);
                Console.WriteLine("| |     | |    | |      | |    |  |     |  |    |    |");
                System.Threading.Thread.Sleep(100);
                Console.WriteLine("| |_____x x    |  x __ x  |    |   x __ x x     |    |");
                System.Threading.Thread.Sleep(100);
                Console.WriteLine("|________x      x ______ x      x ______ x      |____|");
                System.Threading.Thread.Sleep(100);
                Console.WriteLine("");
                Console.ResetColor();
            }
            if (Color == 3)
            {
                //intro
                Console.ForegroundColor = ConsoleColor.Black;
                Console.WriteLine("");
                Console.WriteLine(" ________         ______          _______        ____ ");
                System.Threading.Thread.Sleep(100);
                Console.WriteLine("|  ____  x      x   __   x      x   ____  x     |    |");
                System.Threading.Thread.Sleep(100);
                Console.WriteLine("| |     x x    |  x    x  |    |  x     x_|     |____|");
                System.Threading.Thread.Sleep(100);
                Console.WriteLine("| |     | |    | |      | |    |  |              ____ ");
                System.Threading.Thread.Sleep(100);
                Console.WriteLine("| |     | |    | |      | |    |  |    ____     |    |");
                System.Threading.Thread.Sleep(100);
                Console.WriteLine("| |     | |    | |      | |    |  |   |_   |    |    |");
                System.Threading.Thread.Sleep(100);
                Console.WriteLine("| |     | |    | |      | |    |  |     |  |    |    |");
                System.Threading.Thread.Sleep(100);
                Console.WriteLine("| |_____x x    |  x __ x  |    |   x __ x x     |    |");
                System.Threading.Thread.Sleep(100);
                Console.WriteLine("|________x      x ______ x      x ______ x      |____|");
                System.Threading.Thread.Sleep(100);
                Console.WriteLine("");
                Console.ResetColor();
            }
            if (Color == 4)
            {
                //intro
                Console.ForegroundColor = ConsoleColor.Yellow;
                Console.WriteLine("");
                Console.WriteLine(" ________         ______          _______        ____ ");
                System.Threading.Thread.Sleep(100);
                Console.WriteLine("|  ____  x      x   __   x      x   ____  x     |    |");
                System.Threading.Thread.Sleep(100);
                Console.WriteLine("| |     x x    |  x    x  |    |  x     x_|     |____|");
                System.Threading.Thread.Sleep(100);
                Console.WriteLine("| |     | |    | |      | |    |  |              ____ ");
                System.Threading.Thread.Sleep(100);
                Console.WriteLine("| |     | |    | |      | |    |  |    ____     |    |");
                System.Threading.Thread.Sleep(100);
                Console.WriteLine("| |     | |    | |      | |    |  |   |_   |    |    |");
                System.Threading.Thread.Sleep(100);
                Console.WriteLine("| |     | |    | |      | |    |  |     |  |    |    |");
                System.Threading.Thread.Sleep(100);
                Console.WriteLine("| |_____x x    |  x __ x  |    |   x __ x x     |    |");
                System.Threading.Thread.Sleep(100);
                Console.WriteLine("|________x      x ______ x      x ______ x      |____|");
                System.Threading.Thread.Sleep(100);
                Console.WriteLine("");
                Console.ResetColor();
            }
            if (Color == 5)
            {
                //intro
                Console.ForegroundColor = ConsoleColor.White;
                Console.WriteLine("");
                Console.WriteLine(" ________         ______          _______        ____ ");
                System.Threading.Thread.Sleep(100);
                Console.WriteLine("|  ____  x      x   __   x      x   ____  x     |    |");
                System.Threading.Thread.Sleep(100);
                Console.WriteLine("| |     x x    |  x    x  |    |  x     x_|     |____|");
                System.Threading.Thread.Sleep(100);
                Console.WriteLine("| |     | |    | |      | |    |  |              ____ ");
                System.Threading.Thread.Sleep(100);
                Console.WriteLine("| |     | |    | |      | |    |  |    ____     |    |");
                System.Threading.Thread.Sleep(100);
                Console.WriteLine("| |     | |    | |      | |    |  |   |_   |    |    |");
                System.Threading.Thread.Sleep(100);
                Console.WriteLine("| |     | |    | |      | |    |  |     |  |    |    |");
                System.Threading.Thread.Sleep(100);
                Console.WriteLine("| |_____x x    |  x __ x  |    |   x __ x x     |    |");
                System.Threading.Thread.Sleep(100);
                Console.WriteLine("|________x      x ______ x      x ______ x      |____|");
                System.Threading.Thread.Sleep(100);
                Console.WriteLine("");
                Console.ResetColor();
            }
            if (Color == 6)
            {
                //intro
                Console.ForegroundColor = ConsoleColor.Gray;
                Console.WriteLine("");
                Console.WriteLine(" ________         ______          _______        ____ ");
                System.Threading.Thread.Sleep(100);
                Console.WriteLine("|  ____  x      x   __   x      x   ____  x     |    |");
                System.Threading.Thread.Sleep(100);
                Console.WriteLine("| |     x x    |  x    x  |    |  x     x_|     |____|");
                System.Threading.Thread.Sleep(100);
                Console.WriteLine("| |     | |    | |      | |    |  |              ____ ");
                System.Threading.Thread.Sleep(100);
                Console.WriteLine("| |     | |    | |      | |    |  |    ____     |    |");
                System.Threading.Thread.Sleep(100);
                Console.WriteLine("| |     | |    | |      | |    |  |   |_   |    |    |");
                System.Threading.Thread.Sleep(100);
                Console.WriteLine("| |     | |    | |      | |    |  |     |  |    |    |");
                System.Threading.Thread.Sleep(100);
                Console.WriteLine("| |_____x x    |  x __ x  |    |   x __ x x     |    |");
                System.Threading.Thread.Sleep(100);
                Console.WriteLine("|________x      x ______ x      x ______ x      |____|");
                System.Threading.Thread.Sleep(100);
                Console.WriteLine("");
                Console.ResetColor();
            }
            if (Color == 7)
            {
                //intro
                Console.ForegroundColor = ConsoleColor.Green;
                Console.WriteLine("");
                Console.WriteLine(" ________         ______          _______        ____ ");
                System.Threading.Thread.Sleep(100);
                Console.WriteLine("|  ____  x      x   __   x      x   ____  x     |    |");
                System.Threading.Thread.Sleep(100);
                Console.WriteLine("| |     x x    |  x    x  |    |  x     x_|     |____|");
                System.Threading.Thread.Sleep(100);
                Console.WriteLine("| |     | |    | |      | |    |  |              ____ ");
                System.Threading.Thread.Sleep(100);
                Console.WriteLine("| |     | |    | |      | |    |  |    ____     |    |");
                System.Threading.Thread.Sleep(100);
                Console.WriteLine("| |     | |    | |      | |    |  |   |_   |    |    |");
                System.Threading.Thread.Sleep(100);
                Console.WriteLine("| |     | |    | |      | |    |  |     |  |    |    |");
                System.Threading.Thread.Sleep(100);
                Console.WriteLine("| |_____x x    |  x __ x  |    |   x __ x x     |    |");
                System.Threading.Thread.Sleep(100);
                Console.WriteLine("|________x      x ______ x      x ______ x      |____|");
                System.Threading.Thread.Sleep(100);
                Console.WriteLine("");
                Console.ResetColor();
            }
            // intro
            Console.WriteLine("Hello man!");
            Console.WriteLine("");
            Console.WriteLine("This is program name 'UnKODER'.");
            Console.WriteLine("Press any key and go to program...");
            Console.ReadKey();
            Console.Clear();
            Process.Start(Assembly.GetExecutingAssembly().Location);
            Environment.Exit(0);
 
            Console.WriteLine("");
            Console.WriteLine("MENU");
            Console.WriteLine("");
            Console.WriteLine("Press '1' go to settings");
            Console.WriteLine("");
            Console.WriteLine("Press '2' go to UnKODER");
            Console.WriteLine("");
            Menu = Convert.ToInt32(Console.ReadLine());
 
            if (Menu == 1)
            {
                Console.WriteLine("");
                Console.WriteLine("SETTINGS");
                Console.WriteLine("");
                Console.WriteLine("Press '1' set collor intro");
                Console.WriteLine("");
                Console.WriteLine("Press '2' set language program");
                Console.WriteLine("");
                Console.WriteLine("Press '3' set koder");
                Console.WriteLine("");
                Sett = Convert.ToInt32(Console.ReadLine());
                if (Sett == 1)
                {
                    Console.WriteLine("");
                    Console.WriteLine("COLER SETTINGS");
                    Console.WriteLine("");
                    Console.WriteLine("Press [1] to set color red");
                    Console.WriteLine("");
                    Console.WriteLine("Press [2] to set color blue");
                    Console.WriteLine("");
                    Console.WriteLine("Press [3] to set color black");
                    Console.WriteLine("");
                    Console.WriteLine("Press [4] to set color yellow");
                    Console.WriteLine("");
                    Console.WriteLine("Press [5] to set color white");
                    Console.WriteLine("");
                    Console.WriteLine("Press [6] to set color gray");
                    Console.WriteLine("");
                    Console.WriteLine("Press [7] to set color green");
                    Console.WriteLine("");
                    Console.WriteLine("Press [8] to reset color");
                    Color = Convert.ToInt32(Console.ReadLine());
                    // Запись файла со значением цвета.
                    if (Color == 1)
                    {
                        System.IO.File.Create("D:\\DogiGameSTuDIO\\UnKoder\\Red.txt");
                    }
                    else if (Color == 2)
                    {
                        System.IO.File.Delete("D:\\DogiGame\\UnKoder\\Red.txt");
                        System.IO.File.Create("D:\\DogiGame\\UnKoder\\Blue.txt");
                        Process.Start(Assembly.GetExecutingAssembly().Location);
                        Environment.Exit(0);
                    }
                    else if (Color == 3)
                    {
                        System.IO.File.Delete("D:\\DogiGame\\UnKoder\\Red.txt");
                        System.IO.File.Create("D:\\DogiGame\\UnKoder\\Black.txt");
 
                    }
                    else if (Color == 4)
                    {
                        System.IO.File.Delete("D:\\DogiGame\\UnKoder\\Red.txt");
                        System.IO.File.Create("D:\\DogiGame\\UnKoder\\Yellow.txt");
                    }
                    else if (Color == 5)
                    {
                        System.IO.File.Delete("D:\\DogiGame\\UnKoder\\Red.txt");
                        System.IO.File.Create("D:\\DogiGame\\UnKoder\\White.txt");
                    }
                    else if (Color == 6)
                    {
                        System.IO.File.Delete("D:\\DogiGame\\UnKoder\\Red.txt");
                        System.IO.File.Create("D:\\DogiGame\\UnKoder\\Gray.txt");
                    }
                    else if (Color == 7)
                    {
                        System.IO.File.Delete("D:\\DogiGame\\UnKoder\\Red.txt");
                        System.IO.File.Create("D:\\DogiGame\\UnKoder\\Green.txt");
                    }
                    else if (Color == 8 )
                    {
                        System.IO.DirectoryInfo di = new DirectoryInfo("D:\\DogiGame\\UnKoder");
 
                        foreach (FileInfo file in di.GetFiles())
                        {
                            file.Delete();
                        }
                    }
 
                    Process.Start(Assembly.GetExecutingAssembly().Location);
                    Environment.Exit(0);
                }
            }
            else if (Menu == 2)
            {
 
            }
            else
            {
                Console.WriteLine("ERROR #0001 - неверное значение Menu");
            }
        }
    }
}
Нужна перезагрузка после выбора цвета надписи в начале "Dogi".
0
629 / 41 / 25
Регистрация: 25.04.2017
Сообщений: 510
25.06.2018, 22:14 7
DogiPlus, я не знаю, что такое "перезагрузить консоль", но возможно вам нужно очистить ее экран, тогда
C#
1
Console.Clear();
0
TheGreatCornholio
1254 / 732 / 285
Регистрация: 30.07.2015
Сообщений: 2,408
25.06.2018, 22:15 8
Цитата Сообщение от worldandlife Посмотреть сообщение
я не знаю, что такое "перезагрузить консоль"
По коду в первом посте вполне понятно, что нужно.
0
0 / 0 / 0
Регистрация: 09.06.2018
Сообщений: 8
25.06.2018, 22:16  [ТС] 9
"Перезагрузить консоль" я подразумеваю закрыть закрыть открытую консоль и открыть новую.
0
629 / 41 / 25
Регистрация: 25.04.2017
Сообщений: 510
25.06.2018, 22:27 10
Цитата Сообщение от DogiPlus Посмотреть сообщение
system.io.filenotfoundexception.
Это исключение, которое выдается при попытке получить доступ к файлу или каталогу, которых нет на диске.
0
25.06.2018, 22:27
IT_Exp
Эксперт
87844 / 49110 / 22898
Регистрация: 17.06.2006
Сообщений: 92,604
25.06.2018, 22:27
Помогаю со студенческими работами здесь

Ошибка при перезагрузке при установке Windows XP
Здравствуйте, второй день бьюсь с установкой win xp. Вот мои последние действия: с диска...

При перезагрузке операционки вылетает ошибка
Сигнатура проблемы: Имя события проблемы: BEX Имя приложения: regsvr32.exe Версия...

Ошибка при перезагрузке php-fastcgi
Всем вновь привет. Вот при перезапускае php-fastcgi выдаёт такую ошибку: ...

Ошибка диска при перезагрузке во время установки Windows
Привет, решил переустановить Винду. Записал образ на диск, все как надо сделал, а оно доходит до...


Искать еще темы с ответами

Или воспользуйтесь поиском по форуму:
10
Ответ Создать тему
КиберФорум - форум программистов, компьютерный форум, программирование
Powered by vBulletin
Copyright ©2000 - 2024, CyberForum.ru