Esempio n. 1
0
        public ImportXlFileTest() : base()
        {
            var files = Directory.GetFiles(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "ImportFiles"), _importParam.ImportFileMask());

            if (files.Length == 0)
            {
                return;
            }
            _importParam.FileName = Path.GetFileName(files[0]);
            _fileData             = File.ReadAllBytes(files[0]);
        }
Esempio n. 2
0
        public ImportFileTest() : base()
        {
            //_importParam.Format = "BD";
            //_importParam.Format = "VT";
            //_importParam.Format = "SF";
            //_importParam.Format = "ZF";
            //_importParam.Format = "NP";
            //_importParam.Format = "IP";
            _importParam.Format = "SE";
            //_importParam.Format = "CE";
            var files = Directory.GetFiles(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "ImportFiles"), _importParam.ImportFileMask());

            if (files.Length == 0)
            {
                return;
            }
            _importParam.FileName = Path.GetFileName(files[0]);
            var enc = CodePagesEncodingProvider.Instance.GetEncoding(1251);

            using (StreamReader filereader = new StreamReader(files[0], enc))
            {
                // var str64 = Convert.ToBase64String(bytes);
                _fileData = Encoding.UTF8.GetBytes(filereader.ReadToEnd());
            }
        }