コード例 #1
0
        internal static string GetPlatformAssemblyPath(WSASDK wsaSDK)
        {
            string windowsKitDirectory = MicrosoftCSharpCompiler.GetWindowsKitDirectory(wsaSDK);
            string result;

            if (wsaSDK == WSASDK.UWP)
            {
                string text = Paths.Combine(new string[]
                {
                    windowsKitDirectory,
                    "UnionMetadata",
                    UWPReferences.SdkVersionToString(UWPReferences.GetDesiredSDKVersion()),
                    "Facade",
                    "Windows.winmd"
                });
                if (!File.Exists(text))
                {
                    text = Path.Combine(windowsKitDirectory, "UnionMetadata\\Facade\\Windows.winmd");
                }
                result = text;
            }
            else
            {
                result = Path.Combine(windowsKitDirectory, "References\\CommonConfiguration\\Neutral\\Windows.winmd");
            }
            return(result);
        }
コード例 #2
0
        private static string[] GetPlatform(string folder, string version)
        {
            string text = UWPReferences.CombinePaths(new string[]
            {
                folder,
                "Platforms\\UAP",
                version,
                "Platform.xml"
            });

            string[] result;
            if (!File.Exists(text))
            {
                result = new string[0];
            }
            else
            {
                XDocument xDocument = XDocument.Load(text);
                XElement  xElement  = xDocument.Element("ApplicationPlatform");
                if (xElement.Attribute("name").Value != "UAP")
                {
                    throw new Exception(string.Format("Invalid platform manifest at \"{0}\".", text));
                }
                XElement containedApiContractsElement = xElement.Element("ContainedApiContracts");
                result = UWPReferences.GetReferences(folder, version, containedApiContractsElement);
            }
            return(result);
        }
コード例 #3
0
        public static string[] GetReferences()
        {
            string text;
            string version;

            UWPReferences.GetSDKFolderAndVersion(out text, out version);
            HashSet <string> hashSet = new HashSet <string>(StringComparer.InvariantCultureIgnoreCase);
            string           item    = Path.Combine(text, "UnionMetadata\\Facade\\Windows.winmd");

            hashSet.Add(item);
            string[] platform = UWPReferences.GetPlatform(text, version);
            for (int i = 0; i < platform.Length; i++)
            {
                string item2 = platform[i];
                hashSet.Add(item2);
            }
            UWPReferences.UWPExtension[] extensions = UWPReferences.GetExtensions(text, version);
            for (int j = 0; j < extensions.Length; j++)
            {
                UWPReferences.UWPExtension uWPExtension = extensions[j];
                string[] references = uWPExtension.References;
                for (int k = 0; k < references.Length; k++)
                {
                    string item3 = references[k];
                    hashSet.Add(item3);
                }
            }
            return(hashSet.ToArray <string>());
        }
コード例 #4
0
        public static Version GetDesiredSDKVersion()
        {
            Version[] array = UWPReferences.GetInstalledSDKVersions().ToArray <Version>();
            Version   result;

            if (array.Length == 0)
            {
                result = new Version(10, 0, 10240, 0);
            }
            else
            {
                Version version   = array.Max <Version>();
                string  wsaUWPSDK = EditorUserBuildSettings.wsaUWPSDK;
                if (string.IsNullOrEmpty(wsaUWPSDK))
                {
                    result = version;
                }
                else
                {
                    Version[] array2 = array;
                    for (int i = 0; i < array2.Length; i++)
                    {
                        Version version2 = array2[i];
                        if (version2.ToString() == wsaUWPSDK)
                        {
                            result = version2;
                            return(result);
                        }
                    }
                    result = version;
                }
            }
            return(result);
        }
コード例 #5
0
 internal static string[] GetAdditionalReferences(WSASDK wsaSDK)
 {
     if (wsaSDK != WSASDK.UWP)
     {
         return(null);
     }
     return(UWPReferences.GetReferences(UWPReferences.GetDesiredSDKVersion()));
 }
