Пример #1
0
        public static Type GetViewModelType(string typeString)
        {
            Type t = null;

            foreach (var asm in UserAssembly)
            {
                t = asm.GetType(typeString);
                if (t != null)
                {
                    break;
                }
            }

            if (t == null)
            {
                t = ExecutingAssembly.GetType(typeString);
            }

            if (t == null)
            {
                Debug.LogError($"ViewModel type {typeString} not found. Is it in a different Assembly?");
            }

            return(t);
        }
Пример #2
0
        static XmlConfigLoader()
        {
            /*
             *	There are four possible location for this file:
             *		a. UE4/Engine/Programs/UnrealBuildTool
             *		b. UE4/Engine/Programs/NotForLicensees/UnrealBuildTool
             *		c. UE4/Engine/Saved/UnrealBuildTool
             *		d. <AppData or My Documnets>/Unreal Engine/UnrealBuildTool -- the location is
             *		   chosen by existence and if both exist most recently used.
             *
             *	The UBT is looking for it in all four places in the given order and
             *	overrides already read data with the loaded ones, hence d. has the
             *	priority. Not defined classes and fields are left alone.
             */

            var UE4EnginePath = new FileInfo(Path.Combine(ExecutingAssembly.GetDirectory(), "..", "..")).FullName;

            ConfigLocationHierarchy = new XmlConfigLocation[]
            {
                new XmlDefaultConfigLocation(Path.Combine(UE4EnginePath, "Programs", "UnrealBuildTool")),
                new XmlConfigLocation(Path.Combine(UE4EnginePath, "Programs", "NotForLicensees", "UnrealBuildTool"), "NotForLicensees"),
                new XmlConfigLocation(Path.Combine(UE4EnginePath, "Saved", "UnrealBuildTool"), "User", true),
                new XmlConfigLocation(new string[] {
                    Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Unreal Engine", "UnrealBuildTool"),
                    Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal), "Unreal Engine", "UnrealBuildTool")
                }, "Global", true)
            };
        }
 static SvgImageManager()
 {
     ManifestResourceNames.Add(ExecutingAssembly, ExecutingAssembly.GetManifestResourceNames().ToList());
     if (ExecutingAssembly != CallingAssembly)
     {
         ManifestResourceNames.Add(CallingAssembly, CallingAssembly.GetManifestResourceNames().ToList());
     }
 }
Пример #4
0
        static string GetInternalReportXaml(string name)
        {
            System.Reflection.Assembly ExecutingAssembly;
            ExecutingAssembly = System.Reflection.Assembly.GetExecutingAssembly();
            System.IO.Stream stream = ExecutingAssembly.GetManifestResourceStream("Ginger.Reports.InternalTemplates." + name);
            StreamReader     reader = new StreamReader(stream);
            string           Xaml   = reader.ReadToEnd();

            return(Xaml);
        }
Пример #5
0
        public string GetMessage(string prefix)
        {
            if (!IsValid())
            {
                return(string.Empty);
            }

            return(String.Format("{0} {1}.{2}, {3}", prefix, Method.DeclaringType.Name, Method.Name,
                                 ExecutingAssembly.GetName().Name));
        }
Пример #6
0
        private static string GetInternalReportHTML(string name)
        {
            Assembly ExecutingAssembly;

            ExecutingAssembly = Assembly.GetExecutingAssembly();
            var stream = ExecutingAssembly.GetManifestResourceStream("Ginger.Reports.HTMLTemplates." + name);
            var reader = new StreamReader(stream);
            var HTML   = reader.ReadToEnd();

            return(HTML);
        }
Пример #7
0
        private static string GetAppUniqueId()
        {
            Guid AppGuid = PluginDetails.Guid;

            if (AppGuid == Guid.Empty)
            {
                // In case the guid is provided by the project settings and not source code.
                Contract.RequireNotNull(Assembly.GetExecutingAssembly(), out Assembly ExecutingAssembly);
                Contract.RequireNotNull(ExecutingAssembly.GetCustomAttribute <GuidAttribute>(), out GuidAttribute AppGuidAttribute);
                AppGuid = Guid.Parse(AppGuidAttribute.Value);
            }

            string AppUniqueId = AppGuid.ToString("B", CultureInfo.InvariantCulture).ToUpper(CultureInfo.InvariantCulture);

            return(AppUniqueId);
        }
