Jump to content

Large xml file is not saved using robotManager.Helpful.Setting


Pudge
 Share

Recommended Posts

Hello.

I'm using robotManager.Helpful.Setting to save my big database in xml. The problem is that if the xml file size exceeds above 210 megabytes, then the data is not saved to the file on disk. Can this be fixed, or is there an alternative save method?

Link to comment
Share on other sites

Thanks for the quick response. The database contains various data about NPCs, objects, players in the lists of the classes with data, it is quite large (almost 15 million lines in each xml document for different game servers), and it is unlikely that I will be able to convert it to another type. So why can't it be saved to disk if the file is larger than 210 megabytes? Possible reasons?

Link to comment
Share on other sites

Try to use C# API to read your file https://www.google.com/search?q=XML+Serialization+and+Deserialization+c%23 or wrobot api https://wrobot.eu/byme/doc/html/AllMembers.T-robotManager.Helpful.XmlSerializer.htm (but avoid to use "Setting", I added few protections to avoid corrupted files this can impact performance)

Link to comment
Share on other sites

@PudgeHere is what i am using for XML, note it could look / be better but it works for what i use it for.

 

public class XMLSerialization
{
    public static void Serialize(String Path, object @ObjectType)
    {
        using (var stream = new FileStream(Path, FileMode.Create))
        {
            var Serialize = new XmlSerializer(@ObjectType.GetType());
            Serialize.Serialize(stream, @ObjectType);
        }
    }

    public static T Deserialize<T>(String Path)
    {
        Object Temp;
        XmlSerializer x = new XmlSerializer(typeof(T));
        try
        {
            Temp = (T)x.Deserialize(new StringReader(File.ReadAllText(Path)));
        }
        catch(Exception)
        {
            Temp = null;
        }
        return (T)Temp;
    }
}

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...