コード例 #6
0
        public static IEnumerable <UWPExtensionSDK> GetExtensionSDKs()
        {
            string sdkFolder;
            string sdkVersion;

            UWPReferences.GetSDKFolderAndVersion(out sdkFolder, out sdkVersion);
            return(UWPReferences.GetExtensionSDKs(sdkFolder, sdkVersion));
        }
コード例 #7
0
        public static IEnumerable <Version> GetInstalledSDKVersions()
        {
            string windowsKit = UWPReferences.GetWindowsKit10();
            IEnumerable <Version> result;

            if (string.IsNullOrEmpty(windowsKit))
            {
                result = new Version[0];
            }
            else
            {
                string path = UWPReferences.CombinePaths(new string[]
                {
                    windowsKit,
                    "Platforms",
                    "UAP"
                });
                if (!Directory.Exists(path))
                {
                    result = new Version[0];
                }
                else
                {
                    string[]             files      = Directory.GetFiles(path, "*", SearchOption.AllDirectories);
                    IEnumerable <string> enumerable = from f in files
                                                      where string.Equals("Platform.xml", Path.GetFileName(f), StringComparison.OrdinalIgnoreCase)
                                                      select f;
                    List <Version> list = new List <Version>();
                    foreach (string current in enumerable)
                    {
                        XDocument xDocument;
                        try
                        {
                            xDocument = XDocument.Load(current);
                        }
                        catch
                        {
                            continue;
                        }
                        foreach (XNode current2 in xDocument.Nodes())
                        {
                            XElement xElement = current2 as XElement;
                            if (xElement != null)
                            {
                                Version item;
                                if (UWPReferences.FindVersionInNode(xElement, out item))
                                {
                                    list.Add(item);
                                }
                            }
                        }
                    }
                    result = list;
                }
            }
            return(result);
        }
コード例 #8
0
        public static IEnumerable <UWPSDK> GetInstalledSDKs()
        {
            string windowsKit = UWPReferences.GetWindowsKit10();
            IEnumerable <UWPSDK> result;

            if (string.IsNullOrEmpty(windowsKit))
            {
                result = Enumerable.Empty <UWPSDK>();
            }
            else
            {
                string path = UWPReferences.CombinePaths(new string[]
                {
                    windowsKit,
                    "Platforms",
                    "UAP"
                });
                if (!Directory.Exists(path))
                {
                    result = Enumerable.Empty <UWPSDK>();
                }
                else
                {
                    List <UWPSDK>        list       = new List <UWPSDK>();
                    string[]             files      = Directory.GetFiles(path, "*", SearchOption.AllDirectories);
                    IEnumerable <string> enumerable = from f in files
                                                      where string.Equals("Platform.xml", Path.GetFileName(f), StringComparison.OrdinalIgnoreCase)
                                                      select f;
                    foreach (string current in enumerable)
                    {
                        XDocument xDocument;
                        try
                        {
                            xDocument = XDocument.Load(current);
                        }
                        catch
                        {
                            continue;
                        }
                        foreach (XElement current2 in xDocument.Elements("ApplicationPlatform"))
                        {
                            Version version;
                            if (UWPReferences.FindVersionInNode(current2, out version))
                            {
                                string s = (from e in current2.Elements("MinimumVisualStudioVersion")
                                            select e.Value).FirstOrDefault <string>();
                                list.Add(new UWPSDK(version, UWPReferences.TryParseVersion(s)));
                            }
                        }
                    }
                    result = list;
                }
            }
            return(result);
        }
コード例 #9
0
 internal static string[] GetAdditionalReferences(WSASDK wsaSDK)
 {
     if (wsaSDK != WSASDK.UWP)
     {
         return(null);
     }
     if (_uwpReferences == null)
     {
         _uwpReferences = UWPReferences.GetReferences();
     }
     return(_uwpReferences);
 }
