Homever there isnt some kind of Save function there.
So, how is this class useful? I heard that its used in gamemodes.
Thanks for answer.

Moderator: English Moderator
i checked it and there is no text after Ctrl+G twicedomino54 wrote:Check the manialink exchange and press Ctrl + G twice, search for githubusercontent.com or dominolink.aq.pl and see how it's used (a lot).
Code: Select all
// create document
declare CXmlDocument Document = XML.Create(ApiResponseString);
declare CXmlNode Root = Document.Root;
// iterate over items
declare i = 0;
foreach (Node in Root.Children) {
// Just a little (useless) example on what to do with the data
MyLabels[i].Value = """TagName: {{{Node.Name}}}, Attribute 'data': {{{Node.GetAttributeText("data", "not set")}}}""";
i += 1;
}
Yes it's possible with the Http API using a file:// address instead of a web url.zocka wrote:I don't know if gamemodes can read local XML config files
Code: Select all
declare Request <=> Http.CreateGet("file://Media/Path/To/My/File.xml", False);
Code: Select all
declare CXmlDocument xmlFile;
xmlFile.TextContents = Http.CreateGet("file://Media/Path/To/My/File.xml", False).Result;
Just declaring xmlFile will result in xmlFile being Null and thus not having the property TextContents.BigBang1112 wrote:If I understand this right, these 2 line above will work and read the file as CXmlDocument?Code: Select all
declare CXmlDocument xmlFile; xmlFile.TextContents = Http.CreateGet("file://Media/Path/To/My/File.xml", False).Result;
Code: Select all
declare CXmlDocument xmlFile;
...
declare CHttpRequest RequestToLocalFile;
declare Boolean RequestToLocalFilePending;
...
RequestToLocalFile = Http.CreateGet("file://Media/Path/To/My/File.xml", False);
RequestToLocalFilePending = True;
...
while(True) {
yield;
if (RequestToLocalFilePending && RequestToLocalFile.IsCompleted) {
RequestToLocalFilePending = False;
if (RequestToLocalFile.StatusCode == 200) {
xmlFile = Xml.Create(RequestToLocalFile.Result);
doSomethingWithTheData(xmlFile);
} else {
log("probably local file was not found");
}
Http.Destroy(RequestToLocalFile);
}
}
Users browsing this forum: No registered users and 3 guests