Пример #1
0
        public static BagInstance FromPyTKAdditionalSaveData(Dictionary <string, string> PyTKData)
        {
            if (PyTKData != null && PyTKData.TryGetValue(PyTKSaveDataKey, out string DataString))
            {
                if (XMLSerializer.TryDeserializeFromString(DataString.Replace(PyTKEqualsSignEncoding, "="), out BagInstance Data, out Exception Error))
                {
                    return(Data);
                }
            }

            return(null);
        }
Пример #2
0
        public Dictionary <string, string> ToPyTKAdditionalSaveData()
        {
            Dictionary <string, string> SaveData = new Dictionary <string, string>();

            if (XMLSerializer.TrySerializeToString(this, out string DataString, out Exception Error))
            {
                string CompatibleDataString = DataString.Replace("=", PyTKEqualsSignEncoding); // PyTK Mod doesn't like it when the Value contains '=' characters (the string will be truncated in ISaveElement.rebuild), so replace = with something else
                SaveData.Add(PyTKSaveDataKey, CompatibleDataString);
            }

            return(SaveData);
        }