public override void OnLoadData()
        {
            Logger.LogDebug($"Start load map data");

            if (serializableDataManager.LoadData(Loader.Id) is byte[] data)
            {
                try
                {
                    var sw = Stopwatch.StartNew();

                    var decompress = Loader.Decompress(data);
#if DEBUG
                    Logger.LogDebug(decompress);
#endif
                    var config = Loader.Parse(decompress);
                    MarkupManager.FromXml(config, new ObjectsMap());

                    sw.Stop();
                    Logger.LogDebug($"Map data was loaded in {sw.ElapsedMilliseconds}ms; Size = {data.Length} bytes");
                }
                catch (Exception error)
                {
                    Logger.LogError("Could not load map data", error);
                }
            }
            else
            {
                Logger.LogDebug($"Saved map data not founded");
            }
        }
Exemple #2
0
        public override void OnLoadData()
        {
            Logger.LogDebug($"{nameof(Serializer)}.{nameof(OnLoadData)}");

            if (serializableDataManager.LoadData(Id) is byte[] data)
            {
                try
                {
                    var sw = Stopwatch.StartNew();

                    var decompress = Decompress(data);
#if DEBUG
                    Logger.LogDebug(decompress);
#endif
                    var config = Parse(decompress);
                    MarkupManager.FromXml(config);

                    sw.Stop();
                    Logger.LogDebug($"Data was loaded in {sw.ElapsedMilliseconds}ms; Size = {data.Length} bytes");
                }
                catch (Exception error)
                {
                    Logger.LogError(() => "Could load data", error);
                }
            }
            else
            {
                Logger.LogDebug($"Saved data not founded");
            }
        }
Exemple #3
0
        public static bool OnImportData(string file)
        {
            Logger.LogDebug($"{nameof(Serializer)}.{nameof(OnImportData)}");

            try
            {
                using (var fileStream = File.OpenRead(file))
                    using (var reader = new StreamReader(fileStream))
                    {
                        var xml    = reader.ReadToEnd();
                        var config = Parse(xml);

                        MarkupManager.FromXml(config);

                        Logger.LogDebug($"Data was imported");

                        return(true);
                    }
            }
            catch (Exception error)
            {
                Logger.LogError(() => "Could import data", error);
                return(false);
            }
        }
Exemple #4
0
 protected override void SetLoadData(XElement config) => MarkupManager.FromXml(config, new ObjectsMap(), false);
Exemple #5
0
 protected override void PlaceAsset(XElement config, ObjectsMap map) => MarkupManager.FromXml(config, map, true);