TryGetStringArrayField() public method

public TryGetStringArrayField ( string FieldName, Array &Result ) : bool
FieldName string
Result Array
return bool
Esempio n. 1
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="RawObject">Raw JSON object to parse</param>
        public ProjectDescriptor(JsonObject RawObject)
        {
            // Read the version
            if (!RawObject.TryGetIntegerField("FileVersion", out FileVersion))
            {
                if (!RawObject.TryGetIntegerField("ProjectFileVersion", out FileVersion))
                {
                    throw new BuildException("Project does not contain a valid FileVersion entry");
                }
            }

            // Check it's not newer than the latest version we can parse
            if (FileVersion > (int)PluginDescriptorVersion.Latest)
            {
                throw new BuildException("Project descriptor appears to be in a newer version ({0}) of the file format that we can load (max version: {1}).", FileVersion, (int)ProjectDescriptorVersion.Latest);
            }

            // Read simple fields
            RawObject.TryGetStringField("EngineAssociation", out EngineAssociation);
            RawObject.TryGetStringField("Category", out Category);
            RawObject.TryGetStringField("Description", out Description);
            RawObject.TryGetBoolField("Enterprise", out IsEnterpriseProject);

            // Read the modules
            JsonObject[] ModulesArray;
            if (RawObject.TryGetObjectArrayField("Modules", out ModulesArray))
            {
                Modules = Array.ConvertAll(ModulesArray, x => ModuleDescriptor.FromJsonObject(x));
            }

            // Read the plugins
            JsonObject[] PluginsArray;
            if (RawObject.TryGetObjectArrayField("Plugins", out PluginsArray))
            {
                Plugins = Array.ConvertAll(PluginsArray, x => PluginReferenceDescriptor.FromJsonObject(x));
            }

            // Read the additional plugin directories
            RawObject.TryGetStringArrayField("AdditionalPluginDirectories", out AdditionalPluginDirectories);

            // Read the target platforms
            RawObject.TryGetStringArrayField("TargetPlatforms", out TargetPlatforms);

            // Get the sample name hash
            RawObject.TryGetUnsignedIntegerField("EpicSampleNameHash", out EpicSampleNameHash);

            // Read the pre and post-build steps
            CustomBuildSteps.TryRead(RawObject, "PreBuildSteps", out PreBuildSteps);
            CustomBuildSteps.TryRead(RawObject, "PostBuildSteps", out PostBuildSteps);
        }
Esempio n. 2
0
        /// <summary>
        /// Construct a PluginReferenceDescriptor from a Json object
        /// </summary>
        /// <param name="RawObject">The Json object containing a plugin reference descriptor</param>
        /// <returns>New PluginReferenceDescriptor object</returns>
        public static PluginReferenceDescriptor FromJsonObject(JsonObject RawObject)
        {
            string[] WhitelistPlatformNames       = null;
            string[] BlacklistPlatformNames       = null;
            string[] SupportedTargetPlatformNames = null;

            PluginReferenceDescriptor Descriptor = new PluginReferenceDescriptor(RawObject.GetStringField("Name"), null, RawObject.GetBoolField("Enabled"));

            RawObject.TryGetBoolField("Optional", out Descriptor.bOptional);
            RawObject.TryGetStringField("Description", out Descriptor.Description);
            RawObject.TryGetStringField("MarketplaceURL", out Descriptor.MarketplaceURL);

            // Only parse platform information if enabled
            if (Descriptor.bEnabled)
            {
                RawObject.TryGetStringArrayField("WhitelistPlatforms", out WhitelistPlatformNames);
                RawObject.TryGetStringArrayField("BlacklistPlatforms", out BlacklistPlatformNames);
                RawObject.TryGetEnumArrayField <UnrealTargetConfiguration>("WhitelistTargetConfigurations", out Descriptor.WhitelistTargetConfigurations);
                RawObject.TryGetEnumArrayField <UnrealTargetConfiguration>("BlacklistTargetConfigurations", out Descriptor.BlacklistTargetConfigurations);
                RawObject.TryGetEnumArrayField <TargetType>("WhitelistTargets", out Descriptor.WhitelistTargets);
                RawObject.TryGetEnumArrayField <TargetType>("BlacklistTargets", out Descriptor.BlacklistTargets);
                RawObject.TryGetStringArrayField("SupportedTargetPlatforms", out SupportedTargetPlatformNames);
            }

            try
            {
                // convert string array to UnrealTargetPlatform arrays
                if (WhitelistPlatformNames != null)
                {
                    Descriptor.WhitelistPlatforms = WhitelistPlatformNames.Select(x => UnrealTargetPlatform.Parse(x)).ToList();
                }
                if (BlacklistPlatformNames != null)
                {
                    Descriptor.BlacklistPlatforms = BlacklistPlatformNames.Select(x => UnrealTargetPlatform.Parse(x)).ToList();
                }
                if (SupportedTargetPlatformNames != null)
                {
                    Descriptor.SupportedTargetPlatforms = SupportedTargetPlatformNames.Select(x => UnrealTargetPlatform.Parse(x)).ToList();
                }
            }
            catch (BuildException Ex)
            {
                ExceptionUtils.AddContext(Ex, "while parsing PluginReferenceDescriptor {0}", Descriptor.Name);
                throw;
            }


            return(Descriptor);
        }
