Example #1
0
        public static IList <string> Run(Txt2BinModelConverterConfig config)
        {
            var converter       = new Txt2BinModelConverter(ref config);
            var outputFileNames = converter.Save();

            return(outputFileNames);
        }
Example #2
0
        private Txt2BinModelConverter(ref Txt2BinModelConverterConfig config)
        {
            if (config.Model == null)
            {
                throw (new ArgumentNullException("config.Model"));
            }
            if (string.IsNullOrWhiteSpace(config.OutputFileName))
            {
                throw (new ArgumentNullException("config.OutputFileName"));
            }


            _Model                 = config.Model;
            _BufferSize            = config.BufferSize.GetValueOrDefault(DEFAULT_BUFFER_SIZE);
            _OutputDirectoryName   = Path.GetDirectoryName(config.OutputFileName);
            _OutputFileNamePattern = Path.GetFileNameWithoutExtension(config.OutputFileName);
            _OutputFileExtension   = Path.GetExtension(config.OutputFileName);
            if (string.IsNullOrWhiteSpace(_OutputFileExtension))
            {
                _OutputFileExtension = DEFAULT_FILE_EXTENSION;
            }
            _OutputFileSizeInBytes = config.OutputFileSizeInBytes.GetValueOrDefault();
            _OutputFileNumber      = 0;
        }