CombinePaths() 개인적인 정적인 메소드

private static CombinePaths ( ) : string
리턴 string
예제 #1
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);
        }
예제 #2
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);
        }
예제 #3
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);
        }
예제 #4
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);
        }
예제 #5
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);
        }
예제 #6
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());
        }