public static void RunOnDevice(HashDevice device, string userName, string password) { var hasSSH = DeviceUtil.HasProgram(device, ProgramType.SSH); if (hasSSH) { if (DeviceUtil.TryLogin(device, userName, password)) { var user = DeviceUtil.FindUserByName(device, userName); DeviceUtil.ChangeDevice(device, user); var msg = string.Format("Successfully logged into '{0}'", device.DeviceName); msg = TextUtil.Success(msg); TerminalUtil.ShowText(msg); } else { var msg = "Username or password invalid."; msg = TextUtil.Error(msg); TerminalUtil.ShowText(msg); } } else { var msg = "The device '{0}' is not running a SSH instance, therefore cannot be accessed using a SSH."; msg = string.Format(msg, device.IpAddress); msg = TextUtil.Error(msg); TerminalUtil.ShowText(msg); } }
// // Phased Systems Initialization // LocalizationManager, UISystem, AudioSystem private void Primary() { // Record Main thread identity DeviceUtil.SetUIThread(); Secondary(); }
private void checkVersion() { bool isNeedClean = false; if (WpStorage.GetIsoSetting("Version") != null) { string version = WpStorage.GetIsoSetting("Version").ToString(); if (version != DeviceUtil.GetAppVersion()) { isNeedClean = true; WpStorage.SetIsoSetting("Version", DeviceUtil.GetAppVersion()); } } else { if (IsolatedStorageSettings.ApplicationSettings.Count > 0 || WpStorage.isoFile.DirectoryExists(CommonData.IsoRootPath)) { isNeedClean = true; } WpStorage.SetIsoSetting("Version", DeviceUtil.GetAppVersion()); } if (isNeedClean) { if (MessageBox.Show("检测到版本更新,为避免数据冲突建议清除本地缓存,是否清除缓存?", "", MessageBoxButton.OKCancel) == MessageBoxResult.OK) { WpStorage.DeleteDirectory(CommonData.IsoRootPath); IsolatedStorageSettings.ApplicationSettings.Clear(); WpStorage.SetIsoSetting("Version", DeviceUtil.GetAppVersion()); } } App.BeginApp(); }
public static void Execute(ProgramExecutionOptions options) { if (ProgramUtil.ShowHelpIfNeeded(options)) { return; } if (CommandLineUtil.ValidateArguments(options.ParsedArguments, Validations)) { var target = CommandLineUtil.FindArgumentByName(options.ParsedArguments, TargetArgName).Value; var userName = CommandLineUtil.FindArgumentByName(options.ParsedArguments, UserNameArgName).Value; var password = CommandLineUtil.FindArgumentByName(options.ParsedArguments, PasswordArgName).Value; var device = DeviceUtil.FindDeviceByIpOrName(target); if (device == null) { var msg = string.Format("No device found with IP or Name equal to '{0}'.", target); msg = TextUtil.Error(msg); TerminalUtil.ShowText(msg); } else { RunOnDevice(device, userName, password); } } else { TerminalUtil.ShowText("ERROR, PLEASE USE HELP. DUMB ASS"); } }
public TestAttributionHandler(DeviceUtil deviceUtil, IAssert assert, TargetPlatform targetPlatform) : base(deviceUtil, assert) { TargetPlatform = targetPlatform; TestActivityPackage.Assert = Assert; TestActivityPackage.TargetPlatform = TargetPlatform; }
/* * Private. */ private void UpdateDeviceInfo() { CurrentDevicePlatform = GetCurrentDevicePlatform(); CurrentDeviceType = DeviceUtil.GetDeviceType(CurrentDevicePlatform); Log.Debug((p, t) => $"Platform: {p} DeviceType: {t}", CurrentDevicePlatform, CurrentDeviceType); }
private void LaunchDeepLink(Dictionary <string, string> jsonDict) { if (jsonDict == null) { return; } string deeplink; if (!jsonDict.TryGetValue("deeplink", out deeplink)) { return; } if (!Uri.IsWellFormedUriString(deeplink, UriKind.Absolute)) { Logger.Error("Malformed deeplink '{0}'", deeplink); return; } Logger.Error("Wellformed deeplink '{0}'", deeplink); var deeplinkUri = new Uri(deeplink); DeviceUtil.LauchDeeplink(deeplinkUri); }
private OverlayWindow() { InitializeComponent(); primaryScreen = DeviceUtil.GetScreen(Settings.Default.primaryMonitor); Settings.Default.PropertyChanged += SettingsChanged; SystemEvents.DisplaySettingsChanged += SystemEvents_DisplaySettingsChanged; this.baseGrid.Visibility = Visibility.Hidden; this.layoutChooserOverlay.Visibility = Visibility.Hidden; //Compensate for DPI settings Loaded += (o, e) => { //PresentationSource source = PresentationSource.FromVisual(this); //CompositionTarget ct = source.CompositionTarget; //Matrix transformMatrix = ct.TransformFromDevice; //this.baseCanvas.RenderTransform = new MatrixTransform(transformMatrix); this.updateWindowToScreen(primaryScreen); //Prevent OverlayWindow from showing up in alt+tab menu. UIHelpers.HideFromAltTab(this); }; }
public static IActivityHandler GetActivityHandler(AdjustConfig adjustConfig, DeviceUtil deviceUtil) { if (IActivityHandler == null) return ActivityHandler.GetInstance(adjustConfig, deviceUtil); IActivityHandler.Init(adjustConfig, deviceUtil); return IActivityHandler; }
private void SettingsChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) { if (e.PropertyName == "primaryMonitor") { primaryScreen = DeviceUtil.GetScreen(Settings.Default.primaryMonitor); this.updateWindowToScreen(primaryScreen); } }
private void UpdateLabels() { var device = record.device; imageDeviceIcon.Image = DeviceUtil.GetUIImageFromDeviceModel(device.serialNumber.deviceModel); labelDeviceType.Text = device.serialNumber.deviceModel.GetTypeString(); labelDeviceName.Text = device.name; }
public StartPage() { InitializeComponent(); versionText.Text = DeviceUtil.GetAppVersion(); BgImgTimer.Interval = new TimeSpan(1000); BgImgTimer.Tick += new EventHandler(BgImgTimer_Tick); BgImgTimer.Start(); }
private D3DCursorWindow() { Settings.Default.PropertyChanged += SettingsChanged; SystemEvents.DisplaySettingsChanged += SystemEvents_DisplaySettingsChanged; cursors = new List <D3DCursor>(2); mutex = new Mutex(); primaryScreen = DeviceUtil.GetScreen(Settings.Default.primaryMonitor); }
private ActivityHandler(AdjustConfig adjustConfig, DeviceUtil deviceUtil) { // default values Enabled = true; Logger = AdjustFactory.Logger; InternalQueue = new ActionQueue("adjust.ActivityQueue"); InternalQueue.Enqueue(() => InitInternal(adjustConfig, deviceUtil)); }
public static IActivityHandler GetActivityHandler(AdjustConfig adjustConfig, DeviceUtil deviceUtil) { if (IActivityHandler == null) { return(ActivityHandler.GetInstance(adjustConfig, deviceUtil)); } IActivityHandler.Init(adjustConfig, deviceUtil); return(IActivityHandler); }
public void ApplicationLaunching(AdjustConfig adjustConfig, DeviceUtil deviceUtil) { if (ActivityHandler != null) { Logger.Error("Adjust already initialized"); return; } ActivityHandler = AdjustSdk.Pcl.ActivityHandler.GetInstance(adjustConfig, deviceUtil); }
private void NullResponseTest() { MockHttpMessageHandler.ResponseType = ResponseType.NULL; RequestHandler.SendPackage(ClickPackage); DeviceUtil.Sleep(1000); Assert.Test("HttpMessageHandler SendAsync"); Assert.Test("PackageHandler CloseFirstPackage"); }
/// <summary> /// Construct a new Window. /// </summary> public MainWindow() { //Set highest priority on main process. Process currentProcess = Process.GetCurrentProcess(); currentProcess.PriorityClass = ProcessPriorityClass.High; Thread.CurrentThread.Priority = ThreadPriority.Normal; if (Settings.Default.minimizeOnStart) { this.ShowActivated = false; this.WindowState = System.Windows.WindowState.Minimized; } string currentVmultiMonitor = VmultiUtil.getCurrentMonitorDevicePath(); IEnumerable <MonitorInfo> monInfos = DeviceUtil.GetMonitorList(); if (VmultiDevice.Current.isAvailable()) { //See if the selected monitor is still connected to the computer if (currentVmultiMonitor != null) { string primaryMonitor = null; foreach (MonitorInfo monInfo in monInfos) { if (monInfo.DevicePath == currentVmultiMonitor) { primaryMonitor = currentVmultiMonitor; } } if (primaryMonitor != null) //The vmulti monitor is still connected. { Settings.Default.primaryMonitor = primaryMonitor; //Make sure the same value is in settings. } else //The selected monitor is not connected { VmultiUtil.setCurrentMonitor(monInfos.First()); //Use the first monitor in the list. } } else { VmultiUtil.setCurrentMonitor(monInfos.First()); //No setting found, default to first found monitor. } } else { Settings.Default.primaryMonitor = ""; } defaultInstance = this; // Load from the XAML. InitializeComponent(); }
private void SettingsChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) { if (e.PropertyName == "primaryMonitor") { primaryScreen = DeviceUtil.GetScreen(Settings.Default.primaryMonitor); Dispatcher.BeginInvoke(new Action(delegate() { this.updateWindowToScreen(primaryScreen); })); } }
public float getScreenScale() { float sc = 1920 * 1.0f / 1080 / (Screen.height * 1.0f / Screen.width); if (sc > 1 && DeviceUtil.getInst().curScreenType != ScreenType.Screen_Pad) { sc = 1; } return(sc); }
private void StartGetAttributionTest(AttributionHandler attributionHandler, ResponseType responseType) { MockHttpMessageHandler.ResponseType = responseType; attributionHandler.AskAttribution(); DeviceUtil.Sleep(1000); RequestTest(MockHttpMessageHandler.HttpRequestMessage); Assert.Test("HttpMessageHandler SendAsync"); }
public void UpdateFromGaugeSensor(GaugeDeviceSensor sensor) { if (viewSensor == null) { return; } var device = ((GaugeDeviceSensor)viewSensor)?.device; var state = device.connection.connectionState; labelHeader.Text = device.serialNumber.deviceModel.GetTypeString() + ": " + viewSensor.name; imageSensorIcon.Image = DeviceUtil.GetUIImageFromDeviceModel(device.serialNumber.deviceModel); labelMeasurement.Text = sensor.ToFormattedString(); labelUnit.Text = sensor.unit.ToString(); activityConnectStatus.Hidden = EConnectionState.Resolving != sensor.device.connection.connectionState; buttonConnection.Hidden = false; UpdateAlarm(sensor); if (device.isConnected) { UpdateBatteryIcon(device.battery); buttonConnection.SetImage(UIImage.FromBundle("ic_bluetooth_connected"), UIControlState.Normal); buttonConnection.BackgroundColor = UIColor.Green; labelMeasurement.TextColor = new UIColor(Colors.BLACK); labelUnit.TextColor = new UIColor(Colors.BLACK); labelConnectionStatus.Text = "Connected"; labelConnectionStatus.TextColor = UIColor.Green; } else { if (EConnectionState.Broadcasting == device.connection.connectionState) { UpdateBatteryIcon(device.battery); labelConnectionStatus.Text = "Long Range Mode"; labelConnectionStatus.TextColor = UIColor.Blue; } else { labelConnectionStatus.Text = "Disconnected"; labelConnectionStatus.TextColor = UIColor.Red; UpdateBatteryIcon(-1); } buttonConnection.SetImage(UIImage.FromBundle("ic_bluetooth_disconnected"), UIControlState.Normal); buttonConnection.BackgroundColor = UIColor.Red; labelMeasurement.TextColor = new UIColor(Colors.LIGHT_GRAY); labelUnit.TextColor = new UIColor(Colors.LIGHT_GRAY); } }
private void RunDelegate(AdjustAttribution adjustAttribution) { if (AdjustConfig.AttributionChanged == null) { return; } if (adjustAttribution == null) { return; } DeviceUtil.RunAttributionChanged(AdjustConfig.AttributionChanged, adjustAttribution); }
private void ClientExceptionTest() { MockHttpMessageHandler.ResponseType = ResponseType.CLIENT_PROTOCOL_EXCEPTION; RequestHandler.SendPackage(ClickPackage); DeviceUtil.Sleep(1000); Assert.Test("HttpMessageHandler SendAsync"); Assert.Error("Failed to track click. (testResponseError, Status code: Null). Will retry later"); Assert.Test("PackageHandler CloseFirstPackage"); }
public void TestAskIn() { AttributionHandler attributionHandler = new AttributionHandler( activityHandler: MockActivityHandler, attributionPackage: AttributionPackage, startPaused: false, hasDelegate: true); var response = "Response: {{ \"ask_in\" : 4000 }}"; CallCheckAttributionWithGet(attributionHandler, ResponseType.ASK_IN, response); // change the response to avoid a cycle; MockHttpMessageHandler.ResponseType = ResponseType.MESSAGE; // check attribution was called with ask_in Assert.NotTest("ActivityHandler UpdateAttribution"); // it did update to true Assert.Test("ActivityHandler SetAskingAttribution, True"); // and waited to for query Assert.Debug("Waiting to query attribution in 4000 milliseconds"); DeviceUtil.Sleep(2000); var askInJsonResponse = new Dictionary <string, string> { { "ask_in", "5000" } }; attributionHandler.CheckAttribution(askInJsonResponse); DeviceUtil.Sleep(3000); // it did update to true Assert.Test("ActivityHandler SetAskingAttribution, True"); // and waited to for query Assert.Debug("Waiting to query attribution in 5000 milliseconds"); // it was been waiting for 1000 + 2000 + 3000 = 6 seconds // check that the mock http client was not called because the original clock was reseted Assert.NotTest("HttpMessageHandler SendAsync"); // check that it was finally called after 6 seconds after the second ask_in DeviceUtil.Sleep(3000); OkMessageTestLogs(); RequestTest(MockHttpMessageHandler.HttpRequestMessage); }
/// <summary> /// 获取服务器列表 /// </summary> public void RequestGameServer() { if (m_isBusy) { return; } m_isBusy = true; Dictionary <string, object> dic = new Dictionary <string, object>(); dic["passportId"] = AccountProxy.Instance.CurrentAccountEntity.passportId; dic["token"] = AccountProxy.Instance.CurrentAccountEntity.token; dic["bundleId"] = DeviceUtil.GetBundleIdentifier(); NetWorkHttp.Instance.SendData(ConstDefine.WebUrl + ConstDefine.HTTPAddrGateway, OnRequestGameServerCallBack, true, ConstDefine.HTTPFuncGateway, dic); }
public WiiPointerProviderSettings() { InitializeComponent(); //this.cbSystemCursor.IsChecked = Settings.Default.pointer_changeSystemCursor; //this.cbMoveCursor.IsChecked = Settings.Default.pointer_moveCursor; if (Settings.Default.pointer_sensorBarPos == "top") { this.cbiTop.IsSelected = true; } else if (Settings.Default.pointer_sensorBarPos == "bottom") { this.cbiBottom.IsSelected = true; } else { this.cbiCenter.IsSelected = true; } if (VmultiDevice.Current.isAvailable()) { string currentMonitor = VmultiUtil.getCurrentMonitorDevicePath(); IEnumerable <MonitorInfo> monInfos = DeviceUtil.GetMonitorList(); foreach (MonitorInfo monInfo in monInfos) { ComboBoxItem cbItem = new ComboBoxItem(); cbItem.Content = monInfo.FriendlyName; cbItem.DataContext = monInfo; this.MonitorComboBox.Items.Add(cbItem); if (monInfo.DevicePath == currentMonitor) { this.MonitorComboBox.SelectedItem = cbItem; } } this.initializing = false; } else { ComboBoxItem cbItem = new ComboBoxItem(); cbItem.Content = "Requires driver"; this.MonitorComboBox.Items.Add(cbItem); this.MonitorComboBox.IsEnabled = false; this.MonitorComboBox.SelectedIndex = 0; this.initializing = false; } }
private void WrongJsonTest() { MockHttpMessageHandler.ResponseType = ResponseType.WRONG_JSON; RequestHandler.SendPackage(ClickPackage); DeviceUtil.Sleep(2000); Assert.Test("HttpMessageHandler SendAsync, responseType: WRONG_JSON"); Assert.Verbose("Response: not a json response"); Assert.Error("Failed to parse json response (Unexpected character encountered while parsing"); Assert.Test("PackageHandler CloseFirstPackage"); }
private void AddAndSendFirstPackageTest(PackageHandler packageHandler) { // add a package ActivityPackage activityPackage = CreateUnknowPackage("FirstPackage"); // send the first package packageHandler.AddPackage(activityPackage); packageHandler.SendFirstPackage(); DeviceUtil.Sleep(2000); AddPackageTests(1, "unknownFirstPackage"); SendFirstTests(SendFirstState.SEND, "unknownFirstPackage"); }
/// <summary> /// 请求重建房间 /// </summary> public void RequestRebuildRoom() { if (m_isBusy) { return; } m_isBusy = true; UIViewManager.Instance.ShowWait(); Dictionary <string, object> dic = new Dictionary <string, object>(); AccountEntity entity = AccountProxy.Instance.CurrentAccountEntity; dic["passportId"] = entity.passportId; dic["token"] = entity.token; dic["bundleId"] = DeviceUtil.GetBundleIdentifier(); NetWorkHttp.Instance.SendData(ConstDefine.WebUrl + ConstDefine.HTTPAddrRenter, OnRequestRebuildRoomCallBack, true, ConstDefine.HTTPFuncRenter, dic); }
private void EmptyJsonTest() { MockHttpMessageHandler.ResponseType = ResponseType.EMPTY_JSON; RequestHandler.SendPackage(ClickPackage); DeviceUtil.Sleep(1000); Assert.Test("HttpMessageHandler SendAsync, responseType: EMPTY_JSON"); Assert.Verbose("Response: {{ }}"); Assert.Info("No message found"); Assert.Test("PackageHandler FinishedTrackingActivity,"); Assert.Test("PackageHandler SendNextPackage"); }
public static ActivityHandler GetInstance(AdjustConfig adjustConfig, DeviceUtil deviceUtil) { if (adjustConfig == null) { AdjustFactory.Logger.Error("AdjustConfig missing"); return null; } if (!adjustConfig.IsValid()) { AdjustFactory.Logger.Error("AdjustConfig not initialized correctly"); return null; } ActivityHandler activityHandler = new ActivityHandler(adjustConfig, deviceUtil); return activityHandler; }
public void Init(AdjustConfig adjustConfig, DeviceUtil deviceUtil) { AdjustConfig = adjustConfig; DeviceUtil = deviceUtil; }
public TestRequestHandler(DeviceUtil deviceUtil, IAssert assert) : base(deviceUtil, assert) { }
protected TestTemplate(DeviceUtil deviceUtil, IAssert assert) { DeviceUtil = deviceUtil; Assert = assert; }
public void Init(AdjustConfig adjustConfig, DeviceUtil deviceUtil) { MockLogger.Test("{0} Init", prefix); }
private void InitInternal(AdjustConfig adjustConfig, DeviceUtil deviceUtil) { Init(adjustConfig, deviceUtil); DeviceInfo = DeviceUtil.GetDeviceInfo(); DeviceInfo.SdkPrefix = adjustConfig.SdkPrefix; TimerInterval = AdjustFactory.GetTimerInterval(); TimerStart = AdjustFactory.GetTimerStart(); SessionInterval = AdjustFactory.GetSessionInterval(); SubsessionInterval = AdjustFactory.GetSubsessionInterval(); if (AdjustConfig.Environment.Equals(AdjustConfig.EnvironmentProduction)) { Logger.LogLevel = LogLevel.Assert; } if (AdjustConfig.EventBufferingEnabled) { Logger.Info("Event buffering is enabled"); } if (AdjustConfig.DefaultTracker != null) { Logger.Info("Default tracker: '{0}'", AdjustConfig.DefaultTracker); } ReadAttribution(); ReadActivityState(); PackageHandler = AdjustFactory.GetPackageHandler(this, Paused()); var attributionPackage = GetAttributionPackage(); AttributionHandler = AdjustFactory.GetAttributionHandler(this, attributionPackage, Paused(), AdjustConfig.HasDelegate); Timer = new TimerCycle(InternalQueue, TimerFiredInternal, timeInterval: TimerInterval, timeStart: TimerStart); StartInternal(); }
public TestPackageHandler(DeviceUtil deviceUtil, IAssert assert) : base(deviceUtil, assert) { }