i copied this the function name CalculateAuthorizationCode() from Eaton.SSE.Security.Authorize.dll and i addedd the prefence to some dll which functions are used inside this main function here is my function code string CalculateAuthorizationCode(string registrationCode, AccessLevel accessLevel, uint numberOfDays, IEnumerable<string> allowedEquipmentList)
{
if (string.IsNullOrEmpty(registrationCode))
{
throw new EatonException("Bad Authorization Code Request (RegistrationCode is empty).");
}
if (!AccessLevelHelper.IsValidUserAccessLevel(accessLevel, CommonUtils.ProductType, false))
{
throw new EatonException("Bad Authorization Code Request (Access level invalid).");
}
bool flag = numberOfDays < 1U || numberOfDays > 730U;
if (flag)
{
throw new EatonException("Bad Authorization Code Request (Number of days value is out of range).");
}
if (allowedEquipmentList == null || allowedEquipmentList.Count<string>() <= 0)
{
throw new EatonException("Bad Authorization Code Request (Allowed Equipment List is Empty).");
}
try
{
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.Append(registrationCode);
stringBuilder.Append("!");
stringBuilder.Append(accessLevel.ToString());
stringBuilder.Append("!");
stringBuilder.Append(numberOfDays.ToString());
stringBuilder.Append("!");
foreach (string text in allowedEquipmentList)
{
stringBuilder.Append(text);
stringBuilder.Append(",");
}
if (stringBuilder.Length > 1)
{
stringBuilder.Remove(stringBuilder.Length - 1, 1);
}
byte[] array = _encrypt.EncryptTextToBytes(stringBuilder.ToString(), CryptoKey.Registration);
LoggerInterface.WriteLine(LogLevel.Information, string.Format("Authorize.CalculateAuthorizationCode (), Code is {0}.", stringBuilder), LogControl.Encrypt);
return CommonParse.BytesToString(array, FormatType.Hexadecimal);
}
catch (Exception ex)
{
LoggerInterface.WriteLine(LogLevel.Exception, ex.ToString());
}
return string.Empty;
}
}
i have compile error at this line byte[] array = _encrypt.EncryptTextToBytes(stringBuilder.ToString(), CryptoKey.Registration); An object reference is required for the non-static field, method, or property 'Program._encrypt please can some one guide me here i uploaded my csharp project https://we.tl/t-kLfapytJBX