Esempio n. 3
0
        /// <summary>
        /// Constructs a ModuleDescriptor from a Json object
        /// </summary>
        /// <param name="InObject"></param>
        /// <returns>The new module descriptor</returns>
        public static ModuleDescriptor FromJsonObject(JsonObject InObject)
        {
            ModuleDescriptor Module = new ModuleDescriptor(InObject.GetStringField("Name"), InObject.GetEnumField <ModuleHostType>("Type"));

            ModuleLoadingPhase LoadingPhase;

            if (InObject.TryGetEnumField <ModuleLoadingPhase>("LoadingPhase", out LoadingPhase))
            {
                Module.LoadingPhase = LoadingPhase;
            }

            UnrealTargetPlatform[] WhitelistPlatforms;
            if (InObject.TryGetEnumArrayField <UnrealTargetPlatform>("WhitelistPlatforms", out WhitelistPlatforms))
            {
                Module.WhitelistPlatforms = WhitelistPlatforms;
            }

            UnrealTargetPlatform[] BlacklistPlatforms;
            if (InObject.TryGetEnumArrayField <UnrealTargetPlatform>("BlacklistPlatforms", out BlacklistPlatforms))
            {
                Module.BlacklistPlatforms = BlacklistPlatforms;
            }

            string[] AdditionalDependencies;
            if (InObject.TryGetStringArrayField("AdditionalDependencies", out AdditionalDependencies))
            {
                Module.AdditionalDependencies = AdditionalDependencies;
            }

            return(Module);
        }
Esempio n. 4
0
        /// <summary>
        /// Creates a plugin descriptor from a file on disk
        /// </summary>
        /// <param name="FileName">The filename to read</param>
        /// <returns>New plugin descriptor</returns>
        public static ProjectDescriptor FromFile(string FileName)
        {
            JsonObject RawObject = JsonObject.Read(FileName);

            try
            {
                ProjectDescriptor Descriptor = new ProjectDescriptor();

                // Read the version
                if (!RawObject.TryGetIntegerField("FileVersion", out Descriptor.FileVersion))
                {
                    if (!RawObject.TryGetIntegerField("ProjectFileVersion", out Descriptor.FileVersion))
                    {
                        throw new BuildException("Project descriptor '{0}' does not contain a valid FileVersion entry", FileName);
                    }
                }

                // Check it's not newer than the latest version we can parse
                if (Descriptor.FileVersion > (int)PluginDescriptorVersion.Latest)
                {
                    throw new BuildException("Project descriptor '{0}' appears to be in a newer version ({1}) of the file format that we can load (max version: {2}).", FileName, Descriptor.FileVersion, (int)ProjectDescriptorVersion.Latest);
                }

                // Read simple fields
                RawObject.TryGetStringField("EngineAssociation", out Descriptor.EngineAssociation);
                RawObject.TryGetStringField("Category", out Descriptor.Category);
                RawObject.TryGetStringField("Description", out Descriptor.Description);

                // Read the modules
                JsonObject[] ModulesArray;
                if (RawObject.TryGetObjectArrayField("Modules", out ModulesArray))
                {
                    Descriptor.Modules = Array.ConvertAll(ModulesArray, x => ModuleDescriptor.FromJsonObject(x));
                }

                // Read the plugins
                JsonObject[] PluginsArray;
                if (RawObject.TryGetObjectArrayField("Plugins", out PluginsArray))
                {
                    Descriptor.Plugins = Array.ConvertAll(PluginsArray, x => PluginReferenceDescriptor.FromJsonObject(x));
                }

                // Read the target platforms
                RawObject.TryGetStringArrayField("TargetPlatforms", out Descriptor.TargetPlatforms);

                // Get the sample name hash
                RawObject.TryGetUnsignedIntegerField("EpicSampleNameHash", out Descriptor.EpicSampleNameHash);

                // Read the pre and post-build steps
                CustomBuildSteps.TryRead(RawObject, "PreBuildSteps", out Descriptor.PreBuildSteps);
                CustomBuildSteps.TryRead(RawObject, "PostBuildSteps", out Descriptor.PostBuildSteps);

                return(Descriptor);
            }
            catch (JsonParseException ParseException)
            {
                throw new JsonParseException("{0} (in {1})", ParseException.Message, FileName);
            }
        }
