예제 #1
0
        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);
        }
예제 #2
0
        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);
        }
예제 #3
0
        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);
        }
예제 #4
0
        public void SaveDataBridge(Stream stream, DataBridgeInfo dataBridgeInfo)
        {
            var serializer = new XmlSerializerHelper <DataBridgeInfo>();

            serializer.Save(stream, dataBridgeInfo);
        }
예제 #5
0
        public void SaveDataBridge(string fileName, DataBridgeInfo dataBridgeInfo)
        {
            var serializer = new XmlSerializerHelper <DataBridgeInfo>();

            serializer.Save(fileName, dataBridgeInfo);
        }