View Single Post
  #2  
Old 25-02-2019, 11:50
JRD!'s Avatar
JRD! JRD! is offline
Registered User
 
Join Date: Sep 2015
Location: Matrix
Posts: 274
Thanks: 225
Thanked 591 Times in 168 Posts
JRD! is on a distinguished road
The key contains the same encoding and decoding information as in arc.ini except that you can add additional options that are specific to the compressor or for example automatically test whether the target system is 32 or 64 bits in order to use the version the appropriate program.

The name of the compressor you used during compression must be the same as the name of the CLS, and the programs on which it is referenced conform to those specified in the part encoding / decoding.

They do not require an arc.ini file but can search for preferences in the CLS.ini file as needed.

Exemple in C++

Code:
int ClsMain (int op, CLS_CALLBACK callback, void* instance)
{
    switch(op)
    {
    case CLS_COMPRESS:
    case CLS_DECOMPRESS:
        {   
            char param[100];
            callback(instance, CLS_GET_PARAMSTR, param, 100);  // Get method parameters as single string

            const int BUFSIZE = 4096;
            char buf[BUFSIZE];
            for (int len; (len=callback(instance, CLS_PARTIAL_READ, buf, BUFSIZE)) != 0; )
            {
                if (len<0)  return len;  // Return errcode on error
                int result = callback(instance, CLS_FULL_WRITE, buf, len);
                if (result != len)  return result<0? result : CLS_ERROR_WRITE;
            }
            return CLS_OK;
        }

    default:
        return CLS_ERROR_NOT_IMPLEMENTED;
    }
}
__________________
Practice makes perfect.
Reply With Quote