On 29 oct, 09:47, Brian Roisentul <brianroisen...@hotmail.comwrote:
On 26 oct, 18:12, "Rad [Visual C# MVP]" <r...@nospam.comwrote:
On Fri, 26 Oct 2007 06:46:33 -0700, Brian Roisentul
<brianroisen...@hotmail.comwrote:
>Hi everyone,
>I've been investigating for a while about this, but with no luck yet.
>Does anybody know a way to do it?
>Many thanks,
>Brian
Take a look at the 7zip SDK ... it may allow you to programmatically
create a spanned archive
--http://bytes.thinkersroom.com
I'll try this, thanks.
But I just wanted to know something also...
Spliting a file and then merging it back must work? Even with
"complex" files' types?
I'm asking this because I tried it with a ".txt" file and it worked,
but then, when i tried with an excel file with vb code inside, when i
opened it, it threw me a message like something was wrong, but then I
could see the grid's content, but the vb code wasn't there any more.
The file's size was the same than the original and all.
Then, when i tried it with a SharePoint's backup file (*.fwp) and
tried to restore a site through command line, i got an error saying
the file was corrupted or something like that.
Thanks again,
Brian- Ocultar texto de la cita -
- Mostrar texto de la cita -
BTW, this is my code, maybe i did something wrong:
//Note: this.ext is a string property which represents the file's
extension.
/
************************************************** **************************
splitFile procedure
************************************************** **************************/
private void splitFile( string path, string path_parts, long
size_part )
{
long parts=0;
try
{
using ( FileStream fs = new FileStream( path, FileMode.Open ) )
{
flength = fs.Length;
parts = fs.Length / long.Parse( size_part.ToString() );
if ( parts 0 )
{
for ( int i = 0; i < parts; i++ )
{
string filename= Path.Combine( path_parts, "spfile" +
i.ToString() + this.ext );
using ( FileStream fsOut = new FileStream( filename,
FileMode.Create ) )
{
byte[] arrBytes = new byte[ flength ];
int offSet = ( int ) (size_part * i ) + ( ( i>0 ) ? 1 : 0 );
int count = ( int ) size_part;
int ret = fs.Read( arrBytes, offSet, count );
fsOut.Write( arrBytes, offSet, count );
arrBytes = null;
}
}
}
}
}
catch {
throw;
}
}
/
************************************************** **************************
buildFile procedure
************************************************** **************************/
private void buildFile( string path_parts, long size_part, long
flength, string path_out )
{
try
{
byte[] arrBytes=null;
string filename_out= Path.Combine( path_out, "spfile_out" +
this.ext );
long parts = ( size_part != 0 ) ? flength /
long.Parse( size_part.ToString() ) : 0;
byte[] arrBytes_out= new byte[ flength ];
for ( int i = 0; i < parts; i++ )
{
string filename= Path.Combine( path_parts, "spfile" +
i.ToString() + this.ext );
using ( FileStream fs = new FileStream( filename,
FileMode.Open ) )
{
arrBytes = new byte[ size_part ];//fs.Length
int ret = fs.Read( arrBytes, 0, Convert.ToInt32( size_part ) );//
fs.Length
arrBytes.CopyTo( arrBytes_out, i * size_part );
}
}
using ( FileStream fsOut = new FileStream( filename_out,
FileMode.Create ) )
fsOut.Write( arrBytes_out, 0, Convert.ToInt32( flength ) );
}
catch( Exception ex )
{
throw;
}
}