private string SolutionText(IEnumerable <MonoIsland> islands, SolutionSynchronizer.Mode mode)
        {
            string str1 = "11.00";

            if (this._settings.VisualStudioVersion == 9)
            {
                str1 = "10.00";
            }
            IEnumerable <MonoIsland> monoIslands = SolutionSynchronizer.RelevantIslandsForMode(islands, mode);
            string projectEntries = this.GetProjectEntries(monoIslands);
            string str2           = string.Join(SolutionSynchronizer.WindowsNewline, monoIslands.Select <MonoIsland, string>((Func <MonoIsland, string>)(i => this.GetProjectActiveConfigurations(this.ProjectGuid(i._output)))).ToArray <string>());

            return(string.Format(this._settings.SolutionTemplate, (object)str1, (object)projectEntries, (object)str2, (object)this.ReadExistingMonoDevelopSolutionProperties()));
        }
        private string SolutionText(IEnumerable <MonoIsland> islands, SolutionSynchronizer.Mode mode)
        {
            string text = "11.00";

            if (this._settings.VisualStudioVersion == 9)
            {
                text = "10.00";
            }
            IEnumerable <MonoIsland> enumerable = SolutionSynchronizer.RelevantIslandsForMode(islands, mode);
            string projectEntries = this.GetProjectEntries(enumerable);
            string text2          = string.Join(SolutionSynchronizer.WindowsNewline, (from i in enumerable
                                                                                      select this.GetProjectActiveConfigurations(this.ProjectGuid(i._output))).ToArray <string>());

            return(string.Format(this._settings.SolutionTemplate, new object[]
            {
                text,
                projectEntries,
                text2,
                this.ReadExistingMonoDevelopSolutionProperties()
            }));
        }
 private static IEnumerable <MonoIsland> RelevantIslandsForMode(IEnumerable <MonoIsland> islands, SolutionSynchronizer.Mode mode)
 {
     return(from i in islands
            where mode == SolutionSynchronizer.Mode.UnityScriptAsUnityProj || ScriptingLanguage.CSharp == SolutionSynchronizer.ScriptingLanguageFor(i)
            select i);
 }
        private string ProjectText(MonoIsland island, SolutionSynchronizer.Mode mode, string allAssetsProject)
        {
            StringBuilder stringBuilder = new StringBuilder(this.ProjectHeader(island));
            List <string> list          = new List <string>();
            List <Match>  list2         = new List <Match>();

            string[] files = island._files;
            for (int i = 0; i < files.Length; i++)
            {
                string text  = files[i];
                string b     = Path.GetExtension(text).ToLower();
                string text2 = (!Path.IsPathRooted(text)) ? Path.Combine(this._projectDirectory, text) : text;
                if (".dll" != b)
                {
                    string arg = "Compile";
                    stringBuilder.AppendFormat("     <{0} Include=\"{1}\" />{2}", arg, this.EscapedRelativePathFor(text2), SolutionSynchronizer.WindowsNewline);
                }
                else
                {
                    list.Add(text2);
                }
            }
            stringBuilder.Append(allAssetsProject);
            foreach (string current in list.Union(island._references))
            {
                if (!current.EndsWith("/UnityEditor.dll") && !current.EndsWith("/UnityEngine.dll") && !current.EndsWith("\\UnityEditor.dll") && !current.EndsWith("\\UnityEngine.dll"))
                {
                    Match match = SolutionSynchronizer.scriptReferenceExpression.Match(current);
                    if (match.Success && (mode == SolutionSynchronizer.Mode.UnityScriptAsUnityProj || (int)Enum.Parse(typeof(ScriptingLanguage), match.Groups["language"].Value, true) == 2))
                    {
                        list2.Add(match);
                    }
                    else
                    {
                        string text3 = (!Path.IsPathRooted(current)) ? Path.Combine(this._projectDirectory, current) : current;
                        if (AssemblyHelper.IsManagedAssembly(text3))
                        {
                            if (!AssemblyHelper.IsInternalAssembly(text3))
                            {
                                text3 = text3.Replace("\\", "/");
                                text3 = text3.Replace("\\\\", "/");
                                stringBuilder.AppendFormat(" <Reference Include=\"{0}\">{1}", Path.GetFileNameWithoutExtension(text3), SolutionSynchronizer.WindowsNewline);
                                stringBuilder.AppendFormat(" <HintPath>{0}</HintPath>{1}", text3, SolutionSynchronizer.WindowsNewline);
                                stringBuilder.AppendFormat(" </Reference>{0}", SolutionSynchronizer.WindowsNewline);
                            }
                        }
                    }
                }
            }
            if (0 < list2.Count)
            {
                stringBuilder.AppendLine("  </ItemGroup>");
                stringBuilder.AppendLine("  <ItemGroup>");
                foreach (Match current2 in list2)
                {
                    string value = current2.Groups["project"].Value;
                    stringBuilder.AppendFormat("    <ProjectReference Include=\"{0}{1}\">{2}", value, SolutionSynchronizer.GetProjectExtension((ScriptingLanguage)((int)Enum.Parse(typeof(ScriptingLanguage), current2.Groups["language"].Value, true))), SolutionSynchronizer.WindowsNewline);
                    stringBuilder.AppendFormat("      <Project>{{{0}}}</Project>", this.ProjectGuid(Path.Combine("Temp", current2.Groups["project"].Value + ".dll")), SolutionSynchronizer.WindowsNewline);
                    stringBuilder.AppendFormat("      <Name>{0}</Name>", value, SolutionSynchronizer.WindowsNewline);
                    stringBuilder.AppendLine("    </ProjectReference>");
                }
            }
            stringBuilder.Append(this.ProjectFooter(island));
            return(stringBuilder.ToString());
        }