Пример #8
0
        static Environment()
        {
            ExecutingAssembly = Assembly.GetEntryAssembly();

            AegisVersion = new Version(
                Assembly.GetExecutingAssembly().GetName().Version.Major,
                Assembly.GetExecutingAssembly().GetName().Version.Minor,
                Assembly.GetExecutingAssembly().GetName().Version.Build,
                Assembly.GetExecutingAssembly().GetName().Version.Revision);

            ExecutingVersion = new Version(
                ExecutingAssembly.GetName().Version.Major,
                ExecutingAssembly.GetName().Version.Minor,
                ExecutingAssembly.GetName().Version.Build,
                ExecutingAssembly.GetName().Version.Revision);
        }
Пример #9
0
        public static Type GetViewModelType(string typeString)
        {
            Type t = null;

            foreach (var a in AssemblyProvider.Assemblies)
            {
                t = a.GetType(typeString);
                if (t != null) break;
            }

            if (t == null)
                t = ExecutingAssembly.GetType(typeString);

            if (t == null)
                Debug.LogError($"ViewModel type {typeString} not found. Is it in a different Assembly?");

            return t;
        }
Пример #10
0
        public static Type GetViewModelType(string typeString)
        {
            Type t = null;

            t = UserAssembly?.GetType(typeString);

            if (t == null)
            {
                t = ExecutingAssembly.GetType(typeString);
            }

            if (t == null)
            {
                Debug.LogError($"ViewModel type {typeString} not found. Is it in a different Assembly?");
            }

            return(t);
        }
Пример #11
0
        /// <summary>
        /// 取得类型
        /// </summary>
        /// <returns>类型</returns>
        private Type GetType(string typeName)
        {
            Type type = Type.GetType(typeName);

            if (type == null)
            {
                type = DefaultAssembly.GetType(typeName);
            }
            if (type == null)
            {
                type = CallingAssembly.GetType(typeName);
            }
            if (type == null)
            {
                type = ExecutingAssembly.GetType(typeName);
            }
            if (type == null)
            {
                type = EntryAssembly.GetType(typeName);
            }
            return(type);
        }
Пример #12
0
 /// <summary>
 /// Gets standard BuildConfiguration.xml schema path.
 /// </summary>
 /// <returns>Standard BuildConfiguration.xml schema path.</returns>
 public static string GetXSDPath()
 {
     return(new FileInfo(Path.Combine(ExecutingAssembly.GetDirectory(), "..", "..", "Saved", "UnrealBuildTool", "BuildConfiguration.Schema.xsd")).FullName);
 }
Пример #13
0
        private static bool Validate(ABIFileSystemOptions options)
        {
            bool validated = true;

            #region DotLiquid

            _logger.Info("Validating DotLiquid assembly");

            var liquidAssemblies = ExecutingAssembly.GetReferencedAssemblies()
                                   .Where((a) => a.Name.Contains("DotLiquid"));

            var liquidRequiredVersion = new Version(1, 8, 0, 2);

            foreach (var assembly in liquidAssemblies)
            {
                _logger.Info($"Using { assembly.Name } v{ assembly.Version }");

                if (assembly.Version.CompareTo(liquidRequiredVersion) != 0)
                {
                    _logger.Error($"DotLiquid v{ liquidRequiredVersion } is needed to work properly");
                    validated = false;
                }
            }

            #endregion

            #region Option paths

            _logger.Info("Validating folder structure integrity");

            if (!Directory.Exists(options.MetadataPath))
            {
                _logger.Error($"Metadata path not found [{ options.MetadataPath }]");
                validated = false;
            }

            if (!Directory.Exists(options.TemplatePath))
            {
                _logger.Error($"Template path not found [{ options.TemplatePath }]");
                validated = false;
            }

            if (!Directory.Exists(options.OutputPath))
            {
                _logger.Info($"Output path not found. Folders have been created [{ options.OutputPath }]");
                Directory.CreateDirectory(options.OutputPath);
            }

            #endregion

            #region Option search patterns

            _logger.Info("Validating search pattern options");

            if (!options.MetadataSearchPattern.ToLower().EndsWith(ABIFileSystemOptions.StandardMetadataFileExtension))
            {
                _logger.Error($"Invalid metadata search pattern [{ options.MetadataSearchPattern }]");
                validated = false;
            }

            #endregion

            return(validated);
        }
