Update Server.pb, Object.pbi, kidney.ini, and 3 more files

This commit is contained in:
2026-09-30 22:41:50 +02:00
parent 6b408c8c75
commit 8292d30917
6 changed files with 125 additions and 20 deletions
+64 -1
View File
@@ -1,9 +1,72 @@
XIncludeFile "../../Commons/HashMap/HashMap.pbi"
Structure YassObject
id.s
Id.s
Type.s
EndStructure
Macro YassObjectPtr : i : EndMacro
; Returns the raw value with its surrounding double quotes removed.
Procedure.s UnquoteValue(Value.s)
ProcedureReturn Trim(Trim(Value), #DQUOTE$)
EndProcedure
Procedure FreeYassObject(*Object.YassObject)
FreeStructure(*Object)
EndProcedure
; Returns a newly allocated YassObject, or #Null if the file can't be opened or lacks core values.
; The caller owns the returned object and must free it with FreeYassObject().
Procedure.YassObjectPtr FromDefinitionFile(DefFilePath.s)
Protected *Object.YassObject
; 1. Load Ini
If Not OpenPreferences(DefFilePath)
Debug "Failed to open definition file: " + DefFilePath
ProcedureReturn #Null
EndIf
; 2. Read "Object" group
If Not PreferenceGroup("Object")
Debug "Missing [Object] group in: " + DefFilePath
ClosePreferences()
ProcedureReturn #Null
EndIf
; 3. Read core values
*Object = AllocateStructure(YassObject)
*Object\Id = UnquoteValue(ReadPreferenceString("id", ""))
*Object\Type = UnquoteValue(ReadPreferenceString("type", ""))
If *Object\Id = "" Or *Object\Type = ""
Debug "Missing 'id' or 'type' in: " + DefFilePath
FreeYassObject(*Object)
ClosePreferences()
ProcedureReturn #Null
EndIf
; 4. For each other group, iterate
ExaminePreferenceGroups()
While NextPreferenceGroup()
If PreferenceGroupName() = "Object"
Continue
EndIf
; 4.1 For each value, Debug it
ExaminePreferenceKeys()
While NextPreferenceKey()
If Left(PreferenceKeyName(), 1) = "#"
Continue
EndIf
Debug PreferenceKeyName() + " = " + UnquoteValue(PreferenceKeyValue())
Wend
Wend
ClosePreferences()
ProcedureReturn *Object
EndProcedure