private static void UpdateProjectFile(string projectFolder, XboxLiveAppConfiguration configuration) { string projectFile = Path.Combine(projectFolder, Application.productName + ".csproj"); // Copy the XboxServices.config file over to the project folder. CopyConfigurationFile(XboxLiveAppConfiguration.FileName, projectFolder); XDocument project = XDocument.Load(projectFile); XNamespace msb = "http://schemas.microsoft.com/developer/msbuild/2003"; XmlNamespaceManager ns = new XmlNamespaceManager(new NameTable()); ns.AddNamespace("msb", msb.NamespaceName); // Add the XboxService.config to the project if it doesn't exist already. XElement identityItemGroup = project.XPathSelectElement("msb:Project/msb:ItemGroup[msb:AppxManifest]", ns); if (identityItemGroup.XPathSelectElement("msb:Content[@Include='XboxServices.config']", ns) == null) { identityItemGroup.Add( new XElement(msb + "Content", new XAttribute("Include", "XboxServices.config"), new XElement(msb + "CopyToOutputDirectory", "PreserveNewest"))); } project.Save(projectFile); }
private static void UpdateAppxManifest(string projectFolder, XboxLiveAppConfiguration configuration) { string manifestFile = Path.Combine(projectFolder, "Package.appxmanifest"); XDocument manifest = XDocument.Load(manifestFile); XmlNamespaceManager ns = new XmlNamespaceManager(new NameTable()); XNamespace m = "http://schemas.microsoft.com/appx/manifest/foundation/windows10"; ns.AddNamespace("m", m.NamespaceName); ns.AddNamespace("uap", "http://schemas.microsoft.com/appx/manifest/uap/windows10"); // TODO. Set these to not hardcoded values. manifest.XPathSelectElement("m:Package/m:Identity", ns).Attribute("Name").Value = configuration.PackageIdentityName; manifest.XPathSelectElement("m:Package/m:Identity", ns).Attribute("Publisher").Value = configuration.PublisherId; manifest.XPathSelectElement("m:Package/m:Properties/m:DisplayName", ns).Value = configuration.DisplayName; manifest.XPathSelectElement("m:Package/m:Properties/m:PublisherDisplayName", ns).Value = configuration.PublisherDisplayName; manifest.XPathSelectElement("m:Package/m:Applications/m:Application/uap:VisualElements", ns).Attribute("DisplayName").Value = configuration.DisplayName; if (manifest.XPathSelectElement("m:Package/m:Capabilities", ns) == null) { manifest.XPathSelectElement("m:Package", ns).Add(new XElement(m + "Capabilities")); } if (manifest.XPathSelectElement("m:Package/m:Capabilities/m:Capability[@Name='internetClient']", ns) == null) { manifest.XPathSelectElement("m:Package/m:Capabilities", ns).Add(new XElement(m + "Capability", new XAttribute("Name", "internetClient"))); } manifest.Save(manifestFile); }
internal StatsService() { this.config = XboxLive.Instance.AppConfig; this.serializerSettings = new JsonSerializerSettings(); this.statsReadEndpoint = config.GetEndpointForService("statsread"); this.statsWriteEndpoint = config.GetEndpointForService("statswrite"); }
public LeaderboardResult( XboxLiveUser userContext, XboxLiveContextSettings xboxLiveContextSettings, XboxLiveAppConfiguration appConfig) { this.userContext = userContext; this.xboxLiveContextSettings = xboxLiveContextSettings; this.appConfig = appConfig; }
public UserImpl(EventHandler <SignInCompletedEventArgs> signInCompleted, EventHandler <SignOutCompletedEventArgs> signOutCompleted) { this.signInCompleted = signInCompleted; this.signOutCompleted = signOutCompleted; this.appConfig = XboxLiveAppConfiguration.Instance; this.AuthConfig = new AuthConfig { Sandbox = this.appConfig.Sandbox, EnvrionmentPrefix = this.appConfig.EnvironmentPrefix, Envrionment = this.appConfig.Environment, UseCompactTicket = this.appConfig.UseFirstPartyToken }; }
public LeaderboardResult( uint totalRowCount, IList <LeaderboardColumn> columns, IList <LeaderboardRow> rows, XboxLiveUser userContext, XboxLiveContextSettings xboxLiveContextSettings, XboxLiveAppConfiguration appConfig) { this.TotalRowCount = totalRowCount; this.Columns = columns; this.Rows = rows; this.userContext = userContext; this.xboxLiveContextSettings = xboxLiveContextSettings; this.appConfig = appConfig; }
private static void UpdateProjectFile(string projectFolder, XboxLiveAppConfiguration configuration) { var scriptingBackend = PlayerSettings.GetScriptingBackend(BuildTargetGroup.WSA); // Copy the XboxServices.config file over to the project folder. CopyConfigurationFile(XboxLiveAppConfiguration.FileName, projectFolder); string projectFile = null; if (scriptingBackend == ScriptingImplementation.WinRTDotNET) { projectFile = Path.Combine(projectFolder, Application.productName + ".csproj"); } else if (scriptingBackend == ScriptingImplementation.IL2CPP) { projectFile = Path.Combine(projectFolder, Application.productName + ".vcxproj"); } XDocument project = XDocument.Load(projectFile); XNamespace msb = "http://schemas.microsoft.com/developer/msbuild/2003"; XmlNamespaceManager ns = new XmlNamespaceManager(new NameTable()); ns.AddNamespace("msb", msb.NamespaceName); // Add the XboxService.config to the project if it doesn't exist already. XElement identityItemGroup = project.XPathSelectElement("msb:Project/msb:ItemGroup[msb:AppxManifest]", ns); if (scriptingBackend == ScriptingImplementation.WinRTDotNET) { if (identityItemGroup.XPathSelectElement(string.Format("msb:Content[@Include='{0}']", XboxLiveAppConfiguration.FileName), ns) == null) { identityItemGroup.Add(new XElement(msb + "Content", new XAttribute("Include", XboxLiveAppConfiguration.FileName), new XElement(msb + "CopyToOutputDirectory", "PreserveNewest"))); } } else if (scriptingBackend == ScriptingImplementation.IL2CPP) { if (identityItemGroup.XPathSelectElement(string.Format("msb:None[@Include='{0}']", XboxLiveAppConfiguration.FileName), ns) == null) { identityItemGroup.Add(new XElement(msb + "None", new XAttribute("Include", XboxLiveAppConfiguration.FileName), new XElement(msb + "DeploymentContent", "true"))); } } project.Save(projectFile); }
/// <summary> /// Attempts to loads the current Xbox Live configuration if present. /// </summary> /// <returns>The configuration declared in the configuration file, or null if it does not exist or is invalid.</returns> internal XboxLiveAppConfiguration TryLoad() { if (!File.Exists(this.configFilePath)) { return(null); } try { return(XboxLiveAppConfiguration.Load(this.configFilePath)); } catch (Exception) { return(null); } }
/// <summary> /// Attempts to loads the current Xbox Live configuration if present. /// </summary> /// <returns>The configuration declared in the configuration file, or null if it does not exist or is invalid.</returns> internal XboxLiveAppConfiguration TryLoad() { if (!File.Exists(this.configFilePath)) { return(null); } try { return(XboxLiveAppConfiguration.Load(this.configFilePath)); } catch (Exception ex) { Debug.LogWarning(string.Format("Xbox Live config file exists but failed to load: {0}", ex.Message)); return(null); } }
private void OnEnable() { this.configFileDirectory = Path.Combine(Application.dataPath, ".."); this.configFilePath = Path.Combine(this.configFileDirectory, XboxLiveAppConfiguration.FileName); this.configuration = this.TryLoad(); // Start a file system watcher to notify us if we need to reload the configuration file. FileSystemWatcher configFileWatcher = new FileSystemWatcher(this.configFileDirectory) { Filter = XboxLiveAppConfiguration.FileName }; configFileWatcher.Created += this.ConfigFileChanged; configFileWatcher.Deleted += this.ConfigFileChanged; configFileWatcher.Renamed += this.ConfigFileChanged; configFileWatcher.Changed += this.ConfigFileChanged; configFileWatcher.EnableRaisingEvents = true; }
private static void UpdateProjectFile(string projectFolder, XboxLiveAppConfiguration configuration) { string projectFile = Path.Combine(projectFolder, Application.productName + ".csproj"); XDocument project = XDocument.Load(projectFile); XNamespace msb = "http://schemas.microsoft.com/developer/msbuild/2003"; XmlNamespaceManager ns = new XmlNamespaceManager(new NameTable()); ns.AddNamespace("msb", msb.NamespaceName); XElement identityItemGroup = project.XPathSelectElement("msb:Project/msb:ItemGroup[msb:AppxManifest]", ns); XElement certificateElement = identityItemGroup.XPathSelectElement("./msb:None[@Include='WSATestCertificate.pfx']", ns); if (certificateElement != null) { string publisherCertificateFileName = configuration.PackageIdentityName + "_StoreKey.pfx"; CopyConfigurationFile(publisherCertificateFileName, projectFolder); // Replace the existing test cert with our generated cert. certificateElement.Attribute("Include").Value = publisherCertificateFileName; // And update the PackageCertificateKeyFile project.XPathSelectElement("msb:Project/msb:PropertyGroup/msb:PackageCertificateKeyFile", ns).Value = publisherCertificateFileName; } CopyConfigurationFile(XboxLiveAppConfiguration.FileName, projectFolder); // Add the XboxService.config file if it doesn't exist if (identityItemGroup.XPathSelectElement("msb:Content[@Include='XboxServices.config']", ns) == null) { identityItemGroup.Add( new XElement(msb + "Content", new XAttribute("Include", "XboxServices.config"), new XElement(msb + "CopyToOutputDirectory", "PreserveNewest"))); } project.Save(projectFile); }
internal LeaderboardService() { this.appConfig = XboxLive.Instance.AppConfig; }
internal ProfileService() { this.config = XboxLive.Instance.AppConfig; this.profileEndpoint = this.config.GetEndpointForService("profile"); }
/// <summary> /// Initializes a new instance of <see cref="TitleStorageService"/> class. /// </summary> /// <param name="appConfig">Xbox Live App Configuration</param> public TitleStorageService() { this.appConfig = XboxLive.Instance.AppConfig; }
internal PeopleHubService() { this.appConfig = XboxLive.Instance.AppConfig; this.peopleHubEndpoint = appConfig.GetEndpointForService("peoplehub"); }
internal LeaderboardService(XboxLiveUser userContext, XboxLiveContextSettings xboxLiveContextSettings, XboxLiveAppConfiguration appConfig) { this.userContext = userContext; this.xboxLiveContextSettings = xboxLiveContextSettings; this.appConfig = appConfig; }
internal StatsService(XboxLiveContext context) { this.config = context.AppConfig; this.context = context; this.settings = context.Settings; }
private void ConfigFileChanged(object sender, FileSystemEventArgs fileSystemEventArgs) { // When the config file changes, reload the configuration. this.configuration = this.TryLoad(); }
internal ProfileService(XboxLiveAppConfiguration config, XboxLiveContext context, XboxLiveContextSettings settings) { this.config = config; this.context = context; this.settings = settings; }
public PeopleHubService(XboxLiveContextSettings httpCallSettings, XboxLiveAppConfiguration appConfig) { this.httpCallSettings = httpCallSettings; this.appConfig = appConfig; this.peopleHubHost = XboxLiveEndpoint.GetEndpointForService("peoplehub", appConfig); }