Esempio n. 1
0
        private static JSONValue JsonForProject()
        {
            List <ProjectStateRestHandler.Island> list = (from i in EditorCompilationInterface.GetAllMonoIslands()
                                                          select new ProjectStateRestHandler.Island
            {
                MonoIsland = i,
                Name = Path.GetFileNameWithoutExtension(i._output),
                References = i._references.ToList <string>()
            }).ToList <ProjectStateRestHandler.Island>();

            foreach (ProjectStateRestHandler.Island current in list)
            {
                List <string> list2 = new List <string>();
                List <string> list3 = new List <string>();
                foreach (string current2 in current.References)
                {
                    string refName = Path.GetFileNameWithoutExtension(current2);
                    if (current2.StartsWith("Library/") && list.Any((ProjectStateRestHandler.Island i) => i.Name == refName))
                    {
                        list2.Add(refName);
                        list3.Add(current2);
                    }
                    if (current2.EndsWith("/UnityEditor.dll") || current2.EndsWith("/UnityEngine.dll") || current2.EndsWith("\\UnityEditor.dll") || current2.EndsWith("\\UnityEngine.dll"))
                    {
                        list3.Add(current2);
                    }
                }
                current.References.Add(InternalEditorUtility.GetEditorAssemblyPath());
                current.References.Add(InternalEditorUtility.GetEngineAssemblyPath());
                foreach (string current3 in list2)
                {
                    current.References.Add(current3);
                }
                foreach (string current4 in list3)
                {
                    current.References.Remove(current4);
                }
            }
            string[]  array   = list.SelectMany((ProjectStateRestHandler.Island i) => i.MonoIsland._files).Concat(ProjectStateRestHandler.GetAllSupportedFiles()).Distinct <string>().ToArray <string>();
            string[]  strings = ProjectStateRestHandler.RelativeToProjectPath(ProjectStateRestHandler.FindEmptyDirectories(ProjectStateRestHandler.AssetsPath, array));
            JSONValue result  = default(JSONValue);

            result["islands"] = new JSONValue((from i in list
                                               select ProjectStateRestHandler.JsonForIsland(i) into i2
                                               where !i2.IsNull()
                                               select i2).ToList <JSONValue>());
            result["basedirectory"] = ProjectStateRestHandler.ProjectPath;
            JSONValue value = default(JSONValue);

            value["files"]            = JSONHandler.ToJSON(array);
            value["emptydirectories"] = JSONHandler.ToJSON(strings);
            result["assetdatabase"]   = value;
            return(result);
        }
        private static JSONValue JsonForProject()
        {
            List <ProjectStateRestHandler.Island> list = ((IEnumerable <MonoIsland>)InternalEditorUtility.GetMonoIslands()).Select <MonoIsland, ProjectStateRestHandler.Island>((Func <MonoIsland, ProjectStateRestHandler.Island>)(i => new ProjectStateRestHandler.Island()
            {
                MonoIsland = i, Name = Path.GetFileNameWithoutExtension(i._output), References = ((IEnumerable <string>)i._references).ToList <string>()
            })).ToList <ProjectStateRestHandler.Island>();

            using (List <ProjectStateRestHandler.Island> .Enumerator enumerator1 = list.GetEnumerator())
            {
                while (enumerator1.MoveNext())
                {
                    ProjectStateRestHandler.Island current1 = enumerator1.Current;
                    List <string> stringList1 = new List <string>();
                    List <string> stringList2 = new List <string>();
                    using (List <string> .Enumerator enumerator2 = current1.References.GetEnumerator())
                    {
                        while (enumerator2.MoveNext())
                        {
                            string current2 = enumerator2.Current;
                            // ISSUE: object of a compiler-generated type is created
                            // ISSUE: variable of a compiler-generated type
                            ProjectStateRestHandler.\u003CJsonForProject\u003Ec__AnonStorey25 projectCAnonStorey25 = new ProjectStateRestHandler.\u003CJsonForProject\u003Ec__AnonStorey25();
                            // ISSUE: reference to a compiler-generated field
                            projectCAnonStorey25.refName = Path.GetFileNameWithoutExtension(current2);
                            // ISSUE: reference to a compiler-generated method
                            if (current2.StartsWith("Library/") && list.Any <ProjectStateRestHandler.Island>(new Func <ProjectStateRestHandler.Island, bool>(projectCAnonStorey25.\u003C\u003Em__31)))
                            {
                                // ISSUE: reference to a compiler-generated field
                                stringList1.Add(projectCAnonStorey25.refName);
                                stringList2.Add(current2);
                            }
                            if (current2.EndsWith("/UnityEditor.dll") || current2.EndsWith("/UnityEngine.dll") || (current2.EndsWith("\\UnityEditor.dll") || current2.EndsWith("\\UnityEngine.dll")))
                            {
                                stringList2.Add(current2);
                            }
                        }
                    }
                    current1.References.Add(InternalEditorUtility.GetEditorAssemblyPath());
                    current1.References.Add(InternalEditorUtility.GetEngineAssemblyPath());
                    using (List <string> .Enumerator enumerator2 = stringList1.GetEnumerator())
                    {
                        while (enumerator2.MoveNext())
                        {
                            string current2 = enumerator2.Current;
                            current1.References.Add(current2);
                        }
                    }
                    using (List <string> .Enumerator enumerator2 = stringList2.GetEnumerator())
                    {
                        while (enumerator2.MoveNext())
                        {
                            string current2 = enumerator2.Current;
                            current1.References.Remove(current2);
                        }
                    }
                }
            }
            string[]  array       = list.SelectMany <ProjectStateRestHandler.Island, string>((Func <ProjectStateRestHandler.Island, IEnumerable <string> >)(i => (IEnumerable <string>)i.MonoIsland._files)).Concat <string>(ProjectStateRestHandler.GetAllSupportedFiles()).Distinct <string>().ToArray <string>();
            string[]  projectPath = ProjectStateRestHandler.RelativeToProjectPath(ProjectStateRestHandler.FindEmptyDirectories(ProjectStateRestHandler.AssetsPath, array));
            JSONValue jsonValue1  = new JSONValue();

            jsonValue1["islands"]       = new JSONValue((object)list.Select <ProjectStateRestHandler.Island, JSONValue>((Func <ProjectStateRestHandler.Island, JSONValue>)(i => ProjectStateRestHandler.JsonForIsland(i))).Where <JSONValue>((Func <JSONValue, bool>)(i2 => !i2.IsNull())).ToList <JSONValue>());
            jsonValue1["basedirectory"] = (JSONValue)ProjectStateRestHandler.ProjectPath;
            JSONValue jsonValue2 = new JSONValue();

            jsonValue2["files"]            = Handler.ToJSON((IEnumerable <string>)array);
            jsonValue2["emptydirectories"] = Handler.ToJSON((IEnumerable <string>)projectPath);
            jsonValue1["assetdatabase"]    = jsonValue2;
            return(jsonValue1);
        }