login about faq

I have a current support contract for Chilkat.

I am using code based on: http://www.example-code.com/csharp/facSplitFile.asp

I modified it slightly as follows so it uses my filename:

        Chilkat.FileAccess fac = new Chilkat.FileAccess();

        bool success;

        //  Any type of file may be split.  It doesn't matter if it's
        //  a binary file or a text file.
        string fileToSplit;
        fileToSplit = @"D:\ChilkatTest\Snap10.png";

        string partPrefix;
        partPrefix = "hamlet";
        string partExtension;
        partExtension = "spl";
        int maxChunkSize;
        maxChunkSize = 50000;
        string destDirPath;
        destDirPath = @"D:\ChilkatTest\";

        fac.VerboseLogging = true;

        //This will return true so I know the file is being found by Chilkat

        success = fac.FileExists(fileToSplit);

        if (success == true)
        {
            MessageBox.Show("Success.");
        }
        else
        {
            MessageBox.Show(fac.LastErrorText);
            Console.WriteLine(fac.LastErrorText);
        }

        //  Splits hamlet.xml into hamlet1.spl, hamlet2.spl, ...
        //  Output files are written to the current working directory.
        //  Each chunk will be 50000 bytes except for the last which
        //  will be the remainder.
        success = fac.SplitFile(fileToSplit, partPrefix, partExtension, maxChunkSize, destDirPath);

        if (success == true)
        {
            MessageBox.Show("Success.");
        }
        else
        {
            MessageBox.Show(fac.LastErrorText);
        }
    }

But I am getting this error which does not really tell me why it failed:

ChilkatLog:
  SplitFile:
    DllDate: Jan 16 2014
    ChilkatVersion: 9.5.0.5
    UnlockPrefix: NONE
    Username: OS-IT:OS-IT
    Architecture: Little Endian; 32-bit
    Language: .NET 2.0
    VerboseLogging: 1
    path: D:\ChilkatTest\Snap10.png
    prefix: hamlet
    extension: spl
    partSize: 50000
    bufSize: 200000
    Failed.
  --SplitFile

My Snap10.png file is located in the D:ChilkatTest directory and it is 15.5k. I even lowered the maxChunkSize to 5000 but it still errors out.

I have also tried this with other files and larger ones but the same error occurs.

Can you tell me what is causing this problem?

asked Feb 24 '14 at 11:41

fraXis's gravatar image

fraXis
164710

edited Feb 24 '14 at 11:41


Thanks, I'm investigating...

link

answered Feb 24 '14 at 16:20

chilkat's gravatar image

chilkat ♦♦
11.8k316358420

Thanks Matt for the great support and fast turn around on the fix.

I will test this out.

link

answered Feb 24 '14 at 19:46

fraXis's gravatar image

fraXis
164710

The ability to file split works great. Thanks for fixing that.

However, when I go to reassemble the file using this example:

http://www.example-code.com/csharp/facReassembleFile.asp



Chilkat reports success, but the reassembled file has a file size of 0.

Here is the output of LastErrorText:

ChilkatLog:
  ReassembleFile:
    DllDate: Feb 24 2014
    ChilkatVersion: 9.5.0.14
    UnlockPrefix: NONE
    Username: OANDS-IT:O&S-IT
    Architecture: Little Endian; 32-bit
    Language: .NET 2.0
    VerboseLogging: 1
    Failed to open file (2)
    localFilePath: .\Snap101.spl
    currentWorkingDirectory: C:\Users\O&S-IT\Desktop\ChilkatSplit\ChilkatSplit\ChilkatSplit\bin\Debug
    osErrorInfo: The system cannot find the file specified.
    localWindowsFilePath: .\Snap101.spl
    Failed to open file data source.
    Success.
  --ReassembleFile
--ChilkatLog



I noticed it says there is a path problem, but Chilkat still reports success when this line of code is executed:

 success = fac.ReassembleFile(srcDirPath, partPrefix, partExtension, reassembledFilename);


Here is my code for reassembling the file:

    Chilkat.FileAccess fac = new Chilkat.FileAccess();

    bool success;

    //  Any type of file may be reassembled.  It doesn't matter if it's
    //  a binary file or a text file.
    string reassembledFilename;
    reassembledFilename = @"D:\ChilkatTest\2ASArchive4";

    string partPrefix;
    partPrefix = "Snap10";
    string partExtension;
    partExtension = "spl";
    string srcDirPath;
    srcDirPath = ".";
    fac.VerboseLogging = true;

    //  Reassembles the original file from hamlet1.spl, hamlet2.spl, ...
    success = fac.ReassembleFile(srcDirPath, partPrefix, partExtension, reassembledFilename);

    if (success == true)
    {
        MessageBox.Show("Success.");
    }
    else
    {
        MessageBox.Show(fac.LastErrorText);
    }

        MessageBox.Show(fac.LastErrorText);
link

answered Feb 25 '14 at 12:10

fraXis's gravatar image

fraXis
164710

The reason it reports success is that it will assemble parts until it fails on the next index. In this case, it failed on the 1st index (the 1st part) and in this special case it should return false. I made the fix and will provide an update later today..

link

answered Feb 25 '14 at 12:23

chilkat's gravatar image

chilkat ♦♦
11.8k316358420

link

answered Feb 26 '14 at 09:23

chilkat's gravatar image

chilkat ♦♦
11.8k316358420

Thanks Matt for the update.

Works perfect now.

Is it alright to use this build in a production environment?

(Feb 27 '14 at 11:51) fraXis

Yes, this should be fine for production.

(Feb 27 '14 at 12:43) chilkat ♦♦
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or __italic__
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×98

Asked: Feb 24 '14 at 11:41

Seen: 1,059 times

Last updated: Feb 27 '14 at 12:43

powered by OSQA