static void RunOptions(Options opts) { var interfaceNumber = opts.Interface - 1; var designatedPort = opts.Port; var language = opts.Language.ToLower(); string terminalCommand = string.Empty; NetworkInterface[] networkDevices = NetworkInterface.GetAllNetworkInterfaces(); if (interfaceNumber <= 0 || interfaceNumber > networkDevices.Length) { System.Console.WriteLine("Invalid interface index."); return; } var addresses = networkDevices[interfaceNumber].GetIPProperties().UnicastAddresses; IPAddress ipv4Address = InterfaceExtractor.ExtractIpV4Address(addresses); try { terminalCommand = ReverseShellProvider.GetReverseShell(language, ipv4Address, designatedPort); } catch (ArgumentException ex) { System.Console.WriteLine(ex.Message); return; } System.Console.WriteLine(terminalCommand); if (opts.ToClipboard) { ClipboardService.SetText(terminalCommand); } }
public void Copy_Input(IWebElement target, string text) { ClipboardService.SetText(text); var action = new Actions(this.driver).MoveToElement(target).Click().KeyDown(Keys.Control).SendKeys("v").KeyUp(Keys.Control); action.Perform(); }
protected override void GivenThat() { base.GivenThat(); ClipboardService.Stub(s => s.GetText()) .Return("http://www.blah.com/podcast.xml"); }
public void Export() { Run("export tada").StandardOutput.Should().Contain("\"Raw\": \"🎉\""); Run("export tada --format json").StandardOutput.Should().Contain("\"Raw\": \"🎉\""); Run("export tada -f json").StandardOutput.Should().Contain("\"Raw\": \"🎉\""); Run("export tada -f JSON").StandardOutput.Should().Contain("\"Raw\": \"🎉\""); Run("export tada --format toml").StandardOutput.Should().Contain("raw = \"🎉\""); Run("export tada -f toml").StandardOutput.Should().Contain("raw = \"🎉\""); Run("export tada -f TOML").StandardOutput.Should().Contain("raw = \"🎉\""); Run("export tada --format xml").StandardOutput.Should().Contain("<Raw>🎉</Raw>"); Run("export tada -f xml").StandardOutput.Should().Contain("<Raw>🎉</Raw>"); Run("export tada -f XML").StandardOutput.Should().Contain("<Raw>🎉</Raw>"); Run("export tada --format yaml").StandardOutput.Should().Contain("- Raw: \"\\U0001F389\""); Run("export tada -f yaml").StandardOutput.Should().Contain("- Raw: \"\\U0001F389\""); Run("export tada -f YAML").StandardOutput.Should().Contain("- Raw: \"\\U0001F389\""); Run("export tada --copy"); ClipboardService.GetText().Should().Contain("\"Raw\": \"🎉\""); Run("export tada -c"); ClipboardService.GetText().Should().Contain("\"Raw\": \"🎉\""); Run("export -h").StandardOutput.Should() .Contain("Export emoji data") .And.Contain("Find emojis via description, category, alias or tag") .And.Contain("Format the data as <json|toml|xml|yaml>"); }
public HomePageController(AddressManager addressManager, IEventAggregator eventAggregator, MessageBoxService msgBox, ClipboardService clip, ToastService toast) { this.AddressManager = addressManager; this.MsgBox = msgBox; this.Clipboard = clip; this.Toast = toast; this.EventAggregator = eventAggregator; this.RootAddress = new AddressVM(); this.CompanyAddresses = new ObservableCollection <AddressVM>(); this.CustomerAddresses = new ObservableCollection <AddressVM>(); this.EventAggregator.GetEvent <LoginSuccessEvent>().Subscribe(Initialize); this.CreateAddressCommand = new DelegateCommand <string>(CreateAddress); this.CreateAddressPopupRequest = new InteractionRequest <INotification>(); this.AddWachtOnlyAddressCommand = new DelegateCommand <string>(AddWatchOnlyAddress); this.AddWachtOnlyAddressPopupRequest = new InteractionRequest <INotification>(); this.AccountDetailCommand = new DelegateCommand <string>(addr => { this.Clipboard.SetText(addr); this.Toast.Success("成功复制地址"); }); EventAggregator.GetEvent <CreateAddressSuccessEvent>().Subscribe(AfterCreateAddress); }
/// <summary> /// Gets text from clipboard. /// </summary> /// <returns>Clipboard text.</returns> public string GetClipboardText() { // code from http://forums.getpaint.net/index.php?/topic/13712-trouble-accessing-the-clipboard/page__view__findpost__p__226140 string ret = String.Empty; Thread staThread = new Thread( () => { try { var text = ClipboardService.GetText(); if (string.IsNullOrEmpty(text)) { return; } ret = text; } catch (Exception) { return; } }); staThread.SetApartmentState(ApartmentState.STA); staThread.Start(); staThread.Join(); // at this point either you have clipboard data or an exception*/ return(ret); }
private void CopyIssue_Click(object sender, RoutedEventArgs e) { string summary = IssueSummaryBox.Text; string details = IssueDetailsBox.Text; ClipboardService.SetText($"{summary}\n{details}"); }
private void CopyComputerName_Click(object sender, RoutedEventArgs e) { if (RemoteSessionListBox.SelectedItem != null) { ClipboardService.SetText(((Computer)(RemoteSessionListBox.SelectedItem)).Name); } }
private void OnCutClass() { if (_selectedCard == null || _selectedCard.Class == null) { return; } var classCard = ClassesCards[_selectedRow][_selectedColumn]; if (classCard == null) { return; } var row = Grid.GetRow(classCard) - TitleRowsCount; var col = Grid.GetColumn(classCard) - TimeColumnsCount; var @class = new ClassRecord(); ClassRecord.Copy(_groupClasses.GetClass(row, col), @class); ClipboardService.SetData(@class); var vmodel = classCard.DataContext as ClassCardViewModel; if (vmodel == null) { return; } vmodel.Class = null; _groupClasses.RemoveClass(row, col); }
protected override bool DoCopy() { items = new MemoryLibraryItem[1]; items[0] = innerControl.DragControl._rightMessageBtn.PlaylistItem.Target; ClipboardService.Set(items); return(true); }
public static void Copy() { if (Menu.LastFocused is TextField textField && textField.SelectedLength != 0) { textField.Copy(); ClipboardService.SetText(Clipboard.Contents.ToString()); }
internal RepositoryTreeModel(ServerConnectionManager connManager, TreeViewAdv tree, OpenResourceManager openResMgr, ClipboardService clip) { _connManager = connManager; _tree = tree; _openResMgr = openResMgr; _clip = clip; }
private void Stop() { if (_clipboardService != null) { _clipboardService.Dispose(); _clipboardService = null; } stopSimulating = true; startButton.Enabled = true; stopButton.Enabled = false; exePathBrowseButton.Enabled = true; iterationsBox.Enabled = true; lengthBox.Enabled = true; varyLengthBox.Enabled = true; threadsBox.Enabled = true; processPriorityBox.Enabled = true; SettingsButton.Enabled = true; TaskbarMenu.Items["StartMenuitem"].Enabled = true; TaskbarMenu.Items["StopMenuItem"].Enabled = false; TaskbarMenu.Items["SettingsMenuItem"].Enabled = true; StatusLabel.Text = "Ready to Start!"; }
public static void RegisterLocalServices() { if (ServiceContainer.Resolve <INativeLogService>("nativeLogService", true) == null) { ServiceContainer.Register <INativeLogService>("nativeLogService", new ConsoleLogService()); } ILogger logger = null; if (ServiceContainer.Resolve <ILogger>("logger", true) == null) { #if DEBUG logger = DebugLogger.Instance; #else logger = Logger.Instance; #endif ServiceContainer.Register("logger", logger); } var preferencesStorage = new PreferencesStorageService(AppGroupId); var appGroupContainer = new NSFileManager().GetContainerUrl(AppGroupId); var liteDbStorage = new LiteDbStorageService( Path.Combine(appGroupContainer.Path, "Library", "bitwarden.db")); var localizeService = new LocalizeService(); var broadcasterService = new BroadcasterService(logger); var messagingService = new MobileBroadcasterMessagingService(broadcasterService); var i18nService = new MobileI18nService(localizeService.GetCurrentCultureInfo()); var secureStorageService = new KeyChainStorageService(AppId, AccessGroup, () => ServiceContainer.Resolve <IAppIdService>("appIdService").GetAppIdAsync()); var cryptoPrimitiveService = new CryptoPrimitiveService(); var mobileStorageService = new MobileStorageService(preferencesStorage, liteDbStorage); var stateService = new StateService(mobileStorageService, secureStorageService, messagingService); var stateMigrationService = new StateMigrationService(liteDbStorage, preferencesStorage, secureStorageService); var deviceActionService = new DeviceActionService(stateService, messagingService); var clipboardService = new ClipboardService(stateService); var platformUtilsService = new MobilePlatformUtilsService(deviceActionService, clipboardService, messagingService, broadcasterService); var biometricService = new BiometricService(mobileStorageService); var cryptoFunctionService = new PclCryptoFunctionService(cryptoPrimitiveService); var cryptoService = new CryptoService(stateService, cryptoFunctionService); var passwordRepromptService = new MobilePasswordRepromptService(platformUtilsService, cryptoService); ServiceContainer.Register <IBroadcasterService>("broadcasterService", broadcasterService); ServiceContainer.Register <IMessagingService>("messagingService", messagingService); ServiceContainer.Register <ILocalizeService>("localizeService", localizeService); ServiceContainer.Register <II18nService>("i18nService", i18nService); ServiceContainer.Register <ICryptoPrimitiveService>("cryptoPrimitiveService", cryptoPrimitiveService); ServiceContainer.Register <IStorageService>("storageService", mobileStorageService); ServiceContainer.Register <IStorageService>("secureStorageService", secureStorageService); ServiceContainer.Register <IStateService>("stateService", stateService); ServiceContainer.Register <IStateMigrationService>("stateMigrationService", stateMigrationService); ServiceContainer.Register <IDeviceActionService>("deviceActionService", deviceActionService); ServiceContainer.Register <IClipboardService>("clipboardService", clipboardService); ServiceContainer.Register <IPlatformUtilsService>("platformUtilsService", platformUtilsService); ServiceContainer.Register <IBiometricService>("biometricService", biometricService); ServiceContainer.Register <ICryptoFunctionService>("cryptoFunctionService", cryptoFunctionService); ServiceContainer.Register <ICryptoService>("cryptoService", cryptoService); ServiceContainer.Register <IPasswordRepromptService>("passwordRepromptService", passwordRepromptService); }
protected override void GivenThat() { base.GivenThat(); ClipboardService.Stub(s => s.GetText()) .Return("banana"); }
public static void Add(RootCommand command) { var rr = new Command("readrsa", "3. (本地)读取剪切板公钥值写入txt的pfx文件中"); rr.AddAlias("rr"); rr.AddOption(new Option <string>("-val", () => string.Empty, "通过命令行将公钥传入")); rr.AddOption(new Option <bool>("-dev", DevDesc)); rr.Handler = CommandHandler.Create((string val, bool dev) => { if (string.IsNullOrWhiteSpace(val)) { var text = ClipboardService.GetText(); if (string.IsNullOrWhiteSpace(text)) { Console.WriteLine("错误:读取剪切板值无效!"); return; } else { val = text; } } var value = Serializable.DJSON <AppIdWithPublicKey>(val); Handler(value, dev); Console.WriteLine("完成。"); }); command.AddCommand(rr); }
/// <inheritdoc/> protected override void RegisterTypes(IContainerRegistry containerRegistry) { _applicationSettings = ApplicationSettings.LoadFromFile(AppDomain.CurrentDomain.BaseDirectory + AppSettingsFileName); containerRegistry.RegisterInstance <IApplicationSettings>(_applicationSettings); _systemDialogService = new SystemDialogService(); containerRegistry.RegisterInstance <ISystemDialogService>(_systemDialogService); _scriptVideoService = new ScriptVideoService(_systemDialogService); containerRegistry.RegisterInstance <IScriptVideoService>(_scriptVideoService); _clipboardService = new ClipboardService(); containerRegistry.RegisterInstance <IClipboardService>(_clipboardService); containerRegistry.RegisterSingleton <IProjectService, ProjectService>(); containerRegistry.RegisterInstance <MonitoredUndo.IUndoService>(MonitoredUndo.UndoService.Current); containerRegistry.RegisterSingleton <MonitoredUndo.IChangeFactory, MonitoredUndo.ChangeFactory>(); containerRegistry.RegisterSingleton <IApplicationCommands, ApplicationCommands>(); containerRegistry.RegisterSingleton <ITimelineCommands, TimelineCommands>(); containerRegistry.RegisterDialog <Views.Dialogs.InputValuePromptDialog, ViewModels.Dialogs.InputValuePromptDialogViewModel>(); containerRegistry.RegisterDialog <Views.Dialogs.OutputVideoPropertiesDialog, ViewModels.Dialogs.OutputVideoPropertiesDialogViewModel>(); containerRegistry.RegisterForNavigation <Views.Cropping.CroppingVideoOverlayView>(); containerRegistry.RegisterForNavigation <Views.Cropping.CroppingRibbonGroupView>(); containerRegistry.RegisterForNavigation <Views.Cropping.CroppingDetailsView>(); containerRegistry.RegisterForNavigation <Views.Masking.MaskingVideoOverlayView>(); containerRegistry.RegisterForNavigation <Views.Masking.MaskingRibbonGroupView>(); containerRegistry.RegisterForNavigation <Views.Masking.MaskingDetailsView>(); }
/// <summary> /// This function is the callback used to execute the command when the menu item is clicked. /// See the constructor to see how the menu item is associated with this function using /// OleMenuCommandService service and MenuCommand class. /// </summary> /// <param name="sender">Event sender.</param> /// <param name="e">Event args.</param> private void MenuItemCallback(object sender, EventArgs e) { var clipboardText = ClipboardService.GetText(); if (string.IsNullOrWhiteSpace(clipboardText)) { return; } var formatedText = TextHelper.GetFormattedText(clipboardText); if (string.IsNullOrWhiteSpace(formatedText)) { return; } var dte = (this.package as BaseCommandPackage).GetServiceHelper(typeof(DTE)) as DTE; if (dte != null) { var doc = (TextDocument)dte.Application.ActiveDocument.Object(null); doc.Selection.Text = formatedText; //doc.EndPoint.CreateEditPoint().Insert(formatedText); } }
protected override void ProcessRecord() { source = new CancellationTokenSource(); var messageWriter = new CmdletMessageWriter(this); CancellationToken cancellationToken = source.Token; var endPoint = string.Empty; using (var authManager = new AuthenticationManager()) { endPoint = authManager.GetAzureADLoginEndPoint(AzureEnvironment); } Task.Factory.StartNew(() => { var deviceCodeApplication = PublicClientApplicationBuilder.Create(PnPConnection.PnPManagementShellClientId).WithAuthority($"{endPoint}/organizations/").WithRedirectUri("https://login.microsoftonline.com/common/oauth2/nativeclient").Build(); deviceCodeApplication.AcquireTokenWithDeviceCode(new[] { "https://graph.microsoft.com/.default" }, codeResult => { if (Utilities.OperatingSystem.IsWindows()) { ClipboardService.SetText(codeResult.UserCode); messageWriter.WriteMessage($"Provide consent for the PnP Management Shell application to access SharePoint.\n\nWe opened a browser and navigated to {codeResult.VerificationUrl}\n\nEnter code: {codeResult.UserCode} (we copied this code to your clipboard)"); BrowserHelper.GetWebBrowserPopup(codeResult.VerificationUrl, "Provide consent for the PnP Management Shell application"); } else { messageWriter.WriteMessage($"Please provide consent for the PnP Management Shell application by navigating to\n\n{codeResult.VerificationUrl}\n\nEnter code: {codeResult.UserCode}."); } return(Task.FromResult(0)); }).ExecuteAsync(cancellationToken).GetAwaiter().GetResult(); messageWriter.Finished = true; }, cancellationToken); messageWriter.Start(); }
static void Main(string[] args) { var stopWatch = new Stopwatch(); int numRuns = 1; string result1 = ""; string result2 = ""; stopWatch.Start(); for (int n = 0; n < numRuns; n++) { ISolution solution = new Advent9.Solution(); result1 = solution.GetResult1().ToString(); result2 = solution.GetResult2().ToString(); } stopWatch.Stop(); if (!string.IsNullOrEmpty(result1)) { ClipboardService.SetText(result1); } if (!string.IsNullOrEmpty(result2)) { ClipboardService.SetText(result2); } Console.WriteLine(string.Format("Result for part 1: {0}", result1)); Console.WriteLine(string.Format("Result for part 2: {0}", result2)); Console.WriteLine(); Console.WriteLine("Total runtime: " + stopWatch.ElapsedMilliseconds + "ms"); Console.WriteLine("Average runtime: " + (stopWatch.ElapsedMilliseconds / numRuns) + "ms"); Console.ReadLine(); }
async Task ClearClipboardAsync() { #region ClearClipboardAsync await ClipboardService.SetTextAsync(""); #endregion }
private void ScriptValidByIdBase_Click(object sender, EventArgs e, bool newWindow) { try { var menuItem = GetMenuItem(); if (menuItem == null) { return; } if (newWindow) { ScriptFactory.Instance.CreateNewBlankScript(ScriptType.Sql); } var dte = _package.GetServiceHelper(typeof(DTE)) as DTE; if (dte != null) { var doc = (TextDocument)dte.Application.ActiveDocument.Object(null); var clipBoardText = ClipboardService.GetText(); var clipBoardIsGuid = Guid.TryParse(clipBoardText, out Guid id); string query = QueryService.GetSelectQuery(menuItem.Tag.ToString(), clipBoardIsGuid ? id.ToString() : string.Empty); doc.EndPoint.CreateEditPoint().Insert(query); } } catch (Exception ex) { } }
static async Task VerifyInnerAsync(string expected) { await ClipboardService.SetTextAsync(expected); var actual = await ClipboardService.GetTextAsync(); Assert.AreEqual(expected, actual); }
static void VerifyInner(string expected) { ClipboardService.SetText(expected); var actual = ClipboardService.GetText(); Assert.AreEqual(expected, actual); }
async Task GetTextAsync() { #region GetTextAsync var text = await ClipboardService.GetTextAsync(); #endregion }
async Task SetTextAsync() { #region SetTextAsync await ClipboardService.SetTextAsync("Text to place in clipboard"); #endregion }
void GetText() { #region GetText var text = ClipboardService.GetText(); #endregion }
private void Application_Idle() { if (this.LastCut != null && !ClipboardService.IsCurrent(this.LastCut)) { this.UpdateLastCut(null); } this.invokeIdle = true; }
private void CopyCommandImpl() { if (ConsoleService.IsEnabled) { string text = ConsoleService.SelectedText; ClipboardService.SetText(text); } }
public TransactionDetailPopupController(ClipboardService clipboardService, ToastService toastService) { ClipboardService = clipboardService; ToastService = toastService; CopyTransactionHashCommand = new DelegateCommand(CopyTransactionHash); CopyBlockHashCommand = new DelegateCommand(CopyBlockHash); CloseCommand = new DelegateCommand(ClosePopup); }
protected override void OnSetup() { _currentObject = Clipboard.GetDataObject(); _service = new ClipboardService(); }