Skip to content

Commit

Permalink
Fixed: Double logging when cannot allocate a panel
Browse files Browse the repository at this point in the history
Added: Dumping more state convars
Updated: Picures in readme
  • Loading branch information
dvdvideo1234 committed Apr 1, 2016
1 parent 6af7434 commit 8ebf73e
Show file tree
Hide file tree
Showing 19 changed files with 184 additions and 171 deletions.
10 changes: 10 additions & 0 deletions data/hooks/pre-commit.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
set InpFile=tmp.lua
set OutFile=trackassembly_init.lua
set BasPath=%~dp0
set LuaPath=%1
set LogFile=%2
echo %BasPath%, %LuaPath%>%LogFile%
copy %BasPath%..\..\lua\autorun\%OutFile% %BasPath%..\..\lua\autorun\%InpFile%
call %LuaPath%lua.exe %BasPath%pre-commit.lua %BasPath%..\..\lua\autorun\ %OutFile% UNX E:\Desktop\tmp.txt
del %BasPath%..\..\lua\autorun\tmp.lua
exit 0
215 changes: 108 additions & 107 deletions hooks/pre-commit.lua → data/hooks/pre-commit.lua
Original file line number Diff line number Diff line change
@@ -1,107 +1,108 @@
-- Test in CMD:
-- ..\..\bin\lua.exe go.lua "E:\Documents\Lua-Projs\SVN\TrackAssemblyTool_GIT_master\lua\autorun\trackassembly_init.lua" "Rev." "UNX"
-- Call in CMD: Script { LUA_PATH, LOG_FILE }
-- Work: E:\Documents\Lua-Projs\SVN\TrackAssemblyTool_GIT_master\hooks\pre-commit.bat E:\Documents\Lua-Projs\Lua\Bin\ E:\Desktop\tmp.txt
-- Home:

local sLog = tostring(arg[4]) -- "test.lua"
if((sLog == "nil") or (string.len(sLog) == 0)) then
io.write("No output log file")
else
sLog = sLog:gsub("\\","/")
fLog = io.open(sLog,"w+")
if(fLog) then io.output(fLog) end
end

io.write("------------------ ARG ------------------\n")
io.write("arg[1]<"..tostring(arg[1])..">\n")
io.write("arg[2]<"..tostring(arg[2])..">\n")
io.write("arg[3]<"..tostring(arg[3])..">\n")
io.write("arg[4]<"..tostring(arg[4])..">\n")
local sBase = tostring(arg[1])
sBase = sBase:gsub("\\","/")
if((sBase == "nil") or (string.len(sBase) == 0)) then
io.write("No file\n")
return false
end
io.write("------------------ FILE ------------------\n")
local sOut = tostring(arg[2]) -- "test.lua"
if((sOut == "nil") or (string.len(sOut) == 0)) then
io.write("No output file")
return false
end
local sOut = sBase..sOut
local sInp = sBase.."tmp.lua"
io.write("<"..sOut..">\n<"..sInp..">\n")
io.write("------------------ END ------------------\n")
local sEnd = tostring(arg[3])
if((sEnd == "nil") or (string.len(sEnd) == 0)) then
io.write("No end-line\n")
return false
end
if(not (sEnd == "DOS" or sEnd == "UNX")) then
io.write("Wrong end line mode: -"..sEnd.."-\n")
return false
end
if(sEnd == "DOS") then sEnd = "\r\n" end
if(sEnd == "UNX") then sEnd = "\n" end
io.write("------------------ OPEN FILE ------------------\n")
local fOut = io.open(sOut,"w+")
local fInp = io.open(sInp,"r+")
if(not fOut) then
io.write("File "..sOut.." not found\n")
return false
end
if(not fInp) then
io.write("File "..sInp.." not found\n")
return false
end
io.write("------------------ STORE ------------------\n")
local sI = fInp:read()
if(not sI) then
io.write("File "..sInp.." reached EOF\n")
return false
end
local sO, sCat = "", ""
local sLog = "asmlib.SetLogControl("
local sVer = "asmlib.SetOpVar(\"TOOL_VERSION\",\"5."
local nB, nE, nS, nL = 1, 1, 1, 1
while(sI) do
nB, nE = sI:find(sLog,1,true)
if(nB and nE) then
sCat = "0,\"\")"
io.write("["..tostring(nL).."]Disable logs[1]:<"..tostring(nB).."><"..tostring(nE).."><"..sCat..">\n")
nB = sI:find(",",1,true)
if(nB and tonumber(sI:sub(nE+1,nB-1))) then
io.write("["..tostring(nL).."]Disable logs[2]:<"..tostring(nB).."><"..tostring(sI:sub(nE+1,nB-1)).."><"..tonumber(sI:sub(nE+1,nB-1))..">\n")
sI = sLog..sCat
end
end
nB, nE = sI:find(sVer,1,true)
if(nB and nE) then
sCat = "\")"
io.write("["..tostring(nL).."]Increment the version[1]:<"..tostring(nB).."><"..tostring(nE).."><"..sCat..">\n")
nB = sI:find(sCat,1,true)
if(nB) then
nS = tonumber(sI:sub(nE+1,nB-1))
io.write("["..tostring(nL).."]Increment the version[2]:<"..tostring(nS).."><"..tostring(sI:sub(nE+1,nB-1))..">\n")
if(nS) then
io.write("["..tostring(nL).."]Increment the version[3]:<"..tostring(nS+1)..">\n")
sI = sVer..tostring(nS+1)..sCat
end
end
end; nL = nL + 1
fOut:write(sI..sEnd)
sI = fInp:read()
end
io.write("------------------ FINISH ------------------\n")
fOut:flush()
fOut:close()
fInp:close()

