Exemplo n.º 1
0
 private Ja2Data.SlfFile.Record DownloadTxtRecord(SlfRecordText aTxtRecord)
 {
     Ja2Data.SlfFile.Record.Header _header = this.DownloadSlfRecordHeader(aTxtRecord.SlfRecordHeader);
     Ja2Data.SlfFile.Record        _rec    = new Ja2Data.SlfFile.Record(_header);
     _rec.Data = Ja2Data.Common.StringToByteArray(aTxtRecord.TextData, (int)_header.uiLength);
     return(_rec);
 }
Exemplo n.º 2
0
        public override int Upload(BinaryReader aReader, int aSlfFileId)
        {
            int _count = 0;

            foreach (Ja2Data.SlfFile.Record _file in this.FFiles)
            {
                try
                {
                    aReader.BaseStream.Position = _file.Offset;

                    SlfRecordText _textRec = new SlfRecordText();

                    _textRec.SlfFileId = aSlfFileId;

                    SlfRecordHeader _recHeader = base.CreateSlfRecordHeader(_file);
                    base.FHeaders.Add(_recHeader);
                    _textRec.TextData        = Ja2Data.Common.ByteArrayToString(aReader.ReadBytes((int)_recHeader.Length));
                    _textRec.SlfRecordHeader = _recHeader;
                    _textRec.ID = _file.FileNameExtention;



                    _textRec.UserId      = this.FUserId;
                    _textRec.DateCreated = DateTime.Now;

                    this.FSlfRecordText.Add(_textRec);

                    this.AddRecordsToDataSet();
                    _count += this.SaveChanges();
                }
                catch (Exception _exc)
                {
                    string _excMess = String.Format("Uploading file {0} exception\n", _file.FileName);
                    throw new Exception(_excMess, _exc);
                }
            }

            return(_count);
        }