InstallPluginsByExtension() static private method

static private InstallPluginsByExtension ( string pluginSourceFolder, string extension, string debugExtension, string destPluginFolder, bool copyDirectories ) : bool
pluginSourceFolder string
extension string
debugExtension string
destPluginFolder string
copyDirectories bool
return bool
Exemplo n.º 1
0
        internal static void InstallPlugins(string destPluginFolder, BuildTarget target)
        {
            string str1 = "Assets/Plugins";
            IBuildPostprocessor buildPostProcessor = ModuleManager.GetBuildPostProcessor(target);

            if (buildPostProcessor != null)
            {
                bool     shouldRetainStructure;
                string[] pluginFilesToCopy = buildPostProcessor.FindPluginFilesToCopy(str1, out shouldRetainStructure);
                if (pluginFilesToCopy != null)
                {
                    if (pluginFilesToCopy.Length > 0 && !Directory.Exists(destPluginFolder))
                    {
                        Directory.CreateDirectory(destPluginFolder);
                    }
                    foreach (string str2 in pluginFilesToCopy)
                    {
                        if (Directory.Exists(str2))
                        {
                            string target1 = Path.Combine(destPluginFolder, str2);
                            FileUtil.CopyDirectoryRecursive(str2, target1);
                        }
                        else
                        {
                            string fileName = Path.GetFileName(str2);
                            if (shouldRetainStructure)
                            {
                                string directoryName = Path.GetDirectoryName(str2.Substring(str1.Length + 1));
                                string str3          = Path.Combine(destPluginFolder, directoryName);
                                string to            = Path.Combine(str3, fileName);
                                if (!Directory.Exists(str3))
                                {
                                    Directory.CreateDirectory(str3);
                                }
                                FileUtil.UnityFileCopy(str2, to, true);
                            }
                            else
                            {
                                string to = Path.Combine(destPluginFolder, fileName);
                                FileUtil.UnityFileCopy(str2, to, true);
                            }
                        }
                    }
                    return;
                }
            }
            bool          flag1           = false;
            List <string> subdirs         = new List <string>();
            bool          flag2           = target == BuildTarget.StandaloneOSXIntel || target == BuildTarget.StandaloneOSXIntel64 || target == BuildTarget.StandaloneOSXUniversal;
            bool          copyDirectories = flag2;
            string        extension       = string.Empty;
            string        debugExtension  = string.Empty;

            if (flag2)
            {
                extension = ".bundle";
                subdirs.Add(string.Empty);
            }
            else if (target == BuildTarget.StandaloneWindows)
            {
                extension      = ".dll";
                debugExtension = ".pdb";
                PostprocessBuildPlayer.AddPluginSubdirIfExists(subdirs, str1, PostprocessBuildPlayer.subDir32Bit);
            }
            else if (target == BuildTarget.StandaloneWindows64)
            {
                extension      = ".dll";
                debugExtension = ".pdb";
                PostprocessBuildPlayer.AddPluginSubdirIfExists(subdirs, str1, PostprocessBuildPlayer.subDir64Bit);
            }
            else if (target == BuildTarget.StandaloneGLESEmu)
            {
                extension      = ".dll";
                debugExtension = ".pdb";
                subdirs.Add(string.Empty);
            }
            else if (target == BuildTarget.StandaloneLinux)
            {
                extension = ".so";
                PostprocessBuildPlayer.AddPluginSubdirIfExists(subdirs, str1, PostprocessBuildPlayer.subDir32Bit);
            }
            else if (target == BuildTarget.StandaloneLinux64)
            {
                extension = ".so";
                PostprocessBuildPlayer.AddPluginSubdirIfExists(subdirs, str1, PostprocessBuildPlayer.subDir64Bit);
            }
            else if (target == BuildTarget.StandaloneLinuxUniversal)
            {
                extension = ".so";
                subdirs.Add(PostprocessBuildPlayer.subDir32Bit);
                subdirs.Add(PostprocessBuildPlayer.subDir64Bit);
                flag1 = true;
            }
            else if (target == BuildTarget.PS3)
            {
                extension = ".sprx";
                subdirs.Add(string.Empty);
            }
            else if (target == BuildTarget.Android)
            {
                extension = ".so";
                subdirs.Add("Android");
            }
            else if (target == BuildTarget.BlackBerry)
            {
                extension = ".so";
                subdirs.Add("BlackBerry");
            }
            using (List <string> .Enumerator enumerator = subdirs.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    string current = enumerator.Current;
                    if (flag1)
                    {
                        PostprocessBuildPlayer.InstallPluginsByExtension(Path.Combine(str1, current), extension, debugExtension, Path.Combine(destPluginFolder, current), copyDirectories);
                    }
                    else
                    {
                        PostprocessBuildPlayer.InstallPluginsByExtension(Path.Combine(str1, current), extension, debugExtension, destPluginFolder, copyDirectories);
                    }
                }
            }
        }
        internal static void InstallPlugins(string destPluginFolder, BuildTarget target)
        {
            string text = "Assets/Plugins";
            IBuildPostprocessor buildPostProcessor = ModuleManager.GetBuildPostProcessor(target);

            if (buildPostProcessor != null)
            {
                bool     flag;
                string[] array = buildPostProcessor.FindPluginFilesToCopy(text, out flag);
                if (array != null)
                {
                    if (array.Length > 0 && !Directory.Exists(destPluginFolder))
                    {
                        Directory.CreateDirectory(destPluginFolder);
                    }
                    string[] array2 = array;
                    for (int i = 0; i < array2.Length; i++)
                    {
                        string text2 = array2[i];
                        if (Directory.Exists(text2))
                        {
                            string target2 = Path.Combine(destPluginFolder, text2);
                            FileUtil.CopyDirectoryRecursive(text2, target2);
                        }
                        else
                        {
                            string fileName = Path.GetFileName(text2);
                            if (flag)
                            {
                                string directoryName = Path.GetDirectoryName(text2.Substring(text.Length + 1));
                                string text3         = Path.Combine(destPluginFolder, directoryName);
                                string to            = Path.Combine(text3, fileName);
                                if (!Directory.Exists(text3))
                                {
                                    Directory.CreateDirectory(text3);
                                }
                                FileUtil.UnityFileCopy(text2, to);
                            }
                            else
                            {
                                string to2 = Path.Combine(destPluginFolder, fileName);
                                FileUtil.UnityFileCopy(text2, to2);
                            }
                        }
                    }
                    return;
                }
            }
            bool          flag2           = false;
            List <string> list            = new List <string>();
            bool          flag3           = target == BuildTarget.StandaloneOSXIntel || target == BuildTarget.StandaloneOSXIntel64 || target == BuildTarget.StandaloneOSXUniversal;
            bool          copyDirectories = flag3;
            string        extension       = string.Empty;
            string        debugExtension  = string.Empty;

            if (flag3)
            {
                extension = ".bundle";
                list.Add(string.Empty);
            }
            else
            {
                if (target == BuildTarget.StandaloneWindows)
                {
                    extension      = ".dll";
                    debugExtension = ".pdb";
                    PostprocessBuildPlayer.AddPluginSubdirIfExists(list, text, PostprocessBuildPlayer.subDir32Bit);
                }
                else
                {
                    if (target == BuildTarget.StandaloneWindows64)
                    {
                        extension      = ".dll";
                        debugExtension = ".pdb";
                        PostprocessBuildPlayer.AddPluginSubdirIfExists(list, text, PostprocessBuildPlayer.subDir64Bit);
                    }
                    else
                    {
                        if (target == BuildTarget.StandaloneGLESEmu)
                        {
                            extension      = ".dll";
                            debugExtension = ".pdb";
                            list.Add(string.Empty);
                        }
                        else
                        {
                            if (target == BuildTarget.StandaloneLinux)
                            {
                                extension = ".so";
                                PostprocessBuildPlayer.AddPluginSubdirIfExists(list, text, PostprocessBuildPlayer.subDir32Bit);
                            }
                            else
                            {
                                if (target == BuildTarget.StandaloneLinux64)
                                {
                                    extension = ".so";
                                    PostprocessBuildPlayer.AddPluginSubdirIfExists(list, text, PostprocessBuildPlayer.subDir64Bit);
                                }
                                else
                                {
                                    if (target == BuildTarget.StandaloneLinuxUniversal)
                                    {
                                        extension = ".so";
                                        list.Add(PostprocessBuildPlayer.subDir32Bit);
                                        list.Add(PostprocessBuildPlayer.subDir64Bit);
                                        flag2 = true;
                                    }
                                    else
                                    {
                                        if (target == BuildTarget.PS3)
                                        {
                                            extension = ".sprx";
                                            list.Add(string.Empty);
                                        }
                                        else
                                        {
                                            if (target == BuildTarget.Android)
                                            {
                                                extension = ".so";
                                                list.Add("Android");
                                            }
                                            else
                                            {
                                                if (target == BuildTarget.BB10)
                                                {
                                                    extension = ".so";
                                                    list.Add("BlackBerry");
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            foreach (string current in list)
            {
                if (flag2)
                {
                    PostprocessBuildPlayer.InstallPluginsByExtension(Path.Combine(text, current), extension, debugExtension, Path.Combine(destPluginFolder, current), copyDirectories);
                }
                else
                {
                    PostprocessBuildPlayer.InstallPluginsByExtension(Path.Combine(text, current), extension, debugExtension, destPluginFolder, copyDirectories);
                }
            }
        }