Esempio n. 5
0
        /// <summary>
        /// Reads a plugin descriptor from a json object
        /// </summary>
        /// <param name="RawObject">The object to read from</param>
        /// <returns>New plugin descriptor</returns>
        public PluginDescriptor(JsonObject RawObject)
        {
            // Read the version
            if (!RawObject.TryGetIntegerField("FileVersion", out FileVersion))
            {
                if (!RawObject.TryGetIntegerField("PluginFileVersion", out FileVersion))
                {
                    throw new BuildException("Plugin descriptor does not contain a valid FileVersion entry");
                }
            }

            // Check it's not newer than the latest version we can parse
            if (FileVersion > (int)PluginDescriptorVersion.Latest)
            {
                throw new BuildException("Plugin descriptor appears to be in a newer version ({0}) of the file format that we can load (max version: {1}).", FileVersion, (int)PluginDescriptorVersion.Latest);
            }

            // Read the other fields
            RawObject.TryGetIntegerField("Version", out Version);
            RawObject.TryGetStringField("VersionName", out VersionName);
            RawObject.TryGetStringField("FriendlyName", out FriendlyName);
            RawObject.TryGetStringField("Description", out Description);

            if (!RawObject.TryGetStringField("Category", out Category))
            {
                // Category used to be called CategoryPath in .uplugin files
                RawObject.TryGetStringField("CategoryPath", out Category);
            }

            // Due to a difference in command line parsing between Windows and Mac, we shipped a few Mac samples containing
            // a category name with escaped quotes. Remove them here to make sure we can list them in the right category.
            if (Category != null && Category.Length >= 2 && Category.StartsWith("\"") && Category.EndsWith("\""))
            {
                Category = Category.Substring(1, Category.Length - 2);
            }

            RawObject.TryGetStringField("CreatedBy", out CreatedBy);
            RawObject.TryGetStringField("CreatedByURL", out CreatedByURL);
            RawObject.TryGetStringField("DocsURL", out DocsURL);
            RawObject.TryGetStringField("MarketplaceURL", out MarketplaceURL);
            RawObject.TryGetStringField("SupportURL", out SupportURL);
            RawObject.TryGetStringField("EngineVersion", out EngineVersion);
            RawObject.TryGetEnumArrayField <UnrealTargetPlatform>("SupportedTargetPlatforms", out SupportedTargetPlatforms);
            RawObject.TryGetStringArrayField("SupportedPrograms", out SupportedPrograms);

            JsonObject[] ModulesArray;
            if (RawObject.TryGetObjectArrayField("Modules", out ModulesArray))
            {
                Modules = Array.ConvertAll(ModulesArray, x => ModuleDescriptor.FromJsonObject(x));
            }

            JsonObject[] LocalizationTargetsArray;
            if (RawObject.TryGetObjectArrayField("LocalizationTargets", out LocalizationTargetsArray))
            {
                LocalizationTargets = Array.ConvertAll(LocalizationTargetsArray, x => LocalizationTargetDescriptor.FromJsonObject(x));
            }

            bool bEnabledByDefaultValue;

            if (RawObject.TryGetBoolField("EnabledByDefault", out bEnabledByDefaultValue))
            {
                bEnabledByDefault = bEnabledByDefaultValue;
            }

            RawObject.TryGetBoolField("CanContainContent", out bCanContainContent);
            RawObject.TryGetBoolField("IsBetaVersion", out bIsBetaVersion);
            RawObject.TryGetBoolField("Installed", out bInstalled);

            bool bCanBeUsedWithUnrealHeaderTool;

            if (RawObject.TryGetBoolField("CanBeUsedWithUnrealHeaderTool", out bCanBeUsedWithUnrealHeaderTool) && bCanBeUsedWithUnrealHeaderTool)
            {
                Array.Resize(ref SupportedPrograms, (SupportedPrograms == null)? 1 : SupportedPrograms.Length + 1);
                SupportedPrograms[SupportedPrograms.Length - 1] = "UnrealHeaderTool";
            }

            RawObject.TryGetBoolField("RequiresBuildPlatform", out bRequiresBuildPlatform);

            CustomBuildSteps.TryRead(RawObject, "PreBuildSteps", out PreBuildSteps);
            CustomBuildSteps.TryRead(RawObject, "PostBuildSteps", out PostBuildSteps);

            JsonObject[] PluginsArray;
            if (RawObject.TryGetObjectArrayField("Plugins", out PluginsArray))
            {
                Plugins = Array.ConvertAll(PluginsArray, x => PluginReferenceDescriptor.FromJsonObject(x));
            }
        }
