protected string SerializeMessageFromProperties(Platform?platform) { if (!platform.HasValue) { GCMNotificationPayload gcmPayload = model.GCMNotificationPayload ?? new GCMNotificationPayload(model.NotificationPayload); APNSNotificationPayload apnsPayload = model.APNSNotificationPayload ?? new APNSNotificationPayload(model.NotificationPayload); APNSPushMessage generatedApns = GenerateAPNSMessageFromPayload(apnsPayload); GCMPushMessage generatedGcm = GenerateGCMMessageFromPayload(gcmPayload); return(CreateSNSNotificationMessage(generatedApns, generatedGcm, model.TargetEnvironment, apnsPayload.CustomPayload, gcmPayload.CustomPayload, model.SnsDefaultMessage)); } switch (platform.Value) { case Platform.APNS: APNSNotificationPayload apnsPayload = model.APNSNotificationPayload ?? new APNSNotificationPayload(model.NotificationPayload); APNSPushMessage generatedApns = GenerateAPNSMessageFromPayload(apnsPayload); return(CreateSNSNotificationMessage(generatedApns, null, model.TargetEnvironment, apnsPayload.CustomPayload, null, model.SnsDefaultMessage)); case Platform.GCM: GCMNotificationPayload gcmPayload = model.GCMNotificationPayload ?? new GCMNotificationPayload(model.NotificationPayload); GCMPushMessage generatedGcm = GenerateGCMMessageFromPayload(gcmPayload); return(CreateSNSNotificationMessage(null, generatedGcm, model.TargetEnvironment, null, gcmPayload.CustomPayload, model.SnsDefaultMessage)); default: return(""); } }
internal static async Task <string> GetDataAsync(string url, Platform?platform, IEnumerable <KeyValuePair <string, string> > queries, string ticket) { if (platform != null) { if (url.Equals(Endpoints.Progressions) || url.Equals(Endpoints.Players) || url.Equals(Endpoints.Statistics)) { url = string.Format(url, Constant.PlatformToGuid(platform ?? default), Constant.PlatformToSandbox(platform ?? default)); } else { url = string.Format(url, Constant.PlatformToGuid(platform ?? default)); } } if (queries != null) { // TO-DO: find a better, more secure way of doing this var completeQueries = new List <string>(); foreach (var query in queries) { completeQueries.Add(string.Join('=', query.Key, query.Value)); } url = string.Join('?', url, string.Join('&', completeQueries)); } var uri = new Uri(url); // Add authorization header with ticket (may be null, for requests that are static) var headerValuePairs = new KeyValuePair <HttpRequestHeader, string> [1]; if (ticket != null) { headerValuePairs[0] = new KeyValuePair <HttpRequestHeader, string>(HttpRequestHeader.Authorization, $"Ubi_v1 t={ticket}"); } return(await BuildRequestAsync(uri, headerValuePairs, null, true).ConfigureAwait(false)); }
/// <summary>Construct an instance.</summary> /// <param name="pasteID">The paste ID.</param> /// <param name="platform">The viewer's detected OS, if known.</param> public LogParserModel(string pasteID, Platform?platform) { this.PasteID = pasteID; this.DetectedPlatform = platform; this.ParsedLog = null; this.ShowRaw = false; }
public static ComputeProvider Create(string platformName = "*", DeviceType deviceType = DeviceType.Default) { var platformNameRegex = new Regex(WildcardToRegex(platformName), RegexOptions.IgnoreCase); Platform? currentPlatform = null; ErrorCode error; foreach (Platform platform in Cl.GetPlatformIDs(out error)) { if (platformNameRegex.Match(Cl.GetPlatformInfo(platform, PlatformInfo.Name, out error).ToString()).Success) { currentPlatform = platform; break; } } if (currentPlatform == null) { throw new PlatformNotSupportedException(string.Format("Could not find a platform that matches {0}", platformName)); } var compatibleDevices = from device in Cl.GetDeviceIDs(currentPlatform.Value, deviceType, out error) select device; if (compatibleDevices.Count() == 0) { throw new PlatformNotSupportedException(string.Format("Could not find a device with type {0} on platform {1}", deviceType, Cl.GetPlatformInfo(currentPlatform.Value, PlatformInfo.Name, out error))); } return(new ComputeProvider(compatibleDevices.ToArray().First())); }
public async Task <ActionResult <IEnumerable <BuildDto> > > Query ([FromQuery] string Product, [FromQuery] Platform?Platform, [FromQuery] DateTime?from, [FromQuery] DateTime?to) { var builds = _context.Builds.AsQueryable(); if (Platform != null) { builds = builds.Where(b => b.Platform == Platform); } if (Product != null) { builds = builds.Where(b => b.ProductName == Product); } if (from != null) { builds = builds.Where(b => b.BuildDate >= from); } if (to != null) { builds = builds.Where(b => b.BuildDate <= to); } var result = await builds.Include(b => b.BuildPerson).Include(b => b.UpdatePerson).ToListAsync(); return(_mapper.Map <List <BuildDto> >(result)); }
private static void Init(Platform platform) { if (!_platform.HasValue) { _platform = platform; var assemblies = AppDomain.CurrentDomain.GetAssemblies(); if (_platform == Platform.Win) { var assemmbly = assemblies .FirstOrDefault(assembly => assembly.FullName.StartsWith("DevExpress.XtraEditors")); _progressBarControlType = assemmbly?.GetType("DevExpress.XtraEditors.ProgressBarControl"); } else if (_platform == Platform.Web) { var assemmbly = assemblies .FirstOrDefault(assembly => assembly.FullName.StartsWith("DevExpress.Web.v")); _progressBarControlType = assemmbly?.GetType("DevExpress.Web.ASPxProgressBar"); _percentage = AppDomain.CurrentDomain.Web().TypeUnitPercentage(); var assemblyDevExpressExpressAppWeb = AppDomain.CurrentDomain.XAF().AssemblyDevExpressExpressAppWeb(); _asssignClientHanderSafe = assemblyDevExpressExpressAppWeb.TypeClientSideEventsHelper().AsssignClientHanderSafe(); var methodInfoGetShowMessageScript = assemblyDevExpressExpressAppWeb.GetType("DevExpress.ExpressApp.Web.PopupWindowManager").GetMethod("GetShowMessageScript", BindingFlags.Static | BindingFlags.NonPublic); _delegateForGetShowMessageScript = methodInfoGetShowMessageScript.DelegateForCallMethod(); } } }
/// <summary> /// 查询消息状态(http://docs.developer.qq.com/xg/push_faq/server_api/rest.html#%E6%9F%A5%E8%AF%A2%E6%B6%88%E6%81%AF%E7%8A%B6%E6%80%81)。 /// <para>此接口目前仅支持全量推送和标签群推消息的发送状态的查询,不支持其他推送方式的查询。</para> /// </summary> /// <param name="pushIds">必需:是,消息唯一标识,可在管理台查看。</param> /// <param name="start">必需:是,起始记录id,分页查询使用。</param> /// <param name="length">必需:是,查询记录条数。</param> /// <param name="type">必需:是,推送消息类型: /// <para>- 1=通知栏消息</para> /// <para>- 2=透传消息(应用内消息)</para></param> /// <param name="push_type">必需:否,方式:WEB(1)/restAPI(2)/all(3)。</param> /// <param name="task_type">必需:否,推送取值范围: /// <para>- 0=所有范围(设备、账号、标签)</para> /// <para>- 1=设备</para> /// <para>- 2=帐号</para> /// <para>- 3=标签</para> /// </param> /// <param name="platform">必需:否,平台:Android(1)/iOS(2)。</param> /// <param name="start_date">必需:否,开始时间,格式: yyyy-MM-dd。</param> /// <param name="end_date">必需:否,结束时间,格式: yyyy-MM-dd。</param> /// <param name="status">必需:否,状态: /// <para>- 0=所有状态</para> /// <para>- 1=待推送</para> /// <para>- 2=推送中</para> /// <para>- 3=推送完成</para> /// <para>- 4=推送失败</para> /// <para>- 5=非法任务</para> /// <para>- 6=其他状态</para> /// </param> /// <param name="message">必需:否,根据消息内容进行模糊查找。</param> /// <param name="operation">必需:否,建议取值 1。</param> /// <returns></returns> public Task <XingePushClientResult <QueryPushStatusResult> > QueryPushStatus( [NotNull] ICollection <string> pushIds, int start, int length, int type, int?push_type = null, int?task_type = null, Platform?platform = null, DateTime?start_date = null, DateTime?end_date = null, int?status = null, string message = null, int?operation = null) { if (pushIds == null) { throw new ArgumentNullException(nameof(pushIds)); } var param = new Dictionary <string, object> { { Constants.push_ids, GetPushIds(pushIds) }, { nameof(start), start }, { nameof(length), length }, { nameof(type), type }, }; if (push_type.HasValue) { param.Add(nameof(push_type), push_type.Value); } if (task_type.HasValue) // task_type 类型(string) { param.Add(nameof(task_type), task_type.Value.ToString()); } if (platform.HasValue) { param.Add(nameof(platform), (int)platform.Value); } if (start_date.HasValue) { param.Add(nameof(start_date), ToDateFormat(start_date.Value)); } if (end_date.HasValue) { param.Add(nameof(end_date), ToDateFormat(end_date.Value)); } if (status.HasValue) { param.Add(nameof(status), status.Value); } if (!string.IsNullOrEmpty(message)) { param.Add(nameof(message), message); } if (operation.HasValue) { param.Add(nameof(operation), operation.Value); } return(SendAsync <QueryPushStatusResult>(RESTAPI_QUERYPUSHSTATUS, param)); }
public static Platform GetPlatform() { if (_currentPlatform.HasValue) { return(_currentPlatform.Value); } var pid = Environment.OSVersion.Platform; if (pid == PlatformID.Win32NT || pid == PlatformID.Win32S || pid == PlatformID.Win32Windows || pid == PlatformID.WinCE) { _currentPlatform = Platform.Windows; } else if (IsRunningOnMac()) { _currentPlatform = Platform.Mac; } else if (Environment.OSVersion.Platform == PlatformID.Unix) { _currentPlatform = Platform.Unix; } else { _currentPlatform = Platform.Other; } return(_currentPlatform.Value); }
public ValidationResult Initialise(Uri apiEndpoint, string token, ForkMode?forkModeFromSettings, Platform?platformFromSettings) { var platformSettingsReader = FindPlatformSettingsReader(platformFromSettings, apiEndpoint); if (platformSettingsReader != null) { _platform = platformSettingsReader.Platform; } else { return(ValidationResult.Failure($"Unable to find collaboration platform for uri {apiEndpoint}")); } Settings.BaseApiUrl = UriFormats.EnsureTrailingSlash(apiEndpoint); Settings.Token = token; Settings.ForkMode = forkModeFromSettings; platformSettingsReader.UpdateCollaborationPlatformSettings(Settings); var result = ValidateSettings(); if (!result.IsSuccess) { return(result); } CreateForPlatform(); return(ValidationResult.Success); }
private ISettingsReader FindPlatformSettingsReader( Platform?platformFromSettings, Uri apiEndpoint) { if (platformFromSettings.HasValue) { var reader = _settingReaders .FirstOrDefault(s => s.Platform == platformFromSettings.Value); if (reader != null) { _nuKeeperLogger.Normal($"Collaboration platform specified as '{reader.Platform}'"); } return(reader); } else { var reader = _settingReaders .FirstOrDefault(s => s.CanRead(apiEndpoint)); if (reader != null) { _nuKeeperLogger.Normal($"Matched uri '{apiEndpoint}' to collaboration platform '{reader.Platform}'"); } return(reader); } }
private void UserIdAndPlatformResolvedMessageReceived(UserIdAndPlatformResolvedMessage message) { _userId = message.UserId; _platform = message.Platform; Messenger.Default.Send(new BattlelogResponseMessage(UserIdAndPlatformResolved, true)); GetFilesFromServer(); }
/// <summary>Construct an instance.</summary> /// <param name="mods">The mods to search.</param> /// <param name="apiVersion">The SMAPI version installed by the player. If this is null, the API won't provide a recommended update.</param> /// <param name="gameVersion">The Stardew Valley version installed by the player.</param> /// <param name="platform">The OS on which the player plays.</param> /// <param name="includeExtendedMetadata">Whether to include extended metadata for each mod.</param> public ModSearchModel(ModSearchEntryModel[] mods, ISemanticVersion apiVersion, ISemanticVersion gameVersion, Platform platform, bool includeExtendedMetadata) { this.Mods = mods.ToArray(); this.ApiVersion = apiVersion; this.GameVersion = gameVersion; this.Platform = platform; this.IncludeExtendedMetadata = includeExtendedMetadata; }
/********* ** Public methods *********/ /// <summary>Detect the current OS.</summary> public static Platform DetectPlatform() { if (EnvironmentUtility.CachedPlatform == null) { EnvironmentUtility.CachedPlatform = EnvironmentUtility.DetectPlatformImpl(); } return(EnvironmentUtility.CachedPlatform.Value); }
//public static bool usedVicoVR = false; public static void GetData() { if (currentPlatform == null) { PlatformSetsData setsData = Resources.Load("PlatformChangerData") as PlatformSetsData; currentPlatform = setsData.currentPlatform; Debug.Log("Current Platform " + currentPlatform); } }
/// <summary>Build a log parser model.</summary> /// <param name="pasteID">The paste ID.</param> /// <param name="uploadError">An error which occurred while uploading the log to Pastebin.</param> private LogParserModel GetModel(string pasteID, string uploadError = null) { string sectionUrl = this.Config.LogParserUrl; Platform?platform = this.DetectClientPlatform(); return(new LogParserModel(sectionUrl, pasteID, platform) { UploadError = uploadError }); }
/********* ** Private methods *********/ /// <summary>Build a log parser model.</summary> /// <param name="pasteID">The stored file ID.</param> /// <param name="expiry">When the uploaded file will no longer be available.</param> /// <param name="uploadWarning">A non-blocking warning while uploading the log.</param> /// <param name="uploadError">An error which occurred while uploading the log.</param> private LogParserModel GetModel(string pasteID, DateTime?expiry = null, string uploadWarning = null, string uploadError = null) { Platform?platform = this.DetectClientPlatform(); return(new LogParserModel(pasteID, platform) { UploadWarning = uploadWarning, UploadError = uploadError, Expiry = expiry }); }
public RequestLog(int type, Platform?platform, DateTime time, int value) { this.Date = time; this.GroupHour = time.ToGroupHour(); this.GroupDay = time.ToGroupDay(); this.GroupWeek = time.ToGroupWeek(); this.GroupMonth = time.ToGroupMonth(); this.Type = type; this.Platform = platform; this.Value = value; }
protected bool IsTargetPlatformRestrictsSubscriber(Platform?target, Platform subscriber) { if (target.HasValue) { if (target != subscriber) { return(true); } } return(false); }
public static AppManager GetInstance(Platform platform) { lock (locker) { if (_appManager == null || (_platformStatic != platform && _platformStatic != null)) { _platformStatic = platform; _appManager = new AppManager(platform); } } return(_appManager); }
private void buttonAddSyncSelection_Click(object sender, RoutedEventArgs e) { Platform?platform = (Platform?)CommonDialogsHelper.ShowInputComboBoxDialog(this, "Select Sync Platform:", EnumHelper.EnumToList <Platform>(), "Add Sync Selection", null, true); if (platform.HasValue) { this.Device.SyncPlatformSelections.Add(platform.Value); UpdateSyncSelections(); listSyncSelections.SelectedItem = platform.Value; } }
public RequestLog(int type, Platform?platform) { var today = DateTime.Today; this.Date = DateTime.Now; this.GroupHour = DateTime.Now.ToGroupHour(); this.GroupDay = today.ToGroupDay(); this.GroupWeek = today.ToGroupWeek(); this.GroupMonth = today.ToGroupMonth(); this.Type = type; this.Platform = platform; }
/********* ** Public methods *********/ /// <summary>Detect the current OS.</summary> public static Platform DetectPlatform() { Platform?platform = EnvironmentUtility.CachedPlatform; if (platform == null) { string rawPlatform = LowLevelEnvironmentUtility.DetectPlatform(); EnvironmentUtility.CachedPlatform = platform = (Platform)Enum.Parse(typeof(Platform), rawPlatform, ignoreCase: true); } return(platform.Value); }
private async Task <T> GetResponseAsync <T>(string endpoint, Platform?platform, CancellationToken?cancellationToken) { var url = Endpoint.Base + (platform ?? "") + (endpoint ?? ""); using (var req = new HttpRequestMessage(HttpMethod.Get, url)) using (var res = await _client.SendAsync(req, cancellationToken ?? CancellationToken.None)) { res.EnsureSuccessStatusCode(); var content = await res.Content.ReadAsStringAsync(); return(JsonConvert.DeserializeObject <T>(content, Converter.Settings)); } }
private KeyValuePair <string, string>[] BuildQuery(Gamemode?gamemodes, DateTime?start, DateTime?end, Platform?platforms, TeamRole?teamroles, TrendType?trend) { var queries = new List <KeyValuePair <string, string> >(); if (gamemodes.HasValue) { var flags = ApiHelper.DeriveGamemodeFlags(gamemodes.Value); var query = new KeyValuePair <string, string>("gameMode", flags); queries.Add(query); } if (start.HasValue) { var value = start.Value.ToString("yyyyMMdd"); var query = new KeyValuePair <string, string>("startDate", value); queries.Add(query); } if (end.HasValue) { var value = end.Value.ToString("yyyyMMdd"); var query = new KeyValuePair <string, string>("endDate", value); queries.Add(query); } if (platforms.HasValue) { var flags = ApiHelper.DerivePlatformFlags(platforms.Value); var query = new KeyValuePair <string, string>("platform", flags); queries.Add(query); } if (teamroles.HasValue) { var flags = ApiHelper.DeriveTeamRoleFlags(teamroles.Value); var query = new KeyValuePair <string, string>("teamRole", flags); queries.Add(query); } if (trend.HasValue) { var query = new KeyValuePair <string, string>("trendType", trend.Value.ToString().ToLower()); queries.Add(query); } return(queries.ToArray()); }
public void Initialise(Uri apiEndpoint, string token, ForkMode?forkModeFromSettings) { var platformSettingsReader = SettingsReaderForPlatform(apiEndpoint); _platform = platformSettingsReader.Platform; _nuKeeperLogger.Normal($"Matched uri '{apiEndpoint}' to collaboration platform '{_platform}'"); Settings.BaseApiUrl = UriFormats.EnsureTrailingSlash(apiEndpoint); Settings.Token = token; Settings.ForkMode = forkModeFromSettings; platformSettingsReader.UpdateCollaborationPlatformSettings(Settings); ValidateSettings(); CreateForPlatform(); }
public static Platform GetPlatform() { if (_currentPlatform.HasValue) return _currentPlatform.Value; var pid = Environment.OSVersion.Platform; if (pid == PlatformID.Win32NT || pid == PlatformID.Win32S || pid == PlatformID.Win32Windows || pid == PlatformID.WinCE) _currentPlatform = Platform.Windows; else if (IsRunningOnMac()) _currentPlatform = Platform.Mac; else if (Environment.OSVersion.Platform == PlatformID.Unix) _currentPlatform = Platform.Unix; else _currentPlatform = Platform.Other; return _currentPlatform.Value; }
internal static async Task <Stream> GetDataAsync(string url, Platform?platform, IEnumerable <KeyValuePair <string, string> > queries, Session session) { if (platform != null) { if (url.Equals(Endpoints.UbiServices.Progressions) || url.Equals(Endpoints.UbiServices.Players) || url.Equals(Endpoints.UbiServices.PlayerSkillRecords) || url.Equals(Endpoints.UbiServices.Statistics)) { url = string.Format(url, Constant.PlatformToGuid(platform ?? default), Constant.PlatformToSandbox(platform ?? default)); } else { url = string.Format(url, Constant.PlatformToGuid(platform ?? default)); } } return(await GetDataAsync(url, queries, session).ConfigureAwait(false)); }
public static PlatformPlugin Create(Platform?platform = null) { if (platform == null) { platform = Autodetector.Platform; } switch (platform) { case Platform.Linux: return(LinuxPlatformPlugin); case Platform.Windows: return(WindowsPlatformPlugin); case Platform.Mac: return(MacPlatformPlugin); default: throw new UnknownPlatformException(platform.Value); } }
private async Task <ISettingsReader> TryGetSettingsReader(Uri repoUri, Platform?platform) { // If the platform was specified explicitly, get the reader by platform. if (platform.HasValue) { return(_settingsReaders.Single(s => s.Platform == Platform)); } // Otherwise, use the Uri to guess which platform to use. foreach (var reader in _settingsReaders) { if (await reader.CanRead(repoUri)) { return(reader); } } return(null); }
public async Task <IActionResult> OnGetAsync(int?id, DateTime?startDate, DateTime?stopDate, Platform?platform) { if (!(await authorizationService.AuthorizeAsync( User, new TimeTrack(), ReportOperations.ViewReport)) .Succeeded) { return(new ChallengeResult()); } await PrepareModel(id, startDate, stopDate, platform); TargetSprintId = id; TargetPlatform = platform; await PopulateSprintsDropDownList(id); PopulatePlatformsDropDownList(platform); return(Page()); }
private static Job GetJob(Jit?jit, Platform?platform) { var job = Job.DryClr; string id = job.Id; if (jit.HasValue) { job = job.With(jit.Value); id += "-" + jit.Value; } if (platform.HasValue) { job = job.With(platform.Value); id += "-" + platform.Value; } return(job.WithId(id)); }
private void Reset() { _responseMessages = 0; _userId = null; _platform = null; }