Пример #14
0
        /// <summary>
        /// Discover and fill in the project info
        /// </summary>
        public static void FillProjectInfo()
        {
            DateTime StartTime = DateTime.Now;

            List <string> DirectoriesToSearch = new List <string>();

            // Find all the .uprojectdirs files contained in the root folder and add their entries to the search array
            string RootDirectory         = Path.Combine(ExecutingAssembly.GetDirectory(), "..", "..", "..");
            string EngineSourceDirectory = Path.GetFullPath(Path.Combine(RootDirectory, "Engine", "Source"));

            foreach (var File in Directory.EnumerateFiles(RootDirectory, "*.uprojectdirs", SearchOption.TopDirectoryOnly))
            {
                string FilePath = Path.GetFullPath(File);
                Log.TraceVerbose("\tFound uprojectdirs file {0}", FilePath);

                using (StreamReader Reader = new StreamReader(FilePath))
                {
                    string LineRead;
                    while ((LineRead = Reader.ReadLine()) != null)
                    {
                        string ProjDirEntry = LineRead.Trim();
                        if (String.IsNullOrEmpty(ProjDirEntry) == false)
                        {
                            if (ProjDirEntry.StartsWith(";"))
                            {
                                // Commented out line... skip it
                                continue;
                            }
                            else
                            {
                                string DirPath = Path.GetFullPath(Path.Combine(RootDirectory, ProjDirEntry));
                                DirectoriesToSearch.Add(DirPath);
                            }
                        }
                    }
                }
            }

            Log.TraceVerbose("\tFound {0} directories to search", DirectoriesToSearch.Count);

            // Initialize the target finding time to 0
            TimeSpan TotalTargetTime = DateTime.Now - DateTime.Now;

            foreach (string DirToSearch in DirectoriesToSearch)
            {
                Log.TraceVerbose("\t\tSearching {0}", DirToSearch);
                if (Directory.Exists(DirToSearch))
                {
                    foreach (string SubDir in Directory.EnumerateDirectories(DirToSearch, "*", SearchOption.TopDirectoryOnly))
                    {
                        Log.TraceVerbose("\t\t\tFound subdir {0}", SubDir);
                        string[] SubDirFiles = Directory.GetFiles(SubDir, "*.uproject", SearchOption.TopDirectoryOnly);
                        foreach (string UProjFile in SubDirFiles)
                        {
                            string RelativePath = Utils.MakePathRelativeTo(UProjFile, EngineSourceDirectory);
                            Log.TraceVerbose("\t\t\t\t{0}", RelativePath);
                            if (!ProjectInfoDictionary.ContainsKey(RelativePath))
                            {
                                DateTime TargetStartTime = DateTime.Now;

                                string SourceFolder   = Path.Combine(Path.GetDirectoryName(UProjFile), "Source");
                                bool   bIsCodeProject = Directory.Exists(SourceFolder);

                                AddProject(RelativePath, bIsCodeProject);

                                if (bIsCodeProject)
                                {
                                    // Find all Target.cs files
                                    bool bFoundTargetFiles = false;
                                    if (!FindTargetFiles(SourceFolder, ref bFoundTargetFiles))
                                    {
                                        Log.TraceVerbose("No target files found under " + SourceFolder);
                                    }
                                }

                                DateTime TargetStopTime = DateTime.Now;

                                TotalTargetTime += TargetStopTime - TargetStartTime;
                            }
                        }
                    }
                }
                else
                {
                    Log.TraceVerbose("ProjectInfo: Skipping directory {0} from .uprojectdirs file as it doesn't exist.", DirToSearch);
                }
            }

            DateTime StopTime = DateTime.Now;

            if (BuildConfiguration.bPrintPerformanceInfo)
            {
                TimeSpan TotalProjectInfoTime = StopTime - StartTime;
                Log.TraceInformation("FillProjectInfo took {0} milliseconds (AddTargetInfo {1} ms)",
                                     TotalProjectInfoTime.Milliseconds, TotalTargetTime.Milliseconds);
            }

            if (UnrealBuildTool.CommandLineContains("-dumpprojectinfo"))
            {
                UProjectInfo.DumpProjectInfo();
            }
        }
        protected override int CompareToImpl(MethodDesc other, TypeSystemComparer comparer)
        {
            var otherMethod = (AssemblyGetExecutingAssemblyMethodThunk)other;

            return(StringComparer.Ordinal.Compare(ExecutingAssembly.GetName().Name, otherMethod.ExecutingAssembly.GetName().Name));
        }
