function gg.read(dizhi,leixing,all)
  local SCCZ ={{address=dizhi,flags=leixing}}
  SCCZ = gg.getValues(SCCZ)
  if all==nil then
    return SCCZ[1].value
   else
    return SCCZ
  end
end

function gg.write(dizhi,shujv,leixin)
  local SCCZ = {}
  SCCZ[1]={}
  SCCZ[1].address=dizhi
  SCCZ[1].flags=leixin
  SCCZ[1].value=shujv
  gg.setValues(SCCZ)
end

function gg.addList(dizhi,na)
  local SCCZ = {}
  SCCZ[1]={}
  SCCZ[1].address=dizhi
  SCCZ[1].flags=4
  SCCZ[1].name=na
  gg.addListItems(SCCZ)
end

function gg.shousuotssr(sr)
  t = 10
  sl = gg.prompt({sr}, {
    [1] = srsl
  }, {
    [1] = "number"
  })
  if sl == nil then
    return Dluae()
   else
    t = sl[1]
    return t
  end
end

function gg.SearchNumber(sum)
  gg.clearResults()
  gg.setRanges(gg.REGION_C_ALLOC)
  gg.searchNumber(sum,gg.TYPE_DWORD,false,gg.SIGN_EQUAL,0, -1)
  return gg.getResults(gg.getResultsCount())
end

function gg.Assert(data)
  if (data == nil) then
    return false
   else
    if (type(data) == 'table') then
      if (data[1] == '') then
        return false
      end
    end
  end
  return true
end

function gg.readfile(path)
  local file = io.open(path, "r")
  if file then
    local content = file:read("*a")
    io.close(file)
    return content
  end
  return nil
end

function gg.writefile(path, content, mode)
  mode = mode or "w+b"
  local file = assert(io.open(path, mode))
  if file then
    for i=1,#content do
      if file:write(content[i],"\n") == nil then
        return false
      end
    end
    io.close(file)
    return true
   else
    return false
  end
end

function gg.reloafResults(dizhi)
  local SCCZ = {}
  SCCZ[1]={}
  SCCZ[1].address=dizhi
  SCCZ[1].flags=4
  return SCCZ
end

function gg.lock(dizhi,name,zhuangtai) --将数据保存到列表,并且冻结
  local SCCZ={{address=dizhi,flags=4}}
  SCCZ=gg.getValues(SCCZ)
  if name~=nil then
    SCCZ[1].name=name
  end
  if zhuangtai==true then
    SCCZ[1].freeze=true
  end
  gg.addListItems(SCCZ)
  return SCCZ[1].value
end

gg.setVisible(false)
local Script=gg.makeRequest('https://gitee.com/luoyeziqiu/simziy/raw/master/simcity1425.txt').content
local Script1=gg.makeRequest('https://gitee.com/luoyeziqiu/simziy/raw/master/put.txt').content

function Orageload(loads)
  Orage=load(loads)
  if Orage==nil then
    gg.alert('无法访问云端，可能网络问题')
   else
    gg.toast('正在启动...')
    Orage()
  end
end
local v=gg.getTargetInfo()
if v.versionCode == 1042005 then
function Dluae()
  Dahl = gg.choice({
    "普通版",
    "高级版(需卡密)",
    "退出脚本"
  }, nil, "卡密邀请制")
  if Dahl == 1 then
    Orageload(Script1)
  end
  if Dahl == 2 then
    Orageload(Script)
  end
  if Dahl == 3 then
    Exit()
  end
  Rain = -1
end


function Exit()
  os.exit()
end

while true do
  if gg.isVisible(true) then
    Rain = 1
    gg.setVisible(false)
  end
  gg.clearResults()
  if Rain == 1 then
    Dluae()
  end
end
else
  gg.alert("游戏选择错误")
  gg.alert("进程选择simcity版本1.42.5，64位")
  os.exit()
end