if(fLog) then
fLog:flush()
fLog:close()
end


-- Test in CMD:
-- ..\..\bin\lua.exe go.lua "E:\Documents\Lua-Projs\SVN\TrackAssemblyTool_GIT_master\lua\autorun\trackassembly_init.lua" "Rev." "UNX"
-- Call in CMD: Script { LUA_PATH, LOG_FILE }
-- Work: E:\Documents\Lua-Projs\SVN\TrackAssemblyTool_GIT_master\hooks\pre-commit.bat E:\Documents\Lua-Projs\Lua\Bin\ E:\Desktop\tmp.txt
-- Home:

local sLog = tostring(arg[4]) -- "test.lua"
if((sLog == "nil") or (string.len(sLog) == 0)) then
io.write("No output log file")
else
sLog = sLog:gsub("\\","/")
fLog = io.open(sLog,"a+")
if(fLog) then io.output(fLog) end
end

io.write("------------------ ARG ------------------\n")
io.write("arg[1]<"..tostring(arg[1])..">\n")
io.write("arg[2]<"..tostring(arg[2])..">\n")
io.write("arg[3]<"..tostring(arg[3])..">\n")
io.write("arg[4]<"..tostring(arg[4])..">\n")
local sBase = tostring(arg[1])
sBase = sBase:gsub("\\","/")
if((sBase == "nil") or (string.len(sBase) == 0)) then
io.write("No file\n")
return false
end
io.write("------------------ FILE ------------------\n")
local sOut = tostring(arg[2]) -- "test.lua"
if((sOut == "nil") or (string.len(sOut) == 0)) then
io.write("No output file")
return false
end
local sOut = sBase..sOut
local sInp = sBase.."tmp.lua"
io.write("<"..sOut..">\n<"..sInp..">\n")
io.write("------------------ END ------------------\n")
local sEnd = tostring(arg[3])
if((sEnd == "nil") or (string.len(sEnd) == 0)) then
io.write("No end-line\n")
return false
end
if(not (sEnd == "DOS" or sEnd == "UNX")) then
io.write("Wrong end line mode: -"..sEnd.."-\n")
return false
end
if(sEnd == "DOS") then sEnd = "\r\n" end
if(sEnd == "UNX") then sEnd = "\n" end
io.write("------------------ OPEN FILE ------------------\n")
local fOut = io.open(sOut,"w+")
local fInp = io.open(sInp,"r+")
if(not fOut) then
io.write("File "..sOut.." not found\n")
return false
end
if(not fInp) then
io.write("File "..sInp.." not found\n")
return false
end
io.write("------------------ STORE ------------------\n")
local sI = fInp:read()
if(not sI) then
io.write("File "..sInp.." reached EOF\n")
return false
end
local sO, sCat = "", ""
local sLog = "asmlib.SetLogControl("
local sVer = "asmlib.SetOpVar(\"TOOL_VERSION\",\"5."
local nB, nE, nS, nL, sL = 1, 1, 1, 1, ""
while(sI) do
sL = "["..tostring(nL).."]"
nB, nE = sI:find(sLog,1,true)
if(nB and nE) then
sCat = "0,\"\")"
io.write("Disable logs"..sL.."[1]:Found at <"..tostring(nB).."> to <"..tostring(nE).."> end <"..sCat..">\n")
nB = sI:find(",",1,true)
if(nB and tonumber(sI:sub(nE+1,nB-1))) then
io.write("Disable logs"..sL.."[2]:Number at <"..tostring(nB).."> string <"..tostring(sI:sub(nE+1,nB-1)).."> to <"..tonumber(sI:sub(nE+1,nB-1)).."> Updated !\n")
sI = sLog..sCat
end
end
nB, nE = sI:find(sVer,1,true)
if(nB and nE) then
sCat = "\")"
io.write("Increment the version"..sL.."[1]: Found at <"..tostring(nB).."> to <"..tostring(nE).."> end <"..sCat..">\n")
nB = sI:find(sCat,1,true)
if(nB) then
nS = tonumber(sI:sub(nE+1,nB-1))
io.write("Increment the version"..sL.."[2]: String <"..tostring(sI:sub(nE+1,nB-1)).."> to <"..tostring(nS)..">\n")
if(nS) then
io.write("Increment the version"..sL.."[3]: Increment <"..tostring(nS+1).."> Updated !\n")
sI = sVer..tostring(nS+1)..sCat
end
end
end; nL = nL + 1
fOut:write(sI..sEnd)
sI = fInp:read()
end
io.write("------------------ FINISH ------------------\n")
fOut:flush()
fOut:close()
fInp:close()

