Итак, у меня есть два класса.Один называется «Индексаторы», где я храню следующие строки:
class Indexes
{
public string IndexAlpha = "4uCLD[mY7^&*F_5+tXc~UrHMv1ZRxy|`3V}sjIOP<g#wT,.lnG6aK9/SJz?]bB$:8{2hfq=-0N()kd%iAe;'QEp!@>Wo"; //
public string IndexOmega = "iHL@C7(^nYzu?4$5-<cJKe~;b/XAPF_[Uf&{|m9Oolg#%]xM0REyW`jN':82Q=p6}h3kwGTZ1Vt>v,DsS.!daBri)q+*";// //
public string EncryptionCharLibrary = ",q@xRm|T=3`adV!.sDZMi)h8tb1;eKy7Yn^Q2Gwk0S]?~HL(}$4Op#g6NjU<-fAilE:%9/J[Xv>{P&zW'co+Cu5_FrB*";//
}
Другой называется «Персоны», где я запускаю следующий метод.
Это вызывается первым (в пределахКласс «Персоны»):
Indexes UsingIndex = new Indexes();
Затем позже ... v
public string InitialEncryptionComputationAndRepeatTracker() {
StringBuilder sb = new StringBuilder(Password);
int count = ForMethod.ComputeOddEven();
while (PasswordLength > 0)
{
char toFind = PasswordAsArray[PasswordLength - 1];//find first Password Char in array[0] to start
int FromAlpha = 0;
if (count % 2 == 0)
{
FromAlpha = UsingIndex.IndexAlpha.IndexOf(toFind);
}
else
{
FromAlpha = UsingIndex.IndexOmega.IndexOf(toFind);
}
char FromOmega = UsingIndex.EncryptionCharLibrary[FromAlpha];
//TEST a Character:
//MessageBox.Show("input: " + toFind + " | High/low: " + FromAlpha + " | Encryption: " + FromOmega);
char[] squiggle = { '-' };
if (toFind != squiggle[0])
{
//do nothing (subtract 1 from length down below. --v--
sb[PasswordLength - 1] = FromOmega; // store in position of StringBuilder -
FinalEncryptedPass = sb.ToString(); // Enter change into password value - <-1
//Checkfor repeat values -v-
}
int RepeatChecker = FinalEncryptedPass.LastIndexOf(toFind); //grab another instance of, and store as an integer value, the index of where that repeat character is-
while (RepeatChecker != -1) // If the value 'RepeatChecker' is 'null'/ or -1, we know that there was no repeat of the value we just changed a second ago- -1-^
{
string integerToCountBy = RepeatChecker.ToString();
AccountableToRepeats.Add(integerToCountBy); // should add a zero at the first repeat-
string toFind2 = toFind.ToString(); // Convert "the 'char' in question" to string so we can add to the string list ( AccountabletoRepeats )
AccountableToRepeats.Add(toFind2); // ex. the password 'Reed23' would have the following stored in
// AccountableToRepeats -list (ignoring encryption): AccountableToRepeats["0",1,"E",E"] before the while=looop ends.
//count = count++;// doesn't work.. just keep them in some order and replace the squiggles.
// squiggle has to be a char first to go into stringbuilder below (just like 'fromOmega' (in the instance of "none-repeating characters"))
sb[RepeatChecker] = squiggle[0];
FinalEncryptedPass = sb.ToString();
RepeatChecker = FinalEncryptedPass.LastIndexOf(toFind); //check for another repeat of the same character (stored in 'toFind' variable) // ----------------------+
}
PasswordLength = PasswordLength - 1;
count = count+ 1;
}
return sb.ToString();
}
Метод, по сути, должен использовать символы в определенных индексах переменных (IndexAlpha, IndexOmega иEncryptionCharLibrary) из объекта 'Indexers' (UsingIndexes), однако !!, когда я запускаю, я получаю ошибку в классе 'Indexes.cs', говорящую, исключение типа 'system.stackoverflowexception' было сгенерировано ..
По моему мнению, «первая переменная в классе Indexes.cs объявляется до конца времени». Я пытаюсь реформировать буквально дикие методы процедурного программирования, по существу, тасуякод, который вы видите выше, и я не уверен, уместно ли вызывать объект класса в методе другого класса?это то, что я сделал не так?
idts. Очень признателен за любую помощь (у меня не было проблем с 'Indexes.cs', вызывающим ошибку переполнения, пока я не ввел метод Person, (по его христианскому названию: 'InitialEncryptionComputationAndRepeatTracker ()').