示例#1
0
        /// <summary>
        /// Receive and process station messages.
        /// </summary>
        /// <param name="message"></param>
        private void StationMessage(String message)
        {
            try
            {
                ILog.LogInfo("Received eflow system message: [{0}]", message);

                if (Regex.IsMatch(message, "(?i)(Stop|Disable|End|Exit|Close|Break|log(out|off?)|Terminate|Abort)"))
                {
                    //-- Stop and logoutr CSMs --\\
                    this.RemoveCsms(true, this.CsmNames);
                }
            }
            catch (Exception ex)
            {
                ILog.LogError(ex);
            }
        }
示例#2
0
        /// <summary>
        /// Get the page count of the specified image
        /// </summary>
        /// <param name="sourceImage">The image  path to get size from.</param>
        /// <param name="evt">Process page event</param>
        public static int GetImagePageCount(String sourceImage, object evt)
        {
            int result = 0;

            try
            {
                using (FileStream fs = new FileStream(sourceImage, FileMode.Open, FileAccess.Read))
                {
                    using (Image img = Image.FromStream(fs))
                    {
                        result = 1;
                        //-- lLoad input name if valid --\\
                        Guid           objGuid      = img.FrameDimensionsList[0];
                        FrameDimension objDimension = new FrameDimension(objGuid);

                        //-- Gets the total number of frames in the file --\\
                        result = img.GetFrameCount(objDimension);

                        if (result > 0 && evt != null && evt is CCDelegates.OnPageReadEvt)
                        {
                            for (int i = 0; i < result; i++)
                            {
                                img.SelectActiveFrame(FrameDimension.Page, i);
                                try
                                {
                                    (evt as CCDelegates.OnPageReadEvt)(evt, sourceImage, i, img as Bitmap);
                                }
                                catch (Exception ep)
                                {
                                    ILog.LogError(ep);
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                //-- not interested in error, if image was ooened it has one page probably.
                ILog.LogInfo(ex.ToString());
            }
            return(result);
        }
示例#3
0
        /// <summary>
        /// Move the files specified to a folder (dsigned for moving stuff to the error folder).
        /// </summary>
        /// <param name="targetFolder">The target folder path</param>
        /// <param name="files">The file\s and or folder\s to move.</param>
        /// <returns>A list of errors when failed along the way, empty list when successfull.</returns>
        public static String[] MoveToFolder(String targetFolder, params String[] files)
        {
            List <String> result = new List <String>();

            try
            {
                //-- Check target path --\\
                if (String.IsNullOrEmpty(targetFolder))
                {
                    result.Add("Target folder path is empty, in: " + MethodBase.GetCurrentMethod().Name);
                }
                else if (!Directory.Exists(targetFolder))
                {
                    Directory.CreateDirectory(targetFolder);
                }

                //-- check file\s array --\\
                if (files == null || files.Length <= 0)
                {
                    result.Add("No files to copy specified, in: " + MethodBase.GetCurrentMethod().Name);
                }

                if (result != null && result.Count > 0)
                {
                    return(result.ToArray());
                }

                foreach (String s in files)
                {
                    try
                    {
                        Application.DoEvents();
                        if (!String.IsNullOrEmpty(s))
                        {
                            String tempName = null;
                            int    count    = 0;
                            if (File.Exists(s))
                            {
                                tempName = Path.Combine(targetFolder, Path.GetFileName(s));
                                while (File.Exists(tempName))
                                {
                                    Application.DoEvents();
                                    count++;
                                    tempName = Path.Combine(targetFolder, String.Format("{0}_{1:0000}.{2}", Path.GetFileNameWithoutExtension(s), count, Path.GetExtension(s).Trim(' ', '.')));
                                }

                                File.SetAttributes(s, FileAttributes.Normal);
                                File.Move(s, tempName);
                            }
                            else if (Directory.Exists(s))
                            {
                                tempName = Path.Combine(targetFolder, Path.GetFileNameWithoutExtension(s));
                                while (Directory.Exists(tempName))
                                {
                                    Application.DoEvents();
                                    count++;
                                    tempName = Path.Combine(targetFolder, String.Format("{0}_{1:0000}", Path.GetFileNameWithoutExtension(s), count));
                                }

                                Directory.Move(s, tempName);
                            }
                            else
                            {
                                result.Add(String.Format("File or folder [{0}] does not exist, item is ignored in method: [{1}]", s, MethodBase.GetCurrentMethod().Name));
                                ILog.LogInfo(result[result.Count - 1]);
                            }
                        }
                    }
                    catch (Exception ep)
                    {
                        result.Add(String.Format("File or folder [{0}] failed move to [{1}], item is ignored in method: [{2}], error: [{3}]", s ?? String.Empty, targetFolder ?? String.Empty, MethodBase.GetCurrentMethod().Name, ep.ToString()));
                        ILog.LogError(ep);
                    }
                }
            }
            catch (Exception ex)
            {
                result.Add(String.Format("Error in method: [{0}], target folder [{1}], error: [{2}]", MethodBase.GetCurrentMethod().Name, targetFolder ?? String.Empty, ex.ToString()));
                ILog.LogError(ex);
            }
            return(result.ToArray());
        }
示例#4
0
        /// <summary>
        /// Read collection definitions from DataTable and load into a CCCollection definition
        /// </summary>
        /// <param name="cfg">The configuration to use.</param>
        /// <param name="errCode">Returns the erroro code for this function.</param>
        /// <param name="errMsg">Will contain all the errors that this function has encountered</param>
        /// <param name="copySourceFiles">Copy source files</param>
        /// <param name="createdFiles">A list of files created durning process. (like XML to PRD)</param>
        /// <param name="dbCollectionData">The data table containing the data for the collection.</param>
        /// <returns>Return a CCCollection from the specified collection data.</returns>
        public static CCCollection FromDataTable(CCConfiguration.CCConfigurationData cfg, out int errCode, out String errMsg, bool copySourceFiles, out String[] createdFiles, DataTable dbCollectionData)
        {
            errCode      = -1;
            errMsg       = null;
            createdFiles = null;

            try
            {
                //-- Log DataTable --\\
                if (cfg != null && cfg.LogCollectionDataTable)
                {
                    try
                    {
                        ILog.LogInfo("{0} received DataTable [{1}], rows data (see next line\\s):\r\n[{2}], [{3}], [{4}], [{5}]\r\n{6}", "InputAPI", dbCollectionData.TableName ?? string.Empty,
                                     CCEnums.CCTableColumns.Level, CCEnums.CCTableColumns.DataType, CCEnums.CCTableColumns.Key, CCEnums.CCTableColumns.Data,
                                     Helpers.CCTDataRows.FromDataRows(dbCollectionData.Select()).ToString("\r\n", ", "));
                    }
                    catch { }
                }

                #region //-- Name table columns (if not named) --\\
                if (!chkLst.Contains(dbCollectionData.Columns[0].ColumnName.ToUpper()))
                {
                    dbCollectionData.Columns[0].ColumnName = CCEnums.CCTableColumns.Level.ToString();
                }

                if (!chkLst.Contains(dbCollectionData.Columns[1].ColumnName.ToUpper()))
                {
                    dbCollectionData.Columns[1].ColumnName = CCEnums.CCTableColumns.DataType.ToString();
                }

                if (!chkLst.Contains(dbCollectionData.Columns[2].ColumnName.ToUpper()))
                {
                    dbCollectionData.Columns[2].ColumnName = CCEnums.CCTableColumns.Key.ToString();
                }

                if (!chkLst.Contains(dbCollectionData.Columns[3].ColumnName.ToUpper()))
                {
                    dbCollectionData.Columns[3].ColumnName = CCEnums.CCTableColumns.Data.ToString();
                }
                #endregion

                //-- Process header data --\\
                int          pgCnt = 0;
                CCCollection res   = ReadHeaderData(cfg, out errCode, out errMsg, out pgCnt, dbCollectionData);

                if (res != null && errCode == (int)CCEnums.CCErrorCodes.E0001)
                {
                    //-- Process pages data --\\
                    createdFiles = ReadPagesData(cfg, out errCode, out errMsg, pgCnt, ref res, dbCollectionData);
                    if (errCode == (int)CCEnums.CCErrorCodes.E0001)
                    {
                        return(res);
                    }
                }
                else
                {
                    if (String.IsNullOrEmpty(errMsg))
                    {
                        errMsg = CCConstants.E0000;
                    }
                    throw new Exception(errMsg);
                }
            }
            catch (Exception ex)
            {
                ILog.LogError(ex, false);
                throw ex;
            }
            return(null);
        }
示例#5
0
        /// <summary>
        /// Receive and process station messages.
        /// </summary>
        /// <param name="message">The message sent by an eFlow application.</param>
        private void StationMessage(String message)
        {
            try
            {
                ILog.LogInfo("Received eflow system MESSAGE: [{0}]", message);


                if (Regex.IsMatch(message, @"(?i)Show\s?Config|Show\s?setting?s|Show\s?definitions?"))
                {
                    CCConfigDialog dlg = new CCConfigDialog();
                    dlg.ShowDialog(config, CurrentProfile.Name, false);

                    Match mtc = Regex.Match(message, @"(?i)(?<=(.+)lprofile:)[^\s]+");
                    if (mtc.Success && mtc.Length > 0)
                    {
                        CurrentProfile = config.GetConfiguration(mtc.Value);
                    }
                }

                if (Regex.IsMatch(message, "(?i)Stop|Pause|Disable|End"))
                {
                    Enabled = false;
                    ILog.LogInfo("Received eflow system message: [{0}], file polling timer is: enabled", message);
                }

                if (Regex.IsMatch(message, "(?i)Continue|Play|Resume|Enabled|Start|Begin"))
                {
                    Enabled = true;
                    ILog.LogInfo("Received eflow system message: [{0}], file polling timer is: disbaled", message);
                }

                if (Regex.IsMatch(message, "(?i)Exit|Terminate|Close"))
                {
                    Enabled    = false;
                    processing = true;
                    Dispose();
                    ILog.LogInfo("Received eflow system message: [{0}], Colisng application down", message);
                    this.ExitThread();
                }

                if (Regex.IsMatch(message, "(?i)search|find"))
                {
                    StartFileSearch();
                    ILog.LogInfo("Received eflow system message: [{0}], starting a search", message);
                }

                if (Regex.IsMatch(message, "(?i)((.+)?load:|config(uration):)") || Regex.IsMatch(message, @"(?i)(?<=(.+)lprofile:)[^\s]+"))
                {
                    Match mtc = Regex.Match(message, @"(?i)(?<=(.+)load:|refresh:)[^\s]+");
                    if (mtc.Success && mtc.Length > 0 && File.Exists(mtc.Value))
                    {
                        config = CCConfiguration.FromXml(message);
                    }

                    mtc = Regex.Match(message, @"(?i)(?<=(.+)lprofile:)[^\s]+");
                    if (mtc.Success && mtc.Length > 0)
                    {
                        CurrentProfile = config.GetConfiguration(mtc.Value);
                    }
                }

                if (Regex.IsMatch(message, "(?i)((.+)?timer?:|interval:)"))
                {
                    Match mtc = Regex.Match(message, @"(?i)(?<=(.+)timer:|interval:)[^\s]+");
                    if (mtc.Success && mtc.Length > 0)
                    {
                        int prs = -1;
                        if (int.TryParse(mtc.Value, out prs))
                        {
                            PollingTimer.Interval = Math.Max(int.MaxValue, prs * 1000);
                        }
                    }
                }

                if (Regex.IsMatch(message, "(?i)((.+)?max.?count:)"))
                {
                    Match mtc = Regex.Match(message, @"(?i)(?<=(.+)max.?count)[^\s]+");
                    if (mtc.Success && mtc.Length > 0)
                    {
                        int prs = -1;
                        if (int.TryParse(mtc.Value, out prs))
                        {
                            CurrentProfile.MaxFilesLock = prs;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                ILog.LogError(ex);
            }
        }
示例#6
0
        public static int CreateCsmCollection(string nextStation, ITisClientServicesModule csm, CCConfiguration.CCConfigurationData dataCfg, bool copySourceFiles, String collectionDataPath, out int errCode, out String errMsg)
#endif
        {
            errCode = -1;
            errMsg  = null;

            try
            {
                #region //-- Validate profile and CSM --\\
                if (csm == null)
                {
                    errCode = (int)CCEnums.CCErrorCodes.E0210;
                    errMsg  = String.Format("{0}, error code [{1}]", CCConstants.E0210, "?Unknown?", errCode);
                    throw new Exception(errMsg);
                }

                if (dataCfg == null)
                {
                    errCode = (int)CCEnums.CCErrorCodes.E0102;
                    errMsg  = String.Format("{0}: [{1}], error code [{2}]", CCConstants.E0102, csm.Application.AppName, errCode);
                    throw new Exception(errMsg);
                }
                #endregion


                //-- Create a collection creator class --\\
                using (CCreator crt = new CCreator(dataCfg))
                {
                    crt.CurrentProfile.CopySourceFiles = copySourceFiles;

                    //-- Create the collection definition --\\
                    CCCollection coll = CCCollection.FromXml(collectionDataPath, !copySourceFiles);

                    if (coll == null)
                    {
                        errCode = (int)CCEnums.CCErrorCodes.E0091;
                        errMsg  = String.Format("{0}, file name: [{1}], error code [{2}]", CCConstants.E0091, collectionDataPath ?? String.Empty, errCode);
                        throw new Exception(errMsg);
                    }


                    String[] resCols = crt.CreateCollections(nextStation, csm, out errCode, coll);
                    if (resCols == null || resCols.Length != 1)
                    {
                        errCode = errCode <= 0 ? (int)CCEnums.CCErrorCodes.E0092 : errCode;
                        errMsg  = String.Format("{0}, {1}, Source file path [{1}], error code [{2}]", CCConstants.E0092, collectionDataPath ?? String.Empty, errCode);
                        throw new Exception(errMsg);
                    }
                    else
                    {
                        ILog.LogInfo("Done creating collection [{0}] from file [{1}] in eFlow system", resCols[0], collectionDataPath);
                        errCode = (int)CCEnums.CCErrorCodes.E0001;
                    }
                }
            }
            catch (Exception ex)
            {
                if (String.IsNullOrEmpty(errMsg))
                {
                    errMsg = ex.Message;
                }
                ILog.LogError(ex);
                if (dataCfg == null || dataCfg.ThrowAllExceptions)
                {
                    throw ex;
                }
            }
            return(errCode);
        }
示例#7
0
        /// <summary>
        /// Create an eFlow collection from the specified DataTable, using an existing\specified CSM object.
        /// </summary>
        /// <param name="nextStation">The name of the next station.</param>
        /// <param name="csm">ITisClientServicesModule object.</param>
        /// <param name="collectionData">The collection data in the a data table.</param>
        /// <param name="dataCfg">The InputApi profile to use to create the collection.</param>
        /// <param name="copySourceFiles">Copy the source file when true (as opposed to move).</param>
        /// <param name="errMsg">Will return the error message if any error occured.</param>
        /// <returns>The error code, 1 = sucsess.</returns>
        public static bool CreateCsmCollection(string nextStation, ITisClientServicesModule csm, DataTable collectionData, CCConfiguration.CCConfigurationData dataCfg, out int errCode, out String errMsg)
        {
            //-- Set returning values --\\
            errCode = (int)CCEnums.CCErrorCodes.E0000;
            errMsg  = null;
            String[] createdFiles = null;

            try
            {
                #region //-- Validate profile and CSM --\\
                if (csm == null)
                {
                    errCode = (int)CCEnums.CCErrorCodes.E0210;
                    errMsg  = String.Format("{0}, error code [{1}]", CCConstants.E0210, "?Unknown?", errCode);
                    throw new Exception(errMsg);
                }

                if (dataCfg == null)
                {
                    errCode = (int)CCEnums.CCErrorCodes.E0102;
                    errMsg  = String.Format("{0}: [{1}], error code [{2}]", CCConstants.E0102, csm.Application.AppName, errCode);
                    throw new Exception(errMsg);
                }
                #endregion

                //-- Create and define the Creator class --\\
                using (CCreator crt = new CCreator(dataCfg))
                {
                    //-- Load CCCollection from a data table (and validate all the data) --\\
                    CCCollection coll = CCDataTable.FromDataTable(dataCfg, out errCode, out errMsg, dataCfg.CopySourceFiles, out createdFiles, collectionData);

                    if (errCode != 1)
                    {
                        errMsg = String.Format("{0}, table name: [{1}], error code [{2}]", CCConstants.E0091, collectionData != null ? collectionData.TableName ?? String.Empty : String.Empty, errCode);
                        throw new Exception(errMsg);
                    }

                    if (coll == null)
                    {
                        errCode = (int)CCEnums.CCErrorCodes.E0091;
                        errMsg  = String.Format("{0}, table name: [{1}], error code [{2}]", CCConstants.E0091, collectionData != null ? collectionData.TableName ?? String.Empty : String.Empty, errCode);
                        throw new Exception(errMsg);
                    }

                    try
                    {
                        //--<< Call eFlow to create the collection >>--\\
                        String[] resCols = crt.CreateCollections(nextStation, csm, out errCode, coll);
                        if (resCols == null || resCols.Length != 1)
                        {
                            errCode = errCode <= 0 ? (int)CCEnums.CCErrorCodes.E0092 : errCode;
                            errMsg  = crt.LastErrors;
                            throw new Exception(String.Format("{0}, {1}, error code [{2}]", CCConstants.E0092, errMsg, errCode));
                        }
                        else
                        {
                            ILog.LogInfo("Done creating collection [{0}] in eFlow system", resCols[0]);
                            errCode = (int)CCEnums.CCErrorCodes.E0001;
                            errMsg  = resCols[0];//-- Return the name of the created collection --\\
                        }
                    }
                    catch (Exception ec)
                    {
                        errCode = (int)CCEnums.CCErrorCodes.E0092;
                        errMsg  = crt.LastErrors;
                        if (String.IsNullOrEmpty(errMsg))
                        {
                            errMsg = CCConstants.E0092 + "," + ec.Message;
                        }
                        throw new Exception(String.Format("{0}, {1}, {2}, error code [{3}]", CCConstants.E0092, errMsg, ec.Message, errCode));
                    }
                }
            }
            catch (Exception ex)
            {
                ILog.LogError(ex);
                if (dataCfg == null || dataCfg.ThrowAllExceptions)
                {
                    throw ex;
                }
            }
            finally
            {
                //-- Delete files created by this method --\\ 
                if (dataCfg != null && dataCfg.CopySourceFiles && createdFiles != null && createdFiles.Length > 0)
                {
                    foreach (String sf in createdFiles)
                    {
                        try
                        {
                            if (File.Exists(sf ?? String.Empty))
                            {
                                File.SetAttributes(sf, FileAttributes.Normal);
                                File.Delete(sf);
                            }
                        }
                        catch (Exception ex)
                        {
                            ILog.LogError(ex);
                            throw ex;
                        }
                    }
                }
            }
            return(errCode == (int)CCEnums.CCErrorCodes.E0001);
        }
示例#8
0
        /*
         * /// <summary>
         * /// Create an eFlow collection from the specified DataTable.
         * /// </summary>
         * /// <param name="collectionData">The collection data in the specified data table.</param>
         * /// <param name="applicationName">The eFlow application name to insert the collection to.</param>
         * /// <param name="copySourceFiles">Copy the source file when true (as opposed to move).</param>
         * /// <param name="errMsg">Will return the error message if any error occured.</param>
         * /// <returns>The error code, 1 = sucsess.</returns>
         * public bool TestCreateCollection(String filePath, String stationName, String applicationName)
         * {
         *  try
         *  {
         *      List<ITisPageParams> pages = new List<ITisPageParams>();
         *      ITisClientServicesModule csm = csmManager.GetCsm(applicationName, stationName, true);
         *      pages.Add(csm.Setup.get_FlowByIndex(0).get_FormByIndex(0).get_PageByIndex(0));
         *      CCCollection.CCPage pg = new CCCollection.CCPage(null, pages[0], "Demo");
         *      CCCollection col = new CCCollection();
         *      for (int i = 0; i < 7; i++)
         *      {
         *          col.AddForm(new CCCollection.CCForm(null, null, csm.Setup.get_FlowByIndex(0).get_FormByIndex(0).Name, pg));
         *      }
         *      col.ImagePath = filePath;// @"C:\Program Files\TIS\eFlow 4.5\Sample Applications\SimpleDemo\Office7Pages.TIF";
         *     // col.FlowType = "OfficeStore";
         *
         *      //-- Create and define the Creator class --\\
         *      using (CCreator crt = new CCreator())
         *      {
         *          crt.ValidatePagePerImagePage = false;
         *          crt.CurrentProfile = CCConfiguration.CCConfigurationData.FromXml("Default2");
         *          int errCode=0;
         *         String[] res= crt.CreateCollections(csm,  out errCode, col);
         *         if (res.Length > 0)
         *         {
         *             return true;
         *         }
         *      }
         *  }
         *  catch (Exception ex)
         *  {
         *      ILog.LogError(ex);
         *  }
         *  return false;
         * }
         */

        /// <summary>
        /// Create an eFlow collection from the specified DataTable.
        /// </summary>
        /// <param name="collectionData">The collection data in the specified data table.</param>
        /// <param name="applicationName">The eFlow application name to insert the collection to.</param>
        /// <param name="copySourceFiles">Copy the source file\s when true (as opposed to move).</param>
        /// <param name="errMsg">Will return the error message if any error occured.</param>
        /// <returns>The error code, 1 = sucsess.</returns>
        public bool CreateCollection(DataTable collectionData, String applicationName, bool copySourceFiles, out int errCode, out String errMsg)
        {
            //-- Set returning values --\\
            errCode = (int)CCEnums.CCErrorCodes.E0000;
            errMsg  = null;
            String[]     createdFiles = null;
            CCCollection coll         = null;

            try
            {
                #region //-- Load and validate profile --\\
                if (config == null)
                {
                    errCode = (int)CCEnums.CCErrorCodes.E0101;
                    errMsg  = String.Format("{0}:, error code [{1}]", CCConstants.E0101, errCode);
                    throw new Exception(errMsg);
                }

                if (String.IsNullOrEmpty(applicationName))
                {
                    applicationName = CCEnums.CCNames.Default.ToString();
                }
                currCfg = config.GetConfiguration(applicationName);

                if (currCfg == null)
                {
                    errCode = (int)CCEnums.CCErrorCodes.E0102;
                    errMsg  = String.Format("{0}: [{1}], error code [{2}]", CCConstants.E0102, applicationName, errCode);
                    throw new Exception(errMsg);
                }
                #endregion

                //-- Create and define the Creator class --\\
                using (CCreator crt = new CCreator())
                {
                    crt.CurrentProfile.CopySourceFiles = copySourceFiles;
                    if (currCfg != null)
                    {
                        crt.CurrentProfile.LockExtension = currCfg.LockExtension;
                    }

                    ITisClientServicesModule csm = csmManager.GetCsm(String.IsNullOrEmpty(currCfg.LoginApplication) ? applicationName : currCfg.LoginApplication, currCfg.LoginStation, true);

                    if (csm == null)
                    {
                        errCode = (int)CCEnums.CCErrorCodes.E0210;
                        errMsg  = String.Format("{0}, Application name: [{1}], Station name: [{2}] error code [{3}]", CCConstants.E0210, String.IsNullOrEmpty(currCfg.LoginApplication) ? applicationName ?? String.Empty : currCfg.LoginApplication ?? String.Empty, currCfg.LoginStation ?? String.Empty, errCode);
                        throw new Exception(errMsg);
                    }

                    //-- Load CCCollection from a data table (and validate all the data) --\\
                    coll = CCDataTable.FromDataTable(currCfg, out errCode, out errMsg, copySourceFiles, out createdFiles, collectionData);

                    if (errCode != 1)
                    {
                        errMsg = String.Format("{0}, table name: [{1}], error code [{2}]", CCConstants.E0091, collectionData != null ? collectionData.TableName ?? String.Empty : String.Empty, errCode);
                        throw new Exception(errMsg);
                    }

                    if (coll == null)
                    {
                        errCode = (int)CCEnums.CCErrorCodes.E0091;
                        errMsg  = String.Format("{0}, table name: [{1}], error code [{2}]", CCConstants.E0091, collectionData != null ? collectionData.TableName ?? String.Empty : String.Empty, errCode);
                        throw new Exception(errMsg);
                    }

                    try
                    {
                        //--<< Call eFlow to create the collection >>--\\
                        String[] resCols = crt.CreateCollections(csm, out errCode, coll);
                        if (resCols == null || resCols.Length != 1)
                        {
                            errCode = errCode <= 0 ? (int)CCEnums.CCErrorCodes.E0092: errCode;
                            errMsg  = crt.LastErrors;
                            throw new Exception(String.Format("{0}, {1}, error code [{2}]", CCConstants.E0092, errMsg, errCode));
                        }
                        else
                        {
                            ILog.LogInfo("Done creating collection [{0}] in eFlow system", resCols[0]);
                            errCode = (int)CCEnums.CCErrorCodes.E0001;
                            errMsg  = resCols[0];//-- Return the name of the created collection --\\
                            //\\ return errCode == (int)CCEnums.CCErrorCodes.E0001;
                        }
                    }
                    catch (Exception ec)
                    {
                        errCode = (int)CCEnums.CCErrorCodes.E0092;
                        errMsg  = crt.LastErrors;
                        if (String.IsNullOrEmpty(errMsg))
                        {
                            errMsg = CCConstants.E0092 + "," + ec.Message;
                        }
                        throw new Exception(String.Format("{0}, {1}, {2}, error code [{3}]", CCConstants.E0092, errMsg, ec.Message, errCode));
                    }
                }
            }
            catch (Exception ex)
            {
                //\\ if (errCode < (int)CCEnums.CCErrorCodes.E0000) errCode = (int)CCEnums.CCErrorCodes.E0000;
                ILog.LogError(ex);
                //-- Move collections to errror folder --\\
                if (coll != null && coll.Files.Length > 0 && currCfg != null && !String.IsNullOrEmpty(currCfg.ErrorFolderPath))
                {
                    CCFileList.MoveToFolder(currCfg.ErrorFolderPath, coll.Files);
                }
                if (currCfg == null || currCfg.ThrowAllExceptions)
                {
                    throw ex;
                }
            }
            finally
            {
                //-- Delete files created by this method --\\ 
                if (copySourceFiles && createdFiles != null && createdFiles.Length > 0)
                {
                    foreach (String sf in createdFiles)
                    {
                        try
                        {
                            if (File.Exists(sf ?? String.Empty))
                            {
                                File.SetAttributes(sf, FileAttributes.Normal);
                                File.Delete(sf);
                            }
                        }
                        catch (Exception ex)
                        {
                            ILog.LogError(ex);
                            throw ex;
                        }
                    }
                }
            }
            //\\  return false;
            return(errCode == (int)CCEnums.CCErrorCodes.E0001);
        }