コード例 #1
0
        public static void SyncCSProject(AssemblyDefinitionAsset asset)
        {
            var m_data     = (Dictionary <string, object>)EditorJson.Deserialize(asset.text);
            var aname      = (string)m_data["name"];
            var aa         = UnityEditor.Compilation.CompilationPipeline.GetAssemblies().Where(x => x.name == aname).ToArray();
            var sourceList = aa[0].sourceFiles;

            //Task.Run(_);
            //void _() {
            var cspath  = $"{System.Environment.CurrentDirectory}/{aname}.csproj".separatorToOS();
            var content = fs.ReadAllText(cspath);
            var ss      = content.Replace("\r", "").Split('\n');
            int step    = 0;

            fs.WriteFileAll(cspath, (b) => {
                foreach (var s in ss)
                {
                    if (step == 0)
                    {
                        if (s.Contains("Compile Include"))
                        {
                            step = 1;
                            continue;
                        }
                    }
                    else if (step == 1)
                    {
                        if (s.Contains("None Include") || s.Contains("Reference Include"))
                        {
                            step = 2;
                            foreach (var c in aa[0].sourceFiles)
                            {
                                b.AppendLine($"    <Compile Include=\"{c.separatorToOS()}\" />");
                            }
                        }

                        else
                        {
                            continue;
                        }
                    }
                    b.AppendLine(s);
                }
            }, utf8bom: true, newLineLinux: false);

            //}
        }
コード例 #2
0
 public static void Load()
 {
     s_manifest = EditorJson.Deserialize(File.ReadAllText(kPATH)) as Dictionary <string, object>;
 }