diff --git a/SteamWareLib/fileMover.cs b/SteamWareLib/fileMover.cs index 7857385..d83036d 100644 --- a/SteamWareLib/fileMover.cs +++ b/SteamWareLib/fileMover.cs @@ -456,6 +456,37 @@ namespace SteamWare /// /// scrive il file dallo stream byte[] inviato /// + /// + /// + /// + /// + public bool salvaFileBuffer(string _path, string _nomeFile, byte[] _fileBuffer) + { + _workPath = _path; + DirectoryInfo _di = getDirectoryInfo(_path, true); + if (!_di.Exists) + { + _di.Create(); + } + FileInfo _fi = getFileInfoByName(_path, _nomeFile); + Stream _stream; + if (!_fi.Exists) + { + _stream = _fi.Create(); + } + else + { + _stream = _fi.OpenWrite(); + } + _stream.Write(_fileBuffer, 0, _fileBuffer.Length); + _stream.Flush(); + _stream.Close(); + + return true; + } + /// + /// scrive il file dallo stream byte[] inviato + /// /// /// /// @@ -485,6 +516,17 @@ namespace SteamWare /// /// scrive il file dalla stringa inviata /// + /// + /// + /// + /// + public bool salvaFileString(string _path, string _nomeFile, string _fileString) + { + return salvaFileBuffer(_path, _nomeFile, strToByte(_fileString)); + } + /// + /// scrive il file dalla stringa inviata + /// /// /// /// @@ -552,7 +594,7 @@ namespace SteamWare // verifica directory _pathFrom = verDir(_pathFrom); _pathTo = verDir(_pathTo); - FileInfo _fi = getFileInfoByName(_nomeFile); + FileInfo _fi = getFileInfoByName(_pathFrom, _nomeFile); try { _fi.CopyTo(_pathTo + _nomeFile, true);