Пример #16
0
        private static bool RequiresTempTarget(string RawProjectPath, List <UnrealTargetPlatform> ClientTargetPlatforms)
        {
            // check to see if we already have a Target.cs file
            if (File.Exists(Path.Combine(Path.GetDirectoryName(RawProjectPath), "Source", Path.GetFileNameWithoutExtension(RawProjectPath) + ".Target.cs")))
            {
                return(false);
            }
            else if (Directory.Exists(Path.Combine(Path.GetDirectoryName(RawProjectPath), "Source")))
            {
                // wasn't one in the main Source directory, let's check all sub-directories
                //@todo: may want to read each target.cs to see if it has a target corresponding to the project name as a final check
                FileInfo[] Files = (new DirectoryInfo(Path.Combine(Path.GetDirectoryName(RawProjectPath), "Source")).GetFiles("*.Target.cs", SearchOption.AllDirectories));
                if (Files.Length > 0)
                {
                    return(false);
                }
            }

            // no Target file, now check to see if build settings have changed
            List <UnrealTargetPlatform> TargetPlatforms = ClientTargetPlatforms;

            if (ClientTargetPlatforms == null || ClientTargetPlatforms.Count < 1)
            {
                // No client target platforms, add all in
                TargetPlatforms = new List <UnrealTargetPlatform>();
                foreach (UnrealTargetPlatform TargetPlatformType in Enum.GetValues(typeof(UnrealTargetPlatform)))
                {
                    if (TargetPlatformType != UnrealTargetPlatform.Unknown)
                    {
                        TargetPlatforms.Add(TargetPlatformType);
                    }
                }
            }

            // Change the working directory to be the Engine/Source folder. We are running from Engine/Binaries/DotNET
            string oldCWD = Directory.GetCurrentDirectory();

            if (BuildConfiguration.RelativeEnginePath == "../../Engine/")
            {
                string EngineSourceDirectory = Path.Combine(ExecutingAssembly.GetDirectory(), "..", "..", "..", "Engine", "Source");
                if (!Directory.Exists(EngineSourceDirectory))                 // only set the directory if it exists, this should only happen if we are launching the editor from an artist sync
                {
                    EngineSourceDirectory = Path.Combine(ExecutingAssembly.GetDirectory(), "..", "..", "..", "Engine", "Binaries");
                }
                Directory.SetCurrentDirectory(EngineSourceDirectory);
            }

            // Read the project descriptor, and find all the plugins available to this project
            ProjectDescriptor Project          = ProjectDescriptor.FromFile(RawProjectPath);
            List <PluginInfo> AvailablePlugins = Plugins.ReadAvailablePlugins(RawProjectPath);

            // check the target platforms for any differences in build settings or additional plugins
            bool RetVal = false;

            foreach (UnrealTargetPlatform TargetPlatformType in TargetPlatforms)
            {
                IUEBuildPlatform BuildPlat = UEBuildPlatform.GetBuildPlatform(TargetPlatformType, true);
                if (!GlobalCommandLine.Rocket && BuildPlat != null && !(BuildPlat as UEBuildPlatform).HasDefaultBuildConfig(TargetPlatformType, Path.GetDirectoryName(RawProjectPath)))
                {
                    RetVal = true;
                    break;
                }

                // find if there are any plugins enabled or disabled which differ from the default
                foreach (PluginInfo Plugin in AvailablePlugins)
                {
                    bool bPluginEnabledForProject = UProjectInfo.IsPluginEnabledForProject(Plugin, Project, TargetPlatformType);
                    if ((bPluginEnabledForProject && !Plugin.Descriptor.bEnabledByDefault) || (bPluginEnabledForProject && Plugin.Descriptor.bInstalled))
                    {
                        if (Plugin.Descriptor.Modules.Any(Module => Module.IsCompiledInConfiguration(TargetPlatformType, TargetRules.TargetType.Game, bBuildDeveloperTools: false, bBuildEditor: false)))
                        {
                            RetVal = true;
                            break;
                        }
                    }
                }
            }

            // Change back to the original directory
            Directory.SetCurrentDirectory(oldCWD);
            return(RetVal);
        }