public bool Format(out string message) { var license = LoadFile("License.xml"); message = CheckMaster(license); if (!string.IsNullOrEmpty(message)) { return(false); } message = Check(); if (!string.IsNullOrEmpty(message)) { return(false); } if (!CheckDogStatus()) { message = "超级狗状态不正确"; return(false); } string lgLicense = null; string lgStatus = null; var status = _licGenApiHelper.sntl_lg_generate_license(null, ref lgLicense, ref lgStatus); _licGenApiHelper.sntl_lg_cleanup(); if (status != sntl_lg_status_t.SNTL_LG_STATUS_OK) { message = "生成许可失败"; return(false); } string acknowledgeXml = null; var dogStatus = Dog.Update(lgLicense, ref acknowledgeXml); _dog.Logout(); _dog.Dispose(); _dog = null; if (dogStatus != DogStatus.StatusOk) { message = "格式化超级狗失败"; return(false); } message = "格式化成功"; return(true); }
public string GenerationLicense() { string GenerationParam = null; string License = null; string UpdatedState = null; Status = LicGenHelper.sntl_lg_generate_license(GenerationParam, ref License, ref UpdatedState); if (sntl_lg_status_t.SNTL_LG_STATUS_OK != Status) { return("GenS_" + Convert.ToString(Status)); } else if (sntl_lg_status_t.SNTL_LG_MASTER_KEY_IO_ERROR == Status) { DialogResult ErrorMessageDialogResult = MessageBox.Show( "Error Message: " + Environment.NewLine + Status + Environment.NewLine + "Error code: 5025 - may happened if you login on PC via RDP." + Environment.NewLine + "Please check RDP connection firstly and then push:" + Environment.NewLine + "Abort - if you would like to stop cleaning process." + Environment.NewLine + "Retry - if you would like to try do last generation again." + Environment.NewLine + "Ignore - if you would like to ignore last error. " + Environment.NewLine, "!Error message!", MessageBoxButtons.AbortRetryIgnore); if (ErrorMessageDialogResult == DialogResult.Abort) { return("break"); } else if (ErrorMessageDialogResult == DialogResult.Retry) { return(GenerationLicense()); } else // if (ErrorMessageDialogResult == DialogResult.Ignore) { return("GenS_" + Convert.ToString(Status)); } } else { return("success"); } }