Esempio n. 5
0
        private string ProjectText(MonoIsland island, SolutionSynchronizer.Mode mode, Dictionary <string, string> allAssetsProjectParts, string[] additionalDefines, List <MonoIsland> allProjectIslands)
        {
            StringBuilder stringBuilder           = new StringBuilder(this.ProjectHeader(island, additionalDefines));
            List <string> list                    = new List <string>();
            List <Match>  list2                   = new List <Match>();
            bool          isBuildingEditorProject = island._output.EndsWith("-Editor.dll");

            string[] files = island._files;
            for (int j = 0; j < files.Length; j++)
            {
                string text = files[j];
                if (this.ShouldFileBePartOfSolution(text))
                {
                    string b     = Path.GetExtension(text).ToLower();
                    string text2 = (!Path.IsPathRooted(text)) ? Path.Combine(this._projectDirectory, text) : text;
                    if (".dll" != b)
                    {
                        string arg = "Compile";
                        stringBuilder.AppendFormat("     <{0} Include=\"{1}\" />{2}", arg, this.EscapedRelativePathFor(text2), SolutionSynchronizer.WindowsNewline);
                    }
                    else
                    {
                        list.Add(text2);
                    }
                }
            }
            string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(island._output);
            string value;

            if (allAssetsProjectParts.TryGetValue(fileNameWithoutExtension, out value))
            {
                stringBuilder.Append(value);
            }
            List <string> list3 = new List <string>();

            foreach (string current in list.Union(island._references))
            {
                if (!current.EndsWith("/UnityEditor.dll") && !current.EndsWith("/UnityEngine.dll") && !current.EndsWith("\\UnityEditor.dll") && !current.EndsWith("\\UnityEngine.dll"))
                {
                    Match match = SolutionSynchronizer.scriptReferenceExpression.Match(current);
                    if (match.Success)
                    {
                        SupportedLanguage languageFromExtension = ScriptCompilers.GetLanguageFromExtension(island.GetExtensionOfSourceFiles());
                        ScriptingLanguage scriptingLanguage     = (ScriptingLanguage)Enum.Parse(typeof(ScriptingLanguage), languageFromExtension.GetLanguageName(), true);
                        if (mode == SolutionSynchronizer.Mode.UnityScriptAsUnityProj || scriptingLanguage == ScriptingLanguage.CSharp)
                        {
                            string dllName = match.Groups["dllname"].Value;
                            if (allProjectIslands.Any((MonoIsland i) => Path.GetFileName(i._output) == dllName))
                            {
                                list2.Add(match);
                                continue;
                            }
                        }
                    }
                    string text3 = (!Path.IsPathRooted(current)) ? Path.Combine(this._projectDirectory, current) : current;
                    if (AssemblyHelper.IsManagedAssembly(text3))
                    {
                        if (AssemblyHelper.IsInternalAssembly(text3))
                        {
                            if (!SolutionSynchronizer.IsAdditionalInternalAssemblyReference(isBuildingEditorProject, text3))
                            {
                                continue;
                            }
                            string fileName = Path.GetFileName(text3);
                            if (list3.Contains(fileName))
                            {
                                continue;
                            }
                            list3.Add(fileName);
                        }
                        text3 = text3.Replace("\\", "/");
                        text3 = text3.Replace("\\\\", "/");
                        stringBuilder.AppendFormat(" <Reference Include=\"{0}\">{1}", Path.GetFileNameWithoutExtension(text3), SolutionSynchronizer.WindowsNewline);
                        stringBuilder.AppendFormat(" <HintPath>{0}</HintPath>{1}", text3, SolutionSynchronizer.WindowsNewline);
                        stringBuilder.AppendFormat(" </Reference>{0}", SolutionSynchronizer.WindowsNewline);
                    }
                }
            }
            if (0 < list2.Count)
            {
                stringBuilder.AppendLine("  </ItemGroup>");
                stringBuilder.AppendLine("  <ItemGroup>");
                foreach (Match current2 in list2)
                {
                    EditorBuildRules.TargetAssembly targetAssemblyDetails = EditorCompilationInterface.Instance.GetTargetAssemblyDetails(current2.Groups["dllname"].Value);
                    ScriptingLanguage language = ScriptingLanguage.None;
                    if (targetAssemblyDetails != null)
                    {
                        language = (ScriptingLanguage)Enum.Parse(typeof(ScriptingLanguage), targetAssemblyDetails.Language.GetLanguageName(), true);
                    }
                    string value2 = current2.Groups["project"].Value;
                    stringBuilder.AppendFormat("    <ProjectReference Include=\"{0}{1}\">{2}", value2, SolutionSynchronizer.GetProjectExtension(language), SolutionSynchronizer.WindowsNewline);
                    stringBuilder.AppendFormat("      <Project>{{{0}}}</Project>", this.ProjectGuid(Path.Combine("Temp", current2.Groups["project"].Value + ".dll")), SolutionSynchronizer.WindowsNewline);
                    stringBuilder.AppendFormat("      <Name>{0}</Name>", value2, SolutionSynchronizer.WindowsNewline);
                    stringBuilder.AppendLine("    </ProjectReference>");
                }
            }
            stringBuilder.Append(this.ProjectFooter(island));
            return(stringBuilder.ToString());
        }
 private static IEnumerable <MonoIsland> RelevantIslandsForMode(IEnumerable <MonoIsland> islands, SolutionSynchronizer.Mode mode)
 {
     // ISSUE: object of a compiler-generated type is created
     // ISSUE: reference to a compiler-generated method
     return(islands.Where <MonoIsland>(new Func <MonoIsland, bool>(new SolutionSynchronizer.\u003CRelevantIslandsForMode\u003Ec__AnonStoreyC3()
     {
         mode = mode
     }.\u003C\u003Em__235)));
 }
        private string ProjectText(MonoIsland island, SolutionSynchronizer.Mode mode, string allAssetsProject)
        {
            StringBuilder stringBuilder           = new StringBuilder(this.ProjectHeader(island));
            List <string> first                   = new List <string>();
            List <Match>  matchList               = new List <Match>();
            bool          isBuildingEditorProject = island._output.EndsWith("-Editor.dll");

            foreach (string file1 in island._files)
            {
                string lower = Path.GetExtension(file1).ToLower();
                string file2 = !Path.IsPathRooted(file1) ? Path.Combine(this._projectDirectory, file1) : file1;
                if (".dll" != lower)
                {
                    string str = "Compile";
                    stringBuilder.AppendFormat("     <{0} Include=\"{1}\" />{2}", (object)str, (object)this.EscapedRelativePathFor(file2), (object)SolutionSynchronizer.WindowsNewline);
                }
                else
                {
                    first.Add(file2);
                }
            }
            stringBuilder.Append(allAssetsProject);
            foreach (string str1 in first.Union <string>((IEnumerable <string>)island._references))
            {
                if (!str1.EndsWith("/UnityEditor.dll") && !str1.EndsWith("/UnityEngine.dll") && (!str1.EndsWith("\\UnityEditor.dll") && !str1.EndsWith("\\UnityEngine.dll")))
                {
                    Match match = SolutionSynchronizer.scriptReferenceExpression.Match(str1);
                    if (match.Success && (mode == SolutionSynchronizer.Mode.UnityScriptAsUnityProj || (int)Enum.Parse(typeof(ScriptingLanguage), match.Groups["language"].Value, true) == 2))
                    {
                        matchList.Add(match);
                    }
                    else
                    {
                        string str2 = !Path.IsPathRooted(str1) ? Path.Combine(this._projectDirectory, str1) : str1;
                        if (AssemblyHelper.IsManagedAssembly(str2) && (!AssemblyHelper.IsInternalAssembly(str2) || SolutionSynchronizer.IsInternalAssemblyThatShouldBeReferenced(isBuildingEditorProject, str2)))
                        {
                            string path = str2.Replace("\\", "/").Replace("\\\\", "/");
                            stringBuilder.AppendFormat(" <Reference Include=\"{0}\">{1}", (object)Path.GetFileNameWithoutExtension(path), (object)SolutionSynchronizer.WindowsNewline);
                            stringBuilder.AppendFormat(" <HintPath>{0}</HintPath>{1}", (object)path, (object)SolutionSynchronizer.WindowsNewline);
                            stringBuilder.AppendFormat(" </Reference>{0}", (object)SolutionSynchronizer.WindowsNewline);
                        }
                    }
                }
            }
            if (0 < matchList.Count)
            {
                stringBuilder.AppendLine("  </ItemGroup>");
                stringBuilder.AppendLine("  <ItemGroup>");
                using (List <Match> .Enumerator enumerator = matchList.GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        Match  current = enumerator.Current;
                        string str     = current.Groups["project"].Value;
                        stringBuilder.AppendFormat("    <ProjectReference Include=\"{0}{1}\">{2}", (object)str, (object)SolutionSynchronizer.GetProjectExtension((ScriptingLanguage)Enum.Parse(typeof(ScriptingLanguage), current.Groups["language"].Value, true)), (object)SolutionSynchronizer.WindowsNewline);
                        stringBuilder.AppendFormat("      <Project>{{{0}}}</Project>", (object)this.ProjectGuid(Path.Combine("Temp", current.Groups["project"].Value + ".dll")), (object)SolutionSynchronizer.WindowsNewline);
                        stringBuilder.AppendFormat("      <Name>{0}</Name>", (object)str, (object)SolutionSynchronizer.WindowsNewline);
                        stringBuilder.AppendLine("    </ProjectReference>");
                    }
                }
            }
            stringBuilder.Append(this.ProjectFooter(island));
            return(stringBuilder.ToString());
        }