少年修仙传客户端基础资源
dabaoji
2025-06-04 34d28a982a741d63f183884881b0bea73f8c8b47
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Xml;
using System.Xml.Linq;
using System.Xml.XPath;
 
#if UNITY_XCODE_API_BUILD
namespace UnityEditor.iOS.Xcode
#else
namespace UnityEditor.iOS.Xcode.Custom
#endif
{
    internal class XcScheme
    {
        XDocument m_Doc;
 
        // Returns the current build configuration. Returns null if it is not set.
        public string GetBuildConfiguration()
        {
            var el = m_Doc.Root.XPathSelectElement("./LaunchAction");
            if (el == null)
                throw new Exception("The xcscheme document does not contain build configuration setting");
            var attr = el.Attribute("buildConfiguration");
            if (attr == null)
                return null;
            return attr.Value;
        }
 
        public void SetBuildConfiguration(string buildConfigName)
        {
            var el = m_Doc.Root.XPathSelectElement("./LaunchAction");
            if (el == null)
                throw new Exception("The xcscheme document does not contain build configuration setting");
            el.SetAttributeValue("buildConfiguration", buildConfigName);
        }
 
        public void ReadFromFile(string path)
        {
            ReadFromString(File.ReadAllText(path));
        }
 
        public void ReadFromStream(TextReader tr)
        {
            ReadFromString(tr.ReadToEnd());
        }
 
        public void ReadFromString(string text)
        {
            m_Doc = PlistDocument.ParseXmlNoDtd(text);
        }
 
        public void WriteToFile(string path)
        {
            System.Text.Encoding utf8WithoutBom = new System.Text.UTF8Encoding(false);
            File.WriteAllText(path, WriteToString(), utf8WithoutBom);
        }
 
        public void WriteToStream(TextWriter tw)
        {
            tw.Write(WriteToString());
        }
 
        public string WriteToString()
        {
            return PlistDocument.CleanDtdToString(m_Doc, null).Replace("\r\n", "\n");
        }        
    }
 
} // namespace UnityEditor.iOS.XCode