示例#1
0
            public static UnrealModuleType GetModuleType(string modulePath)
            {
                if (File.Exists(modulePath))
                {
                    string moduleDir = FPaths.GetPath(modulePath);
                    string subDir;

                    if (FPaths.DirectoryExists(moduleDir))
                    {
                        if (FPaths.IsSameOrSubDirectory(FPaths.EnginePluginsDir, moduleDir))
                        {
                            return(UnrealModuleType.EnginePlugin);
                        }
                        else if (FPaths.IsSameOrSubDirectory(FPaths.Combine(FPaths.EngineDir, "Binaries"), moduleDir))
                        {
                            return(UnrealModuleType.Engine);
                        }
                        else if (FPaths.IsSameOrSubDirectory(FPaths.ProjectPluginsDir, moduleDir))
                        {
                            return(UnrealModuleType.GamePlugin);
                        }
                        else if (FPaths.IsSameOrSubDirectory(FPaths.ProjectDir, moduleDir, out subDir) && string.IsNullOrEmpty(subDir))
                        {
                            // Game module path is being treated as the .uproject path
                            return(UnrealModuleType.Game);
                        }
                    }
                }
                return(UnrealModuleType.Unknown);
            }
示例#2
0
            public static UnrealModuleType GetModuleType(string moduleName, string modulePath, IPlugin[] plugins)
            {
                if (File.Exists(modulePath))
                {
                    string moduleDir = FPaths.GetPath(modulePath);

                    if (FPaths.DirectoryExists(moduleDir))
                    {
                        if (FPaths.IsSameOrSubDirectory(FPaths.EnginePluginsDir, moduleDir))
                        {
                            return(UnrealModuleType.EnginePlugin);
                        }
                        else if (FPaths.IsSameOrSubDirectory(FPaths.Combine(FPaths.EngineDir, "Binaries"), moduleDir))
                        {
                            return(UnrealModuleType.Engine);
                        }
                        else if (FPaths.IsSameOrSubDirectory(FPaths.ProjectPluginsDir, moduleDir))
                        {
                            return(UnrealModuleType.GamePlugin);
                        }
                        else
                        {
                            foreach (IPlugin plugin in plugins)
                            {
                                if (plugin.Name == moduleName)
                                {
                                    switch (plugin.PluginType)
                                    {
                                    case EPluginType.Engine:
                                    case EPluginType.Enterprise:
                                    case EPluginType.External:
                                        return(UnrealModuleType.EnginePlugin);

                                    case EPluginType.Mod:
                                    case EPluginType.Project:
                                        return(UnrealModuleType.GamePlugin);
                                    }
                                }
                            }

                            if (FPaths.IsSameOrSubDirectory(FPaths.ProjectDir, moduleDir) &&
                                moduleName.Equals(FApp.GetProjectName(), StringComparison.OrdinalIgnoreCase))
                            {
                                return(UnrealModuleType.Game);
                            }
                        }
                    }
                }
                return(UnrealModuleType.Unknown);
            }