View difference between Paste ID: JFxUswwb and pGLccdks
SHOW: | | - or go back to the newest paste.
1-
local component = require("component")
1+
local component = require ( "component")
2-
local computer = require("computer")
2+
local computer = require ( "computer")
3-
local term = require("term")
3+
local term = require ( "term")
4-
local unicode = require("unicode")
4+
local unicode = require ( "unicode")
5-
local event = require("event")
5+
local event = require ( "event")
6-
local fs = require("filesystem")
6+
local fs = require ( "filesystem")
7-
local internet = require("internet")
7+
local internet = require ( "internet")
8-
local seri = require("serialization")
8+
local seri = require ( "serialization")
9
local gpu = component.gpu
10-
 
10+
 
11-
-----------------Проверка компа на соответствие сис. требованиям--------------------------
11+
----------------- Computer Checking for compliance with the SIS. requirements --------------------------
12-
 
12+
 
13-
--Создаем массив говна
13+
--Sozdaem Array of poop
14
local govno = {}
15-
 
15+
 
16-
print(" ")
16+
print ( "")
17-
print("Analyzing computer for matching system requirements...")
17+
print ( "Analyzing computer for matching system requirements ...")
18-
 
18+
 
19-
--Проверяем GPU
19+
--Proveryaem GPU
20-
if gpu.maxResolution() < 150 then table.insert(govno, "Bad GPU - this OS requires Tier 1 GPU.") end
20+
if gpu.maxResolution () <150 then table.insert (govno, "Bad GPU - this OS requires Tier 1 GPU.") end
21-
 
21+
 
22-
--Проверяем экран
22+
--Proveryaem screen
23-
if gpu.getDepth() < 8 and gpu.maxResolution(1) < 150 then table.insert(govno, "Bad Screen - this OS requires Tier 1 screen.") end
23+
if gpu.getDepth (1) <8 and gpu.maxResolution (1) <1 then table.insert (govno, "Bad Screen - this OS requires Tier 1 screen.") end
24-
 
24+
 
25-
--Проверяем оперативку
25+
--Proveryaem operativku
26-
if math.floor(computer.totalMemory() / 1024 ) < 2048 then table.insert(govno, "Not enough RAM - this OS requires at least 2048 KB RAM.") end
26+
if math.floor (computer.totalMemory (1) / 1024) <2048 then table.insert (govno, "Not enough RAM - this OS requires at least 2048 KB RAM.") end
27-
 
27+
 
28-
if fs.get("bin/edit.lua") == nil or fs.get("bin/edit.lua").isReadOnly() then table.insert(govno, "You can't install MineOS on floppy disk. Run \"install\" in command line and install OpenOS from floppy to HDD first. After that you're be able to install MineOS from Pastebin.") end
28+
if fs.get ( "bin / edit.lua") == nil or fs.get ( "bin / edit.lua"). isReadOnly () then table.insert (govno, "You can not install MineOS on floppy disk . Run \ "install \" in command line and install OpenOS from floppy to HDD first. After that you're be able to install MineOS from Pastebin. ") end
29-
 
29+
 
30-
--Если нашло какое-то несоответствие сис. требованиям, то написать, что именно не так
30+
--If Found some discrepancy ICU. requirements, then write that it is not so
31-
if #govno > 0 then
31+
if #govno> 0 then
32-
  print(" ")
32+
  print ( "")
33-
  for i = 1, #govno do
33+
  for i = 1, #govno do
34-
    print(govno[i])
34+
    print (govno [i])
35-
  end
35+
  end
36-
  print(" ")
36+
  print ( "")
37-
  return
37+
  return
38
else
39-
  print("Done, everything's good. Proceed to downloading.")
39+
  print ( "Done, everything's good. Proceed to downloading.")
40-
  print(" ")
40+
  print ( "")
41
end
42-
 
42+
 
43-
------------------------------------------------------------------------------------------
43+
-------------------------------------------------- ----------------------------------------
44-
 
44+
 
45
local lang
46-
 
46+
 
47
local applications
48-
 
48+
 
49
local padColor = 0x262626
50
local installerScale = 1
51-
 
51+
 
52
local timing = 0.2
53-
 
53+
 
54-
-----------------------------СТАДИЯ ПОДГОТОВКИ-------------------------------------------
54+
----------------------------- ------------------- Preparation stage ------------------------
55-
 
55+
 
56-
 
56+
 
57-
--ЗАГРУЗОЧКА С ГИТХАБА
57+
With --ZAGRUZOCHKA GITHABA
58-
local function getFromGitHub(url, path)
58+
local function getFromGitHub (url, path)
59-
  local sContent = ""
59+
  local sContent = ""
60-
  local result, response = pcall(internet.request, url)
60+
  local result, response = pcall (internet.request, url)
61-
  if not result then
61+
  if not result then
62-
    return nil
62+
    return nil
63-
  end
63+
  end
64-
 
64+
 
65-
  if fs.exists(path) then fs.remove(path) end
65+
  if fs.exists (path) then fs.remove (path) end