if(fLog) then
fLog:flush()
fLog:close()
end


File renamed without changes.
File renamed without changes
Binary file added data/pictures/pointassist.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/pictures/screenshot.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/pictures/snapadvaiser.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/pictures/surfsnap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions data/todo.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
V - Checked
X - Fail
D - Discontinued
N - Not applicable
? - Not yet tested
40 changes: 20 additions & 20 deletions addon.json → data/workshop/addon.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
{
"title" : "Track Assembly Tool",
"type" : "tool",
"tags" : [ "fun", "build" ],
"ignore" :
[
"*.psd",
"*.vcproj",
"*.svn*",
"*.git*",
"*hooks*",
"*data*",
"license",
"workshop_publish.bat",
"addon.txt",
"key.txt",
"readme.md",
"icon.jpg"
]
}
{
"title" : "Track Assembly Tool",
"type" : "tool",
"tags" : [ "fun", "build" ],
"ignore" :
[
"*.psd",
"*.vcproj",
"*.svn*",
"*.git*",
"*hooks*",
"*data*",
"license",
"workshop_publish.bat",
"addon.txt",
"key.txt",
"readme.md",
"icon.jpg"
]
}
12 changes: 6 additions & 6 deletions addon.txt → data/workshop/addon.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"AddonInfo"
{
"name" "Track Assembly Tool"
"author_name" "DVD"
"info" "Assembles a track for vehicles to run on xD"
}
"AddonInfo"
{
"name" "Track Assembly Tool"
"author_name" "DVD"
"info" "Assembles a track for vehicles to run on xD"
}
File renamed without changes.
10 changes: 0 additions & 10 deletions hooks/pre-commit.bat

