public override void OnFrameworkInitializationCompleted() { if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop) { var builder = new ConfigurationBuilder() .SetBasePath(Path.Combine(AppContext.BaseDirectory)) .AddJsonFile("appsettings.json", optional: true); _configuration = builder.Build(); _commandText = new CommandText(); _executer = new Executer(); var repo = new DataRepository(_configuration, _commandText, _executer); desktop.MainWindow = new MainWindow { DataContext = new MainWindowViewModel(repo), }; var theme = new Avalonia.Themes.Default.DefaultTheme(); theme.TryGetResource("Button", out _); /*var theme1 = new Avalonia.Themes.Fluent.FluentTheme(); * theme1.TryGetResource("Button", out _);*/ } base.OnFrameworkInitializationCompleted(); }
public DataRepository(IConfiguration configuration, ICommandText commandText, IExecuter executer) { _configuration = configuration; _commandText = commandText; _executer = executer; _connStr = _configuration.GetConnectionString("Gitbang"); }
public void Init <CLIENT_T>() where CLIENT_T : Gamnet.Simulation.Client { Executer <CLIENT_T> executer = new Executer <CLIENT_T>(); this.executer = executer; instance = (Simulator)GameObject.FindObjectOfType(typeof(Simulator)); if (null == instance) { GameObject container = new GameObject(); container.name = "Simulator"; instance = container.AddComponent <Simulator>(); } foreach (string scenarioName in ScenarioNames) { executer.AddScenario(scenarioName); } for (int i = 0; i < SessionCount; i++) { CLIENT_T client_t = executer.CreateClient(); client_t.LoopCount = LoopCount; client_t.Connect(Host, Port); } }
public DistributedHashTableMasterHost(string name, IExecuter executer, int port) { this.executer = executer; master = new DistributedHashTableMaster(); master.TopologyChanged += OnTopologyChanged; listener = new TcpListener(IPAddress.Any, port); hashTable = new PersistentHashTable.PersistentHashTable(name); }
private static async Task AsyncFactoryPattern(ISetting setting) { IExecuterFactory factory = new ExecuterFactory(setting); IExecuter executer = await factory.CreateAsync(); int a = executer.GetData(); // synchronous int b = executer.GetData(); // synchronous }
public HandlingAssignedSegments() { master = MockRepository.GenerateStub <IDistributedHashTableMaster>(); executer = MockRepository.GenerateStub <IExecuter>(); endPoint = NodeEndpoint.ForTest(1); node = new DistributedHashTableNode(master, executer, new BinaryMessageSerializer(), endPoint, MockRepository.GenerateStub <IQueueManager>(), MockRepository.GenerateStub <IDistributedHashTableNodeReplicationFactory>()); }
public HandlingAssignedSegments() { master = MockRepository.GenerateStub<IDistributedHashTableMaster>(); executer = MockRepository.GenerateStub<IExecuter>(); endPoint = NodeEndpoint.ForTest(1); node = new DistributedHashTableNode(master, executer, new BinaryMessageSerializer(), endPoint, MockRepository.GenerateStub<IQueueManager>(), MockRepository.GenerateStub<IDistributedHashTableNodeReplicationFactory>()); }
public WhenFinishedReplicatingSegment() { master = MockRepository.GenerateStub <IDistributedHashTableMaster>(); executer = MockRepository.GenerateStub <IExecuter>(); endPoint = NodeEndpoint.ForTest(1); master.Stub(x => x.Join(Arg.Is(endPoint))) .Return(new Segment[0]); node = new DistributedHashTableNode(master, executer, new BinaryMessageSerializer(), endPoint, MockRepository.GenerateStub <IQueueManager>(), MockRepository.GenerateStub <IDistributedHashTableNodeReplicationFactory>()); }
List <int> breakPoints = new List <int>(); // list contains pcs of all breakpoints public void init(ROM rom, InterruptController interruptController, Memory memory, Decoder decoder, Executer executer, Prescaler prescaler) { this.rom = rom; this.interruptController = interruptController; this.memory = memory; this.decoder = decoder; this.executer = executer; this.prescaler = prescaler; reset(); }
/// <summary> /// Executes the query. /// </summary> /// <returns> /// string that reprsent the result /// </returns> public string Execute() { string result; do { executer = ExecuterFactory.GetExecuter(user, db); result = executer.Execute(); } while (result.Equals(executer.GetSorryMsg())); return(result); }
public virtual bool HandleCommand(IExecuter executer, string commandText) { Debug($"Handling command `{commandText}`"); //Regex re = new Regex("\"(?<arg>.*?)\\"|'(?<arg>.*?)'|(?<arg>[^\\s]+)"); // yes i know this is a c**t of a regex but unless someone know how to make it smaller, it stays Regex re = new Regex("\"(?<val>.*?)\"|'(?<val>.*?)'|(\"(?<val>.*?)\"|'(?<val>.*?)'|(?<val>[\\w-=!@#$%^&*()_+\\[\\]{}\\|<>/?.:;`~]+))(,\\s*(\"(?<val>.*?)\"|'(?<val>.*?)'|(?<val>[\\w-=!@#$%^&*()_+\\[\\]{}\\|<>/?.:;`~]+)))*|(?<val>[^\\s]+)"); MatchCollection matches = re.Matches(commandText.Trim()); string[] split = new string[matches.Count]; for (int i = 0; i < matches.Count; i++) { if (matches[i].Groups[4].Captures.Count > 1) { string[] captures = new string[matches[i].Groups[4].Captures.Count]; int j = 0; foreach (object capture in matches[i].Groups[4].Captures) { captures[j] = capture.ToString().Trim(); j++; } split[i] = String.Join(":#:", captures); } else { split[i] = matches[i].Groups[4].Captures[0].ToString().Trim(); } } string commandName = split[0]; string[] args = split.Skip(1).ToArray(); Command command = Commands.FindCommand(commandName); if (command == null) { return(false); } try { return(command.Execute(new CommandContext(this, executer), args)); } catch (InvalidSyntaxException ex) { WriteLine(Color.Red, ex.Message); } return(false); }
public DistributedHashTableNode(IDistributedHashTableMaster master, IExecuter executer, IMessageSerializer messageSerializer, NodeEndpoint endpoint, IQueueManager queueManager, IDistributedHashTableNodeReplicationFactory replicationFactory) { this.master = master; this.executer = executer; this.messageSerializer = messageSerializer; this.endpoint = endpoint; this.queueManager = queueManager; this.replicationFactory = replicationFactory; State = NodeState.NotStarted; backgroundReplication = new Thread(BackgroundReplication) { IsBackground = true }; }
private ActionResult SendToView(string categoryDescription, int categoryId, Int16 pageNumber, CatalogueType catalogueType) { currentSelection.MenuIndex = GetCategoryIdByDescription(categoryDescription); Category parentCaregory = hopeLingerieEntities.Categories.FirstOrDefault(x => x.CategoryId == categoryId && x.Active); currentSelection.RootCategory = hopeLingerieEntities.Categories.FirstOrDefault(x => x.CategoryId == categoryId); currentSelection.PageNumber = pageNumber; currentSelection.CategoriesMenu = hopeLingerieEntities.Categories.Where(x => x.ParentCategoryId == null && x.Active).OrderBy(x => x.DisplayOrder).ToList(); currentSelection.Action = categoryDescription; IExecuter[] executers = { new OnSale(), new IsNew(), new Standard() }; IExecuter executer = executers.First(x => x.IsValid(catalogueType)); currentSelection.Products = executer.DoQuery().ToList(); PrepareNavigationSettings(parentCaregory); return(View(executer.PickView(), currentSelection)); }
public SolrQueryProvider( IExecuter <TEntity> operations, SolrNetLinqOptions options, MemberContext context, SelectExpressionsCollection selectExpressions) { Operations = operations ?? throw new ArgumentNullException(nameof(operations)); Options = options ?? throw new ArgumentNullException(nameof(options)); SelectExpressions = selectExpressions ?? new SelectExpressionsCollection(); if (context == null) { this.MemberContext = MemberContext.ForType <TEntity>(); this.MemberContext.FieldSerializer = this.Options.SolrFieldSerializer; this.MemberContext.MappingManager = this.Options.MappingManager; } else { this.MemberContext = context; } }
public WhenReplicatingRequestToOwner() { master = MockRepository.GenerateStub <IDistributedHashTableMaster>(); endPoint = NodeEndpoint.ForTest(1); backup1 = NodeEndpoint.ForTest(2); backup2 = NodeEndpoint.ForTest(3); topology = new Topology(new[] { new Segment { Index = 0, AssignedEndpoint = endPoint, PendingBackups = { backup1, backup2, } }, new Segment { Index = 1, AssignedEndpoint = backup1, PendingBackups = { endPoint, backup2, } }, }, 1); master.Stub(x => x.GetTopology()).Return(topology); executer = MockRepository.GenerateStub <IExecuter>(); master.Stub(x => x.Join(Arg.Is(endPoint))) .Return(new Segment[0]); queueManager = MockRepository.GenerateStub <IQueueManager>(); node = new DistributedHashTableNode(master, executer, new BinaryMessageSerializer(), endPoint, queueManager, MockRepository.GenerateStub <IDistributedHashTableNodeReplicationFactory>()); node.Start(); }
public void init(Memory memory, Executer executer) { this.memory = memory; this.executer = executer; }
/// <summary>Ctor /// </summary> public FastDFSClient(IExecuter executer) { _executer = executer; }
public BashInterpreter() { executer = new Executer(); variableManager = new VariableManager(); logger = new Logger(); }
// Token: 0x06000226 RID: 550 RVA: 0x00009CBA File Offset: 0x00007EBA protected ExecuterProxy(IExecuter delegateExecuter) { this.delegateExecuter = delegateExecuter; }
internal Rover(double x, double y, IDirection direction, IExecuter executor) : base(x, y, direction, executor) { }
// Constructor. protected Action(IExecuter executer = null, int cost = 0) { Executer = executer; Cost = cost; }
public static IExecuter <TNew> ChangeType <TNew, TOld>( this IExecuter <TOld> executer, MethodCallExpression expression, SelectExpressionsCollection selectExpressionsCollection) { if (executer == null) { throw new ArgumentNullException(nameof(executer)); } if (expression == null) { throw new ArgumentNullException(nameof(expression)); } if (selectExpressionsCollection == null) { throw new ArgumentNullException(nameof(selectExpressionsCollection)); } try { SolrQueryExecuter <TOld> oldExecuter = executer.Executer; ISolrConnection connection = oldExecuter.GetFieldRecursive <ISolrConnection>(); ISolrQuerySerializer serializer = oldExecuter.GetFieldRecursive <ISolrQuerySerializer>(); ISolrFacetQuerySerializer facetQuerySerializer = oldExecuter.GetFieldRecursive <ISolrFacetQuerySerializer>(); ISolrDocumentResponseParser <TOld> oldParser = oldExecuter.GetFieldRecursive <ISolrDocumentResponseParser <TOld> >(); ISolrFieldParser fieldParser = oldParser.GetFieldRecursive <ISolrFieldParser>(); SolrDictionaryDocumentResponseParser dictionaryParser = new SolrDictionaryDocumentResponseParser(fieldParser); ISolrDocumentResponseParser <TNew> docParser; if (expression.Method.DeclaringType == typeof(Queryable) && expression.Method.Name == nameof(Queryable.Cast)) { docParser = new CastResponseParser <TNew, TOld>(oldParser, dictionaryParser); } else if (expression.Method.DeclaringType == typeof(Queryable) && expression.Method.Name == nameof(Queryable.Select)) { docParser = new SelectResponseParser <TNew, TOld>(oldParser, dictionaryParser, expression, selectExpressionsCollection); } else { throw new InvalidOperationException( $"Unable to change query type from {typeof(TOld).Name} to {typeof(TNew).Name}. Method {expression.Method.Name} not supported"); } ISolrAbstractResponseParser <TNew> parser = new DefaultResponseParser <TNew>(docParser); SolrQueryExecuter <TNew> newExecuter = new SolrQueryExecuter <TNew>(parser, connection, serializer, facetQuerySerializer, new SolrMoreLikeThisHandlerQueryResultsParser <TNew>(Enumerable.Repeat(parser, 1))); newExecuter.DefaultHandler = oldExecuter.DefaultHandler; newExecuter.DefaultRows = oldExecuter.DefaultRows; newExecuter.MoreLikeThisHandler = oldExecuter.MoreLikeThisHandler; return(new SelectQueryExecutor <TNew>(newExecuter)); } catch (Exception e) { throw new InvalidOperationException( $"Unable to change solr query executer from {typeof(TOld)} to {typeof(TNew)}.", e); } }
public JoiningMaster() { master = MockRepository.GenerateStub<IDistributedHashTableMaster>(); executer = MockRepository.GenerateStub<IExecuter>(); endPoint = NodeEndpoint.ForTest(1); master.Stub(x => x.Join(Arg.Is(endPoint))) .Return(new Segment[0]); node = new DistributedHashTableNode(master, executer, new BinaryMessageSerializer(), endPoint, MockRepository.GenerateStub<IQueueManager>(), MockRepository.GenerateStub<IDistributedHashTableNodeReplicationFactory>()); }
public CommandContext(ICommandHandler handler, IExecuter executer) { Handler = handler; Executer = executer; }
async Task <T[]> SerfAsync <T>(IExecuter <T> exec) where T : class { List <T> resList = new List <T>(); List <string> GetLinks(IHtmlDocument doc) { List <string> links = new List <string>(); var allLinks = doc.QuerySelectorAll("a"); foreach (var link in allLinks) { string l = link.Attributes["href"].Value; if (l.StartsWith(@"/")) { foreach (string s in ExcludedDistricts) { if (l.Contains(s)) { goto next; } } links.Add(l); } next :; } return(links); } List <string> urls = new List <string>() { startUrl }; List <string> urlsToGo = new List <string>() { startUrl }; List <string> urlsFound = new List <string>(); while (urlsToGo.Count > 0) { string page = await loader.GetHtmlAsync(urlsToGo[0]); IHtmlDocument doc = await parser.ParseDocumentAsync(page); T middleResult = exec.Go(doc); if (middleResult != null) { resList.Add(middleResult); } urlsFound = GetLinks(doc); foreach (string urlFound in urlsFound) { if (!(urls.Contains(urlFound))) { urls.Add(urlFound); urlsToGo.Add(urlFound); } } urlsToGo.RemoveAt(0); } return(resList.ToArray()); }
public void SetExecuter(IExecuter executer) { this.executer.Finish(this); this.executer = executer; this.executer.Initiate(this); }
public Movable(double x, double y, IDirection direction, IExecuter commandExecuter) { Direction = direction; Position = new Position(x, y); _commandExecuter = commandExecuter; }
public void Restart() { executer = ParseExecuter.instance; currentCommandIndex = 0; }
/// <summary>Ctor /// </summary> public FastDFSClient(IExecuter executer, IClusterFactory clusterFactory) { _executer = executer; _clusterFactory = clusterFactory; }
public void AddCommand(IExecuter cmd) { _cmdList.Add(cmd); }