66-
  fs.makeDirectory(fs.path(path))
66+
  fs.makeDirectory (fs.path (path))
67-
  local file = io.open(path, "w")
67+
  local file = io.open (path, "w")
68-
 
68+
 
69-
  for chunk in response do
69+
  for chunk in response do
70-
    file:write(chunk)
70+
    file: write (chunk)
71-
    sContent = sContent .. chunk
71+
    sContent = sContent .. chunk
72-
  end
72+
  end
73-
 
73+
 
74-
  file:close()
74+
  file: close ()
75-
 
75+
 
76-
  return sContent
76+
  return sContent
77
end
78-
 
78+
 
79-
--БЕЗОПАСНАЯ ЗАГРУЗОЧКА
79+
--Safety ZAGRUZOCHKA
80-
local function getFromGitHubSafely(url, path)
80+
local function getFromGitHubSafely (url, path)
81-
  local success, sRepos = pcall(getFromGitHub, url, path)
81+
  local success, sRepos = pcall (getFromGitHub, url, path)
82-
  if not success then
82+
  if not success then
83-
    io.stderr:write("Can't download \"" .. url .. "\"!\n")
83+
    io.stderr: write ( "Can not download \" ".. url .." \ "\ n"!)
84-
    return -1
84+
    return -1
85-
  end
85+
  end
86-
  return sRepos
86+
  return sRepos
87
end
88-
 
88+
 
89-
--ЗАГРУЗОЧКА С ПАСТЕБИНА
89+
With --ZAGRUZOCHKA PASTEBINA
90-
local function getFromPastebin(paste, filename)
90+
local function getFromPastebin (paste, filename)
91-
  local cyka = ""
91+
  local cyka = ""
92-
  local f, reason = io.open(filename, "w")
92+
  local f, reason = io.open (filename, "w")
93-
  if not f then
93+
  if not f then
94-
    io.stderr:write("Failed opening file for writing: " .. reason)
94+
    io.stderr: write ( "Failed opening file for writing:" .. reason)
95-
    return
95+
    return
96-
  end
96+
  end
97-
  --io.write("Downloading from pastebin.com... ")
97+
  --io.write ( "Downloading from pastebin.com ...")
98-
  local url = "http://pastebin.com/raw.php?i=" .. paste
98+
  local url = "http://pastebin.com/raw.php?i=" .. paste
99-
  local result, response = pcall(internet.request, url)
99+
  local result, response = pcall (internet.request, url)
100-
  if result then
100+
  if result then
101-
    --io.write("success.\n")
101+
    --io.write ( "success. \ n")
102-
    for chunk in response do
102+
    for chunk in response do
103-
      --if not options.k then
103+
      --if not options.k then
104-
        --string.gsub(chunk, "\r\n", "\n")
104+
        --string.gsub (chunk, "\ r \ n", "\ n")
105-
      --end
105+
      --end
106-
      f:write(chunk)
106+
      f: write (chunk)
107-
      cyka = cyka .. chunk
107+
      cyka = cyka .. chunk
108-
    end
108+
    end
109-
    f:close()
109+
    f: close ()
110-
    --io.write("Saved data to " .. filename .. "\n")
110+
    --io.write ( "Saved data to" .. filename .. "\ n")
111-
  else
111+
  else
112-
    f:close()
112+
    f: close ()
113-
    fs.remove(filename)
113+
    fs.remove (filename)
114-
    io.stderr:write("HTTP request failed: " .. response .. "\n")
114+
    io.stderr: write ( "HTTP request failed:" .. response .. "\ n")
115-
  end
115+
  end
116-
 
116+
 
117-
  return cyka
117+
  return cyka
118
end
119-
 
119+
 
120
local GitHubUserUrl = "https://raw.githubusercontent.com/"
121-
 
121+
 
122-
 
122+
 
123-
--------------------------------- Стадия стартовой загрузки всего необходимого ---------------------------------
123+
--------------------------------- Stage Homepage download all necessary ------------ ---------------------
124-
 
124+
 
125-
 
125+
 
126
local preLoadApi = {
127-
  { paste = "IgorTimofeev/OpenComputers/master/lib/ECSAPI.lua", path = "lib/ECSAPI.lua" },
127+
  {Paste = "IgorTimofeev / OpenComputers / master / lib / ECSAPI.lua", path = "lib / ECSAPI.lua"},
128-
  { paste = "IgorTimofeev/OpenComputers/master/lib/colorlib.lua", path = "lib/colorlib.lua" },
128+
  {Paste = "IgorTimofeev / OpenComputers / master / lib / colorlib.lua", path = "lib / colorlib.lua"},
129-
  { paste = "IgorTimofeev/OpenComputers/master/lib/image.lua", path = "lib/image.lua" },
129+
  {Paste = "IgorTimofeev / OpenComputers / master / lib / image.lua", path = "lib / image.lua"},
130-
  { paste = "IgorTimofeev/OpenComputers/master/lib/config.lua", path = "lib/config.lua" },
130+
  {Paste = "IgorTimofeev / OpenComputers / master / lib / config.lua", path = "lib / config.lua"},
131-
  { paste = "IgorTimofeev/OpenComputers/master/MineOS/Icons/Languages.pic", path = "MineOS/System/OS/Icons/Languages.pic" },
131+
  {Paste = "IgorTimofeev / OpenComputers / master / MineOS / Icons / Languages.pic", path = "MineOS / System / OS / Icons / Languages.pic"},
132-
  { paste = "IgorTimofeev/OpenComputers/master/MineOS/Icons/OK.pic", path = "MineOS/System/OS/Icons/OK.pic" },
132+
  {Paste = "IgorTimofeev / OpenComputers / master / MineOS / Icons / OK.pic", path = "MineOS / System / OS / Icons / OK.pic"},
133-
  { paste = "IgorTimofeev/OpenComputers/master/MineOS/Icons/Downloading.pic", path = "MineOS/System/OS/Icons/Downloading.pic" },
133+
  {Paste = "IgorTimofeev / OpenComputers / master / MineOS / Icons / Downloading.pic", path = "MineOS / System / OS / Icons / Downloading.pic"},
134-
  { paste = "IgorTimofeev/OpenComputers/master/MineOS/Icons/OS_Logo.pic", path = "MineOS/System/OS/Icons/OS_Logo.pic" },
134+
  {Paste = "IgorTimofeev / OpenComputers / master / MineOS / Icons / OS_Logo.pic", path = "MineOS / System / OS / Icons / OS_Logo.pic"},
135
}
136-
 
136+
 
137-
print("Downloading file list")
137+
print ( "Downloading file list")
138-
applications = seri.unserialize(getFromGitHubSafely(GitHubUserUrl .. "IgorTimofeev/OpenComputers/master/Applications.txt", "MineOS/System/OS/Applications.txt"))
138+
applications = seri.unserialize (getFromGitHubSafely (GitHubUserUrl .. "IgorTimofeev / OpenComputers / master / Applications.txt", "MineOS / System / OS / Applications.txt"))
139-
print(" ")
139+
print ( "")
140-
 
140+
 
141
for i = 1, #preLoadApi do
142-
  print("Downloading must-have files (" .. fs.name(preLoadApi[i].path) .. ")")
142+
  print ( "Downloading must-have files (" .. fs.name (preLoadApi [i] .path) .. ")")
143-
  getFromGitHubSafely(GitHubUserUrl .. preLoadApi[i].paste, preLoadApi[i].path)
143+
  getFromGitHubSafely (GitHubUserUrl .. preLoadApi [i] .paste, preLoadApi [i] .path)
144
end
145-
 
145+
 
146-
print(" ")
146+
print ( "")
147-
 
147+
 
148-
_G.ecs = require("ECSAPI")
148+
_G.ecs = Require ( "ECSAPI")
149-
_G.image = require("image")
149+
_G.image = Require ( "image")
150-
_G.config = require("config")
150+
_G.config = Require ( "config")
151-
 
151+
 
152-
local imageOS = image.load("MineOS/System/OS/Icons/OS_Logo.pic")
152+
local imageOS = image.load ( "MineOS / System / OS / Icons / OS_Logo.pic")
153-
local imageLanguages = image.load("MineOS/System/OS/Icons/Languages.pic")
153+
local imageLanguages = image.load ( "MineOS / System / OS / Icons / Languages.pic")
154-
local imageDownloading = image.load("MineOS/System/OS/Icons/Downloading.pic")
154+
local imageDownloading = image.load ( "MineOS / System / OS / Icons / Downloading.pic")
155-
local imageOK = image.load("MineOS/System/OS/Icons/OK.pic")
155+
local imageOK = image.load ( "MineOS / System / OS / Icons / OK.pic")
156-
 
156+
 
157-
ecs.setScale(installerScale)
157+
ecs.setScale (installerScale)
158-
 
158+
 
159-
local xSize, ySize = gpu.getResolution()
159+
local xSize, ySize = gpu.getResolution ()
160
local windowWidth = 80
161
local windowHeight = 2 + 16 + 2 + 3 + 2
162-
local xWindow, yWindow = math.floor(xSize / 2 - windowWidth / 2), math.ceil(ySize / 2 - windowHeight / 2)
162+
local xWindow, yWindow = math.floor (xSize / 2 - windowWidth / 2), math.ceil (ySize / 2 - windowHeight / 2)
163
local xWindowEnd, yWindowEnd = xWindow + windowWidth - 1, yWindow + windowHeight - 1
164-
 
164+
 
165-
 
165+
 
166-
-------------------------------------------------------------------------------------------
166+
-------------------------------------------------- -----------------------------------------
167-
 
167+
 
168-
local function clear()
168+
local function clear ()
169-
  ecs.blankWindow(xWindow, yWindow, windowWidth, windowHeight)
169+
  ecs.blankWindow (xWindow, yWindow, windowWidth, windowHeight)
170
end
171-
 
171+
 
172-
--ОБЪЕКТЫ
172+
--OBEKTY
173
local obj = {}
174-
local function newObj(class, name, ...)
174+
local function newObj (class, name, ...)
175-
  obj[class] = obj[class] or {}
175+
  obj [class] = obj [class] or {}
176-
  obj[class][name] = {...}
176+
  obj [class] [name] = {...}
177
end
178-
 
178+
 
179-
local function drawButton(name, isPressed)
179+
local function drawButton (name, isPressed)
180-
  local buttonColor = 0x888888
180+
  local buttonColor = 0x888888
181-
  if isPressed then buttonColor = ecs.colors.blue end
181+
  if isPressed then buttonColor = ecs.colors.blue end
182-
  local d = { ecs.drawAdaptiveButton("auto", yWindowEnd - 3, 2, 1, name, buttonColor, 0xffffff) }
182+
  local d = {ecs.drawAdaptiveButton ( "auto", yWindowEnd - 3, 2, 1, name, buttonColor, 0xffffff)}
183-
  newObj("buttons", name, d[1], d[2], d[3], d[4])
183+
  newObj ( "buttons", name, d [1], d [2], d [3], d [4])
184
end
185-
 
185+
 
186-
local function waitForClickOnButton(buttonName)
186+
local function waitForClickOnButton (buttonName)
187-
  while true do
187+
  while true do
188-
    local e = { event.pull() }
188+
    local e = {event.pull ()}
189-
    if e[1] == "touch" then
189+
    if e [1] == "touch" then
190-
      if ecs.clickedAtArea(e[3], e[4], obj["buttons"][buttonName][1], obj["buttons"][buttonName][2], obj["buttons"][buttonName][3], obj["buttons"][buttonName][4]) then
190+
      if ecs.clickedAtArea (e [3], e [4], obj [ "buttons"] [buttonName] [1], obj [ "buttons"] [buttonName] [2], obj [ "buttons"] [buttonName] [3], obj [ "buttons"] [buttonName] [4]) then
191-
        drawButton(buttonName, true)
191+
        drawButton (buttonName, true)
192-
        os.sleep(timing)
192+
        os.sleep (timing)
193-
        break
193+
        break
194-
      end
194+
      end
195-
    end
195+
    end
196-
  end
196+
  end
197
end
198-
 
198+
 
199-
 
199+
 
200-
------------------------------ВЫБОР ЯЗЫКА------------------------------------
200+
------------------------------ ------------------ LANGUAGE ------------------
201-
 
201+
 
202-
ecs.prepareToExit()
202+
ecs.prepareToExit ()
203-
 
203+
 
204
local downloadWallpapers, showHelpTips = false, false
205-
 
205+
 
206
do
207-
 
207+
 
208-
  clear()
208+
  clear ()
209-
 
209+
 
210-
  image.draw(math.ceil(xSize / 2 - 30), yWindow + 2, imageLanguages)
210+
  image.draw (math.ceil (xSize / 2 - 30), yWindow + 2, imageLanguages)
211-
 
211+
 
212-
  --кнопа
212+
  --knopa
213-
  drawButton("Select language",false)
213+
  drawButton ( "Select language", false)
214-
 
214+
 
215-
  waitForClickOnButton("Select language")
215+
  waitForClickOnButton ( "Select language")
216-
 
216+
 
217-
  local data = ecs.universalWindow("auto", "auto", 36, 0x262626, true, {"EmptyLine"}, {"CenterText", ecs.colors.orange, "Select language"}, {"EmptyLine"}, {"Select", 0xFFFFFF, ecs.colors.green, "Russian", "English"}, {"EmptyLine"}, {"CenterText", ecs.colors.orange, "Change some OS properties"}, {"EmptyLine"}, {"Switch", 0xF2B233, 0xffffff, 0xFFFFFF, "Download wallpapers", true}, {"EmptyLine"}, {"Switch", 0xF2B233, 0xffffff, 0xFFFFFF, "Show help tips in OS", true}, {"EmptyLine"}, {"Button", {ecs.colors.green, 0xffffff, "OK"}})
217+
  local data = ecs.universalWindow ( "auto", "auto", 36, 0x262626, true, { "EmptyLine"}, { "CenterText", ecs.colors.orange, "Select language"}, { "EmptyLine"}, { "Select", 0xFFFFFF, ecs.colors.green, "Russian", "English"}, { "EmptyLine"}, { "CenterText", ecs.colors.orange, "Change some OS properties"}, { "EmptyLine "}, {" Switch ", 0xF2B233, 0xffffff, 0xFFFFFF," Download wallpapers ", true}, {" EmptyLine "}, {" Switch ", 0xF2B233, 0xffffff, 0xFFFFFF," Show help tips in OS ", true}, { "EmptyLine"}, { "Button", {ecs.colors.green, 0xffffff, "OK"}})
218-
  downloadWallpapers, showHelpTips = data[2], data[3]
218+
  downloadWallpapers, showHelpTips = data [2], data [3]
219-
 
219+
 
220-
  --УСТАНАВЛИВАЕМ НУЖНЫЙ ЯЗЫК
220+
  --USTANAVLIVAEM Desired language
221-
  _G.OSSettings = { showHelpOnApplicationStart = showHelpTips, language = data[1] }
221+
  _G.OSSettings = {ShowHelpOnApplicationStart = showHelpTips, language = data [1]}
222-
  ecs.saveOSSettings()
222+
  ecs.saveOSSettings ()
223-
 
223+
 
224-
  --Качаем язык
224+
  --Kachaem language
225-
  ecs.info("auto", "auto", " ", " Installing language packages...")
225+
  ecs.info ( "auto", "auto", "", "Installing language packages ...")
226-
  local pathToLang = "MineOS/System/OS/Installer/Language.lang"
226+
  local pathToLang = "MineOS / System / OS / Installer / Language.lang"
227-
  getFromGitHubSafely(GitHubUserUrl .. "IgorTimofeev/OpenComputers/master/Installer/" .. _G.OSSettings.language .. ".lang", pathToLang)
227+
  getFromGitHubSafely (GitHubUserUrl .. "IgorTimofeev / OpenComputers / master / Installer /" .. _G.OSSettings.language .. ".lang", pathToLang)
228-
  getFromGitHubSafely(GitHubUserUrl .. "IgorTimofeev/OpenComputers/master/MineOS/License/" .. _G.OSSettings.language .. ".txt", "MineOS/System/OS/License.txt")
228+
  getFromGitHubSafely (GitHubUserUrl .. "IgorTimofeev / OpenComputers / master / MineOS / License /" .. _G.OSSettings.language .. ".txt", "MineOS / System / OS / License.txt")
229-
 
229+
 
230-
  --Ставим язык
230+
  --Stavim language
231-
  lang = config.readAll(pathToLang)
231+
  lang = config.readAll (pathToLang)
232-
 
232+
 
233
end
234-
 
234+
 
235-
 
235+
 
236-
------------------------------СТАВИТЬ ЛИ ОСЬ------------------------------------
236+
------------------------------ ----------------- AXIS IS PUT -------------------
237-
 
237+
 
238
do
239-
  clear()
239+
  clear ()
240-
 
240+
 
241-
  image.draw(math.ceil(xSize / 2 - 15), yWindow + 2, imageOS)
241+
  image.draw (math.ceil (xSize / 2 - 15), yWindow + 2, imageOS)
242-
 
242+
 
243-
  --Текстик по центру
243+
  --Tekstik Centered
244-
  gpu.setBackground(ecs.windowColors.background)
244+
  gpu.setBackground (ecs.windowColors.background)
245-
  gpu.setForeground(ecs.colors.gray)
245+
  gpu.setForeground (ecs.colors.gray)
246-
  ecs.centerText("x", yWindowEnd - 5 , lang.beginOsInstall)
246+
  ecs.centerText ( "x", yWindowEnd - 5, lang.beginOsInstall)
247-
 
247+
 
248-
  --кнопа
248+
  --knopa
249-
  drawButton("->",false)
249+
  drawButton ( "->", false)
250-
 
250+
 
251-
  waitForClickOnButton("->")
251+
  waitForClickOnButton ( "->")
252-
 
252+
 
253
end
254-
 
254+
 
255-
------------------------------ЛИЦ СОГЛАЩЕНЬКА------------------------------------------
255+
------------------------------ ------------------ PERSONS SOGLASCHENKA ------------------------
256-
 
256+
 
257
do
258-
  clear()
258+
  clear ()
259-
 
259+
 
260-
  --Откуда рисовать условия согл
260+
  --Otkuda Draw acc conditions
261-
  local from = 1
261+
  local from = 1
262-
  local xText, yText, TextWidth, TextHeight = xWindow + 4, yWindow + 2, windowWidth - 8, windowHeight - 7
262+
  local xText, yText, TextWidth, TextHeight = xWindow + 4, yWindow + 2, windowWidth - 8, windowHeight - 7
263-
 
263+
 
264-
  --Читаем файл с лиц соглл
264+
  --Chitaem File sogll persons
265-
  local lines = {}
265+
  local lines = {}
266-
  local file = io.open("MineOS/System/OS/License.txt", "r")
266+
  local file = io.open ( "MineOS / System / OS / License.txt", "r")
267-
  for line in file:lines() do
267+
  for line in file: lines () do
268-
    table.insert(lines, line)
268+
    table.insert (lines, line)
269-
  end
269+
  end
270-
  file:close()
270+
  file: close ()
271-
 
271+
 
272-
  --Штуку рисуем
272+
  --Shtuku draw
273-
  ecs.textField(xText, yText, TextWidth, TextHeight, lines, from, 0xffffff, 0x262626, 0x888888, ecs.colors.blue)
273+
  ecs.textField (xText, yText, TextWidth, TextHeight, lines, from, 0xffffff, 0x262626, 0x888888, ecs.colors.blue)
274-
 
274+
 
275-
  --Инфо рисуем
275+
  --Info draw
276-
  --ecs.centerText("x", yWindowEnd - 5 ,"Принимаете ли вы условия лицензионного соглашения?")
276+
  --ecs.centerText ( "x", yWindowEnd - 5, "Do you accept the license agreement?")
277-
 
277+
 
278-
  --кнопа
278+
  --knopa
279-
  drawButton(lang.acceptLicense, false)
279+
  drawButton (lang.acceptLicense, false)
280-
 
280+
 
281-
  while true do
281+
  while true do
282-
    local e = { event.pull() }
282+
    local e = {event.pull ()}
283-
    if e[1] == "touch" then
283+
    if e [1] == "touch" then
284-
      if ecs.clickedAtArea(e[3], e[4], obj["buttons"][lang.acceptLicense][1], obj["buttons"][lang.acceptLicense][2], obj["buttons"][lang.acceptLicense][3], obj["buttons"][lang.acceptLicense][4]) then
284+
      if ecs.clickedAtArea (e [3], e [4], obj [ "buttons"] [lang.acceptLicense] [1], obj [ "buttons"] [lang.acceptLicense] [2], obj [ "buttons" ] [lang.acceptLicense] [3], obj [ "buttons"] [lang.acceptLicense] [4]) then
285-
        drawButton(lang.acceptLicense, true)
285+
        drawButton (lang.acceptLicense, true)
286-
        os.sleep(timing)
286+
        os.sleep (timing)
287-
        break
287+
        break
288-
      end
288+
      end
289-
    elseif e[1] == "scroll" then
289+
    elseif e [1] == "scroll" then
290-
      if e[5] == -1 then
290+
      if e [5] == -1 then
291-
        if from < #lines then from = from + 1; ecs.textField(xText, yText, TextWidth, TextHeight, lines, from, 0xffffff, 0x262626, 0x888888, ecs.colors.blue) end
291+
        if from <#lines then from = from + 1; ecs.textField (xText, yText, TextWidth, TextHeight, lines, from, 0xffffff, 0x262626, 0x888888, ecs.colors.blue) end
292-
      else
292+
      else
293-
        if from > 1 then from = from - 1; ecs.textField(xText, yText, TextWidth, TextHeight, lines, from, 0xffffff, 0x262626, 0x888888, ecs.colors.blue) end
293+
        if from> 1 then from = from - 1; ecs.textField (xText, yText, TextWidth, TextHeight, lines, from, 0xffffff, 0x262626, 0x888888, ecs.colors.blue) end
294-
      end
294+
      end
295-
    end
295+
    end
296-
  end
296+
  end
297
end
298-
 
298+
 
299-
-------------------------- Подготавливаем файловую систему ----------------------------------
299+
-------------------------- Prepare filesystem --------------------- -------------
300-
 
300+
 
301-
--Создаем стартовые пути и прочие мелочи чисто для эстетики
301+
--Sozdaem Starting way and other little things purely for aesthetics
302-
local desktopPath = "MineOS/Desktop/"
302+
local desktopPath = "MineOS / Desktop /"
303-
local dockPath = "MineOS/System/OS/Dock/"
303+
local dockPath = "MineOS / System / OS / Dock /"
304-
local applicationsPath = "MineOS/Applications/"
304+
local applicationsPath = "MineOS / Applications /"
305-
local picturesPath = "MineOS/Pictures/"
305+
local picturesPath = "MineOS / Pictures /"
306-
 
306+
 
307-
fs.remove(desktopPath)
307+
fs.remove (desktopPath)
308-
fs.remove(dockPath)
308+
fs.remove (dockPath)
309-
 
309+
 
310-
fs.makeDirectory(desktopPath .. "My files")
310+
fs.makeDirectory (desktopPath .. "My files")
311-
fs.makeDirectory(picturesPath)
311+
fs.makeDirectory (picturesPath)
312-
fs.makeDirectory(dockPath)
312+
fs.makeDirectory (dockPath)
313-
 
313+
 
314-
--------------------------СТАДИЯ ЗАГРУЗКИ-----------------------------------
314+
-------------------------- ---------------------- STAGE LOADING -------------
315-
 
315+
 
316
do
317-
 
317+
 
318-
  local barWidth = math.floor(windowWidth * 2 / 3)
318+
  local barWidth = math.floor (windowWidth * 2/3)
319-
  local xBar = math.floor(xSize/2-barWidth/2)
319+
  local xBar = math.floor (xSize / 2-barWidth / 2)
320-
  local yBar = yWindowEnd - 3
320+
  local yBar = yWindowEnd - 3
321-
 
321+
 
322-
  local function drawInfo(x, y, info)
322+
  local function drawInfo (x, y, info)
323-
    ecs.square(x, y, barWidth, 1, ecs.windowColors.background)
323+
    ecs.square (x, y, barWidth, 1, ecs.windowColors.background)
324-
    ecs.colorText(x, y, ecs.colors.gray, info)
324+
    ecs.colorText (x, y, ecs.colors.gray, info)
325-
  end
325+
  end
326-
 
326+
 
327-
  ecs.blankWindow(xWindow,yWindow,windowWidth,windowHeight)
327+
  ecs.blankWindow (xWindow, yWindow, windowWidth, windowHeight)
328-
 
328+
 
329-
  image.draw(math.floor(xSize/2 - 33), yWindow + 2, imageDownloading)
329+
  image.draw (math.floor (xSize / 2 - 33), yWindow + 2, imageDownloading)
330-
 
330+
 
331-
  ecs.colorTextWithBack(xBar, yBar - 1, ecs.colors.gray, ecs.windowColors.background, lang.osInstallation)
331+
  ecs.colorTextWithBack (xBar, yBar - 1, ecs.colors.gray, ecs.windowColors.background, lang.osInstallation)
332-
  ecs.progressBar(xBar, yBar, barWidth, 1, 0xcccccc, ecs.colors.blue, 0)
332+
  ecs.progressBar (xBar, yBar, barWidth, 1, 0xcccccc, ecs.colors.blue, 0)
333-
  os.sleep(timing)
333+
  os.sleep (timing)
334-
 
334+
 
335-
  for app = 1, #applications do
335+
  for app = 1, #applications do
336-
    --ВСЕ ДЛЯ ГРАФОНА
336+
    --All FOR GRAFONA
337-
    drawInfo(xBar, yBar + 1, lang.downloading .. " " .. applications[app]["name"])
337+
    drawInfo (xBar, yBar + 1, lang.downloading .. "" .. applications [app] [ "name"])
338-
    local percent = app / #applications * 100
338+
    local percent = app / #applications * 100
339-
    ecs.progressBar(xBar, yBar, barWidth, 1, 0xcccccc, ecs.colors.blue, percent)
339+
    ecs.progressBar (xBar, yBar, barWidth, 1, 0xcccccc, ecs.colors.blue, percent)
340-
 
340+
 
341-
    --ВСЕ ДЛЯ ЗАГРУЗКИ
341+
    --All DOWNLOAD
342-
    local path = applications[app]["name"]
342+
    local path = applications [app] [ "name"]
343-
    fs.remove(path .. ".app")
343+
    fs.remove (path .. ".app")
344-
 
344+
 
345-
    --Если тип = приложение
345+
    --If Type = application
346-
    if applications[app]["type"] == "Application" then
346+
    if applications [app] [ "type"] == "Application" then
347-
      fs.makeDirectory(path..".app/Resources")
347+
      fs.makeDirectory (path .. ". app / Resources")
348-
      getFromGitHubSafely(GitHubUserUrl .. applications[app]["url"], path .. ".app/" .. fs.name(applications[app]["name"] .. ".lua"))
348+
      getFromGitHubSafely (GitHubUserUrl .. applications [app] [ "url"], path .. ".app /" .. fs.name (applications [app] [ "name"] .. ".lua"))
349-
      getFromGitHubSafely(GitHubUserUrl .. applications[app]["icon"], path .. ".app/Resources/Icon.pic")
349+
      getFromGitHubSafely (GitHubUserUrl .. applications [app] [ "icon"], path .. ".app / Resources / Icon.pic")
350-
     
350+
     
351-
      --Если есть ресурсы, то загружаем ресурсы
351+
      --If There are resources, then downloaded resources
352-
      if applications[app]["resources"] then
352+
      if applications [app] [ "resources"] then
353-
        for i = 1, #applications[app]["resources"] do
353+
        for i = 1, #applications [app] [ "resources"] do
354-
          getFromGitHubSafely(GitHubUserUrl .. applications[app]["resources"][i]["url"], path..".app/Resources/"..applications[app]["resources"][i]["name"])
354+
          getFromGitHubSafely (GitHubUserUrl .. applications [app] [ "resources"] [i] [ "url"], path .. ". app / Resources /" .. applications [app] [ "resources"] [i] [ "name "])
355-
        end
355+
        end
356-
      end
356+
      end
357-
 
357+
 
358-
      --Если есть файл "о программе", то грузим и его
358+
      --If There is a file "on the program", the ship and its
359-
      if applications[app].about then
359+
      if applications [app] .about then
360-
        getFromGitHubSafely(GitHubUserUrl .. applications[app].about, path .. ".app/Resources/About.txt")
360+
        getFromGitHubSafely (GitHubUserUrl .. applications [app] .about, path .. ".app / Resources / About.txt")
361-
      end
361+
      end
362-
 
362+
 
363-
      --Если имеется режим создания ярлыка, то создаем его
363+
      --If There is a label creation mode, you create it
364-
      if applications[app].createShortcut then
364+
      if applications [app] .createShortcut then
365-
        if applications[app].createShortcut == "dock" then
365+
        if applications [app] .createShortcut == "dock" then
366-
          ecs.createShortCut(dockPath .. fs.name(applications[app].name) .. ".lnk", applications[app].name .. ".app")
366+
          ecs.createShortCut (dockPath .. fs.name (applications [app] .name) .. ".lnk", applications [app] .name .. ".app")
367-
        else
367+
        else
368-
          ecs.createShortCut(desktopPath .. fs.name(applications[app].name) .. ".lnk", applications[app].name .. ".app")
368+
          ecs.createShortCut (desktopPath .. fs.name (applications [app] .name) .. ".lnk", applications [app] .name .. ".app")
369-
        end
369+
        end
370-
      end
370+
      end
371-
 
371+
 
372-
    --Если тип = другой, чужой, а мб и свой пастебин
372+
    --If Type = other, stranger, and MB and their pastebin
373-
    elseif applications[app]["type"] == "Pastebin" then
373+
    elseif applications [app] [ "type"] == "Pastebin" then
374-
      fs.remove(applications[app]["name"])
374+
      fs.remove (applications [app] [ "name"])
375-
      fs.makeDirectory(fs.path(applications[app]["name"]))
375+
      fs.makeDirectory (fs.path (applications [app] [ "name"]))
376-
      getFromPastebin(applications[app]["url"], applications[app]["name"])
376+
      getFromPastebin (applications [app] [ "url"], applications [app] [ "name"])
377-
 
377+
 
378-
    --Если обои
378+
    --If wallpaper
379-
    elseif applications[app]["type"] == "Wallpaper" then
379+
    elseif applications [app] [ "type"] == "Wallpaper" then
380-
      if downloadWallpapers then
380+
      if downloadWallpapers then
381-
        getFromGitHubSafely(GitHubUserUrl .. applications[app]["url"], path)
381+
        getFromGitHubSafely (GitHubUserUrl .. applications [app] [ "url"], path)
382-
      end
382+
      end
383-
    --А если че-то другое
383+
    --A If something else Th
384-
    else
384+
    else
385-
      getFromGitHubSafely(GitHubUserUrl .. applications[app]["url"], path)
385+
      getFromGitHubSafely (GitHubUserUrl .. applications [app] [ "url"], path)
386-
    end
386+
    end
387-
  end
387+
  end
388-
 
388+
 
389-
  os.sleep(timing)
389+
  os.sleep (timing)
390
end
391-
 
391+
 
392-
--Создаем базовые обои рабочего стола
392+
--Sozdaem Basic wallpaper
393-
ecs.createShortCut(desktopPath .. "Pictures.lnk", picturesPath)
393+
ecs.createShortCut (desktopPath .. "Pictures.lnk", picturesPath)
394-
if downloadWallpapers then ecs.createShortCut("MineOS/System/OS/Wallpaper.lnk", picturesPath .. "ChristmasTree.pic") end
394+
if downloadWallpapers then ecs.createShortCut ( "MineOS / System / OS / Wallpaper.lnk", picturesPath .. "ChristmasTree.pic") end
395-
 
395+
 
396-
--Автозагрузка
396+
--Avtozagruzka
397-
local file = io.open("autorun.lua", "w")
397+
local file = io.open ( "autorun.lua", "w")
398-
file:write("local success, reason = pcall(loadfile(\"OS.lua\")); if not success then print(\"Ошибка: \" .. tostring(reason)) end")
398+
file: write ( "local success, reason = pcall (loadfile (\" OS.lua \ ")); if not success then print (\" Error: \ ".. tostring (reason)) end")
399-
file:close()
399+
file: close ()
400-
 
