public Replay(PlatformId platformId, long gameId) { this.platformId = platformId; this.gameId = gameId; this.replayWebRequest = new ReplayWebRequest(); }
public async Task <Platform> UpdatePlatformAsync(PlatformId id, PlatformRequest platformRequest, IAsyncDocumentSession session) { var project = await session .Query <Project>() .Where(p => p.Platforms.Any(a => a.Id == id.Value)) .FirstOrDefaultAsync(); var platform = project.Platforms?.FirstOrDefault(); if (platform == null) { throw new ApiException("I couldn't find that platform. Are you sure it's the right token?", 404); } if (platform.ExportDataUri == platformRequest.ExportDataUri ) { // Nothing to update throw new ApiException("That's the same information that I have. Great, so we agree.", 200); } platform.ExportDataUri = platformRequest.ExportDataUri; platform.LastUpdate = DateTime.Now; // TODO: Save session changes once await session.SaveChangesAsync(); return(platform); }
/// <inheritdoc /> public string GetStoneMimetype(PlatformId knownPlatform, Stream romStream, string extensionFallback) { this.Platforms.TryGetValue(knownPlatform, out IPlatformInfo platform); if (platform == null) { return(String.Empty); } long streamPos = romStream.Position; foreach (var mimetype in platform.FileTypes.Values) { if (!this.FileSignatures.ContainsKey(mimetype)) { continue; } foreach (var sig in this.FileSignatures[mimetype]) { romStream.Seek(streamPos, SeekOrigin.Begin); if (sig.HeaderSignatureMatches(romStream)) { romStream.Seek(streamPos, SeekOrigin.Begin); return(mimetype); } } } romStream.Seek(streamPos, SeekOrigin.Begin); return(String.Empty); }
public override async IAsyncEnumerable <SeedTree> ScrapeAsync(ISeed parent, ILookup <string, SeedContent> rootSeeds, ILookup <string, SeedContent> childSeeds, ILookup <string, SeedContent> siblingSeeds, [EnumeratorCancellation] CancellationToken cancellationToken) { PlatformId platformId = rootSeeds["platform"].First().Value; bool platformSupported = platformMap.TryGetValue(platformId, out int giantBombPlatformId); if (!platformSupported) { yield break; } string searchQuery = parent.Content.Value; var results = (await this.GiantBombClient.SearchForGamesAsync(searchQuery).ConfigureAwait(false)) ?? Enumerable.Empty <GameResult>(); foreach (var result in results.Where(r => r.Platforms?.Select(p => p.Id).Contains(giantBombPlatformId) ?? false)) { yield return("result", result.Name, _( ("title", result?.Name ?? ""), ("description", result?.Deck ?? ""), ("publisher", result?.Publishers != null ? String.Join(", ", result.Publishers.Select(p => p.Name)) : ""), ("giantbomb_id", result?.Id.ToString() ?? "0"), ("boxart", result?.Image?.SuperUrl ?? "") )); } }
public AbstractPlatform( PlatformId platform, LanguageId language, bool isMin, AbstractTranslator translator, AbstractSystemFunctionTranslator systemFunctionTranslator, AbstractOpenGlTranslator nullableOpenGlTranslator, AbstractGamepadTranslator nullableGamepadTranslator) { this.PlatformId = platform; this.LanguageId = language; this.ExpressionTranslatorForExternalLibraries = new ExpressionTranslator(this); this.Context = new CompileContext(); this.IsMin = isMin; this.Translator = translator; this.SystemFunctionTranslator = systemFunctionTranslator; this.OpenGlTranslator = nullableOpenGlTranslator; this.GamepadTranslator = nullableGamepadTranslator; this.Translator.Platform = this; this.SystemFunctionTranslator.Platform = this; this.SystemFunctionTranslator.Translator = translator; if (this.GamepadTranslator != null) { this.GamepadTranslator.Platform = this; this.GamepadTranslator.Translator= translator; } if (this.OpenGlTranslator != null) { this.OpenGlTranslator.Platform = this; this.OpenGlTranslator.Translator = this.Translator; } }
public static IQueryable <User> GetUserForPlatform(PlatformId platformId, BitcornContext dbContext) { switch (platformId.Platform) { case "auth0": return(dbContext.Auth0Query(platformId.Id)); case "twitch": return(dbContext.TwitchQuery(platformId.Id)); case "stream": return(dbContext.TwitchQuery(platformId.Id)); case "twitchusername": return(dbContext.TwitchUsernameQuery(platformId.Id)); case "discord": return(dbContext.DiscordQuery(platformId.Id)); case "twitter": return(dbContext.TwitterQuery(platformId.Id)); case "reddit": return(dbContext.RedditQuery(platformId.Id)); case "userid": return(dbContext.UserIdQuery(int.Parse(platformId.Id))); default: throw new Exception($"User {platformId.Platform}|{platformId.Id} could not be found"); } }
public Rom(PlatformId platform_id, string name, string path) { PlatformId = platform_id; Name = name; Path = path; Hash = Utils.CalcHash(path); }
public IEmulatedController?GetControllerAtPort(IEmulatorOrchestrator orchestrator, PlatformId platform, int portIndex) { var portEntry = this.Ports.GetPort(orchestrator, platform, portIndex); if (portEntry == null) { return(null); } var device = this.Devices.GetPortDevice(portEntry); if (device == null) { return(null); } var instance = device.Instances.FirstOrDefault(i => i.Driver == portEntry.Driver); var profile = this.Mappings.GetMappings(portEntry.ProfileGuid); if (profile == null) { return(null); } if (!this.StoneProvider.Controllers.TryGetValue(portEntry.ControllerID, out var targetLayout)) { return(null); } return(new EmulatedController(portIndex, device, instance, targetLayout, profile)); }
public async Task <AuthenticationResult> Authenticate(Dictionary <string, string> authenticationCtx, IUserService userService) { if (authenticationCtx["provider"] != PROVIDER_NAME) { return(null); } string username; authenticationCtx.TryGetValue("pseudo", out username); var pId = new PlatformId { Platform = PROVIDER_NAME }; if (string.IsNullOrWhiteSpace(username)) { return(AuthenticationResult.CreateFailure("Pseudo must not be empty", pId, authenticationCtx)); } var user = await userService.GetUserByClaim(PROVIDER_NAME, "pseudo", username); if (user == null) { var uid = Guid.NewGuid().ToString("N"); user = await userService.CreateUser(uid, JObject.FromObject(new { pseudo = username })); var claim = new JObject(); claim["pseudo"] = username; user = await userService.AddAuthentication(user, PROVIDER_NAME, claim, username); } return(AuthenticationResult.CreateSuccess(user, pId, authenticationCtx)); }
public void SetPort(PlatformId platform, int portNumber, ControllerId controller, Guid deviceInstanceGuid, InputDriver instanceDriver, Guid inputProfile, string emulatorName) { using var context = new DatabaseContext(Options.Options); var entity = context.PortDeviceEntries .Find(emulatorName, platform, portNumber); if (entity != null) { entity.ProfileGuid = inputProfile; entity.InstanceGuid = deviceInstanceGuid; entity.ControllerID = controller; entity.Driver = instanceDriver; context.Entry(entity).State = EntityState.Modified; } else { var newEntity = new PortDeviceEntryModel() { ProfileGuid = inputProfile, InstanceGuid = deviceInstanceGuid, ControllerID = controller, Driver = instanceDriver, OrchestratorName = emulatorName, PlatformID = platform, PortIndex = portNumber }; context.PortDeviceEntries.Add(newEntity); } context.SaveChanges(); }
internal void Read() { try { int tableOffset = _fontData.Position; version = _fontData.ReadUShort(); numTables = _fontData.ReadUShort(); #if DEBUG_ if (_fontData.Name == "Cambria") { Debug - Break.Break(); } #endif bool success = false; for (int idx = 0; idx < numTables; idx++) { PlatformId platformId = (PlatformId)_fontData.ReadUShort(); int encodingId = _fontData.ReadUShort(); int offset = _fontData.ReadLong(); int currentPosition = _fontData.Position; // Just read Windows stuff. if (platformId == PlatformId.Win && ((WinEncodingId)encodingId == WinEncodingId.Symbol || (WinEncodingId)encodingId == WinEncodingId.Unicode)) { symbol = (WinEncodingId)encodingId == WinEncodingId.Symbol; _fontData.Position = tableOffset + offset; cmap4 = new CMap4(_fontData, (WinEncodingId)encodingId); _fontData.Position = currentPosition; // We have found what we are looking for, so break. success = true; break; } if (platformId == PlatformId.Apple && (AppleEncodingId)encodingId == AppleEncodingId.Unicode20BmpOnly) { symbol = false; _fontData.Position = tableOffset + offset; cmap4 = new CMap4(_fontData, WinEncodingId.Unicode); _fontData.Position = currentPosition; // We have found what we are looking for, so break. success = true; break; } } if (!success) { throw new InvalidOperationException("Font has no usable platform or encoding ID. It cannot be used with PDFsharp."); } } catch (Exception ex) { throw new InvalidOperationException(PSSR.ErrorReadingFontData, ex); } }
internal SerialInfo(PlatformId platformId, string title, string region, string serial) { this.PlatformId = platformId; this.Title = title; this.Serial = serial.Replace("-", string.Empty).Replace("_", string.Empty).ToUpperInvariant(); // normalize serial this.Region = region; }
public IEmulatedPortDeviceEntry?GetPort(PlatformId platform, int portNumber, string emulatorName) { using var context = new DatabaseContext(Options.Options); var entity = context.PortDeviceEntries .Find(emulatorName, platform, portNumber); return(entity); }
public Platform(PlatformId platform_id, string name, string path) { PlatformId = platform_id; Path = path; Name = name; EmulatorId = 0; LaunchArgId = 0; }
internal GameRecord(PlatformId platform, Guid recordId, IMetadataCollection metadata) { this.PlatformId = platform; this.RecordId = recordId; this.Metadata = metadata; }
private static Uri GenerateMetaDataUri(PlatformId platformId, long gameId) { string metaDataUrl = _metaDataUrl; metaDataUrl = metaDataUrl.Replace("[0]", platformId.ToString()); metaDataUrl = metaDataUrl.Replace("[1]", gameId.ToString()); return(new Uri(metaDataUrl)); }
internal ServerInfo(SERVER_INFO_101 info) { this.platformId = (PlatformId)info.sv101_platform_id; this.name = info.sv101_name; this.majorVersion = (int)info.sv101_version_major; this.minorVersion = (int)info.sv101_version_minor; this.serverType = (ServerTypes)info.sv101_type; this.comment = info.sv101_comment; }
private static Uri GenerateLastChunkInfoUri(PlatformId platformId, long gameId) { string lastChunkInfoUrl = _lastChunkInfoUrl; lastChunkInfoUrl = lastChunkInfoUrl.Replace("[0]", platformId.ToString()); lastChunkInfoUrl = lastChunkInfoUrl.Replace("[1]", gameId.ToString()); return(new Uri(lastChunkInfoUrl)); }
public string GetTranslationCode(LanguageId language, PlatformId platform, string functionName) { string file = ReadFile("Translation/" + functionName + ".cry"); file = Constants.DoReplacements(file, new Dictionary<string, string>() { { "SCREEN_BLOCKS_EXECUTION", ScreenBlocksExecution(platform) ? "true" : "false" }, }); return file; }
public IEnumerable <IEmulatedPortDeviceEntry> GetPortsForPlatform(PlatformId platform, string emulatorName) { using var context = new DatabaseContext(Options.Options); var entity = context.PortDeviceEntries .Where(p => p.OrchestratorName == emulatorName && p.PlatformID == platform) .ToList(); return(entity); }
public string GetTranslationCode(LanguageId language, PlatformId platform, string functionName) { string file = ReadFile("Translation/" + functionName + ".cry"); file = Constants.DoReplacements(file, new Dictionary<string, string>() { { "IS_OPEN_GL_BASED", IsOpenGlBased(platform) ? "true" : "false" }, }); return file; }
private void BindPlatforms() { PlatformManager platformManager = new PlatformManager(); PlatformId.DataSource = platformManager.GetAllPlatformInfo(); PlatformId.DataTextField = "Platform"; PlatformId.DataValueField = "ID"; PlatformId.DataBind(); }
public IReadOnlyFile?GetSystemFileByName(PlatformId platformId, string name) { var directory = this.GetSystemFileDirectory(platformId); if (directory.ContainsFile(name) && directory.OpenFile(name).Created) { return(directory.OpenFile(name)); } return(null); }
private static Uri GenerateDataChunkUri(PlatformId platformId, long gameId, int chunkId) { string dataChunkUrl = _dataChunkUrl; dataChunkUrl = dataChunkUrl.Replace("[0]", platformId.ToString()); dataChunkUrl = dataChunkUrl.Replace("[1]", gameId.ToString()); dataChunkUrl = dataChunkUrl.Replace("[2]", chunkId.ToString()); return(new Uri(dataChunkUrl)); }
private static Uri GenerateKeyFrameUri(PlatformId platformId, long gameId, int keyFrameId) { string keyFrameUrl = _keyFrameUrl; keyFrameUrl = keyFrameUrl.Replace("[0]", platformId.ToString()); keyFrameUrl = keyFrameUrl.Replace("[1]", gameId.ToString()); keyFrameUrl = keyFrameUrl.Replace("[2]", keyFrameId.ToString()); return(new Uri(keyFrameUrl)); }
public DebugLog() { /* The Mono linker doesn't appear to respect the DEBUG symbol defined at the top of this file. * It means that Debug.WriteLine(...) doesn't work on those platform. * Hence the use of the console. */ platformId = PlatformDetector.PlatformId; if (platformId == PlatformId.Android || platformId == PlatformId.Ios) { useConsole = true; } }
private ServerInfo(SerializationInfo info, StreamingContext context) { Contracts.Requires.NotNull(info, "info"); this.platformId = (PlatformId)info.GetValue("platformId", typeof(PlatformId)); this.name = info.GetString("name"); this.serverType = (ServerTypes)info.GetValue("serverType", typeof(ServerTypes)); this.majorVersion = info.GetInt32("majorVersion"); this.minorVersion = info.GetInt32("minorVersion"); this.comment = info.GetString("comment"); }
public string GetTranslationCode(LanguageId language, PlatformId platform, string functionName) { string file = ReadFile("Translation/" + functionName + ".cry"); file = Crayon.Constants.DoReplacements(file, new Dictionary<string, string>() { { "INT_IS_FLOOR", IsIntFloor(language) ? "true" : "false" }, }); return file; }
internal RomInfo(PlatformId platformId, string crc32, string md5, string sha1, string region, string mimetype, string fileName) { this.PlatformId = platformId; this.CRC32 = crc32; this.MD5 = md5; this.SHA1 = sha1; this.MimeType = mimetype; this.FileName = fileName; this.Region = region; }
public IReadOnlyFile?GetSystemFileByMd5Hash(PlatformId platformId, string md5Hash) { using var md5 = MD5.Create(); return(this.GetSystemFileDirectory(platformId).EnumerateFiles().AsParallel().FirstOrDefault(f => { using var stream = f.OpenReadStream(); var hash = md5.ComputeHash(stream); var hashString = BitConverter.ToString(hash).Replace("-", "").ToLowerInvariant(); return hashString == md5Hash.ToLowerInvariant(); })); }
public string GetLibrarySwitchStatement(LanguageId language, PlatformId platform) { List<string> output = new List<string>(); foreach (string name in this.orderedListOfFunctionNames) { output.Add("case " + this.libFunctionIds[name] + ":\n"); output.Add("$_comment('" + name + "');"); output.Add(this.importedLibraries[this.functionNameToLibraryName[name]].GetTranslationCode(language, platform, name)); output.Add("\nbreak;\n"); } return string.Join("\n", output); }
public void ClearPort(PlatformId platform, int portNumber, string emulatorName) { using var context = new DatabaseContext(Options.Options); var entity = context.PortDeviceEntries .Find(emulatorName, platform, portNumber); if (entity != null) { context.Entry(entity).State = EntityState.Deleted; } context.SaveChanges(); }
private static string GetOsMatrixNamePart(PlatformId platformId) { if (platformId.OsVersion != null) { return(platformId.OsVersion .Replace("nanoserver", "windows") .Replace("windowsservercore", "windows") .Replace("ltsc2019", "1809")); } return(platformId.OS.GetDockerName()); }
public void Show(PlatformId platform_id) { _platform_id = platform_id; var platform = Library.Platforms[platform_id]; _name = platform.Name; _path = platform.Path; _assigned_emu_id = platform.EmulatorId; _assigned_launch_arg_id = platform.LaunchArgId; base.Show(); }
static Spectator() { Region = PlatformId.Last().IsNumeric() ? PlatformId.Remove(PlatformId.Length - 1).ToLower() : PlatformId.ToLower(); Region = Region.Contains("kr", StringComparison.OrdinalIgnoreCase) ? string.Empty : Region + "."; DoRecordUrl = DoRecordUrl.Replace("{region}", Region).Replace("{game_id}", GameId.ToString()); IsRecordingUrl = IsRecordingUrl.Replace("{region}", Region); UpdateUrl = UpdateUrl.Replace("{region}", Region); MainUrl = MainUrl.Replace("{region}", Region) .Replace("{name}", HttpUtility.UrlEncode(ObjectManager.Player.Name)); }
private static bool IsOpenGlBased(PlatformId platform) { switch (platform) { case PlatformId.C_OPENGL: case PlatformId.CSHARP_OPENTK: case PlatformId.JAVA_ANDROID: return true; case PlatformId.JAVA_AWT: case PlatformId.JAVASCRIPT_CANVAS: case PlatformId.PYTHON_PYGAME: return false; default: throw new Exception(); } }
private static bool ScreenBlocksExecution(PlatformId platform) { switch (platform) { case PlatformId.CSHARP_OPENTK: case PlatformId.JAVA_ANDROID: case PlatformId.JAVA_AWT: return true; case PlatformId.JAVASCRIPT_CANVAS: case PlatformId.PYTHON_PYGAME: return false; case PlatformId.C_OPENGL: default: throw new Exception(); } }
public string GetTranslationCode(LanguageId language, PlatformId platform, string functionName) { return ReadFile("Translation/" + functionName + ".cry"); }
public JavaPlatform(PlatformId platform, JavaSystemFunctionTranslator systemFunctionTranslator, AbstractOpenGlTranslator openGlTranslator) : base(platform, LanguageId.JAVA, false, new JavaTranslator(), systemFunctionTranslator, openGlTranslator, null) { }