コード例 #1
0
        /// <summary>
        /// Perform a complete backup generating a CAB
        /// </summary>
        /// <returns></returns>
        public int BackupCompleteCAB(String BackupFileName)
        {
            int ProcessId;

            try
            {
                // first verify connection
                if (!this.Connected)
                {
                    throw new Exception("Galaxy not connected");
                }

                log.Debug("Checking and correcting filename " + BackupFileName + " to use .CAB");
                // Inspect the filename.  Correct the extension if necessary
                BackupFileName = System.IO.Path.ChangeExtension(BackupFileName, ".CAB");

                // Check for file exists.  Bail if the file already exists and we don't want to overwrite
                if (CheckandLogFileExists(BackupFileName))
                {
                    return(0);
                }

                // Get the current PID
                ProcessId = System.Diagnostics.Process.GetCurrentProcess().Id;
                log.Debug("Got Process ID " + ProcessId.ToString());

                if (ProcessId == 0)
                {
                    log.Error("Inavlid ProcessID");
                    return(-2);
                }


                var obj = _galaxy.GetGalaxyConfiguration();


                log.Info("Starting CAB Backup to " + BackupFileName);

                // Call complete backup routine
                _galaxy.Backup(ProcessId, BackupFileName, this.GRNodeName, _galaxy.Name);

                if (_galaxy.CommandResult.Successful)
                {
                    log.Info("Backup CAB Complete");
                    return(0);
                }
                else
                {
                    log.Error(_galaxy.CommandResult.Text);
                    return(-1);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }