// TODO: check filesize by zero or less than min rows public Algorithm(AlgorithmType algorithmType, long filesize) { AlgorithmType = algorithmType; switch (algorithmType) { case AlgorithmType.Fast: { TextGenerator = new FastTextGenerator(filesize); break; } case AlgorithmType.Rand: { TextGenerator = new RandomTextGenerator(filesize, new RowGenerator()); break; } case AlgorithmType.RandWithDuplicates: { TextGenerator = new RandomTextGenerator(filesize, new RowGeneratorWithRepeat(10)); break; } default: throw new ArgumentException($"unknown algorithm {algorithmType}"); } }
public MainMenuScreenHandler( ITextGenerator textGenerator, IMainMenuHandler handler, IPrinter <MainMenuPrinter.State> printer) : base(textGenerator, printer) { _createCharacterTyper = MakeUniqueTyper(); _handler = handler; }
private void Awake() { if (audioManager == null) { Debug.LogError("Audio manager is empty"); return; } if (particleEffectsManager == null) { Debug.LogError("Particle effects manager is empty"); return; } if (activePlayerProfile == null) { Debug.LogError("Active player profile is empty"); return; } if (playerProfileForGameScene == null) { Debug.LogError("Temprory player profile is empty"); return; } playerProfileForGameScene.Set(new PlayerProfile()); if (assetsReferences == null) { Debug.LogError("Assets with dictiinaries is empty!"); return; } var textGeneratorFactory = new TextGeneratorFactory(gameSettings.variable, assetsReferences.variable); currentTextGenerator = textGeneratorFactory.GetTextGenerator(); if (currentTextGenerator == null) { Debug.LogError("Cannot create text generator!"); return; } // Components AssignComponents(); AssignCompomnentsReferences(); // Events AssignPlayerProfileEventsToManager(); AssignTargetEventsToManager(); AssignPauseEventsFromManager(); AssignAudioEvents(); AssignVFXEventsToEventsManager(); pauseManager.ResumeGame(); timer.OnTick.AddListener(spawnManager.Spawn); }
/// <summary> /// Конструктор. /// </summary> /// <param name="writer">Генератор текста.</param> public Speaker(ITextGenerator writer) { if (writer == null) { throw new ArgumentNullException(nameof(writer)); } _writer = writer; }
public CharacterCreationScreenHandler( ITextGenerator textGenerator, ICharacterCreationHandler characterCreationHandler, IPrinter <CharacterCreationPrintableState> printer) : base(textGenerator) { _returnBackToMainMenuTyper = MakeUniqueTyper(); _characterCreationHandler = characterCreationHandler; _printer = printer; }
public DialogModalScreenHandler( ITextGenerator textGenerator, IOutput output) : base(textGenerator) { _output = output; _text = null !; _ok = null !; _cancel = null !; _okAction = null !; _cancelAction = null !; }
public TextChain DefineGlobally(string key, ITextGenerator generator) { if (this.GlobalEntities.Keys.Contains(key)) { throw new InvalidOperationException(string.Format("A global entity with key '{0}' was previously defined.", key)); } else { this.GlobalEntities[key] = generator; } return(this); }
public static void Print(this ITextGenerator textGenerator, Comment comment, CommentKind kind) { var sections = new List <Section> { new Section(CommentElement.Summary) }; GetCommentSections(comment, sections); foreach (var section in sections) { TrimSection(section); } FormatComment(textGenerator, sections, kind); }
public TextTemplate Define(string key, ITextGenerator generator) { if (!this.EntityPlaceholders.Contains(key)) { throw new InvalidOperationException(string.Format("No entity with key '{0}' was defined through the TextGenerator constructor.", key)); } else { this.EntityDefinitions[key] = generator; } return(this); }
/// <summary> /// Constructor initializes all internal instances and bind with external dependencies /// </summary> /// <param name="_textGenerator">Instance of text generator class</param> public Client(ITextGenerator _textGenerator) { IPHostEntry ipHost = Dns.GetHostEntry("localhost"); IPAddress ipAddr = ipHost.AddressList[0]; IPEndPoint ipEndPoint = new IPEndPoint(ipAddr, 11000); sender = new Socket(ipAddr.AddressFamily, SocketType.Stream, ProtocolType.Tcp); sender.Connect(ipEndPoint); textGenerator = _textGenerator; bufferSize = sender.ReceiveBufferSize; messagesCount = 10; delay = 5000; }
private static void FormatComment(ITextGenerator textGenerator, List <Section> sections, CommentKind kind) { var commentPrefix = Comment.GetMultiLineCommentPrologue(kind); sections.Sort((x, y) => x.Type.CompareTo(y.Type)); var remarks = sections.Where(s => s.Type == CommentElement.Remarks).ToList(); if (remarks.Any()) { remarks.First().GetLines().AddRange(remarks.Skip(1).SelectMany(s => s.GetLines())); } if (remarks.Count > 1) { sections.RemoveRange(sections.IndexOf(remarks.First()) + 1, remarks.Count - 1); } foreach (var section in sections.Where(s => s.HasLines)) { var lines = section.GetLines(); var tag = section.Type.ToString().ToLowerInvariant(); var attributes = string.Empty; if (section.Attributes.Any()) { attributes = ' ' + string.Join(" ", section.Attributes); } textGenerator.Write($"{commentPrefix} <{tag}{attributes}>"); if (lines.Count == 1) { textGenerator.Write(lines[0]); } else { textGenerator.NewLine(); foreach (var line in lines) { textGenerator.WriteLine($"{commentPrefix} <para>{line}</para>"); } textGenerator.Write($"{commentPrefix} "); } textGenerator.WriteLine($"</{tag}>"); } }
static void Main(string[] args)//количество фигур, количество групп { container = ContainerClass.GenerateContainer(int.Parse(args[0]), int.Parse(args[1])); Console.WriteLine("Press Spacebar for .html output, other for .txt"); ConsoleKeyInfo key = Console.ReadKey(false); if (key.Key == ConsoleKey.Spacebar) { container.Configure(_ => { _.For(typeof(IOutput)).Use(typeof(HtmlFileOutput)); }); } else { container.Configure(_ => { _.For(typeof(IOutput)).Use(typeof(TextFileOutput)); }); } try { IContentGenerator content = container.GetInstance <IContentGenerator>(); ITextGenerator Text = container.GetInstance <ITextGenerator>(); IOutput fileOutput = container.GetInstance <IOutput>(); fileOutput.Write(Text.GenerateText(content.GenerateContent() as IEnumerable <Tuple <List <Figure>, (double Min, double Max)> >)); } catch (Exception ex) { Console.WriteLine(ex.ToString()); Console.ReadKey(); } }
public ScreenFactory( ITextGenerator textGenerator, IConnectionManager connectionManager, ICharactersClient charactersClient, ILocationsClient locationsClient, IOutput output, IPrinter <MainMenuState> mainMenuPrinter, IPrinter <CharacterCreationState> characterCreationPrinter, IPrinter <WorldScreenState> worldPrinter) { _textGenerator = textGenerator; _connectionManager = connectionManager; _charactersClient = charactersClient; _locationsClient = locationsClient; _output = output; _mainMenuPrinter = mainMenuPrinter; _characterCreationPrinter = characterCreationPrinter; _worldPrinter = worldPrinter; // Create this only after initializing everything inside ScreenFactory. ScreenNavigation = new ScreenNavigation(this); Task.Run(() => ScreenNavigation.Screen = GameScreen.MainMenu); }
public TextSender() { _httpClient = new HttpClient(); _generator = new TextGenerator(); }
protected MultiTyperInputHandler(ITextGenerator textGenerator) { _textGenerator = textGenerator; }
public UniqueTyperPool(ITextGenerator textGenerator) { _textGenerator = textGenerator; }
public NumberFormatVerifier(INumberVerifierSettings settings, ITextGenerator textGenerator) { VerificationSettings = settings; TextGenerator = textGenerator; }
public MainProgram(IConsole console, ITextGenerator textGenerator) { _console = console; _textGenerator = textGenerator; }
public TextsController(ITextGenerator textGenerator) { _textGenerator = textGenerator; }
public HomeController(ITextGenerator TextGenerator, ITrigramGenerator TrigramGenerator) { _TextGenerator = TextGenerator; _TrigramGenerator = TrigramGenerator; }
public void OneTimeSetUp() { trigram = new TrigramGenerator(); textGenerator = new TextGenerator(); }