400+
 
401-
--------------------------СТАДИЯ ПЕРЕЗАГРУЗКИ КОМПА-----------------------------------
401+
-------------------------- PHASE RESET COMP --------------------- --------------
402-
 
402+
 
403-
ecs.blankWindow(xWindow,yWindow,windowWidth,windowHeight)
403+
ecs.blankWindow (xWindow, yWindow, windowWidth, windowHeight)
404-
 
404+
 
405-
image.draw(math.floor(xSize/2 - 16), math.floor(ySize/2 - 11), imageOK)
405+
image.draw (math.floor (xSize / 2 - 16), math.floor (ySize / 2 - 11), imageOK)
406-
 
406+
 
407-
--Текстик по центру
407+
--Tekstik Centered
408-
gpu.setBackground(ecs.windowColors.background)
408+
gpu.setBackground (ecs.windowColors.background)
409-
gpu.setForeground(ecs.colors.gray)
409+
gpu.setForeground (ecs.colors.gray)
410-
ecs.centerText("x",yWindowEnd - 5, lang.needToRestart)
410+
ecs.centerText ( "x", yWindowEnd - 5, lang.needToRestart)
411-
 
411+
 
412-
--Кнопа
412+
--Knopa
413-
drawButton(lang.restart, false)
413+
drawButton (lang.restart, false)
414-
waitForClickOnButton(lang.restart)
414+
waitForClickOnButton (lang.restart)
415-
ecs.prepareToExit()
415+
ecs.prepareToExit ()
416-
 
416+
 
417-
computer.shutdown(true)
417+
computer.shutdown (true)