code/Kingdom.OrTools.Sat.CodeGeneration.Tool/Managers/CodeGenerationConsoleManager.cs
/// <summary>
/// Loads the <paramref name="registry"/> and Purges Generated Code given
/// <paramref name="serviceManager"/>.
/// </summary>
/// <param name="serviceManager"></param>
/// <param name="registry"></param>
Loads the  and Purges Generated Code given
.
Loads the and Purges Generated Code given .
private void LoadAndPurgeGeneratedCode(CodeGenerationServiceManager serviceManager
            , out OrToolsSatGeneratedSyntaxTreeRegistry registry)
        {
            if (DebugMessagesSwitch)
            {
                Writer.WriteLine("Loading and purging registry.");
            }
            registry = serviceManager.Registry;
            if (!registry.Any())
            {
                if (DebugMessagesSwitch)
                {
                    Writer.WriteLine("There are no Registry entries.");
                }
                return;
            }
            var local = registry;
            var outputDirectory = local.OutputDirectory;
            var anUpdateOccurred = local.GoogleOrToolsVersion < GoogleOrToolsVersion;
            bool ShouldPurgeRegistry(GeneratedSyntaxTreeDescriptor descriptor)
            {
                bool WhetherSomeFilesAreMissing()
                {
                    var someFilesAreMissing = descriptor.GeneratedAssetKeys
                        .Select(y => Path.Combine(outputDirectory, y.RenderGeneratedFileName()))
                        .Any(filePath => !File.Exists(filePath));
                    return someFilesAreMissing;
                }
                var should = anUpdateOccurred || WhetherSomeFilesAreMissing();
                if (DebugMessagesSwitch)
                {
                    Writer.WriteLine($"Should{(should ? " " : " not ")}purge generated code.");
                }
                return should;
            }
            registry.PurgeWhere(ShouldPurgeRegistry);
        }
private void LoadAndPurgeGeneratedCode ( CodeGenerationServiceManager serviceManager , out OrToolsSatGeneratedSyntaxTreeRegistry registry ) { if ( DebugMessagesSwitch ) { Writer . WriteLine ( " " ) ; } registry = serviceManager . Registry ; if ( ! registry . Any ( ) ) { if ( DebugMessagesSwitch ) { Writer . WriteLine ( " " ) ; } return ; } var local = registry ; var outputDirectory = local . OutputDirectory ; var anUpdateOccurred = local . GoogleOrToolsVersion < GoogleOrToolsVersion ; bool ShouldPurgeRegistry ( GeneratedSyntaxTreeDescriptor descriptor ) { bool WhetherSomeFilesAreMissing ( ) { var someFilesAreMissing = descriptor . GeneratedAssetKeys . Select ( y => Path . Combine ( outputDirectory , y . RenderGeneratedFileName ( ) ) ) . Any ( filePath => ! File . Exists ( filePath ) ) ; return someFilesAreMissing ; } var should = anUpdateOccurred || WhetherSomeFilesAreMissing ( ) ; if ( DebugMessagesSwitch ) { Writer . WriteLine ( $" Should { ( should ? " " : " " ) } purge generated code. " ) ; } return should ; } registry . PurgeWhere ( ShouldPurgeRegistry ) ; }
Loads the  and Purges Generated Code given
.
Loads the and Purges Generated Code given .
/* Should not need to re-load any ServiceManager Registries,
             * since this is done inherently by the SM itself. */ // Work around output or reference parameters. // Purge All if any of them are missing. /* Easy Purge to make by Version first, followed closely by whether
                 * any previously registered files have themselves disappeared. */
serviceManager
CodeGenerationServiceManager
None
OrToolsSatGeneratedSyntaxTreeRegistry
out
registry
None