DataObject saveData = ORK.SaveGame.GetSaveData();


Is there a function to convert the above SaveData to xml string?
(via scripting without registering a custom class in Ork's editor)

I want to know the Ork's method(if exits) that converts the saveData object to an xml string, saves it to the server, and converts the xml string to dataObject when loading.

Do ToXml and FromXml method exist? ( argument Dataobject type )

(Recently, I used the compressString method for string compression, but my custom string data registered in "CustomPreLoad" was not properly decompressed, making the data unreadable when i use jsonConvert)
So, I am trying to use the method using xml.
  • Getting the XML string:
    string xmlData = saveData.GetDataFile("filename", false).GetXML();
    Getting a DataObject from XML string:
    DataObject saveData = new XMLParser(xmlData, null).Parse();
    The XMLParser is in the ORKFramework.XML namespace.

    You can look up how this is used in the SaveGameHandler class.
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • edited June 2021

    public void com1 (string t) {
    compressedData = new GZipCompression ().CompressString ( t );
    }

    public void dec2 () {
    decompressedData = new GZipCompression ().DecompressString (compressedData);
    DataObject testData = new XMLParser(decompressedData, null).Parse();
    }


    After compressing about 100kb of save data (xml) through the CompressString function (result in 14kb) , when the above code is executed, the editor stops working.

    Is it because the data is too large? Or is there something wrong with the code?
    (xml string is obtained from savegame0.save file.)



    public void dec2 () {
    decompressedData = new GZipCompression ().DecompressString (compressedData2);
    testData2 = new XMLParser (decompressedData, null).Parse ();
    }
    public void dec3 () {
    testData = ORK.SaveGame.GetSaveData ();
    xmlData = testData.GetDataFile ("filename", false).GetXML ();
    compressedData2 = new GZipCompression ().CompressString (xmlData);
    }

    #2
    I tested it one more time.
    dec3 > call dec2 > freeze editor

    Why is this?
    Post edited by KESHYAS on
  • Hm, 100 kb isn't really that large - even it it freezes the editor, that should only be for a short time. If it's longer or doesn't return to normal at all it might be due to some constantly calling of that code.
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
Sign In or Register to comment.