Jump to content
View in the app

A better way to browse. Learn more.

Tuts 4 You

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

trying to create a keygen for csharp program

Featured Replies

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

Edited by kiran
code block addedd for better reading

judging by the error u posted you have to instantiate the _encrypt variable... Somewhere in app writes for example :

Tesdsfasdft _encrypt

so to instantiate you write :

_encrypt = new Tesdsfasdft

then u call any method..


if you continue have any problem PM @CodeExplorer , dont bump the thread

  • Author

issue resolved by adding

private readonly DataEncryption _encrypt = new DataEncryption();

Create an account or sign in to comment

Account

Navigation

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.