diff --git a/Assets/Xbox Live/Editor/XboxLivePostProcessing.cs b/Assets/Xbox Live/Editor/XboxLivePostProcessing.cs index bfd98398..e1d1a090 100644 --- a/Assets/Xbox Live/Editor/XboxLivePostProcessing.cs +++ b/Assets/Xbox Live/Editor/XboxLivePostProcessing.cs @@ -3,7 +3,6 @@ // namespace Assets.Xbox_Live.Editor { - using System; using System.IO; using System.Xml; using System.Xml.Linq; @@ -11,52 +10,18 @@ namespace Assets.Xbox_Live.Editor using Microsoft.Xbox.Services; - using SyntaxTree.VisualStudio.Unity.Bridge; - using UnityEditor; using UnityEditor.Callbacks; using UnityEngine; /// - /// Handles post processing the generated Visaul Studio projects in order to deal with DevCenter + /// Handles post processing the generated Visual Studio projects in order to deal with DevCenter /// association and including Xbox Live configuration files. /// [InitializeOnLoad] public class XboxLivePostProcessing { - static XboxLivePostProcessing() - { - ProjectFilesGenerator.ProjectFileGeneration += AddXboxServicesConfig; - } - - /// - /// Adds the XboxServices.config file to the generated project file. - /// - /// The name of the file being processed. - /// The content of the file being processed. - /// The project file with an additional content element included. - /// - /// This only modifies the Unity debug projects and will not have any - /// effect on projects built as part of the Unity UWP build process. - /// - private static string AddXboxServicesConfig(string fileName, string fileContent) - { - if (!fileName.EndsWith(".Editor.csproj")) - { - const string configFileElement = - " \r\n" + - " PreserveNewest\r\n" + - " \r\n"; - - // Hacky way to do this for now. Should make it a bit more stable. - int lastItemGroup = fileContent.LastIndexOf(" ", StringComparison.OrdinalIgnoreCase); - fileContent = fileContent.Insert(lastItemGroup, configFileElement); - } - - return fileContent; - } - [PostProcessBuild(1)] public static void OnPostprocessBuild(BuildTarget target, string solutionFolder) { diff --git a/Assets/Xbox Live/Editor/XboxLivePostProcessingUnityProject.cs b/Assets/Xbox Live/Editor/XboxLivePostProcessingUnityProject.cs new file mode 100644 index 00000000..54d83237 --- /dev/null +++ b/Assets/Xbox Live/Editor/XboxLivePostProcessingUnityProject.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation +// Licensed under the MIT license. See LICENSE file in the project root for full license information. +// +namespace Assets.Xbox_Live.Editor +{ + using System; + using Microsoft.Xbox.Services; + using UnityEditor; + + /// + /// Handles post processing the generated Visual Studio projects in order to deal with DevCenter + /// association and including Xbox Live configuration files. + /// + public class XboxLivePostProcessingUnityProject : AssetPostprocessor + { + private static string OnGeneratedCSProject(string path, string content) + { + return AddXboxServicesConfig(path, content); + } + + /// + /// Adds the XboxServices.config file to the generated project file. + /// + /// The name of the file being processed. + /// The content of the file being processed. + /// The project file with an additional content element included. + /// + /// This only modifies the Unity debug projects and will not have any + /// effect on projects built as part of the Unity UWP build process. + /// + private static string AddXboxServicesConfig(string fileName, string fileContent) + { + if (!fileName.EndsWith(".Editor.csproj")) + { + const string configFileElement = + " \r\n" + + " PreserveNewest\r\n" + + " \r\n"; + + // Hacky way to do this for now. Should make it a bit more stable. + int lastItemGroup = fileContent.LastIndexOf(" ", StringComparison.OrdinalIgnoreCase); + fileContent = fileContent.Insert(lastItemGroup, configFileElement); + } + + return fileContent; + } + } +} diff --git a/Assets/Xbox Live/Editor/XboxLivePostProcessingUnityProject.cs.meta b/Assets/Xbox Live/Editor/XboxLivePostProcessingUnityProject.cs.meta new file mode 100644 index 00000000..84c579ea --- /dev/null +++ b/Assets/Xbox Live/Editor/XboxLivePostProcessingUnityProject.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 4fe701e19650d9541b767bce400e693e +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: