Tuesday at 02:35 PM4 days 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 codestring 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 linebyte[] array = _encrypt.EncryptTextToBytes(stringBuilder.ToString(), CryptoKey.Registration);An object reference is required for the non-static field, method, or property 'Program._encryptplease can some one guide mehere i uploaded my csharp projecthttps://we.tl/t-kLfapytJBX Edited Tuesday at 02:40 PM4 days by kiran code block addedd for better reading
Tuesday at 05:14 PM4 days judging by the error u posted you have to instantiate the _encrypt variable... Somewhere in app writes for example :Tesdsfasdft _encryptso to instantiate you write :_encrypt = new Tesdsfasdft then u call any method.. if you continue have any problem PM @CodeExplorer , dont bump the thread
Wednesday at 08:04 AM3 days Author issue resolved by adding private readonly DataEncryption _encrypt = new DataEncryption();
Create an account or sign in to comment