Ejemplo n.º 1
0
        public bool SaveOverlayEntriesToJson()
        {
            try
            {
                var persistence = new OverlayEntryPersistence()
                {
                    OverlayEntries = _overlayEntries.Select(entry => entry as OverlayEntryWrapper).ToList()
                };

                var json = JsonConvert.SerializeObject(persistence);
                File.WriteAllText(JSON_FILE_NAME, json);

                return(true);
            }
            catch { return(false); }
        }
Ejemplo n.º 2
0
        public bool SaveOverlayEntriesToJson()
        {
            try
            {
                var persistence = new OverlayEntryPersistence()
                {
                    OverlayEntries = _overlayEntries.Select(entry => entry as OverlayEntryWrapper).ToList()
                };

                var json = JsonConvert.SerializeObject(persistence);

                if (!Directory.Exists(OVERLAY_CONFIG_FOLDER))
                {
                    Directory.CreateDirectory(OVERLAY_CONFIG_FOLDER);
                }

                File.WriteAllText(GetConfigurationFileName(), json);

                return(true);
            }
            catch { return(false); }
        }
Ejemplo n.º 3
0
        public async Task SaveOverlayEntriesToJson()
        {
            try
            {
                var persistence = new OverlayEntryPersistence()
                {
                    OverlayEntries = _overlayEntries.Select(entry => entry as OverlayEntryWrapper).ToList()
                };

                var json = JsonConvert.SerializeObject(persistence);

                if (!Directory.Exists(OVERLAY_CONFIG_FOLDER))
                {
                    Directory.CreateDirectory(OVERLAY_CONFIG_FOLDER);
                }

                using (StreamWriter outputFile = new StreamWriter(GetConfigurationFileName()))
                {
                    await outputFile.WriteAsync(json);
                }
            }
            catch { return; }
        }