public void Discard(CompositionDiagramElement element, bool isComposition) { if (element == null) { throw new ArgumentNullException(nameof(element)); } var path = isComposition ? _compositionsPath : _strategiesPath; var file = Path.Combine(path, element.GetFileName()); var settings = CultureInfo.InvariantCulture.DoInCulture(() => _serializer.Deserialize(file)); _compositionRegistry.Load(element, settings); }
private void LoadElements() { foreach (var element in ConfigurationExtensions.GetDiagramElements()) { _compositionRegistry.DiagramElements.Add(element); } if (!Directory.Exists(_compositionsPath)) { Directory.CreateDirectory(_compositionsPath); } var files = Directory.GetFiles(_compositionsPath, "*.xml"); foreach (var file in files) { try { _compositionRegistry.Load(_serializer.Deserialize(file)); } catch (Exception excp) { this.AddErrorLog("Load {0} composition element error: {1}", file, excp); } } _compositions.Clear(); _compositions.AddRange(DiagramElements.OfType <CompositionDiagramElement>()); }
private void LoadElements() { foreach (var element in ConfigurationExtensions.GetDiagramElements()) { _compositionRegistry.DiagramElements.Add(element); } if (!Directory.Exists(_compositionsPath)) { Directory.CreateDirectory(_compositionsPath); } var files = Directory.GetFiles(_compositionsPath, "*.xml"); foreach (var file in files) { try { _compositionRegistry.Load(_serializer.Deserialize(file)); } catch (Exception excp) { this.AddErrorLog(LocalizedStrings.Str3046Params, file, excp); } } }
private void InitializeCompositions() { var compositionSerializer = new CompositionRegistry(); ConfigManager.RegisterService(compositionSerializer); compositionSerializer.DiagramElements.AddRange(AppConfig.Instance.DiagramElements.Select(t => t.CreateInstance <DiagramElement>())); Directory.GetFiles("Compositions", "*.xml").Select(File.ReadAllText).ForEach(s => compositionSerializer.Load(s.LoadSettingsStorage(), true)); }
private void InitializeCompositions() { var compositionSerializer = new CompositionRegistry(); ConfigManager.RegisterService(compositionSerializer); compositionSerializer.DiagramElements.AddRange(AppConfig.Instance.DiagramElements.Select(t => t.CreateInstance<DiagramElement>())); Directory.GetFiles("Compositions", "*.xml").Select(File.ReadAllText).ForEach(s => compositionSerializer.Load(s.LoadSettingsStorage(), true)); }
private void InitializeCompositions() { var compositionSerializer = new CompositionRegistry(); ConfigManager.RegisterService(compositionSerializer); compositionSerializer.DiagramElements.AddRange(Configuration.Extensions.GetDiagramElements()); Directory.GetFiles("Compositions", "*.xml").Select(File.ReadAllText).ForEach(s => compositionSerializer.Load(s.LoadSettingsStorage(), true)); }