public DataBridgeInfo LoadDataBridgeInDirectory(string configDirectory, bool createNewWhenNotExist = false) { if (string.IsNullOrEmpty(configDirectory)) { return(null); } DataBridgeInfo currentDataBridgeInfo = null; var path = Path.Combine(configDirectory, this.ConfigName); if (createNewWhenNotExist) { currentDataBridgeInfo = LoadOrCreateNewDataBridge(path); } else { currentDataBridgeInfo = LoadDataBridge(path); } return(currentDataBridgeInfo); }
public DataBridgeInfo CreateNewDataBridge(string fileName) { if (string.IsNullOrEmpty(fileName)) { return(null); } var dataBridgeInfo = new DataBridgeInfo(); dataBridgeInfo.SetDefaultValues(); var configDirectory = Path.GetDirectoryName(fileName); DirectoryUtil.CreateDirectoryIfNotExists(configDirectory); this.SaveDataBridge(fileName, dataBridgeInfo); var defaultPipeline = this.CreateDefaultPipeline(); Pipeline.Save(dataBridgeInfo.PipelineInfos.First().FileName, defaultPipeline); return(dataBridgeInfo); }
public DataBridgeInfo LoadOrCreateNewDataBridge(string fileName) { DataBridgeInfo dataBridgeInfo = null; if (File.Exists(fileName)) { try { dataBridgeInfo = this.LoadDataBridge(fileName); } catch (Exception ex) { throw; // CreateNewDataBridge(fileName); } } else { dataBridgeInfo = this.CreateNewDataBridge(fileName); } return(dataBridgeInfo); }
public void SaveDataBridge(Stream stream, DataBridgeInfo dataBridgeInfo) { var serializer = new XmlSerializerHelper <DataBridgeInfo>(); serializer.Save(stream, dataBridgeInfo); }
public void SaveDataBridge(string fileName, DataBridgeInfo dataBridgeInfo) { var serializer = new XmlSerializerHelper <DataBridgeInfo>(); serializer.Save(fileName, dataBridgeInfo); }