/// <summary> /// Creates an instance of <see cref="ItemsViewModel"/> /// </summary> public ItemsViewModel(Compendium compendium, ItemSearchService itemSearchService, ItemSearchInput itemSearchInput, StringService stringService, DialogService dialogService, XMLImporter xmlImporter, XMLExporter xmlExporter, DocumentService documentService) { _compendium = compendium; _itemSearchService = itemSearchService; _itemSearchInput = itemSearchInput; _stringService = stringService; _dialogService = dialogService; _xmlImporter = xmlImporter; _xmlExporter = xmlExporter; _documentService = documentService; _selectItemCommand = new RelayCommand(obj => true, obj => SelectItem(obj as ItemListItemViewModel)); _editItemCommand = new RelayCommand(obj => true, obj => EditItem(obj as ItemViewModel)); _exportItemCommand = new RelayCommand(obj => true, obj => ExportItem(obj as ItemViewModel)); _cancelEditItemCommand = new RelayCommand(obj => true, obj => CancelEditItem()); _saveEditItemCommand = new RelayCommand(obj => HasUnsavedChanges, obj => SaveEditItem()); _resetFiltersCommand = new RelayCommand(obj => true, obj => InitializeSearch()); _addCommand = new RelayCommand(obj => true, obj => Add()); _copyCommand = new RelayCommand(obj => _selectedItem != null, obj => Copy()); _deleteCommand = new RelayCommand(obj => _selectedItem != null, obj => Delete()); _importCommand = new RelayCommand(obj => true, obj => Import()); _selectNextCommand = new RelayCommand(obj => true, obj => SelectNext()); _selectPreviousCommand = new RelayCommand(obj => true, obj => SelectPrevious()); Search(); }
/// <summary> /// Creates an instance of <see cref="ItemListItemViewModel"/> /// </summary> public ItemListItemViewModel(ItemModel itemModel, StringService stringService) { _itemModel = itemModel; _stringService = stringService; Initialize(); }
public VerificationService(DiscordSocketClient client, DbService db, StringService stringService, ForumService fs) { _client = client; _db = db; _stringService = stringService; _fs = fs; }
/// <summary> /// Creates an instance of <see cref="NPCsViewModel"/> /// </summary> public NPCsViewModel(Compendium compendium, NPCSearchService npcSearchService, NPCSearchInput npcSearchInput, StringService stringService, DialogService dialogService, XMLImporter xmlImporter, DocumentService documentService, DataManager dataManager) { _compendium = compendium; _npcSearchService = npcSearchService; _npcSearchInput = npcSearchInput; _stringService = stringService; _dialogService = dialogService; _xmlImporter = xmlImporter; _documentService = documentService; _dataManager = dataManager; _selectNPCCommand = new RelayCommand(obj => true, obj => SelectNPC(obj as ListItemViewModel <NPCModel>)); _editNPCCommand = new RelayCommand(obj => true, obj => EditNPC(obj as NPCViewModel)); _exportNPCCommand = new RelayCommand(obj => true, obj => ExportNPC(obj as NPCViewModel)); _cancelEditNPCCommand = new RelayCommand(obj => true, obj => CancelEditNPC()); _saveEditNPCCommand = new RelayCommand(obj => HasUnsavedChanges, obj => SaveEditNPC()); _resetFiltersCommand = new RelayCommand(obj => true, obj => InitializeSearch()); _addCommand = new RelayCommand(obj => true, obj => Add()); _copyCommand = new RelayCommand(obj => _selectedNPC != null, obj => Copy()); _deleteCommand = new RelayCommand(obj => _selectedNPC != null, obj => Delete()); _importCommand = new RelayCommand(obj => true, obj => Import()); _selectNextCommand = new RelayCommand(obj => true, obj => SelectNext()); _selectPreviousCommand = new RelayCommand(obj => true, obj => SelectPrevious()); Search(); }
public void TruncateAtWordShouldReturnTheSameInputWhenItsLengthIsShorterThanTheTruncateLength() { var service = new StringService(); var input = "Test Input"; Assert.Equal(input, service.TruncateAtWord(input, input.Length + 1)); }
static void Main(string[] args) { IStringService service = new StringService(); Console.WriteLine("Enter text: "); string text = Console.ReadLine(); //string text = "ABCBAHELLOHOWRACECARAREYOUILOVEUEVOLIIAMAIDOINGGOOD"; //string text = "ABCBABCBD"; => special case, 'overlapping' palindromes => "ABCBA" and "BCBABCB" Console.WriteLine(); Console.WriteLine("Found Palindromes (without Substrings) "); var result0 = service.FindPalindromes(text, false); Console.WriteLine("Text,Index,Length"); foreach (var item in result0) { Console.WriteLine($"{item.Text},{item.Index},{item.Length}"); } Console.WriteLine(); var result1 = service.FindPalindromes(text, true); Console.WriteLine("All Palindromes (including Substrings) "); Console.WriteLine("Text,Index,Length"); foreach (var item in result1) { Console.WriteLine($"{item.Text},{item.Index},{item.Length}"); } Console.WriteLine(); }
/// <summary> /// Creates an instance of <see cref="EncountersViewModel"/> /// </summary> public EncountersViewModel(Compendium compendium, EncounterSearchService encounterSearchService, EncounterSearchInput encounterSearchInput, StringService stringService, DialogService dialogService, XMLImporter xmlImporter, DocumentService documentService, DataManager dataManager) { _compendium = compendium; _encounterSearchService = encounterSearchService; _encounterSearchInput = encounterSearchInput; _stringService = stringService; _dialogService = dialogService; _xmlImporter = xmlImporter; _documentService = documentService; _dataManager = dataManager; _selectEncounterCommand = new RelayCommand(obj => true, obj => SelectEncounter(obj as EncounterListItemViewModel)); _editEncounterCommand = new RelayCommand(obj => true, obj => EditEncounter(obj as EncounterViewModel)); _exportEncounterCommand = new RelayCommand(obj => true, obj => ExportEncounter(obj as EncounterViewModel)); _cancelEditEncounterCommand = new RelayCommand(obj => true, obj => CancelEditEncounter()); _saveEditEncounterCommand = new RelayCommand(obj => HasUnsavedChanges, obj => SaveEditEncounter()); _resetFiltersCommand = new RelayCommand(obj => true, obj => InitializeSearch()); _addCommand = new RelayCommand(obj => true, obj => Add()); _copyCommand = new RelayCommand(obj => _selectedEncounter != null, obj => Copy()); _deleteCommand = new RelayCommand(obj => _selectedEncounter != null, obj => Delete()); _importCommand = new RelayCommand(obj => true, obj => Import()); _selectNextCommand = new RelayCommand(obj => true, obj => SelectNext()); _selectPreviousCommand = new RelayCommand(obj => true, obj => SelectPrevious()); _compendium.CharacterChanged += _compendium_CharacterChanged; _compendium.EncounterChanged += _compendium_EncounterChanged; Search(); }
/// <summary> /// Creates an instance of <see cref="ClassListItemViewModel"/> /// </summary> public ClassListItemViewModel(ClassModel classModel, StringService stringService) { _classModel = classModel; _stringService = stringService; Initialize(); }
public virtual string BuildNewItemName(object importRow) { if (!ItemNameFields.Any()) { throw new NullReferenceException("there are no 'Name' fields specified"); } StringBuilder strItemName = new StringBuilder(); foreach (string nameField in ItemNameFields) { try { strItemName.Append(GetFieldValue(importRow, nameField)); } catch (ArgumentException) { throw new NullReferenceException(string.Format("the field name: '{0}' does not exist in the import row", nameField)); } } string nameValue = strItemName.ToString(); if (string.IsNullOrEmpty(nameValue)) { throw new NullReferenceException(string.Format("the name fields: '{0}' are empty in the import row", string.Join(",", ItemNameFields))); } return(StringService.GetValidItemName(nameValue, this.ItemNameMaxLength).Trim()); }
private string DefineDifficultString(DifficultyMode difficultyMode) { string str = null; switch (difficultyMode) { case DifficultyMode.Easy: str = StringService.GetRandomString(3, _mainWindow.IsCaseSensitive); break; case DifficultyMode.Normal: str = StringService.GetRandomString(4, _mainWindow.IsCaseSensitive); break; case DifficultyMode.Hard: str = StringService.GetRandomString(5, _mainWindow.IsCaseSensitive); break; case DifficultyMode.Professional: str = StringService.GetRandomString(6, _mainWindow.IsCaseSensitive); break; case DifficultyMode.Expert: str = StringService.GetRandomString(7, _mainWindow.IsCaseSensitive); break; } return(str); }
/// <summary> /// Creates an instance of <see cref="MonsterListItemViewModel"/> /// </summary> public MonsterListItemViewModel(MonsterModel monsterModel, StringService stringService) { _monsterModel = monsterModel; _stringService = stringService; Initialize(); }
public TeamUpdateService(DiscordSocketClient client, DbService db, ForumService fs, StringService ss) { _client = client; _db = db; _fs = fs; _ss = ss; _teamUpdateTask = Task.Run(async() => { while (_fs.Forum == null) { await Task.Delay(TimeConstants.WaitForForum); } _staff = await _fs.Forum.GetMembersList(MembersListType.Staff); var log = LogManager.GetCurrentClassLogger(); while (true) { try { await DoTeamUpdate(); } catch (Exception e) { log.Warn(e, CultureInfo.CurrentCulture, "Team updating failed!"); } await Task.Delay(TimeConstants.TeamUpdate); } }); TeamMemberAdded_Message += MessageTeamMemberAdded; TeamMemberRankChanged_Message += MessageTeamMemberRankChanged; TeamMemberRemoved_Message += MessageTeamMemberRemoved; }
/// <summary> /// Creates an instance of <see cref="SpellListItemViewModel"/> /// </summary> public SpellListItemViewModel(SpellModel spellModel, StringService stringService) { _spellModel = spellModel; _stringService = stringService; Initialize(); }
/// <summary> /// Creates an instance of <see cref="TablesViewModel"/> /// </summary> public TablesViewModel(Compendium compendium, TableSearchService tableSearchService, TableSearchInput tableSearchInput, StringService stringService, DialogService dialogService, XMLImporter xmlImporter, DocumentService documentService, DataManager dataManager) { _compendium = compendium; _tableSearchService = tableSearchService; _tableSearchInput = tableSearchInput; _stringService = stringService; _dialogService = dialogService; _xmlImporter = xmlImporter; _documentService = documentService; _dataManager = dataManager; _selectTableCommand = new RelayCommand(obj => true, obj => SelectTable(obj as ListItemViewModel <RandomTableModel>)); _editTableCommand = new RelayCommand(obj => true, obj => EditTable(obj as RandomTableViewModel)); _exportTableCommand = new RelayCommand(obj => true, obj => ExportTable(obj as RandomTableViewModel)); _cancelEditTableCommand = new RelayCommand(obj => true, obj => CancelEditTable()); _saveEditTableCommand = new RelayCommand(obj => HasUnsavedChanges, obj => SaveEditTable()); _resetFiltersCommand = new RelayCommand(obj => true, obj => InitializeSearch()); _addCommand = new RelayCommand(obj => true, obj => Add()); _copyCommand = new RelayCommand(obj => _selectedTable != null, obj => Copy()); _deleteCommand = new RelayCommand(obj => _selectedTable != null, obj => Delete()); _importCommand = new RelayCommand(obj => true, obj => Import()); _selectNextCommand = new RelayCommand(obj => true, obj => SelectNext()); _selectPreviousCommand = new RelayCommand(obj => true, obj => SelectPrevious()); Search(); }
/// <summary> /// Creates an instance of <see cref="BackgroundListItemViewModel"/> /// </summary> public BackgroundListItemViewModel(BackgroundModel backgroundModel, StringService stringService) { _backgroundModel = backgroundModel; _stringService = stringService; Initialize(); }
// GET api/<controller> public async Task <IEnumerable <Models.Actor> > GetMovies() { var service = new StringService(new MovieService()); var output = service.GetAscendingOrder(); return(output); }
public void TestMessageService_GetOutputs() { ILetterMappingRepository letterMappingRepository = new LetterMappingRepository(); ISettingsRepository settingsRepository = new SettingsRepository(); IMessageRepository messageRepository = Mock.Of <IMessageRepository>(s => s.GetAllLines("mockPath") == new string[5] { "4", "hi", "yes", "foo bar", "hello world" }); IStringService stringService = new StringService(); IMessageService messageService = new MessageService(letterMappingRepository, settingsRepository, messageRepository, stringService); IList <string> outputs = messageService.GetOutputs("mockPath", false); Assert.IsTrue(outputs[0] == "Case #1: 44 444"); Assert.IsTrue(outputs[1] == "Case #2: 999337777"); Assert.IsTrue(outputs[2] == "Case #3: 333666 6660 022 2777"); Assert.IsTrue(outputs[3] == "Case #4: 4433555 555666096667775553"); }
/// <summary> /// Creats an instance of <see cref="RaceListItemViewModel"/> /// </summary> public RaceListItemViewModel(RaceModel raceModel, StringService stringService) { _raceModel = raceModel; _stringService = stringService; Initialize(); }
/// <summary> /// Creates an instance of <see cref="BackgroundsViewModel"/> /// </summary> public BackgroundsViewModel(Compendium compendium, BackgroundSearchService backgroundSearchService, BackgroundSearchInput backgroundSearchInput, StringService stringService, DialogService dialogService, XMLImporter xmlImporter, XMLExporter xmlExporter) { _compendium = compendium; _backgroundSearchService = backgroundSearchService; _backgroundSearchInput = backgroundSearchInput; _stringService = stringService; _dialogService = dialogService; _xmlImporter = xmlImporter; _xmlExporter = xmlExporter; _selectBackgroundCommand = new RelayCommand(obj => true, obj => SelectBackground(obj as BackgroundListItemViewModel)); _editBackgroundCommand = new RelayCommand(obj => true, obj => EditBackground(obj as BackgroundViewModel)); _exportBackgroundCommand = new RelayCommand(obj => true, obj => ExportBackground(obj as BackgroundViewModel)); _cancelEditBackgroundCommand = new RelayCommand(obj => true, obj => CancelEditBackground()); _saveEditBackgroundCommand = new RelayCommand(obj => HasUnsavedChanges, obj => SaveEditBackground()); _resetFiltersCommand = new RelayCommand(obj => true, obj => InitializeSearch()); _addCommand = new RelayCommand(obj => true, obj => Add()); _copyCommand = new RelayCommand(obj => _selectedBackground != null, obj => Copy()); _deleteCommand = new RelayCommand(obj => _selectedBackground != null, obj => Delete()); _importCommand = new RelayCommand(obj => true, obj => Import()); _selectNextCommand = new RelayCommand(obj => true, obj => SelectNext()); _selectPreviousCommand = new RelayCommand(obj => true, obj => SelectPrevious()); Search(); }
/// <summary> /// Creates an instance of <see cref="LocationsViewModel"/> /// </summary> public LocationsViewModel(Compendium compendium, LocationSearchService locationSearchService, LocationSearchInput locationSearchInput, StringService stringService, DialogService dialogService, XMLImporter xmlImporter, DocumentService documentService, DataManager dataManager) { _compendium = compendium; _locationSearchService = locationSearchService; _locationSearchInput = locationSearchInput; _stringService = stringService; _dialogService = dialogService; _xmlImporter = xmlImporter; _documentService = documentService; _dataManager = dataManager; _selectLocationCommand = new RelayCommand(obj => true, obj => SelectLocation(obj as ListItemViewModel <LocationModel>)); _editLocationCommand = new RelayCommand(obj => true, obj => EditLocation(obj as LocationViewModel)); _exportLocationCommand = new RelayCommand(obj => true, obj => ExportLocation(obj as LocationViewModel)); _cancelEditLocationCommand = new RelayCommand(obj => true, obj => CancelEditLocation()); _saveEditLocationCommand = new RelayCommand(obj => HasUnsavedChanges, obj => SaveEditLocation()); _resetFiltersCommand = new RelayCommand(obj => true, obj => InitializeSearch()); _addCommand = new RelayCommand(obj => true, obj => Add()); _copyCommand = new RelayCommand(obj => _selectedLocation != null, obj => Copy()); _deleteCommand = new RelayCommand(obj => _selectedLocation != null, obj => Delete()); _importCommand = new RelayCommand(obj => true, obj => Import()); _selectNextCommand = new RelayCommand(obj => true, obj => SelectNext()); _selectPreviousCommand = new RelayCommand(obj => true, obj => SelectPrevious()); Search(); }
/// <summary> /// Creates an instance of <see cref="FeatsViewModel"/> /// </summary> public FeatsViewModel(Compendium compendium, FeatSearchService classSearchService, FeatSearchInput featSearchInput, StringService stringService, DialogService dialogService, XMLImporter xmlImporter, XMLExporter xmlExporter) { _compendium = compendium; _featSearchService = classSearchService; _featSearchInput = featSearchInput; _stringService = stringService; _dialogService = dialogService; _xmlImporter = xmlImporter; _xmlExporter = xmlExporter; _selectFeatCommand = new RelayCommand(obj => true, obj => SelectFeat(obj as FeatListItemViewModel)); _editFeatCommand = new RelayCommand(obj => true, obj => EditFeat(obj as FeatViewModel)); _exportFeatCommand = new RelayCommand(obj => true, obj => ExportFeat(obj as FeatViewModel)); _cancelEditFeatCommand = new RelayCommand(obj => true, obj => CancelEditFeat()); _saveEditFeatCommand = new RelayCommand(obj => HasUnsavedChanges, obj => SaveEditFeat()); _resetFiltersCommand = new RelayCommand(obj => true, obj => InitializeSearch()); _addCommand = new RelayCommand(obj => true, obj => Add()); _copyCommand = new RelayCommand(obj => _selectedFeat != null, obj => Copy()); _deleteCommand = new RelayCommand(obj => _selectedFeat != null, obj => Delete()); _importCommand = new RelayCommand(obj => true, obj => Import()); _selectNextCommand = new RelayCommand(obj => true, obj => SelectNext()); _selectPreviousCommand = new RelayCommand(obj => true, obj => SelectPrevious()); Search(); }
public Poll(StringService strings, IUserMessage umsg, string question, string[] answers) { _strings = strings; _originalMessage = umsg; _guild = ((ITextChannel)umsg.Channel).Guild; _question = question; _answers = answers; }
static void Main(string[] args) { Console.WriteLine("Hello World!"); string newtext = "jaaaaaaaaaaaaaaaaaaaaaaaaa"; var stringService = new StringService(); Console.WriteLine(stringService.CutString(newtext, 5)); }
public void When_ConcatenatingRotatorWithCapac_ThenShould_ReturnRotatorCapac() { var values = new string[] { "rotator", "capac" }; var result = StringService.Concatenate(values); Assert.IsTrue(result == "rotatorcapac"); }
public void When_ConcatenateCalledWithAListOfStrings_ThenShould_ReturnTheListConcatenated() { var values = new string[] { "rotator", "capac" }; var result = StringService.Concatenate(values); Assert.IsTrue(result == "rotatorcapac"); }
public void Json_Has_Return_Data() { var service = new StringService(new MockService()); var output = service.GetAscendingOrder(); Assert.IsInstanceOf <IEnumerable <Models.Actor> >(output); }
public void When_ConcatenateCalledWithNotEmptyArgument_ThenShould_ReturnConcatenateStrings() { var values = new[] { "rotator", "capac" }; var result = StringService.Concatenate(values); Assert.IsTrue(result == "rotatorcapac"); }
public WatchedForumAccountsService(DbService db, VerificationService vs, StringService ss) { _db = db; _vs = vs; _ss = ss; _vs.UserVerified += UserVerified; }
private ConfigModel GetLoggerConfig() { IConfigService configService = new ConfigService(); IFileService fileService = new FileService(); IStringService stringService = new StringService(); IProcessingPlant processingPlant = new ProcessingPlant(); return(configService.GetConfig(stringService, fileService, processingPlant)); }
static void Main(string[] args) { var stringstring = new StringService(); string original = "Det var en gamal gubbe"; string answer = CutString(original, 5); Console.WriteLine(answer); }
public string Get(string url, WebProxy proxy, string publicKey, string secretKey, string resources, string wordcount, string sourceLanguage, string targetLanguage , StringService service = StringService.None, string expertise = "", StringProofreading proofreading = StringProofreading.None, StringCurrency stringCurrency = StringCurrency.None) { using (var client = new WebClient()) { if (proxy != null) client.Proxy = proxy; client.Encoding = Encoding.UTF8; var web = url + String.Format("/tools/quote?public_key={0}&secret_key={1}&resources={2}&wordcount={3}&source_language={4}&target_language={5}&service={6}&expertise={7}&proofreading={8}¤cy={9}" , publicKey, secretKey, resources, wordcount, sourceLanguage, targetLanguage, service.GetStringValue(), expertise, proofreading.GetStringValue(), stringCurrency.GetStringValue()); return client.DownloadString(web); } }
/// <summary> /// Get the summary of an order /// </summary> /// <param name="resources">a comma (,) separated list of resource_uuid</param> /// <param name="wordcount">word count </param> /// <param name="sourceLanguage">See the list of Language Codes</param> /// <param name="targetLanguage">See the list of Language Codes</param> /// <param name="service">[Optional] translation | proofreading | transproof | transcription (defaults to translation)</param> /// <param name="expertise">[Optional] See the list of Expertise Codes</param> /// <param name="proofreading">[Optional] 0 | 1</param> /// <param name="stringCurrency">[Optional] USD | EUR</param> /// <returns></returns> public GetQuoteResult GetQuote(string resources, string wordcount, string sourceLanguage, string targetLanguage , StringService service = StringService.None, string expertise = "", StringProofreading proofreading = StringProofreading.None, StringCurrency stringCurrency = StringCurrency.None) { var r = new GetQuoteResult(); try { if (GetQuoteProvider == null) GetQuoteProvider = new GetQuoteProvider(); var json = GetQuoteProvider.Get(Url, _proxy, KeyPublic, KeySecret, resources, wordcount, sourceLanguage, targetLanguage, service, expertise, proofreading, stringCurrency); r = JsonConvert.DeserializeObject<GetQuoteResult>(json.Replace("\"results\":[", "\"resultsArray\":[")); } catch (Exception err) { r.Status.Code = -1; r.Status.Msg = err.Message; } return r; }
public ConsoleLoggingService(StringService service) { }