コード例 #10
0
        public static string[] GetReferences(Version sdkVersion)
        {
            string windowsKit = UWPReferences.GetWindowsKit10();

            string[] result;
            if (string.IsNullOrEmpty(windowsKit))
            {
                result = new string[0];
            }
            else
            {
                string           text    = UWPReferences.SdkVersionToString(sdkVersion);
                HashSet <string> hashSet = new HashSet <string>(StringComparer.InvariantCultureIgnoreCase);
                string           text2   = UWPReferences.CombinePaths(new string[]
                {
                    windowsKit,
                    "UnionMetadata",
                    text,
                    "Facade",
                    "Windows.winmd"
                });
                if (!File.Exists(text2))
                {
                    text2 = UWPReferences.CombinePaths(new string[]
                    {
                        windowsKit,
                        "UnionMetadata",
                        "Facade",
                        "Windows.winmd"
                    });
                }
                hashSet.Add(text2);
                string[] platform = UWPReferences.GetPlatform(windowsKit, text);
                for (int i = 0; i < platform.Length; i++)
                {
                    string item = platform[i];
                    hashSet.Add(item);
                }
                UWPReferences.UWPExtension[] extensions = UWPReferences.GetExtensions(windowsKit, text);
                for (int j = 0; j < extensions.Length; j++)
                {
                    UWPReferences.UWPExtension uWPExtension = extensions[j];
                    string[] references = uWPExtension.References;
                    for (int k = 0; k < references.Length; k++)
                    {
                        string item2 = references[k];
                        hashSet.Add(item2);
                    }
                }
                result = hashSet.ToArray <string>();
            }
            return(result);
        }
コード例 #11
0
            public UWPExtension(string manifest, string referencesFolder)
            {
                XElement element = XDocument.Load(manifest).Element("FileList");

                if (element.Attribute("TargetPlatform").Value != "UAP")
                {
                    throw new Exception(string.Format("Invalid extension manifest at \"{0}\".", manifest));
                }
                this.Name = element.Attribute("DisplayName").Value;
                XElement containedApiContractsElement = element.Element("ContainedApiContracts");

                this.References = UWPReferences.GetReferences(referencesFolder, containedApiContractsElement);
            }
コード例 #12
0
 internal static string[] GetAdditionalReferences(WSASDK wsaSDK)
 {
     if (wsaSDK != WSASDK.UWP)
     {
         return((string[])null);
     }
     if (MicrosoftCSharpCompiler._uwpReferences != null)
     {
         return(MicrosoftCSharpCompiler._uwpReferences);
     }
     MicrosoftCSharpCompiler._uwpReferences = UWPReferences.GetReferences();
     return(MicrosoftCSharpCompiler._uwpReferences);
 }
コード例 #13
0
 internal static string[] GetAdditionalReferences(WSASDK wsaSDK)
 {
     string[] result;
     if (wsaSDK != WSASDK.UWP)
     {
         result = null;
     }
     else
     {
         result = UWPReferences.GetReferences(UWPReferences.GetDesiredSDKVersion());
     }
     return(result);
 }
コード例 #14
0
        private static string[] GetPlatform(string folder, string version)
        {
            string   referencesFolder = Path.Combine(folder, "References");
            string   uri      = FileUtil.CombinePaths(folder, "Platforms\\UAP", version, "Platform.xml");
            XElement xelement = XDocument.Load(uri).Element((XName)"ApplicationPlatform");

            if (xelement.Attribute((XName)"name").Value != "UAP")
            {
                throw new Exception(string.Format("Invalid platform manifest at \"{0}\".", (object)uri));
            }
            XElement containedApiContractsElement = xelement.Element((XName)"ContainedApiContracts");

            return(UWPReferences.GetReferences(referencesFolder, containedApiContractsElement));
        }
