public static BondResult LaunchCabi(string commandFile)
        {
            BondResult result = new BondResult();

            //see if cabibond location is already populted and if not do so.
            exeLocation = CabiLocation();

            //Build the command file with the relevant options
            if (File.Exists(commandFile))
            {
                //configure the execution
                Process p = new Process();
                p.StartInfo.UseShellExecute        = false;
                p.StartInfo.RedirectStandardOutput = true;
                p.StartInfo.FileName  = exeLocation;
                p.StartInfo.Arguments = commandFile;
                //start
                p.Start();


                //wait for output and return result
                p.WaitForExit();
                result.ExitCode       = p.ExitCode;
                result.StandardOutput = p.StandardOutput.ReadToEnd();
                result.CommandLine    = p.StartInfo.FileName.ToString() + " " + p.StartInfo.Arguments.ToString();
            }
            else
            {
                result.ExitCode       = -1;
                result.StandardOutput = "Unable to find command file";
            }
            return(result);
        }
        public static BondResult IndexDocument(string cabinet = "", string client = "", string status = "", string sender = "", string section = "", string desc = "")
        {
            string     commandFile = BuildCommandFile("file", cabinet, client, status, sender, section, desc);
            BondResult result      = LaunchCabi(commandFile);

            return(result);
        }
        public static BondResult LaunchCabi(string commandFile, Boolean reindex, Boolean silent = false)
        {
            try
            {
                BondResult result = new BondResult();
                //see if cabibond location is already populted and if not do so.
                exeLocation = CabiLocation();

                //Build the command file with the relevant options
                if (File.Exists(commandFile))
                {
                    //configure the execution
                    Process p = new Process();
                    p.StartInfo.UseShellExecute        = false;
                    p.StartInfo.RedirectStandardOutput = true;
                    p.StartInfo.FileName = exeLocation;
                    string args = "";
                    if (silent)
                    {
                        args = args + "-s ";
                    }
                    if (reindex)
                    {
                        args = args + "UPDATEDB " + commandFile;
                    }
                    else
                    {
                        args = args + commandFile;
                    }

                    p.StartInfo.Arguments = args;
                    //start
                    p.Start();


                    //wait for output and return result
                    p.WaitForExit();
                    result.ExitCode       = p.ExitCode;
                    result.StandardOutput = p.StandardOutput.ReadToEnd();
                    result.CommandLine    = p.StartInfo.FileName.ToString() + " " + p.StartInfo.Arguments.ToString();
                }
                else
                {
                    result.ExitCode       = -1;
                    result.StandardOutput = "Unable to find command file";
                }
                return(result);
            }
            catch (Exception ex)
            {
                XLtools.LogException("XLVC-LaunchCabi", ex.ToString());
                return(new BondResult());
            }
        }
 public static BondResult IndexDocument(string docPath, FileInfo fileInfo)
 {
     try
     {
         string     commandFile = BuildCommandFile(docPath, fileInfo);
         BondResult result      = LaunchCabi(commandFile, false);
         result.DocPath = docPath;
         return(result);
     }
     catch (Exception ex)
     {
         XLtools.LogException("XLVC-IndexDocument", ex.ToString());
         return(new BondResult());
     }
 }
 public static BondResult IndexDocument(string docPath, string cabinet = "", string client = "", string status = "", string sender = "", string section = "", string desc = "", string docDate = null, IndexPair additionalIndex1 = null, IndexPair additionalIndex2 = null)
 {
     try
     {
         if (docDate == null)
         {
             docDate = DateTime.Now.ToString("dd/MM/yyyy");
         }
         string     commandFile = BuildCommandFile(docPath, cabinet, client, status, sender, section, desc, docDate, additionalIndex1, additionalIndex2);
         BondResult result      = LaunchCabi(commandFile, false);
         result.DocPath = docPath;
         return(result);
     }
     catch (Exception ex)
     {
         XLtools.LogException("XLVC-IndexDocument", ex.ToString());
         return(new BondResult());
     }
 }