Esempio n. 6
0
        /// <summary>
        /// Read a receipt from disk.
        /// </summary>
        /// <param name="FileName">Filename to read from</param>
        public static TargetReceipt Read(string FileName)
        {
            JsonObject RawObject = JsonObject.Read(FileName);

            // Read the initial fields
            string TargetName = RawObject.GetStringField("TargetName");
            UnrealTargetPlatform      Platform      = RawObject.GetEnumField <UnrealTargetPlatform>("Platform");
            UnrealTargetConfiguration Configuration = RawObject.GetEnumField <UnrealTargetConfiguration>("Configuration");
            string BuildId = RawObject.GetStringField("BuildId");

            // Try to read the build version
            BuildVersion Version;

            if (!BuildVersion.TryParse(RawObject.GetObjectField("Version"), out Version))
            {
                throw new JsonParseException("Invalid 'Version' field");
            }

            // Create the receipt
            TargetReceipt Receipt = new TargetReceipt(TargetName, Platform, Configuration, BuildId, Version);

            // Read the build products
            JsonObject[] BuildProductObjects;
            if (RawObject.TryGetObjectArrayField("BuildProducts", out BuildProductObjects))
            {
                foreach (JsonObject BuildProductObject in BuildProductObjects)
                {
                    string           Path;
                    BuildProductType Type;
                    if (BuildProductObject.TryGetStringField("Path", out Path) && BuildProductObject.TryGetEnumField("Type", out Type))
                    {
                        string Module;
                        BuildProductObject.TryGetStringField("Module", out Module);

                        BuildProduct NewBuildProduct = Receipt.AddBuildProduct(Path, Type);

                        bool IsPrecompiled;
                        if (BuildProductObject.TryGetBoolField("IsPrecompiled", out IsPrecompiled))
                        {
                            NewBuildProduct.IsPrecompiled = IsPrecompiled;
                        }
                    }
                }
            }

            // Read the runtime dependencies
            JsonObject[] RuntimeDependencyObjects;
            if (RawObject.TryGetObjectArrayField("RuntimeDependencies", out RuntimeDependencyObjects))
            {
                foreach (JsonObject RuntimeDependencyObject in RuntimeDependencyObjects)
                {
                    string Path;
                    if (RuntimeDependencyObject.TryGetStringField("Path", out Path))
                    {
                        StagedFileType Type;
                        if (!RuntimeDependencyObject.TryGetEnumField("Type", out Type))
                        {
                            // Previous format included an optional IgnoreIfMissing flag, which was only used for debug files. We can explicitly reference them as DebugNonUFS files now.
                            bool bIgnoreIfMissing;
                            if (RuntimeDependencyObject.TryGetBoolField("IgnoreIfMissing", out bIgnoreIfMissing))
                            {
                                bIgnoreIfMissing = false;
                            }
                            Type = bIgnoreIfMissing? StagedFileType.DebugNonUFS : StagedFileType.NonUFS;
                        }
                        Receipt.RuntimeDependencies.Add(Path, Type);
                    }
                }
            }

            // Read the additional properties
            JsonObject[] AdditionalPropertyObjects;
            if (RawObject.TryGetObjectArrayField("AdditionalProperties", out AdditionalPropertyObjects))
            {
                foreach (JsonObject AdditionalPropertyObject in AdditionalPropertyObjects)
                {
                    string Name;
                    if (AdditionalPropertyObject.TryGetStringField("Name", out Name))
                    {
                        string Value;
                        if (AdditionalPropertyObject.TryGetStringField("Value", out Value))
                        {
                            Receipt.AdditionalProperties.Add(new ReceiptProperty(Name, Value));
                        }
                    }
                }
            }

            // Read the precompiled dependencies
            string[] PrecompiledBuildDependencies;
            if (RawObject.TryGetStringArrayField("PrecompiledBuildDependencies", out PrecompiledBuildDependencies))
            {
                Receipt.PrecompiledBuildDependencies.UnionWith(PrecompiledBuildDependencies);
            }

            // Read the precompiled dependencies
            string[] PrecompiledRuntimeDependencies;
            if (RawObject.TryGetStringArrayField("PrecompiledRuntimeDependencies", out PrecompiledRuntimeDependencies))
            {
                Receipt.PrecompiledRuntimeDependencies.UnionWith(PrecompiledRuntimeDependencies);
            }

            return(Receipt);
        }