コード例 #15
0
        public static IEnumerable <UWPExtensionSDK> GetExtensionSDKs(Version sdkVersion)
        {
            string windowsKit = UWPReferences.GetWindowsKit10();
            IEnumerable <UWPExtensionSDK> result;

            if (string.IsNullOrEmpty(windowsKit))
            {
                result = new UWPExtensionSDK[0];
            }
            else
            {
                result = UWPReferences.GetExtensionSDKs(windowsKit, UWPReferences.SdkVersionToString(sdkVersion));
            }
            return(result);
        }
コード例 #16
0
        private static UWPReferences.UWPExtension[] GetExtensions(string windowsKitsFolder, string version)
        {
            List <UWPReferences.UWPExtension> list = new List <UWPReferences.UWPExtension>();

            foreach (UWPExtensionSDK current in UWPReferences.GetExtensionSDKs(windowsKitsFolder, version))
            {
                try
                {
                    UWPReferences.UWPExtension item = new UWPReferences.UWPExtension(current.ManifestPath, windowsKitsFolder, version);
                    list.Add(item);
                }
                catch
                {
                }
            }
            return(list.ToArray());
        }
コード例 #17
0
        private static IEnumerable <UWPExtensionSDK> GetExtensionSDKs(string sdkFolder, string sdkVersion)
        {
            List <UWPExtensionSDK> list = new List <UWPExtensionSDK>();
            string path = Path.Combine(sdkFolder, "Extension SDKs");
            IEnumerable <UWPExtensionSDK> result;

            if (!Directory.Exists(path))
            {
                result = new UWPExtensionSDK[0];
            }
            else
            {
                string[] directories = Directory.GetDirectories(path);
                for (int i = 0; i < directories.Length; i++)
                {
                    string text  = directories[i];
                    string text2 = UWPReferences.CombinePaths(new string[]
                    {
                        text,
                        sdkVersion,
                        "SDKManifest.xml"
                    });
                    string fileName = Path.GetFileName(text);
                    if (File.Exists(text2))
                    {
                        list.Add(new UWPExtensionSDK(fileName, sdkVersion, text2));
                    }
                    else if (fileName == "XboxLive")
                    {
                        text2 = UWPReferences.CombinePaths(new string[]
                        {
                            text,
                            "1.0",
                            "SDKManifest.xml"
                        });
                        if (File.Exists(text2))
                        {
                            list.Add(new UWPExtensionSDK(fileName, "1.0", text2));
                        }
                    }
                }
                result = list;
            }
            return(result);
        }
コード例 #18
0
        private static UWPReferences.UWPExtension[] GetExtensions(string folder, string version)
        {
            List <UWPReferences.UWPExtension> list = new List <UWPReferences.UWPExtension>();
            string referencesFolder = Path.Combine(folder, "References");

            foreach (UWPExtensionSDK current in UWPReferences.GetExtensionSDKs(folder, version))
            {
                try
                {
                    UWPReferences.UWPExtension item = new UWPReferences.UWPExtension(current.ManifestPath, referencesFolder);
                    list.Add(item);
                }
                catch
                {
                }
            }
            return(list.ToArray());
        }
コード例 #19
0
 internal static string[] GetAdditionalReferences(WSASDK wsaSDK)
 {
     string[] result;
     if (wsaSDK != WSASDK.UWP)
     {
         result = null;
     }
     else if (MicrosoftCSharpCompiler._uwpReferences != null)
     {
         result = MicrosoftCSharpCompiler._uwpReferences;
     }
     else
     {
         MicrosoftCSharpCompiler._uwpReferences = UWPReferences.GetReferences();
         result = MicrosoftCSharpCompiler._uwpReferences;
     }
     return(result);
 }
