internal override bool IsValidCommand(Game game) { if (CommandHelpers.IsCommandValid(game.GlobalManager, RequestingFactionGuid, EntityCommandingGuid, out _factionEntity, out _entityCommanding)) { return(true); } else { return(false); } }
private void UpdateCanExecute() { if (Command != null) { CanExecute = CommandHelpers.CanExecuteCommandSource(CommandParameter, this); } else { CanExecute = true; } }
protected override void Init(IDictionary <string, string> arguments, CancellationToken cancellationToken) { _gallery = arguments.GetOrThrow <string>(Arguments.Gallery); _verbose = arguments.GetOrDefault(Arguments.Verbose, false); _id = arguments.GetOrThrow <string>(Arguments.Id); _version = arguments.GetOrDefault <string>(Arguments.Version); var storageFactory = CommandHelpers.CreateStorageFactory(arguments, _verbose); _storage = storageFactory.Create(); }
/// <summary> /// Invoked each time a key-down event occurs. When key-down occurs we /// check to see if that key was 'Enter', and if so we invoke the /// associated Command. /// </summary> /// <param name="e">A KeyEventArgs that contains the event data.</param> protected override void OnKeyDown(KeyEventArgs e) { base.OnKeyUp(e); if (e.Key == Key.Enter) { CommandHelpers.InvokeCommandSource(CommandParameter, null, this, CommandOperation.Execute); // Dismiss parent Popups RaiseEvent(new RibbonDismissPopupEventArgs()); } }
/// <summary> /// Finds the parameter set hints of a specific command (determined by a given file location) /// </summary> /// <param name="file">The details and contents of a open script file</param> /// <param name="lineNumber">The line number of the cursor for the given script</param> /// <param name="columnNumber">The column number of the cursor for the given script</param> /// <returns>ParameterSetSignatures</returns> public async Task <ParameterSetSignatures> FindParameterSetsInFileAsync( ScriptFile file, int lineNumber, int columnNumber) { SymbolReference foundSymbol = AstOperations.FindCommandAtPosition( file.ScriptAst, lineNumber, columnNumber); // If we are not possibly looking at a Function, we don't // need to continue because we won't be able to get the // CommandInfo object. if (foundSymbol?.SymbolType is not SymbolType.Function and not SymbolType.Unknown) { return(null); } CommandInfo commandInfo = await CommandHelpers.GetCommandInfoAsync( foundSymbol.SymbolName, _runspaceContext.CurrentRunspace, _executionService).ConfigureAwait(false); if (commandInfo == null) { return(null); } try { IEnumerable <CommandParameterSetInfo> commandParamSets = commandInfo.ParameterSets; return(new ParameterSetSignatures(commandParamSets, foundSymbol)); } catch (RuntimeException e) { // A RuntimeException will be thrown when an invalid attribute is // on a parameter binding block and then that command/script has // its signatures resolved by typing it into a script. _logger.LogException("RuntimeException encountered while accessing command parameter sets", e); return(null); } catch (InvalidOperationException) { // For some commands there are no paramsets (like applications). Until // the valid command types are better understood, catch this exception // which gets raised when there are no ParameterSets for the command type. return(null); } }
protected override void Init(IDictionary <string, string> arguments, CancellationToken cancellationToken) { var source = arguments.GetOrThrow <string>(Arguments.Source); var verbose = arguments.GetOrDefault(Arguments.Verbose, false); var contentBaseAddress = arguments.GetOrDefault <string>(Arguments.ContentBaseAddress); var galleryBaseAddress = arguments.GetOrDefault <string>(Arguments.GalleryBaseAddress); var isContentFlatContainer = arguments.GetOrDefault <bool>(Arguments.ContentIsFlatContainer); // The term "legacy" here refers to the registration hives that do not contain any SemVer 2.0.0 packages. // In production, this is two registration hives: // 1) the first hive released, which is not gzipped and does not have SemVer 2.0.0 packages // 2) the secondary hive released, which is gzipped but does not have SemVer 2.0.0 packages var storageFactories = CommandHelpers.CreateRegistrationStorageFactories(arguments, verbose); Logger.LogInformation( "CONFIG source: \"{ConfigSource}\" storage: \"{Storage}\"", source, storageFactories.LegacyStorageFactory); if (isContentFlatContainer) { var flatContainerCursorUriString = arguments.GetOrThrow <string>(Arguments.CursorUri); var flatContainerName = arguments.GetOrThrow <string>(Arguments.FlatContainerName); RegistrationMakerCatalogItem.PackagePathProvider = new FlatContainerPackagePathProvider(flatContainerName); // In case that the flat container is used as the packages' source the registration needs to wait for the flatcontainer cursor _back = new HttpReadCursor(new Uri(flatContainerCursorUriString)); } else { RegistrationMakerCatalogItem.PackagePathProvider = new PackagesFolderPackagePathProvider(); _back = MemoryCursor.CreateMax(); } _collector = new RegistrationCollector( new Uri(source), storageFactories.LegacyStorageFactory, storageFactories.SemVer2StorageFactory, contentBaseAddress == null ? null : new Uri(contentBaseAddress), galleryBaseAddress == null ? null : new Uri(galleryBaseAddress), TelemetryService, Logger, CommandHelpers.GetHttpMessageHandlerFactory(TelemetryService, verbose)); var cursorStorage = storageFactories.LegacyStorageFactory.Create(); _front = new DurableCursor(cursorStorage.ResolveUri("cursor.json"), cursorStorage, MemoryCursor.MinValue); storageFactories.SemVer2StorageFactory?.Create(); _destination = storageFactories.LegacyStorageFactory.DestinationAddress; TelemetryService.GlobalDimensions[TelemetryConstants.Destination] = _destination?.AbsoluteUri; }
// Token: 0x060038DE RID: 14558 RVA: 0x001010F4 File Offset: 0x000FF2F4 internal static void _RegisterClassHandlers(Type controlType, bool registerEventListeners) { ExecutedRoutedEventHandler executedRoutedEventHandler = new ExecutedRoutedEventHandler(TextEditorTables.OnTableCommand); CanExecuteRoutedEventHandler canExecuteRoutedEventHandler = new CanExecuteRoutedEventHandler(TextEditorTables.OnQueryStatusNYI); CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.InsertTable, executedRoutedEventHandler, canExecuteRoutedEventHandler, "KeyInsertTable", "KeyInsertTableDisplayString"); CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.InsertRows, executedRoutedEventHandler, canExecuteRoutedEventHandler, "KeyInsertRows", "KeyInsertRowsDisplayString"); CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.InsertColumns, executedRoutedEventHandler, canExecuteRoutedEventHandler, "KeyInsertColumns", "KeyInsertColumnsDisplayString"); CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.DeleteRows, executedRoutedEventHandler, canExecuteRoutedEventHandler, "KeyDeleteRows", "KeyDeleteRowsDisplayString"); CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.DeleteColumns, executedRoutedEventHandler, canExecuteRoutedEventHandler, "KeyDeleteColumns", "KeyDeleteColumnsDisplayString"); CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.MergeCells, executedRoutedEventHandler, canExecuteRoutedEventHandler, "KeyMergeCells", "KeyMergeCellsDisplayString"); CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.SplitCell, executedRoutedEventHandler, canExecuteRoutedEventHandler, "KeySplitCell", "KeySplitCellDisplayString"); }
//------------------------------------------------------ // // Class Internal Methods // //------------------------------------------------------ #region Class Internal Methods // Registers all text editing command handlers for a given control type internal static void _RegisterClassHandlers(Type controlType, bool registerEventListeners) { var onTableCommand = new ExecutedRoutedEventHandler(OnTableCommand); var onQueryStatusNYI = new CanExecuteRoutedEventHandler(OnQueryStatusNYI); CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.InsertTable, onTableCommand, onQueryStatusNYI, KeyInsertTable, SRID.KeyInsertTableDisplayString); CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.InsertRows, onTableCommand, onQueryStatusNYI, KeyInsertRows, SRID.KeyInsertRowsDisplayString); CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.InsertColumns, onTableCommand, onQueryStatusNYI, KeyInsertColumns, SRID.KeyInsertColumnsDisplayString); CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.DeleteRows, onTableCommand, onQueryStatusNYI, SRID.KeyDeleteRows, SRID.KeyDeleteRowsDisplayString); CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.DeleteColumns, onTableCommand, onQueryStatusNYI, KeyDeleteColumns, SRID.KeyDeleteColumnsDisplayString); CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.MergeCells, onTableCommand, onQueryStatusNYI, KeyMergeCells, SRID.KeyMergeCellsDisplayString); CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.SplitCell, onTableCommand, onQueryStatusNYI, KeySplitCell, SRID.KeySplitCellDisplayString); }
public MainViewModel() { MenuItems = new MenuData[] { new MenuData { Text = "DoorDash", Command = CommandHelpers.PushPageCommand <DoorDashPage>() }, new MenuData { Text = "Robinhood", Command = CommandHelpers.PushPageCommand <RobinhoodPage>() } }; }
internal static async Task <SymbolDetails> CreateAsync( SymbolReference symbolReference, IRunspaceInfo currentRunspace, IInternalPowerShellExecutionService executionService) { SymbolDetails symbolDetails = new() { SymbolReference = symbolReference }; switch (symbolReference.SymbolType) { case SymbolType.Function: CommandInfo commandInfo = await CommandHelpers.GetCommandInfoAsync( symbolReference.SymbolName, currentRunspace, executionService).ConfigureAwait(false); if (commandInfo != null) { symbolDetails.Documentation = await CommandHelpers.GetCommandSynopsisAsync( commandInfo, executionService).ConfigureAwait(false); if (commandInfo.CommandType == CommandTypes.Application) { symbolDetails.DisplayString = "(application) " + symbolReference.SymbolName; return(symbolDetails); } } symbolDetails.DisplayString = "function " + symbolReference.SymbolName; return(symbolDetails); case SymbolType.Parameter: // TODO: Get parameter help symbolDetails.DisplayString = "(parameter) " + symbolReference.SymbolName; return(symbolDetails); case SymbolType.Variable: symbolDetails.DisplayString = symbolReference.SymbolName; return(symbolDetails); default: return(symbolDetails); } } #endregion }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); RegisteredCommand editTestCommand = CommandHelpers.RegisterForNotification(MaximusCommands.EditTest, null, OnEditTestStatus); // exec is in the parent control RegisteredCommand deleteTestCommand = CommandHelpers.RegisterForNotification(MaximusCommands.DeleteTest, null, OnDeleteTestStatus); // exec is in the parent control CommandHelpers.RegisterForNotification(ViewCommands.Refresh, OnRefreshCommand, null); //if (editTestCommand != null) //{ // CommandService.AddAlias(MaximusCommands.EditTest, MaximusCommands.EditTestAlias); // CommandService.AddAlias(MaximusCommands.DeleteTest, MaximusCommands.DeleteTestAlias); // RegisteredCommand editTestAliasedCommand = CommandService.Find(MaximusCommands.EditTestAlias); //} }
protected override void Init(IDictionary <string, string> arguments, CancellationToken cancellationToken) { ServicePointManager.DefaultConnectionLimit = DegreeOfParallelism; var verbose = arguments.GetOrDefault(Arguments.Verbose, false); var packageStorageBase = arguments.GetOrThrow <string>(Arguments.ContentBaseAddress); var failCacheTime = arguments.GetOrDefault(FailCacheTime, TimeSpan.FromHours(1)); var auxStorageFactory = CreateAuxStorageFactory(arguments, verbose); var targetStorageFactory = CreateTargetStorageFactory(arguments, verbose); var packageStorage = new AzureStorage( storageBaseUri: new Uri(packageStorageBase), maxExecutionTime: TimeSpan.FromMinutes(15), serverTimeout: TimeSpan.FromMinutes(10), useServerSideCopy: true, compressContent: false, verbose: true, throttle: null); var source = arguments.GetOrThrow <string>(Arguments.Source); var iconProcessor = new IconProcessor(TelemetryService, LoggerFactory.CreateLogger <IconProcessor>()); var httpHandlerFactory = CommandHelpers.GetHttpMessageHandlerFactory(TelemetryService, verbose); var httpMessageHandler = httpHandlerFactory(); var httpClient = new HttpClient(httpMessageHandler); var simpleHttpClient = new SimpleHttpClient(httpClient, LoggerFactory.CreateLogger <SimpleHttpClient>()); var catalogClient = new CatalogClient(simpleHttpClient, LoggerFactory.CreateLogger <CatalogClient>()); var httpResponseProvider = new HttpClientWrapper(httpClient); var externalIconProvider = new ExternalIconContentProvider(httpResponseProvider, LoggerFactory.CreateLogger <ExternalIconContentProvider>()); var iconCopyResultCache = new IconCopyResultCache(auxStorageFactory.Create(), failCacheTime, LoggerFactory.CreateLogger <IconCopyResultCache>()); var leafProcessor = new CatalogLeafDataProcessor( packageStorage, iconProcessor, externalIconProvider, iconCopyResultCache, TelemetryService, LoggerFactory.CreateLogger <CatalogLeafDataProcessor>()); _collector = new IconsCollector( new Uri(source), TelemetryService, targetStorageFactory, catalogClient, leafProcessor, iconCopyResultCache, auxStorageFactory, CommandHelpers.GetHttpMessageHandlerFactory(TelemetryService, verbose), LoggerFactory.CreateLogger <IconsCollector>()); var cursorStorage = auxStorageFactory.Create(); _front = new DurableCursor(cursorStorage.ResolveUri("c2icursor.json"), cursorStorage, DateTime.MinValue.ToUniversalTime()); }
protected override void Init(IDictionary <string, string> arguments, CancellationToken cancellationToken) { var verbose = arguments.GetOrDefault(Arguments.Verbose, false); _maxRequeueQueueSize = arguments.GetOrDefault(Arguments.MaxRequeueQueueSize, DefaultMaxQueueSize); CommandHelpers.AssertAzureStorage(arguments); var monitoringStorageFactory = CommandHelpers.CreateStorageFactory(arguments, verbose); _statusService = CommandHelpers.GetPackageMonitoringStatusService(arguments, monitoringStorageFactory, LoggerFactory); _queue = CommandHelpers.CreateStorageQueue <PackageValidatorContext>(arguments, PackageValidatorContext.Version); }
public bool SwitchFarmhandByHost() { Console.WriteLine("---------"); Console.WriteLine("Choose a farmhand to change to the host of the saved game: "); Console.WriteLine(">> Host: " + _game.Host.Element("name")?.Value ?? "None?!"); bool success = true; var farmhands = SelectFarmhands(0, inGame: true, hideBlank: true); var farmhandNumber = Prompt.GetInt(Purpose[PurposeEnum.SwitchHost], 1); var farmhand = farmhands.ElementAt(farmhandNumber - 1); _game.SwitchHost(farmhands.ElementAt(farmhandNumber - 1).Cabin); CommandHelpers.SaveFile(_game); return(success); }
/// <summary> /// Overriden to add our menu items to the application menu /// </summary> /// <param name="context">The active command presentation context</param> public override void CreateApplicationContent(ICommandPresentationContext context) { base.CreateApplicationContent(context); context.Add(CommandHelpers.CreateAdjacentSeparator(ScriptingMenuRoot)); context.Add(ScriptingMenuRoot); context.Add(AddNewVICommand); context.Add(AddNewMemberVICommand); context.Add(AddNewTypeCommand); context.Add(AddNewDerivedTypeCommand); context.Add(CreateMergeScriptFromSelectionCommand); context.Add(MergeFromLastMergeScriptCommand); context.Add(TagSelectionCommand); context.Add(FindTaggedElementsCommand); }
/// <summary>Handles the <see cref="E:System.Windows.Documents.Hyperlink.Click" /> routed event.</summary> // Token: 0x06003041 RID: 12353 RVA: 0x000D8E2C File Offset: 0x000D702C protected virtual void OnClick() { if (AutomationPeer.ListenerExists(AutomationEvents.InvokePatternOnInvoked)) { AutomationPeer automationPeer = ContentElementAutomationPeer.CreatePeerForElement(this); if (automationPeer != null) { automationPeer.RaiseAutomationEvent(AutomationEvents.InvokePatternOnInvoked); } } Hyperlink.DoNavigation(this); base.RaiseEvent(new RoutedEventArgs(Hyperlink.ClickEvent, this)); CommandHelpers.ExecuteCommandSource(this); }
public override void Execute(GameCommandTrigger trigger) { string[] args = trigger.Get <string[]>("message"); if (args == null || args.Length <= 1) { trigger.Session.SendNotice("No message provided."); return; } string message = CommandHelpers.BuildString(args, trigger.Session.Player.Name); MapleServer.BroadcastPacketAll(NoticePacket.Notice(message)); }
protected override void Init(IDictionary <string, string> arguments, CancellationToken cancellationToken) { var verbose = arguments.GetOrDefault(Arguments.Verbose, false); _maxRequeueQueueSize = arguments.GetOrDefault(Arguments.MaxRequeueQueueSize, DefaultMaxQueueSize); CommandHelpers.AssertAzureStorage(arguments); var monitoringStorageFactory = CommandHelpers.CreateStorageFactory(arguments, verbose); _statusService = CommandHelpers.GetPackageMonitoringStatusService(arguments, monitoringStorageFactory, LoggerFactory); _packageValidatorContextQueue = CommandHelpers.CreateStorageQueue <PackageValidatorContext>(arguments, PackageValidatorContext.Version); Logger.LogInformation( "CONFIG storage: {Storage}", monitoringStorageFactory); _monitoringCursor = ValidationFactory.GetFront(monitoringStorageFactory); _galleryCursor = CreateCursor(monitoringStorageFactory, GalleryCursorFileName); _deletedCursor = CreateCursor(monitoringStorageFactory, DeletedCursorFileName); var connectionString = arguments.GetOrThrow <string>(Arguments.ConnectionString); var galleryDbConnection = new AzureSqlConnectionFactory( connectionString, SecretInjector, LoggerFactory.CreateLogger <AzureSqlConnectionFactory>()); var packageContentUriBuilder = new PackageContentUriBuilder( arguments.GetOrThrow <string>(Arguments.PackageContentUrlFormat)); var timeoutInSeconds = arguments.GetOrDefault(Arguments.SqlCommandTimeoutInSeconds, 300); _galleryDatabaseQueryService = new GalleryDatabaseQueryService( galleryDbConnection, packageContentUriBuilder, TelemetryService, timeoutInSeconds); var auditingStorageFactory = CommandHelpers.CreateSuffixedStorageFactory( "Auditing", arguments, verbose, new SemaphoreSlimThrottle(new SemaphoreSlim(ServicePointManager.DefaultConnectionLimit))); _auditingStorage = auditingStorageFactory.Create(); var messageHandlerFactory = CommandHelpers.GetHttpMessageHandlerFactory(TelemetryService, verbose); _client = new CollectorHttpClient(messageHandlerFactory()); }
/// <summary> /// Finds the parameter set hints of a specific command (determined by a given file location) /// </summary> /// <param name="file">The details and contents of a open script file</param> /// <param name="lineNumber">The line number of the cursor for the given script</param> /// <param name="columnNumber">The coulumn number of the cursor for the given script</param> /// <returns>ParameterSetSignatures</returns> public async Task <ParameterSetSignatures> FindParameterSetsInFileAsync( ScriptFile file, int lineNumber, int columnNumber, PowerShellContextService powerShellContext) { SymbolReference foundSymbol = AstOperations.FindCommandAtPosition( file.ScriptAst, lineNumber, columnNumber); if (foundSymbol == null) { return(null); } CommandInfo commandInfo = await CommandHelpers.GetCommandInfoAsync( foundSymbol.SymbolName, powerShellContext).ConfigureAwait(false); if (commandInfo == null) { return(null); } try { IEnumerable <CommandParameterSetInfo> commandParamSets = commandInfo.ParameterSets; return(new ParameterSetSignatures(commandParamSets, foundSymbol)); } catch (RuntimeException e) { // A RuntimeException will be thrown when an invalid attribute is // on a parameter binding block and then that command/script has // its signatures resolved by typing it into a script. _logger.LogException("RuntimeException encountered while accessing command parameter sets", e); return(null); } catch (InvalidOperationException) { // For some commands there are no paramsets (like applications). Until // the valid command types are better understood, catch this exception // which gets raised when there are no ParameterSets for the command type. return(null); } }
public override bool ProcessCommand(string commandLine) { // Extract command and parameters bool extractedSuccessfully = CommandHelpers.ExtractCommandAndParameters(commandLine, out var command, out var rawParameters, out var parameters, out _); if (!extractedSuccessfully) { Log.Default.WriteLine(LogLevels.Warning, "Command and parameters not extracted successfully"); Send("Invalid command or parameters"); return(false); } Log.Default.WriteLine(LogLevels.Debug, "[{0}] executing [{1}]", DebugName, commandLine); return(ExecuteCommand(command, rawParameters, parameters)); }
// Handler for "completionItem/resolve". In VSCode this is fired when a completion item is highlighted in the completion list. public async Task <CompletionItem> Handle(CompletionItem request, CancellationToken cancellationToken) { // We currently only support this request for anything that returns a CommandInfo: functions, cmdlets, aliases. if (request.Kind != CompletionItemKind.Function) { return(request); } // No details means the module hasn't been imported yet and Intellisense shouldn't import the module to get this info. if (request.Detail is null) { return(request); } try { await _completionResolveLock.WaitAsync(cancellationToken).ConfigureAwait(false); } catch (OperationCanceledException) { _logger.LogDebug("CompletionItemResolve request canceled for item: {0}", request.Label); return(request); } try { // Get the documentation for the function CommandInfo commandInfo = await CommandHelpers.GetCommandInfoAsync( request.Label, _powerShellContextService).ConfigureAwait(false); if (commandInfo != null) { request = request with { Documentation = await CommandHelpers.GetCommandSynopsisAsync(commandInfo, _powerShellContextService).ConfigureAwait(false) }; } // Send back the updated CompletionItem return(request); } finally { _completionResolveLock.Release(); } }
protected override void Init(IDictionary <string, string> arguments, CancellationToken cancellationToken) { _directory = CommandHelpers.GetLuceneDirectory(arguments, out var destination); _source = arguments.GetOrThrow <string>(Arguments.Source); _verbose = arguments.GetOrDefault(Arguments.Verbose, false); _registration = arguments.GetOrDefault <string>(Arguments.Registration); if (_registration == null) { Logger.LogInformation("Lucene index will be created up to the end of the catalog (alternatively if you provide a registration it will not pass that)"); } _catalogBaseAddress = arguments.GetOrDefault <string>(Arguments.CatalogBaseAddress); if (_catalogBaseAddress == null) { Logger.LogInformation("No catalogBaseAddress was specified so the Lucene index will NOT contain the storage paths"); } _storageBaseAddress = arguments.GetOrDefault <string>(Arguments.StorageBaseAddress); var commitTimeoutInSeconds = arguments.GetOrDefault <int?>(Arguments.CommitTimeoutInSeconds); if (commitTimeoutInSeconds.HasValue) { _commitTimeout = TimeSpan.FromSeconds(commitTimeoutInSeconds.Value); } else { _commitTimeout = null; } Logger.LogInformation("CONFIG source: \"{ConfigSource}\" registration: \"{Registration}\"" + " catalogBaseAddress: \"{CatalogBaseAddress}\" storageBaseAddress: \"{StorageBaseAddress}\" commitTimeout: \"{CommmitTimeout}\"", _source, _registration ?? "(null)", _catalogBaseAddress ?? "(null)", _storageBaseAddress ?? "(null)", _commitTimeout?.ToString() ?? "(null)"); _handlerFunc = CommandHelpers.GetHttpMessageHandlerFactory( TelemetryService, _verbose, _catalogBaseAddress, _storageBaseAddress); _destination = destination; TelemetryService.GlobalDimensions[TelemetryConstants.Destination] = _destination; }
private async Task <string> PostAsync(string url, string data) { if (!String.IsNullOrEmpty(url)) { if (!String.IsNullOrEmpty(data)) { string Url = url.Replace(":", "%3a"); Console.WriteLine($"{this._Client.BaseAddress.ToString()}{Url}"); Console.WriteLine(data); try { return(CommandHelpers.ParsePostPutDeleteResponse(await this.Client.PostAsync(Url, new StringContent(data, Encoding.UTF8, "application/json")))); } catch (InfobloxCustomException e) { throw e; } catch (WebException e) { throw new InfobloxCustomException(e); } catch (HttpRequestException e) { if (e.InnerException is WebException) { throw new InfobloxCustomException((WebException)e.InnerException); } else { throw new InfobloxCustomException(e); } } catch (Exception e) { throw new InfobloxCustomException(e); } } else { throw new ArgumentNullException("data", "A null data set cannot be posted."); } } else { throw new ArgumentNullException("url", "The url string cannot be null or empty."); } }
protected override void Init(IDictionary <string, string> arguments, CancellationToken cancellationToken) { var source = arguments.GetOrThrow <string>(Arguments.Source); var verbose = arguments.GetOrDefault(Arguments.Verbose, false); var contentBaseAddress = arguments.GetOrDefault <string>(Arguments.ContentBaseAddress); var storageFactory = CommandHelpers.CreateStorageFactory(arguments, verbose); var httpClientTimeoutInSeconds = arguments.GetOrDefault <int?>(Arguments.HttpClientTimeoutInSeconds); var httpClientTimeout = httpClientTimeoutInSeconds.HasValue ? (TimeSpan?)TimeSpan.FromSeconds(httpClientTimeoutInSeconds.Value) : null; StorageFactory preferredPackageSourceStorageFactory = null; IAzureStorage preferredPackageSourceStorage = null; var preferAlternatePackageSourceStorage = arguments.GetOrDefault(Arguments.PreferAlternatePackageSourceStorage, defaultValue: false); if (preferAlternatePackageSourceStorage) { preferredPackageSourceStorageFactory = CommandHelpers.CreateSuffixedStorageFactory("PreferredPackageSourceStorage", arguments, verbose); preferredPackageSourceStorage = preferredPackageSourceStorageFactory.Create() as IAzureStorage; } Logger.LogInformation("CONFIG source: \"{ConfigSource}\" storage: \"{Storage}\" preferred package source storage: \"{PreferredPackageSourceStorage}\"", source, storageFactory, preferredPackageSourceStorageFactory); Logger.LogInformation("HTTP client timeout: {Timeout}", httpClientTimeout); MaxDegreeOfParallelism = 256; _collector = new DnxCatalogCollector( new Uri(source), storageFactory, preferredPackageSourceStorage, contentBaseAddress == null ? null : new Uri(contentBaseAddress), TelemetryService, Logger, MaxDegreeOfParallelism, httpClient => new CatalogClient(new SimpleHttpClient(httpClient, LoggerFactory.CreateLogger <SimpleHttpClient>()), LoggerFactory.CreateLogger <CatalogClient>()), CommandHelpers.GetHttpMessageHandlerFactory(TelemetryService, verbose), httpClientTimeout); var storage = storageFactory.Create(); _front = new DurableCursor(storage.ResolveUri("cursor.json"), storage, MemoryCursor.MinValue); _back = MemoryCursor.CreateMax(); _destination = storageFactory.BaseAddress; TelemetryService.GlobalDimensions[TelemetryConstants.Destination] = _destination.AbsoluteUri; }
void IInvokeProvider.Invoke() { RibbonTextBox rtb = (RibbonTextBox)Owner; if (!rtb.IsEnabled) { throw new ElementNotEnabledException(); } Dispatcher.BeginInvoke(DispatcherPriority.Input, new DispatcherOperationCallback(delegate(object param) { RibbonTextBox textBox = (RibbonTextBox)Owner; CommandHelpers.InvokeCommandSource(textBox.CommandParameter, null, textBox, CommandOperation.Execute); return(null); }), null); }
public void CreateRegistrationStorageFactories_WithNoSemVer2Factory() { // Arrange var arguments = new Dictionary <string, string>() { { Arguments.StorageType, "azure" }, { Arguments.StorageBaseAddress, "http://localhost/reg" }, { Arguments.StorageAccountName, "testAccount" }, { Arguments.StorageKeyValue, "ADummyDUMMYpZxLeDumMyyN52gJj+ZlGE0ipRi9PaTcn9A4epwvsngE5rLSMk9TwpazxUtzeyBnFeWFAdummyw==" }, { Arguments.StorageContainer, "testContainer" }, { Arguments.StoragePath, "testStoragePath" }, { Arguments.UseCompressedStorage, "true" }, { Arguments.CompressedStorageBaseAddress, "http://localhost/reg-gz" }, { Arguments.CompressedStorageAccountName, "testAccount-gz" }, { Arguments.CompressedStorageKeyValue, "BDummyDUMMYpZxLeDumMyyN52gJj+ZlGE0ipRi9PaTcn9A4epwvsngE5rLSMk9TwpazxUtzeyBnFeWFAdummyw==" }, { Arguments.CompressedStorageContainer, "testContainer-gz" }, { Arguments.CompressedStoragePath, "testStoragePath-gz" }, { Arguments.UseSemVer2Storage, "false" }, }; // Act var factories = CommandHelpers.CreateRegistrationStorageFactories(arguments, verbose: true); // Assert var legacy = Assert.IsType <AggregateStorageFactory>(factories.LegacyStorageFactory); Assert.True(legacy.Verbose, "verbose should be true on the aggregate storage factory"); Assert.Equal(legacy.BaseAddress, new Uri("http://localhost/reg/testStoragePath/")); var originalFactory = Assert.IsType <AzureStorageFactory>(legacy.PrimaryStorageFactory); Assert.True(originalFactory.Verbose, "verbose should be true on the original storage factory"); Assert.False(originalFactory.CompressContent, "compress should be false on the original storage factory"); Assert.Equal(originalFactory.BaseAddress, new Uri("http://localhost/reg/testStoragePath/")); Assert.Single(legacy.SecondaryStorageFactories); var compressFactory = Assert.IsType <AzureStorageFactory>(legacy.SecondaryStorageFactories.First()); Assert.True(compressFactory.Verbose, "verbose should be true on the compress storage factory"); Assert.True(compressFactory.CompressContent, "compress should be true on the compress storage factory"); Assert.Equal(compressFactory.BaseAddress, new Uri("http://localhost/reg-gz/testStoragePath-gz/")); Assert.Null(factories.SemVer2StorageFactory); }
protected override void Init(IDictionary <string, string> arguments, CancellationToken cancellationToken) { PrintLightning(); // Hard code against Azure storage. arguments[Arguments.StorageType] = Arguments.AzureStorageType; // Configure the package path provider. var useFlatContainerAsPackageContent = arguments.GetOrDefault <bool>(Arguments.ContentIsFlatContainer, false); if (!useFlatContainerAsPackageContent) { RegistrationMakerCatalogItem.PackagePathProvider = new PackagesFolderPackagePathProvider(); } else { var flatContainerName = arguments.GetOrThrow <string>(Arguments.FlatContainerName); RegistrationMakerCatalogItem.PackagePathProvider = new FlatContainerPackagePathProvider(flatContainerName); } _command = arguments.GetOrThrow <string>(Arguments.Command); _verbose = arguments.GetOrDefault(Arguments.Verbose, false); _log = _verbose ? Console.Out : new StringWriter(); _contentBaseAddress = arguments.GetOrThrow <string>(Arguments.ContentBaseAddress); _galleryBaseAddress = arguments.GetOrThrow <string>(Arguments.GalleryBaseAddress); _storageFactories = CommandHelpers.CreateRegistrationStorageFactories(arguments, _verbose); _shouldIncludeSemVer2 = RegistrationCollector.GetShouldIncludeRegistrationPackage(_storageFactories.SemVer2StorageFactory); // We save the arguments because the "prepare" command generates "strike" commands. Some of the arguments // used by "prepare" should be used when executing "strike". _arguments = arguments; switch (_command.ToLowerInvariant()) { case "charge": case "prepare": InitPrepare(arguments); break; case "strike": InitStrike(arguments); break; default: throw new NotSupportedException($"The lightning command '{_command}' is not supported."); } }
static internal async Task <SymbolDetails> CreateAsync( SymbolReference symbolReference, PowerShellContextService powerShellContext) { SymbolDetails symbolDetails = new SymbolDetails { SymbolReference = symbolReference }; switch (symbolReference.SymbolType) { case SymbolType.Function: CommandInfo commandInfo = await CommandHelpers.GetCommandInfoAsync( symbolReference.SymbolName, powerShellContext); if (commandInfo != null) { symbolDetails.Documentation = await CommandHelpers.GetCommandSynopsisAsync( commandInfo, powerShellContext); if (commandInfo.CommandType == CommandTypes.Application) { symbolDetails.DisplayString = "(application) " + symbolReference.SymbolName; return(symbolDetails); } } symbolDetails.DisplayString = "function " + symbolReference.SymbolName; return(symbolDetails); case SymbolType.Parameter: // TODO: Get parameter help symbolDetails.DisplayString = "(parameter) " + symbolReference.SymbolName; return(symbolDetails); case SymbolType.Variable: symbolDetails.DisplayString = symbolReference.SymbolName; return(symbolDetails); default: return(symbolDetails); } }
// Token: 0x06005120 RID: 20768 RVA: 0x0016BF34 File Offset: 0x0016A134 static ListBox() { FrameworkElement.DefaultStyleKeyProperty.OverrideMetadata(typeof(ListBox), new FrameworkPropertyMetadata(typeof(ListBox))); ListBox._dType = DependencyObjectType.FromSystemTypeInternal(typeof(ListBox)); Control.IsTabStopProperty.OverrideMetadata(typeof(ListBox), new FrameworkPropertyMetadata(BooleanBoxes.FalseBox)); KeyboardNavigation.DirectionalNavigationProperty.OverrideMetadata(typeof(ListBox), new FrameworkPropertyMetadata(KeyboardNavigationMode.Contained)); KeyboardNavigation.TabNavigationProperty.OverrideMetadata(typeof(ListBox), new FrameworkPropertyMetadata(KeyboardNavigationMode.Once)); ItemsControl.IsTextSearchEnabledProperty.OverrideMetadata(typeof(ListBox), new FrameworkPropertyMetadata(BooleanBoxes.TrueBox)); ItemsPanelTemplate itemsPanelTemplate = new ItemsPanelTemplate(new FrameworkElementFactory(typeof(VirtualizingStackPanel))); itemsPanelTemplate.Seal(); ItemsControl.ItemsPanelProperty.OverrideMetadata(typeof(ListBox), new FrameworkPropertyMetadata(itemsPanelTemplate)); EventManager.RegisterClassHandler(typeof(ListBox), Mouse.MouseUpEvent, new MouseButtonEventHandler(ListBox.OnMouseButtonUp), true); EventManager.RegisterClassHandler(typeof(ListBox), Keyboard.GotKeyboardFocusEvent, new KeyboardFocusChangedEventHandler(ListBox.OnGotKeyboardFocus)); CommandHelpers.RegisterCommandHandler(typeof(ListBox), ListBox.SelectAllCommand, new ExecutedRoutedEventHandler(ListBox.OnSelectAll), new CanExecuteRoutedEventHandler(ListBox.OnQueryStatusSelectAll), KeyGesture.CreateFromResourceStrings(SR.Get("ListBoxSelectAllKey"), SR.Get("ListBoxSelectAllKeyDisplayString"))); ControlsTraceLogger.AddControl(TelemetryControls.ListBox); }
// Token: 0x0600388B RID: 14475 RVA: 0x000FDD0C File Offset: 0x000FBF0C internal static void _RegisterClassHandlers(Type controlType, bool acceptsRichContent, bool registerEventListeners) { CanExecuteRoutedEventHandler canExecuteRoutedEventHandler = new CanExecuteRoutedEventHandler(TextEditorParagraphs.OnQueryStatusNYI); if (acceptsRichContent) { CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.AlignLeft, new ExecutedRoutedEventHandler(TextEditorParagraphs.OnAlignLeft), canExecuteRoutedEventHandler, "KeyAlignLeft", "KeyAlignLeftDisplayString"); CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.AlignCenter, new ExecutedRoutedEventHandler(TextEditorParagraphs.OnAlignCenter), canExecuteRoutedEventHandler, "KeyAlignCenter", "KeyAlignCenterDisplayString"); CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.AlignRight, new ExecutedRoutedEventHandler(TextEditorParagraphs.OnAlignRight), canExecuteRoutedEventHandler, "KeyAlignRight", "KeyAlignRightDisplayString"); CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.AlignJustify, new ExecutedRoutedEventHandler(TextEditorParagraphs.OnAlignJustify), canExecuteRoutedEventHandler, "KeyAlignJustify", "KeyAlignJustifyDisplayString"); CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.ApplySingleSpace, new ExecutedRoutedEventHandler(TextEditorParagraphs.OnApplySingleSpace), canExecuteRoutedEventHandler, "KeyApplySingleSpace", "KeyApplySingleSpaceDisplayString"); CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.ApplyOneAndAHalfSpace, new ExecutedRoutedEventHandler(TextEditorParagraphs.OnApplyOneAndAHalfSpace), canExecuteRoutedEventHandler, "KeyApplyOneAndAHalfSpace", "KeyApplyOneAndAHalfSpaceDisplayString"); CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.ApplyDoubleSpace, new ExecutedRoutedEventHandler(TextEditorParagraphs.OnApplyDoubleSpace), canExecuteRoutedEventHandler, "KeyApplyDoubleSpace", "KeyApplyDoubleSpaceDisplayString"); } CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.ApplyParagraphFlowDirectionLTR, new ExecutedRoutedEventHandler(TextEditorParagraphs.OnApplyParagraphFlowDirectionLTR), canExecuteRoutedEventHandler); CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.ApplyParagraphFlowDirectionRTL, new ExecutedRoutedEventHandler(TextEditorParagraphs.OnApplyParagraphFlowDirectionRTL), canExecuteRoutedEventHandler); }