ma3rxofficial / ComputerCraft

Home of SpeedOS for ComputerCraft mod.
2 stars 1 forks source link

а хули? #4

Open FililT1 opened 2 hours ago

FililT1 commented 2 hours ago

как на счет добавить compressor из SpeedOS 1.3x? хули нет? если что вот код:

os.loadAPI("/SpeedAPI/SpeedGUI")
os.loadAPI("/SpeedAPI/lddfm")
term.setBackgroundColor(colors.cyan)
term.clear()
term.setCursorPos(20, 2)
print("Compressor")
term.setCursorPos(1, 3)
print("---------------------------------------------------")

function compress()

  term.setBackgroundColor(colors.gray)
  term.setTextColor(colors.white)
  term.setCursorPos(2, 2)
  term.clear()

  term.setTextColor(colors.white)
  term.setCursorPos(25, 2)
  i_f = tostring(lddfm.makeMenu())

  term.setBackgroundColor(colors.gray)
  term.setTextColor(colors.white)
  term.setCursorPos(2, 2)
  term.clear()

  print("Enter output file: ")
  term.setCursorPos(25, 2)
  term.setBackgroundColor(colors.lightGray)
  term.setTextColor(colors.white)
  print("          ")

  term.setTextColor(colors.white)
  term.setCursorPos(25, 2)
  o_f = io.read()

  term.setBackgroundColor(colors.gray)
  term.setTextColor(colors.orange)
  term.setCursorPos(2, 4)

  shell.run("/SpeedOS/Applications/Utils/compress "..i_f.." "..o_f)

  sleep(1)
  term.setTextColor(colors.white)
  term.setBackgroundColor(colors.black)
  term.clear()
  error()
end

function decompress()

  term.setBackgroundColor(colors.gray)
  term.setTextColor(colors.white)
  term.setCursorPos(2, 2)
  term.clear()

  term.setTextColor(colors.white)
  term.setCursorPos(25, 2)
  i_f = tostring(lddfm.makeMenu())

  term.setBackgroundColor(colors.gray)
  term.setTextColor(colors.white)
  term.setCursorPos(2, 2)
  term.clear()

  print("Enter output file: ")
  term.setCursorPos(25, 2)
  term.setBackgroundColor(colors.lightGray)
  term.setTextColor(colors.white)
  print("          ")

  term.setTextColor(colors.white)
  term.setCursorPos(25, 2)
  o_f = io.read()

  term.setBackgroundColor(colors.gray)
  term.setTextColor(colors.orange)
  term.setCursorPos(2, 4)

  shell.run("/SpeedOS/Applications/Utils/decompress "..i_f.." "..o_f)
  print("Decompressed "..i_f.." to "..o_f)

  sleep(1)
  term.setTextColor(colors.white)
  term.setBackgroundColor(colors.black)
  term.clear()
  error()
end

SpeedGUI.gui.button.add("Compress file",compress,17,5,2,3,colors.white,colors.lightBlue)
SpeedGUI.gui.button.add("Decompress file",decompress,16,9,2,3,colors.white,colors.blue)
SpeedGUI.start()
FililT1 commented 2 hours ago

СУКА ДА КАК ЭТОТ МАРКДАУН РАБОТАЕТ

FililT1 commented 2 hours ago

всё, пофиксил

ma3rxofficial commented 2 hours ago

Нахуя? Уже есть встроенный "архиватор", который даже папки поддерживает. Compressor, если не ошибаюсь, просто убирает переносы из файла, вот это оптимизация, да? Но я подумаю, а то давно не обновлял что-то...