コード例 #20
0
ファイル: UWPReferences.cs プロジェクト: wensincai/Unity5.4
        public static string[] GetReferences()
        {
            string  text;
            Version version;

            UWPReferences.GetWindowsKit10(out text, out version);
            string text2 = version.ToString();

            if (version.Minor == -1)
            {
                text2 += ".0";
            }
            if (version.Build == -1)
            {
                text2 += ".0";
            }
            if (version.Revision == -1)
            {
                text2 += ".0";
            }
            HashSet <string> hashSet = new HashSet <string>(StringComparer.InvariantCultureIgnoreCase);
            string           item    = Path.Combine(text, "UnionMetadata\\Facade\\Windows.winmd");

            hashSet.Add(item);
            string[] platform = UWPReferences.GetPlatform(text, text2);
            for (int i = 0; i < platform.Length; i++)
            {
                string item2 = platform[i];
                hashSet.Add(item2);
            }
            UWPReferences.UWPExtension[] extensions = UWPReferences.GetExtensions(text, text2);
            for (int j = 0; j < extensions.Length; j++)
            {
                UWPReferences.UWPExtension uWPExtension = extensions[j];
                string[] references = uWPExtension.References;
                for (int k = 0; k < references.Length; k++)
                {
                    string item3 = references[k];
                    hashSet.Add(item3);
                }
            }
            return(hashSet.ToArray <string>());
        }
コード例 #21
0
        private static void GetSDKFolderAndVersion(out string sdkFolder, out string sdkVersion)
        {
            Version version;

            UWPReferences.GetWindowsKit10(out sdkFolder, out version);
            sdkVersion = version.ToString();
            if (version.Minor == -1)
            {
                sdkVersion += ".0";
            }
            if (version.Build == -1)
            {
                sdkVersion += ".0";
            }
            if (version.Revision == -1)
            {
                sdkVersion += ".0";
            }
        }
コード例 #22
0
        private static bool FindVersionInNode(XElement node, out Version version)
        {
            bool result;

            for (XAttribute xAttribute = node.FirstAttribute; xAttribute != null; xAttribute = xAttribute.NextAttribute)
            {
                if (string.Equals(xAttribute.Name.LocalName, "version", StringComparison.OrdinalIgnoreCase))
                {
                    version = UWPReferences.TryParseVersion(xAttribute.Value);
                    if (version != null)
                    {
                        result = true;
                        return(result);
                    }
                }
            }
            version = null;
            result  = false;
            return(result);
        }
コード例 #23
0
        public static string[] GetReferences()
        {
            string  folder;
            Version version1;

            UWPReferences.GetWindowsKit10(out folder, out version1);
            string version2 = version1.ToString();

            if (version1.Minor == -1)
            {
                version2 += ".0";
            }
            if (version1.Build == -1)
            {
                version2 += ".0";
            }
            if (version1.Revision == -1)
            {
                version2 += ".0";
            }
            HashSet <string> source = new HashSet <string>((IEqualityComparer <string>)StringComparer.InvariantCultureIgnoreCase);

            source.Add(Path.Combine(folder, "UnionMetadata\\Facade\\Windows.winmd"));
            foreach (string str in UWPReferences.GetPlatform(folder, version2))
            {
                source.Add(str);
            }
            foreach (UWPReferences.UWPExtension extension in UWPReferences.GetExtensions(folder, version2))
            {
                foreach (string reference in extension.References)
                {
                    source.Add(reference);
                }
            }
            return(source.ToArray <string>());
        }
コード例 #24
0
        private static string[] GetReferences(string windowsKitsFolder, string sdkVersion, XElement containedApiContractsElement)
        {
            List <string> list = new List <string>();

            foreach (XElement current in containedApiContractsElement.Elements("ApiContract"))
            {
                string value  = current.Attribute("name").Value;
                string value2 = current.Attribute("version").Value;
                string text   = UWPReferences.CombinePaths(new string[]
                {
                    windowsKitsFolder,
                    "References",
                    sdkVersion,
                    value,
                    value2,
                    value + ".winmd"
                });
                if (!File.Exists(text))
                {
                    text = UWPReferences.CombinePaths(new string[]
                    {
                        windowsKitsFolder,
                        "References",
                        value,
                        value2,
                        value + ".winmd"
                    });
                    if (!File.Exists(text))
                    {
                        continue;
                    }
                }
                list.Add(text);
            }
            return(list.ToArray());
        }