internal bool Prepare() { if ((_config = Serializer.DeserializeItem <Config>(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetName().CodeBase), "config.config").Replace("file:\\", ""))) == null) { _config = Config.GetDefaultConfig(); Serializer.SerializeItem(_config, Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetName().CodeBase), "config.config").Replace("file:\\", "")); return(false); } Directory.CreateDirectory(_config.InputPath); Directory.CreateDirectory(_config.LogPath); Directory.CreateDirectory(_config.OutputFolder); Directory.CreateDirectory(_config.UserLogFolder); _logger = new FileLogger(_config.LogPath); _userLogger = new FileLogger(_config.UserLogFolder); _filesInProcess = new List <string>(); LogWriter.AddLogger(_logger, _config.LogLevel); LogWriter.AddLogger(_userLogger, LogDepth.UserLevel); try { _processedFiles = Serializer.DeserializeItem <List <string> >(_config.ProcessedCSVs); if (_processedFiles == null) { _processedFiles = new List <string>(); } _converter = new CSVOperator(); return(true); } catch (Exception e) { LogWriter.LogMessage(e.Message, LogDepth.UserLevel); LogWriter.LogMessage(e.StackTrace, LogDepth.Debug); return(false); } }
private void WriteNoneDependencyCSVFile(string resultDir, List <string> csvDataTbl) { if (string.IsNullOrEmpty(resultDir)) { return; } string resultFilePath = resultDir + "无引用_" + DateTime.Now.ToString(m_dataFormat) + ".csv"; CSVOperator.WriteFile(resultFilePath, csvDataTbl.ToArray()); }
private void WriteCSVFile(string filePath, List <string> csvDataTbl, out string fixFilePath) { fixFilePath = string.Empty; if (string.IsNullOrEmpty(filePath)) { return; } fixFilePath = filePath + "Atlas一致性检查结果_" + DateTime.Now.ToString(m_dataFormat) + ".csv"; CSVOperator.WriteFile(fixFilePath, csvDataTbl.ToArray()); }
public static UploadConfig SetThingsAndDirs(string filepath) { var result = CSVOperator.LoadCSVFile(filepath); var config = new UploadConfig(); config.AIThings = new string[result.Count - 1]; config.ServerDataDirectories = new string[result.Count - 1]; for (int i = 1; i < result.Count; i++) { config.AIThings[i - 1] = result[i][0]; config.ServerDataDirectories[i - 1] = result[i][1]; } return(config); }
public static Channel[] SetChannel(string filepath) { var result = CSVOperator.LoadCSVFile(filepath); var channels = new Channel[result.Count - 1]; //第一行是说明 for (int i = 1; i < result.Count; i++) { channels[i - 1] = new Channel(); channels[i - 1].SourceAIData = result[i][0] + @"/data/" + result[i][1]; channels[i - 1].SourceAISampleRate = result[i][0] + @"/samplerate"; channels[i - 1].SourceAILength = result[i][0] + @"/length"; channels[i - 1].SourceAIStartTime = result[i][0] + @"/starttime"; channels[i - 1].Tag = result[i][2]; channels[i - 1].Enable = true; } return(channels); }
private void WriteDependencyCSVFile(string resultDir, string assetPath, List <string> csvDataTbl) { if ( string.IsNullOrEmpty(resultDir) || string.IsNullOrEmpty(assetPath) ) { return; } string resultFilePath = string.Empty; string assetName = Path.GetFileNameWithoutExtension(assetPath); string assetExtension = Path.GetExtension(assetPath); //resultDir = resultDir + "正向引用_" + DateTime.Now.ToString(m_dataFormat) + @"/"; if (!Directory.Exists(resultDir)) { Directory.CreateDirectory(resultDir); } resultFilePath = resultDir + assetName + "(" + assetExtension + ").csv"; CSVOperator.WriteFile(resultFilePath, csvDataTbl.ToArray()); }