public SomeResource Go(SomeInput input) { return new SomeResource(); }
public SomeResource Go(SomeInput input) { return(new SomeResource()); }
public string Get(SomeInput input) { return("Bar"); }
public void Go(SomeInput input) { }
/// <summary> /// Called every time this plugin is run in the workflow execution. /// </summary> public void Execute() { StringBuilder output = new StringBuilder(); string orderedAlphabet = settings.OrderedAlphabet; string unorderedAlphabet = settings.unorderedAlphabet; int index = 0; int errorType = 0; // HOWTO: Use this to show the progress of a plugin algorithm execution in the editor. ProgressChanged(0, 1); if (string.IsNullOrEmpty(SomeInput)) { errorType = 1; } else if (string.IsNullOrEmpty(settings.Keyword)) { errorType = 2; } else if (!checkKeyword(settings.Keyword.ToUpper())) { errorType = 3; } switch (errorType) { case 0: int index2 = 0; string number = ""; int l = 0; string temp; char currentChar; bool space = false; for (int i = 0; i < SomeInput.Length + 1; i++) { switch (settings.Action) { case SpanishStripCipherSettings.CipherMode.Encrypt: if (i < SomeInput.Length) { temp = "0"; SomeInput = SomeInput.ToUpper(); //TODO if Alpahebt 29 selected letter[i] == C or L || letter[i] == H or L currentChar = SomeInput[i]; if (settings.Alphabets == 0) { index = unorderedAlphabet.IndexOf(currentChar); } else { if (SomeInput.Length != i + 1) { if (currentChar == 'C' && SomeInput[i + 1] == 'H') { index = unorderedAlphabet.IndexOf("ß"); //CH<-ß encoded i++; } else if (currentChar == 'L' && SomeInput[i + 1] == 'L') { index = unorderedAlphabet.IndexOf("Ä"); //LL<-Ä encoded i++; } else { index = unorderedAlphabet.IndexOf(currentChar); } } else { index = unorderedAlphabet.IndexOf(currentChar); } } if (index != -1) { output = output.Append(homophones[index][0]); temp = homophones[index][0]; int j = 0; for (j = 0; j < homophones[index].Count - 1; j++) { homophones[index][j] = homophones[index][j + 1]; } homophones[index][j] = temp; } /*else{ * output = output.Append(" "); * }*/ } break; case SpanishStripCipherSettings.CipherMode.Decrypt: if (i < SomeInput.Length) { if (SomeInput[i].ToString() == " ") { space = true; } else { if (l == 2) { index2 = findIndex(number); if (unorderedAlphabet[index2] == 'Ä') { output = output.Append("LL"); //Ä<-LL encoded } else if (unorderedAlphabet[index2] == 'ß') { output = output.Append("CH"); //ß<-CH encoded } else { output = output.Append(unorderedAlphabet[index2]); } if (space) { output = output.Append(" "); space = false; } l = 0; number = ""; } number = number + SomeInput[i]; l++; } } else { index2 = findIndex(number); output = output.Append(unorderedAlphabet[index2]); } break; } //Show the progress. ProgressChanged(i, SomeInput.Length - 1); } SomeOutput = output.ToString(); OnPropertyChanged("SomeOutput"); break; case 1: ProgressChanged(100, SomeInput.Length - 1); if (settings.Action == SpanishStripCipherSettings.CipherMode.Encrypt) { GuiLogMessage("Please enter plaintext to be encrypted.", NotificationLevel.Info); } else { GuiLogMessage("Please enter ciphertext to be decrypted.", NotificationLevel.Info); } SomeOutput = " "; OnPropertyChanged("SomeOutput"); break; case 2: ProgressChanged(100, SomeInput.Length - 1); GuiLogMessage("The parameter \"keyword\" cannot be left empty.", NotificationLevel.Error); SomeOutput = " "; OnPropertyChanged("SomeOutput"); break; case 3: ProgressChanged(100, SomeInput.Length - 1); GuiLogMessage("The parameter \"keyword\" must only contain letters of the fixed alphabet", NotificationLevel.Error); SomeOutput = " "; OnPropertyChanged("SomeOutput"); break; } // HOWTO: You can pass error, warning, info or debug messages to the CT2 main window. // HOWTO: Make sure the progress bar is at maximum when your Execute() finished successfully. }