This file was deleted.

7 changes: 3 additions & 4 deletions lua/autorun/trackassembly_init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ local asmlib = trackasmlib

------ CONFIGURE ASMLIB ------
asmlib.InitAssembly("track","assembly")
asmlib.SetOpVar("TOOL_VERSION","5.225")
asmlib.SetOpVar("TOOL_VERSION","5.226")
asmlib.SetLogControl(0,"")
asmlib.SetIndexes("V",1,2,3)
asmlib.SetIndexes("A",1,2,3)
Expand Down Expand Up @@ -116,11 +116,10 @@ if(CLIENT) then
while(iNdex <= iSize) do
vItem = pnElements:Select(iNdex)
if(IsValid(vItem.Panel)) then
vItem.Panel:Remove()
asmlib.LogInstance("OPEN_FRAME: Deleted panel ID #"..iNdex)
vItem.Panel:Remove(); vItem = "and panel"
end
pnElements:Delete(iNdex)
asmlib.LogInstance("OPEN_FRAME: Deleted entry ID #"..iNdex)
asmlib.LogInstance("OPEN_FRAME: Deleted entry "..vItem.." ID #"..iNdex)
iNdex = iNdex + 1
end
pnFrame:Remove()
Expand Down
6 changes: 3 additions & 3 deletions lua/weapons/gmod_tool/stools/trackassembly.lua
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ if(CLIENT) then
languageAdd("tool."..gsToolNameL..".mcspawn" , "Spawns the piece at the mass-centre, else spawns relative to the active point chosen")
languageAdd("tool."..gsToolNameL..".surfsnap" , "Snaps the piece to the surface the player is pointing at")
languageAdd("tool."..gsToolNameL..".adviser" , "Controls rendering the tool position/angle adviser")
languageAdd("tool."..gsToolNameL..".pntasist" , "Controls rendering the tool snap point assistant")
languageAdd("tool."..gsToolNameL..".pntasist" , "Controls rendering the tool snap point assistant")
languageAdd("tool."..gsToolNameL..".ghosthold", "Controls rendering the tool ghosted holder piece")
languageAdd("cleanup."..gsToolNameL , "Undone assembly")
languageAdd("cleaned."..gsToolNameL.."s", "Cleaned up all Pieces")
Expand Down Expand Up @@ -391,7 +391,7 @@ function TOOL:GetStatus(stTrace,anyMessage,hdEnt)
sDu = sDu..sSpace.." HD.IgnoreType: <"..tostring(self:GetIgnoreType())..">"..sDelim
sDu = sDu..sSpace.." HD.SurfSnap: <"..tostring(self:GetSurfaceSnap())..">"..sDelim
sDu = sDu..sSpace.." HD.PntAssist: <"..tostring(self:GetPointAssist())..">"..sDelim
sDu = sDu..sSpace.." HD.GhostHold: <"..tostring(self:GetGhostHolder())..">"..sDelim
sDu = sDu..sSpace.." HD.GhostHold: <"..tostring(self:GetGhostHolder())..">"..sDelim
sDu = sDu..sSpace.." HD.PhysMeter: <"..tostring(self:GetPhysMeterial())..">"..sDelim
sDu = sDu..sSpace.." HD.ActRadius: <"..tostring(self:GetActiveRadius())..">"..sDelim
sDu = sDu..sSpace.." HD.SkinBG: <"..tostring(self:GetBodyGroupSkin())..">"..sDelim
Expand Down Expand Up @@ -1241,7 +1241,7 @@ function TOOL.BuildCPanel(CPanel)
Label = "Draw assistant",
Command = gsToolPrefL.."pntasist"})
pItem:SetTooltip(languageGetPhrase("tool."..gsToolNameL..".pntasist"))

pItem = CPanel:AddControl("Checkbox", {
Label = "Draw holder ghost",
Command = gsToolPrefL.."ghosthold"})
Expand Down
Loading

0 comments on commit 8ebf73e

Please sign in to comment.