Esempio n. 7
0
        /// <summary>
        /// Writes an action to a json file
        /// </summary>
        /// <param name="Object">The object to parse</param>
        public static Action ImportJson(JsonObject Object)
        {
            Action Action = new Action(Object.GetEnumField <ActionType>("Type"));

            string WorkingDirectory;

            if (Object.TryGetStringField("WorkingDirectory", out WorkingDirectory))
            {
                Action.WorkingDirectory = new DirectoryReference(WorkingDirectory);
            }

            string CommandPath;

            if (Object.TryGetStringField("CommandPath", out CommandPath))
            {
                Action.CommandPath = new FileReference(CommandPath);
            }

            string CommandArguments;

            if (Object.TryGetStringField("CommandArguments", out CommandArguments))
            {
                Action.CommandArguments = CommandArguments;
            }

            string CommandDescription;

            if (Object.TryGetStringField("CommandDescription", out CommandDescription))
            {
                Action.CommandDescription = CommandDescription;
            }

            string StatusDescription;

            if (Object.TryGetStringField("StatusDescription", out StatusDescription))
            {
                Action.StatusDescription = StatusDescription;
            }

            bool bPrintDebugInfo;

            if (Object.TryGetBoolField("bPrintDebugInfo", out bPrintDebugInfo))
            {
                Action.bPrintDebugInfo = bPrintDebugInfo;
            }

            bool bCanExecuteRemotely;

            if (Object.TryGetBoolField("bCanExecuteRemotely", out bCanExecuteRemotely))
            {
                Action.bCanExecuteRemotely = bCanExecuteRemotely;
            }

            bool bCanExecuteRemotelyWithSNDBS;

            if (Object.TryGetBoolField("bCanExecuteRemotelyWithSNDBS", out bCanExecuteRemotelyWithSNDBS))
            {
                Action.bCanExecuteRemotelyWithSNDBS = bCanExecuteRemotelyWithSNDBS;
            }

            bool bIsGCCCompiler;

            if (Object.TryGetBoolField("bIsGCCCompiler", out bIsGCCCompiler))
            {
                Action.bIsGCCCompiler = bIsGCCCompiler;
            }

            bool bShouldOutputStatusDescription;

            if (Object.TryGetBoolField("bShouldOutputStatusDescription", out bShouldOutputStatusDescription))
            {
                Action.bShouldOutputStatusDescription = bShouldOutputStatusDescription;
            }

            bool bProducesImportLibrary;

            if (Object.TryGetBoolField("bProducesImportLibrary", out bProducesImportLibrary))
            {
                Action.bProducesImportLibrary = bProducesImportLibrary;
            }

            string[] PrerequisiteItems;
            if (Object.TryGetStringArrayField("PrerequisiteItems", out PrerequisiteItems))
            {
                Action.PrerequisiteItems.AddRange(PrerequisiteItems.Select(x => FileItem.GetItemByPath(x)));
            }

            string[] ProducedItems;
            if (Object.TryGetStringArrayField("ProducedItems", out ProducedItems))
            {
                Action.ProducedItems.AddRange(ProducedItems.Select(x => FileItem.GetItemByPath(x)));
            }

            string[] DeleteItems;
            if (Object.TryGetStringArrayField("DeleteItems", out DeleteItems))
            {
                Action.DeleteItems.AddRange(DeleteItems.Select(x => FileItem.GetItemByPath(x)));
            }

            string DependencyListFile;

            if (Object.TryGetStringField("DependencyListFile", out DependencyListFile))
            {
                Action.DependencyListFile = FileItem.GetItemByPath(DependencyListFile);
            }

            return(Action);
        }
        /// <summary>
        /// Creates a plugin descriptor from a file on disk
        /// </summary>
        /// <param name="FileName">The filename to read</param>
        /// <returns>New plugin descriptor</returns>
        public static ProjectDescriptor FromFile(string FileName)
        {
            JsonObject RawObject = JsonObject.Read(FileName);

            try
            {
                ProjectDescriptor Descriptor = new ProjectDescriptor();

                // Read the version
                if (!RawObject.TryGetIntegerField("FileVersion", out Descriptor.FileVersion))
                {
                    if (!RawObject.TryGetIntegerField("ProjectFileVersion", out Descriptor.FileVersion))
                    {
                        throw new BuildException("Project descriptor '{0}' does not contain a valid FileVersion entry", FileName);
                    }
                }

                // Check it's not newer than the latest version we can parse
                if (Descriptor.FileVersion > (int)PluginDescriptorVersion.Latest)
                {
                    throw new BuildException("Project descriptor '{0}' appears to be in a newer version ({1}) of the file format that we can load (max version: {2}).", FileName, Descriptor.FileVersion, (int)ProjectDescriptorVersion.Latest);
                }

                // Read simple fields
                RawObject.TryGetStringField("EngineAssociation", out Descriptor.EngineAssociation);
                RawObject.TryGetStringField("Category", out Descriptor.Category);
                RawObject.TryGetStringField("Description", out Descriptor.Description);

                // Read the modules
                JsonObject[] ModulesArray;
                if (RawObject.TryGetObjectArrayField("Modules", out ModulesArray))
                {
                    Descriptor.Modules = Array.ConvertAll(ModulesArray, x => ModuleDescriptor.FromJsonObject(x));
                }

                // Read the plugins
                JsonObject[] PluginsArray;
                if (RawObject.TryGetObjectArrayField("Plugins", out PluginsArray))
                {
                    Descriptor.Plugins = Array.ConvertAll(PluginsArray, x => PluginReferenceDescriptor.FromJsonObject(x));
                }

                string[] Dirs;
                Descriptor.AdditionalPluginDirectories = new List <DirectoryReference>();
                // Read the additional plugin directories
                if (RawObject.TryGetStringArrayField("AdditionalPluginDirectories", out Dirs))
                {
                    for (int Index = 0; Index < Dirs.Length; Index++)
                    {
                        if (Path.IsPathRooted(Dirs[Index]))
                        {
                            // Absolute path so create in place
                            Descriptor.AdditionalPluginDirectories.Add(new DirectoryReference(Dirs[Index]));
                            Log.TraceVerbose("Project ({0}) : Added additional absolute plugin directory ({1})", FileName, Dirs[Index]);
                        }
                        else
                        {
                            // This path is relative to the project path so build that out
                            string RelativePath = Path.Combine(Path.GetDirectoryName(FileName), Dirs[Index]);
                            Descriptor.AdditionalPluginDirectories.Add(new DirectoryReference(RelativePath));
                            Log.TraceVerbose("Project ({0}) : Added additional relative plugin directory ({1})", FileName, Dirs[Index]);
                        }
                    }
                }

                // Read the target platforms
                RawObject.TryGetStringArrayField("TargetPlatforms", out Descriptor.TargetPlatforms);

                // Get the sample name hash
                RawObject.TryGetUnsignedIntegerField("EpicSampleNameHash", out Descriptor.EpicSampleNameHash);

                // Read the pre and post-build steps
                CustomBuildSteps.TryRead(RawObject, "PreBuildSteps", out Descriptor.PreBuildSteps);
                CustomBuildSteps.TryRead(RawObject, "PostBuildSteps", out Descriptor.PostBuildSteps);

                return(Descriptor);
            }
            catch (JsonParseException ParseException)
            {
                throw new JsonParseException("{0} (in {1})", ParseException.Message, FileName);
            }
        }
        /// <summary>
        /// Constructs a ModuleDescriptor from a Json object
        /// </summary>
        /// <param name="InObject"></param>
        /// <returns>The new module descriptor</returns>
        public static ModuleDescriptor FromJsonObject(JsonObject InObject)
        {
            ModuleDescriptor Module = new ModuleDescriptor(InObject.GetStringField("Name"), InObject.GetEnumField <ModuleHostType>("Type"));

            ModuleLoadingPhase LoadingPhase;

            if (InObject.TryGetEnumField <ModuleLoadingPhase>("LoadingPhase", out LoadingPhase))
            {
                Module.LoadingPhase = LoadingPhase;
            }

            try
            {
                string[] WhitelistPlatforms;
                if (InObject.TryGetStringArrayField("WhitelistPlatforms", out WhitelistPlatforms))
                {
                    Module.WhitelistPlatforms = Array.ConvertAll(WhitelistPlatforms, x => UnrealTargetPlatform.Parse(x));
                }

                string[] BlacklistPlatforms;
                if (InObject.TryGetStringArrayField("BlacklistPlatforms", out BlacklistPlatforms))
                {
                    Module.BlacklistPlatforms = Array.ConvertAll(BlacklistPlatforms, x => UnrealTargetPlatform.Parse(x));
                }
            }
            catch (BuildException Ex)
            {
                ExceptionUtils.AddContext(Ex, "while parsing module descriptor '{0}'", Module.Name);
                throw;
            }

            TargetType[] WhitelistTargets;
            if (InObject.TryGetEnumArrayField <TargetType>("WhitelistTargets", out WhitelistTargets))
            {
                Module.WhitelistTargets = WhitelistTargets;
            }

            TargetType[] BlacklistTargets;
            if (InObject.TryGetEnumArrayField <TargetType>("BlacklistTargets", out BlacklistTargets))
            {
                Module.BlacklistTargets = BlacklistTargets;
            }

            UnrealTargetConfiguration[] WhitelistTargetConfigurations;
            if (InObject.TryGetEnumArrayField <UnrealTargetConfiguration>("WhitelistTargetConfigurations", out WhitelistTargetConfigurations))
            {
                Module.WhitelistTargetConfigurations = WhitelistTargetConfigurations;
            }

            UnrealTargetConfiguration[] BlacklistTargetConfigurations;
            if (InObject.TryGetEnumArrayField <UnrealTargetConfiguration>("BlacklistTargetConfigurations", out BlacklistTargetConfigurations))
            {
                Module.BlacklistTargetConfigurations = BlacklistTargetConfigurations;
            }

            string[] WhitelistPrograms;
            if (InObject.TryGetStringArrayField("WhitelistPrograms", out WhitelistPrograms))
            {
                Module.WhitelistPrograms = WhitelistPrograms;
            }

            string[] BlacklistPrograms;
            if (InObject.TryGetStringArrayField("BlacklistPrograms", out BlacklistPrograms))
            {
                Module.BlacklistPrograms = BlacklistPrograms;
            }

            string[] AdditionalDependencies;
            if (InObject.TryGetStringArrayField("AdditionalDependencies", out AdditionalDependencies))
            {
                Module.AdditionalDependencies = AdditionalDependencies;
            }

            return(Module);
        }