Пример #1
0
        public static IGUsingGroup MUsingGroupForConsoleMonitorPatternInInterfaces()
        {
            var _gUsingGroup = new GUsingGroup("Using Group For System in GHHS and GHBS");

            foreach (var gName in new List <string>()
            {
                "System.Text",
            })
            {
                var gUsing = new GUsing(gName);
                _gUsingGroup.GUsings.Add(gUsing.Philote, gUsing);
            }
            return(_gUsingGroup);
        }
Пример #2
0
        public static IGUsingGroup MUsingGroupForSystemGenericHostInGHHSAndGHBS()
        {
            var _gUsingGroup = new GUsingGroup("Using Group For System in GHHS and GHBS");

            foreach (var gName in new List <string>()
            {
                "System", "System.Collections.Generic", "System.Threading", "System.Threading.Tasks"
            })
            {
                var gUsing = new GUsing(gName);
                _gUsingGroup.GUsings.Add(gUsing.Philote, gUsing);
            }
            return(_gUsingGroup);
        }
Пример #3
0
        public static IGUsingGroup MUsingGroupForMicrosoftGenericHostInGHHSAndGHBS()
        {
            var _gUsingGroup = new GUsingGroup("Usings For Microsoft GenericHost in GHHS and GHBS");

            foreach (var gName in new List <string>()
            {
                "Microsoft.Extensions.Localization", "Microsoft.Extensions.Options", "Microsoft.Extensions.Configuration", "Microsoft.Extensions.Logging",
                "Microsoft.Extensions.Logging.Abstractions", "Microsoft.Extensions.DependencyInjection", "Microsoft.Extensions.Hosting", "Microsoft.Extensions.Hosting.Internal"
            })
            {
                var gUsing = new GUsing(gName);
                _gUsingGroup.GUsings.Add(gUsing.Philote, gUsing);
            }
            return(_gUsingGroup);
        }
        public static IGAssemblyGroup MFileSystemToObjectGraphGHS(string gAssemblyGroupName,
                                                                  string subDirectoryForGeneratedFiles     = default, string baseNamespaceName = default, bool hasInterfaces = true,
                                                                  IGPatternReplacement gPatternReplacement = default)
        {
            IGPatternReplacement _gPatternReplacement =
                gPatternReplacement == default ? new GPatternReplacement() : gPatternReplacement;
            var mCreateAssemblyGroupResult = MAssemblyGroupGHHSConstructor(gAssemblyGroupName, subDirectoryForGeneratedFiles,
                                                                           baseNamespaceName, hasInterfaces, _gPatternReplacement);

            #region Initial StateMachine Configuration
            mCreateAssemblyGroupResult.GPrimaryConstructorBase.GStateConfiguration.GDOTGraphStatements.Add(
                @"
          WaitingForInitialization ->InitiateContactWithConsoleMonitor [label = ""InitializationCompleteReceived""] // ToDo: move this to ConsoleMonitorClient
          Connected -> Execute [label = ""inputline == 1""]
          Connected -> Relinquish [label = ""inputline == 99""]
          Connected -> Editing [label = ""inputline == 2""]
          Editing -> Connected [label=""EditingComplete""]
          Execute -> Connected [label = ""LongRunningTaskStartedNotificationSent""]
          Relinquish -> Contacted [label = ""RelinquishNotificationAcknowledgementReceived""]
          Connected ->ShutdownStarted [label = ""CancellationTokenActivated""]
          Editing->ShutdownStarted[label = ""CancellationTokenActivated""]
          Execute->ShutdownStarted[label = ""CancellationTokenActivated""]
          Relinquish->ShutdownStarted[label = ""CancellationTokenActivated""]
          Connected -> ServiceFaulted [label = ""ExceptionCaught""]
          Editing ->ServiceFaulted [label = ""ExceptionCaught""]
          Execute ->ServiceFaulted [label = ""ExceptionCaught""]
          Relinquish ->ServiceFaulted [label = ""ExceptionCaught""]
          Connected ->ShutdownStarted [label = ""StopAsyncActivated""]
          Editing ->ShutdownStarted [label = ""StopAsyncActivated""]
          Execute ->ShutdownStarted [label = ""StopAsyncActivated""]
          Relinquish ->ShutdownStarted [label = ""StopAsyncActivated""]
        "
                );
            #endregion
            #region Add UsingGroups to the Titular Derived and Titular Base CompilationUnits
            #region Add UsingGroups common to both the Titular Derived and Titular Base CompilationUnits
            var gUsingGroup =
                new GUsingGroup(
                    $"UsingGroup common to both {mCreateAssemblyGroupResult.GTitularDerivedCompilationUnit.GName} and {mCreateAssemblyGroupResult.GTitularBaseCompilationUnit.GName}");
            foreach (var gName in new List <string>()
            {
                "ATAP.Utilities.ComputerInventory.Hardware", "ATAP.Utilities.Persistence",
            })
            {
                var gUsing = new GUsing(gName);
                gUsingGroup.GUsings.Add(gUsing.Philote, gUsing);
            }
            mCreateAssemblyGroupResult.GTitularDerivedCompilationUnit.GUsingGroups
            .Add(gUsingGroup.Philote, gUsingGroup);
            mCreateAssemblyGroupResult.GTitularBaseCompilationUnit.GUsingGroups
            .Add(gUsingGroup.Philote, gUsingGroup);
            #endregion
            #region Add UsingGroups specific to the Titular Base CompilationUnit
            #endregion
            #endregion
            #region Injected PropertyGroup For ConsoleSinkAndConsoleSource
            #endregion
            #region Add the MethodGroup containing new methods provided by this library to the Titular Base CompilationUnits
            var gMethodGroup =
                new GMethodGroup(
                    gName:
                    $"MethodGroup specific to {mCreateAssemblyGroupResult.GTitularBaseCompilationUnit.GName}");
            var gMethod = MCreateConvertFileSystemToObjectGraphAsync(mCreateAssemblyGroupResult.GClassBase);
            gMethodGroup.GMethods.Add(gMethod.Philote, gMethod);
            mCreateAssemblyGroupResult.GClassBase.AddMethodGroup(gMethodGroup);
            #endregion
            #region Add additional classes provided by this library to the Titular Base CompilationUnit
            #endregion
            #region Add References used by the Titular Derived and Titular Base CompilationUnits to the ProjectUnit
            #region Add References used by both the Titular Derived and Titular Base CompilationUnits
            foreach (var o in new List <IGItemGroupInProjectUnit>()
            {
                new GItemGroupInProjectUnit(
                    "References common to both Titular and Base specific to {titularAssemblyUnitLookupPrimaryConstructorResults.gCompilationUnits.First().GName}",
                    "References to the Hardware, Persistence, and Progress classes and methods",
                    new GBody(new List <string>()
                {
                    "<PackageReference Include=\"ATAP.Utilities.ComputerInventory.Hardware.Extensions\" />",
                    "<PackageReference Include=\"ATAP.Utilities.Persistence.Interfaces\" />",
                    "<PackageReference Include=\"ATAP.Utilities.Persistence\" />",
                })
                    )
            }
                     )
            {
                mCreateAssemblyGroupResult.GTitularAssemblyUnit.GProjectUnit.GItemGroupInProjectUnits
                .Add(o.Philote, o);
            }
            #endregion
            #region Add References unique to the Titular Base CompilationUnit
            #endregion
            #endregion
            /*******************************************************************************/
            #region Update the Interface Assembly for this service
            #region Add UsingGroups for the Titular Derived Interface and Titular Base Interface
            #region Add UsingGroups common to both the Titular Derived Interface CompilationUnit and the Titular Base Interface CompilationUnit
            gUsingGroup =
                new GUsingGroup(
                    $"UsingGroup common to both {mCreateAssemblyGroupResult.GTitularInterfaceDerivedCompilationUnit.GName} and {mCreateAssemblyGroupResult.GTitularInterfaceBaseCompilationUnit.GName}");
            foreach (var gName in new List <string>()
            {
                "ATAP.Utilities.ComputerInventory.Hardware",
                "ATAP.Utilities.Persistence",
            })
            {
                var gUsing = new GUsing(gName);
                gUsingGroup.GUsings.Add(gUsing.Philote, gUsing);
            }
            mCreateAssemblyGroupResult.GTitularInterfaceDerivedCompilationUnit.GUsingGroups
            .Add(gUsingGroup.Philote, gUsingGroup);
            mCreateAssemblyGroupResult.GTitularInterfaceBaseCompilationUnit.GUsingGroups
            .Add(gUsingGroup.Philote, gUsingGroup);
            #endregion
            #region Add UsingGroups specific to the Titular Base Interface
            #endregion
            #endregion
            #endregion
            /* ************************************************************************************ */
            #region Update the ProjectUnits in both the Titular AssemblyUnit and Titular InterfacesAssemblyUnit
            #region Add References for the Titular Interface ProjectUnit
            #region Add References common to both the Titular Derived Interface and Titular Base Interface
            foreach (var o in new List <IGItemGroupInProjectUnit>()
            {
                new GItemGroupInProjectUnit(
                    $"References common to both  {mCreateAssemblyGroupResult.GTitularDerivedCompilationUnit.GName} and {mCreateAssemblyGroupResult.GTitularBaseCompilationUnit.GName}",
                    "References to the Hardware, Persistence, and Progress classes and methods",
                    new GBody(new List <string>()
                {
                    "<PackageReference Include=\"ATAP.Utilities.ComputerInventory.Hardware.Extensions\" />",
                    "<PackageReference Include=\"ATAP.Utilities.Persistence.Interfaces\" />",
                    "<PackageReference Include=\"ATAP.Utilities.Persistence\" />",
                })
                    )
            }
                     )
            {
                mCreateAssemblyGroupResult.gTitularInterfaceAssemblyUnit.GProjectUnit.GItemGroupInProjectUnits.Add(o.Philote, o);
            }
            #endregion
            #region Add References unique to the Titular Base Interface CompilationUnit
            #endregion
            #endregion
            #endregion
            #region Finalize the GHHS
            GAssemblyGroupGHHSFinalizer(mCreateAssemblyGroupResult);
            #endregion
            return(mCreateAssemblyGroupResult.GAssemblyGroup);
        }
Пример #5
0
        public static IGAssemblyGroup MConsoleSourceGHS(string gAssemblyGroupName,
                                                        string subDirectoryForGeneratedFiles    = default, string baseNamespaceName = default, bool hasInterfaces = true,
                                                        GPatternReplacement gPatternReplacement = default)
        {
            GPatternReplacement _gPatternReplacement =
                gPatternReplacement == default ? new GPatternReplacement() : gPatternReplacement;
            var mCreateAssemblyGroupResult = MAssemblyGroupGHHSConstructor(gAssemblyGroupName, subDirectoryForGeneratedFiles,
                                                                           baseNamespaceName, hasInterfaces, _gPatternReplacement);

            #region Initial StateMachine Configuration
            mCreateAssemblyGroupResult.GPrimaryConstructorBase.GStateConfiguration.GDOTGraphStatements.Add(
                @"
          WaitingForInitialization ->BlockingOnConsoleInReadLineAsync [label = ""InitializationCompleteReceived""]
          BlockingOnConsoleInReadLineAsync -> ServiceFaulted [label = ""ExceptionCaught""]
          BlockingOnConsoleInReadLineAsync -> ShutdownStarted [label = ""CancellationTokenActivated""]
          "
                );
            #endregion

            #region Add UsingGroups to the Titular Derived and Titular Base CompilationUnits
            #region Add UsingGroups common to both the Titular Derived and Titular Base CompilationUnits
            #endregion
            #region Add UsingGroups specific to the Titular Base CompilationUnit
            var gUsingGroup =
                new GUsingGroup(
                    $"UsingGroup specific to {mCreateAssemblyGroupResult.GTitularBaseCompilationUnit.GName}");
            foreach (var gName in new List <string>()
            {
                "System.Reactive.Linq", "System.Reactive.Concurrency",
            })
            {
                var gUsing = new GUsing(gName);
                gUsingGroup.GUsings.Add(gUsing.Philote, gUsing);
            }
            mCreateAssemblyGroupResult.GTitularBaseCompilationUnit.GUsingGroups
            .Add(gUsingGroup.Philote, gUsingGroup);
            #endregion
            #endregion
            #region Injected PropertyGroup For ConsoleSinkAndConsoleSource
            #endregion
            #region Add the MethodGroup containing new methods provided by this library to the Titular Base CompilationUnit
            var gMethodGroup =
                new GMethodGroup(
                    gName:
                    $"MethodGroup specific to {mCreateAssemblyGroupResult.GClassBase.GName}");
            IGMethod gMethod;
            gMethod = CreateConsoleReadLineAsyncAsObservableMethod();
            gMethodGroup.GMethods.Add(gMethod.Philote, gMethod);
            mCreateAssemblyGroupResult.GClassBase.AddMethodGroup(gMethodGroup);
            #endregion
            #region Add additional classes provided by this library to the Titular Base CompilationUnit
            #endregion
            #region Add References used by the Titular Derived and Titular Base CompilationUnits to the ProjectUnit
            #region Add References used by both the Titular Derived and Titular Base CompilationUnits
            foreach (var o in new List <IGItemGroupInProjectUnit>()
            {
                ReactiveUtilitiesReferencesItemGroupInProjectUnit(),
            }
                     )
            {
                mCreateAssemblyGroupResult.GTitularAssemblyUnit.GProjectUnit.GItemGroupInProjectUnits
                .Add(o.Philote, o);
            }
            #endregion
            #region Add References unique to the Titular Base CompilationUnit
            #endregion
            #endregion
            /*******************************************************************************/
            #region Update the Interface Assembly for this service
            #region Add UsingGroups for the Titular Derived Interface and Titular Base Interface
            #region Add UsingGroups common to both the Titular Derived Interface and the Titular Base Interface
            #endregion
            #region Add UsingGroups specific to the Titular Base Interface
            #endregion
            #endregion
            #region Add References for the Titular Interface ProjectUnit
            #region Add References common to both the Titular Derived Interface and Titular Base Interface
            foreach (var o in new List <IGItemGroupInProjectUnit>()
            {
                ReactiveUtilitiesReferencesItemGroupInProjectUnit()
            }
                     )
            {
                mCreateAssemblyGroupResult.gTitularInterfaceAssemblyUnit.GProjectUnit.GItemGroupInProjectUnits
                .Add(o.Philote, o);
            }
            #endregion
            #region Add References unique to the Titular Base Interface CompilationUnit
            #endregion
            #endregion
            #endregion
            #region Finalize the GHHS
            GAssemblyGroupGHHSFinalizer(mCreateAssemblyGroupResult);
            #endregion
            return(mCreateAssemblyGroupResult.GAssemblyGroup);
        }
        public static IGAssemblyGroup MFileSystemWatcherGHS(string gAssemblyGroupName,
                                                            string subDirectoryForGeneratedFiles     = default, string baseNamespaceName = default, bool hasInterfaces = true,
                                                            IGPatternReplacement gPatternReplacement = default)
        {
            IGPatternReplacement _gPatternReplacement =
                gPatternReplacement == default ? new GPatternReplacement() : gPatternReplacement;
            var mCreateAssemblyGroupResult = MAssemblyGroupGHHSConstructor(gAssemblyGroupName, subDirectoryForGeneratedFiles,
                                                                           baseNamespaceName, hasInterfaces, _gPatternReplacement);

            #region Initial StateMachine Configuration
            mCreateAssemblyGroupResult.GPrimaryConstructorBase.GStateConfiguration.GDOTGraphStatements.Add(
                @"
              WaitingForInitialization -> WaitingForARequestForAFileSystemWatcher [label = ""InitializationCompleteReceived""]
              WaitingForARequestForAFileSystemWatcher -> RespondingToARequestForAFileSystemWatcher [label = ""FileSystemWatcherRequested""]
              RespondingToARequestForAFileSystemWatcher -> WaitingForARequestForAFileSystemWatcher [label = ""FileSystemWatcherAllocatedAndSent""]
              RespondingToARequestForAFileSystemWatcher -> WaitingForARequestForAFileSystemWatcher [label = ""CancellationTokenActivated""]
              WaitingForARequestForAFileSystemWatcher -> ServiceFaulted [label = ""ExceptionCaught""]
              RespondingToARequestForAFileSystemWatcher ->ServiceFaulted [label = ""ExceptionCaught""]
              WaitingForARequestForAFileSystemWatcher ->ShutdownStarted [label = ""CancellationTokenActivated""]
              RespondingToARequestForAFileSystemWatcher ->ShutdownStarted [label = ""StopAsyncActivated""]
            "
                );
            #endregion
            #region Add UsingGroups to the Titular Derived and Titular Base CompilationUnits
            #region Add UsingGroups common to both the Titular Derived and Titular Base CompilationUnits
            var gUsingGroup =
                new GUsingGroup(
                    $"UsingGroup common to both  {mCreateAssemblyGroupResult.GTitularDerivedCompilationUnit.GName} and {mCreateAssemblyGroupResult.GTitularBaseCompilationUnit.GName}");
            foreach (var gName in new List <string>()
            {
                "System.IO"
            })
            {
                var gUsing = new GUsing(gName);
                gUsingGroup.GUsings.Add(gUsing.Philote, gUsing);
            }
            mCreateAssemblyGroupResult.GTitularDerivedCompilationUnit.GUsingGroups
            .Add(gUsingGroup.Philote, gUsingGroup);
            mCreateAssemblyGroupResult.GTitularBaseCompilationUnit.GUsingGroups
            .Add(gUsingGroup.Philote, gUsingGroup);
            #endregion
            #region Add UsingGroups specific to the Titular Base CompilationUnit
            gUsingGroup =
                new GUsingGroup(
                    $"UsingGroup specific to {mCreateAssemblyGroupResult.GTitularBaseCompilationUnit.GName}");
            foreach (var gName in new List <string>()
            {
                "System.IO"
            })
            {
                var gUsing = new GUsing(gName);
                gUsingGroup.GUsings.Add(gUsing.Philote, gUsing);
            }
            mCreateAssemblyGroupResult.GTitularBaseCompilationUnit.GUsingGroups
            .Add(gUsingGroup.Philote, gUsingGroup);
            #endregion
            #endregion
            #region Injected PropertyGroup For ConsoleSinkAndConsoleSource
            #endregion
            #region Add the MethodGroup for this service
            var gMethodGroup =
                new GMethodGroup(
                    gName:
                    $"MethodGroup specific to {mCreateAssemblyGroupResult.GClassBase.GName}");
            var gMethod = MCreateRequestAFileSystemWatcher();
            gMethodGroup.GMethods.Add(gMethod.Philote, gMethod);
            mCreateAssemblyGroupResult.GClassBase.AddMethodGroup(gMethodGroup);
            #endregion

            #region Add References used by the Titular Derived and Titular Base CompilationUnits to the ProjectUnit
            #region Add References used by both the Titular Derived and Titular Base CompilationUnits
            #endregion
            #region Add References unique to the Titular Base CompilationUnit
            #endregion
            #endregion

            /*******************************************************************************/
            #region Update the Interface Assembly for this service
            #region Add UsingGroups for the Titular Derived Interface and Titular Base Interface
            #region Add UsingGroups common to both the Titular Derived Interface and the Titular Base Interface
            gUsingGroup =
                new GUsingGroup($"UsingGroups common to both {mCreateAssemblyGroupResult.GTitularInterfaceDerivedCompilationUnit.GName} and {mCreateAssemblyGroupResult.GTitularInterfaceBaseCompilationUnit.GName}");
            foreach (var gName in new List <string>()
            {
                "System.IO",
            })
            {
                var gUsing = new GUsing(gName);
                gUsingGroup.GUsings.Add(gUsing.Philote, gUsing);
            }
            mCreateAssemblyGroupResult.GTitularInterfaceDerivedCompilationUnit.GUsingGroups.Add(gUsingGroup.Philote, gUsingGroup);
            mCreateAssemblyGroupResult.GTitularInterfaceBaseCompilationUnit.GUsingGroups.Add(gUsingGroup.Philote, gUsingGroup);
            #endregion
            #region Add UsingGroups specific to the Titular Base Interface
            #endregion
            #endregion
            #region Add References for the Titular Interface ProjectUnit
            #region Add References common to both the Titular Derived Interface and Titular Base Interface
            #endregion
            #region Add References unique to the Titular Base Interface CompilationUnit
            #endregion
            #endregion
            #endregion

            #region Finalize the GHHS
            GAssemblyGroupGHHSFinalizer(mCreateAssemblyGroupResult);
            #endregion
            return(mCreateAssemblyGroupResult.GAssemblyGroup);
        }
Пример #7
0
        public static IGAssemblyGroup MAUStateless(string gAssemblyGroupName,
                                                   string subDirectoryForGeneratedFiles     = default, string baseNamespaceName = default, bool hasInterfaces = true,
                                                   IGPatternReplacement gPatternReplacement = default)
        {
            IGPatternReplacement _gPatternReplacement =
                gPatternReplacement == default ? new GPatternReplacement() : gPatternReplacement;


            var gAssemblyGroupBasicConstructorResult = MAssemblyGroupBasicConstructor(gAssemblyGroupName,
                                                                                      subDirectoryForGeneratedFiles,
                                                                                      baseNamespaceName, hasInterfaces, _gPatternReplacement);

            #region Initial StateMachine Configuration
            gAssemblyGroupBasicConstructorResult.GPrimaryConstructorBase.GStateConfiguration.GDOTGraphStatements.Add(
                @"
              WaitingForARequestToGenerateAStateMachineConfiguration -> GeneratingAStateMachineConfiguration [label = ""RequestToGenerateAStateMachineReceived""]
              GeneratingAStateMachineConfiguration -> WaitingForARequestToGenerateAStateMachineConfiguration [label = ""ReadyToReturnAStateMachineConfigurationMethod""]
              WaitingForARequestToGenerateAStateMachineConfiguration -> WaitingForARequestToGenerateAStateMachineConfiguration [label = ""CancellationTokenActivated""]
              GeneratingAStateMachineConfiguration -> WaitingForARequestToGenerateAStateMachineConfiguration [label = ""CancellationTokenActivated""]
              WaitingForARequestToGenerateAStateMachineConfiguration -> ServiceFaulted [label = ""ExceptionCaught""]
              GeneratingAStateMachineConfiguration -> ServiceFaulted [label = ""ExceptionCaught""]
            "
                );
            #endregion
            #region Add UsingGroups to the Titular Derived and Titular Base CompilationUnits
            #region Add UsingGroups common to both the Titular Derived and Titular Base CompilationUnits
            #endregion
            #region Add UsingGroups specific to the Titular Base CompilationUnit
            var gUsingGroup =
                new GUsingGroup(
                    $"UsingGroup specific to {gAssemblyGroupBasicConstructorResult.GTitularBaseCompilationUnit.GName}");
            foreach (var gName in new List <string>()
            {
                "Stateless", "System.Collections.Generic",
            })
            {
                var gUsing = new GUsing(gName);
                gUsingGroup.GUsings.Add(gUsing.Philote, gUsing);
            }
            gAssemblyGroupBasicConstructorResult.GTitularBaseCompilationUnit.GUsingGroups
            .Add(gUsingGroup.Philote, gUsingGroup);
            #endregion
            #endregion
            #region Injected PropertyGroup For ConsoleSinkAndConsoleSource
            #endregion
            #region Add the MethodGroup containing new methods provided by this library to the Titular Base CompilationUnits
            #endregion
            #region Add additional classes provided by this library to the Titular Base CompilationUnit
            #region Add the StateConfiguration Class provided by this library to the Titular Base CompilationUnits
            //var gClass = MCreateStateConfigurationClass();
            //mCreateAssemblyGroupResult.GNamespaceBase.GClasss.Add(gClass.Philote, gClass);
            #endregion
            #endregion
            #region Add References used by the Titular Derived and Titular Base CompilationUnits to the ProjectUnit
            #region Add References used by both the Titular Derived and Titular Base CompilationUnits
            foreach (var o in new List <IGItemGroupInProjectUnit>()
            {
                new GItemGroupInProjectUnit("StatelessPackageReferences",
                                            "Packages for the Stateless lightweight StateMachine library",
                                            new GBody(new List <string>()
                {
                    "<PackageReference Include=\"Stateless\" />",
                })),
            }
                     )
            {
                gAssemblyGroupBasicConstructorResult.GTitularAssemblyUnit.GProjectUnit.GItemGroupInProjectUnits
                .Add(o.Philote, o);
            }
            #endregion
            #region Add References unique to the Titular Base CompilationUnit
            #endregion
            #endregion
            /*******************************************************************************/
            #region Update the Interface Assembly for this service
            #region Add UsingGroups for the Titular Derived Interface and Titular Base Interface
            #region Add UsingGroups common to both the Titular Derived Interface and the Titular Base Interface
            #endregion
            #region Add UsingGroups specific to the Titular Base Interface
            #endregion
            #endregion
            #endregion
            /* ************************************************************************************ */
            #region Upate the ProjectUnits in both the Titular AssemblyUnit and Titular InterfacesAssemblyUnit
            #region Add References for the Titular Interface ProjectUnit
            #region Add References common to both the Titular Derived Interface and Titular Base Interface
            #endregion
            #region Add References unique to the Titular Base Interface CompilationUnit
            #endregion
            #endregion
            #endregion
            #region Finalize the Assemblygroup
            GAssemblyGroupCommonFinalizer(gAssemblyGroupBasicConstructorResult);
            #endregion
            return(gAssemblyGroupBasicConstructorResult.GAssemblyGroup);
        }
Пример #8
0
        public static IGAssemblyGroup MConsoleMonitorGHS(string gAssemblyGroupName,
                                                         string subDirectoryForGeneratedFiles     = default, string baseNamespaceName = default, bool hasInterfaces = true,
                                                         IGPatternReplacement gPatternReplacement = default)
        {
            IGPatternReplacement _gPatternReplacement =
                gPatternReplacement == default ? new GPatternReplacement() : gPatternReplacement;
            var mCreateAssemblyGroupResult = MAssemblyGroupGHHSConstructor(gAssemblyGroupName, subDirectoryForGeneratedFiles,
                                                                           baseNamespaceName, hasInterfaces, _gPatternReplacement);

            #region Initial StateMachine Configuration
            mCreateAssemblyGroupResult.GPrimaryConstructorBase.GStateConfiguration.GDOTGraphStatements.Add(
                @"
          WaitingForInitialization ->BlockingOnConsoleInReadLineAsync [label = ""InitializationCompleteReceived""]
          WaitingForRequestToWriteSomething -> WaitingForWriteToComplete [label = ""WriteStarted""]
          WaitingForWriteToComplete -> WaitingForRequestToWriteSomething [label = ""WriteFinished""]
          WaitingForWriteToComplete -> WaitingForRequestToWriteSomething [label = ""CancellationTokenActivated""]
          WaitingForRequestToWriteSomething -> ServiceFaulted [label = ""ExceptionCaught""]
          WaitingForWriteToComplete ->ServiceFaulted [label = ""ExceptionCaught""]
          WaitingForRequestToWriteSomething ->ShutdownStarted [label = ""CancellationTokenActivated""]
          WaitingForRequestToWriteSomething ->ShutdownStarted [label = ""StopAsyncActivated""]
          WaitingForWriteToComplete ->ShutdownStarted [label = ""StopAsyncActivated""]
        "
                );
            #endregion
            #region Add UsingGroups to the Titular Derived and Titular Base CompilationUnits
            #region Add UsingGroups common to both the Titular Derived and Titular Base CompilationUnits
            var gUsingGroup =
                new GUsingGroup(
                    $"UsingGroup common to both  {mCreateAssemblyGroupResult.GTitularDerivedCompilationUnit.GName} and {mCreateAssemblyGroupResult.GTitularBaseCompilationUnit.GName}");
            foreach (var gName in new List <string>()
            {
                "ATAP.Utilities.GenericHostServices.ConsoleSourceGHS", "ATAP.Utilities.GenericHostServices.ConsoleSinkGHS",
            })
            {
                var gUsing = new GUsing(gName);
                gUsingGroup.GUsings.Add(gUsing.Philote, gUsing);
            }
            mCreateAssemblyGroupResult.GTitularDerivedCompilationUnit.GUsingGroups
            .Add(gUsingGroup.Philote, gUsingGroup);
            mCreateAssemblyGroupResult.GTitularBaseCompilationUnit.GUsingGroups
            .Add(gUsingGroup.Philote, gUsingGroup);
            #endregion
            #region Add UsingGroups specific to the Titular Base CompilationUnit
            gUsingGroup =
                new GUsingGroup(
                    $"UsingGroup specific to {mCreateAssemblyGroupResult.GTitularBaseCompilationUnit.GName}");
            foreach (var gName in new List <string>()
            {
                "System.Reactive.Linq",
                "System.Reactive.Concurrency",
                $"{baseNamespaceName}ConsoleSinkGHS",
                $"{baseNamespaceName}ConsoleSourceGHS"
            })
            {
                var gUsing = new GUsing(gName);
                gUsingGroup.GUsings.Add(gUsing.Philote, gUsing);
            }
            mCreateAssemblyGroupResult.GTitularBaseCompilationUnit.GUsingGroups
            .Add(gUsingGroup.Philote, gUsingGroup);
            #endregion
            #endregion
            #region Injected PropertyGroup For ConsoleSinkAndConsoleSource
            var gPropertyGroup = new GPropertyGroup("Injected Property for ConsoleSinkGHS and ConsoleSourceGHS");
            mCreateAssemblyGroupResult.GClassBase.AddPropertyGroups(gPropertyGroup);
            foreach (var o in new List <string>()
            {
                "ConsoleSourceGHS", "ConsoleSinkGHS"
            })
            {
                mCreateAssemblyGroupResult.GClassBase.AddTConstructorAutoPropertyGroup(
                    mCreateAssemblyGroupResult.GPrimaryConstructorBase.Philote, o, gPropertyGroupId: gPropertyGroup.Philote);
            }
            #endregion
            #region Add the MethodGroup for this service
            var gMethodGroup =
                new GMethodGroup(
                    gName:
                    $"MethodGroup specific to {mCreateAssemblyGroupResult.GClassBase.GName}");
            IGMethod gMethod;
            gMethod = CreateConsoleSourceReadLineAsyncAsObservableMethod();
            gMethodGroup.GMethods.Add(gMethod.Philote, gMethod);
            gMethod = MCreateWriteMethodInConsoleMonitor();
            gMethodGroup.GMethods.Add(gMethod.Philote, gMethod);
            //gMethod = MCreateWriteAsyncMethodInConsoleMonitor();
            //gMethodGroup.GMethods.Add(gMethod.Philote, gMethod);
            mCreateAssemblyGroupResult.GClassBase.AddMethodGroup(gMethodGroup);
            #endregion
            #region Add References used by the Titular Derived and Titular Base CompilationUnits to the ProjectUnit
            #region Add References used by both the Titular Derived and Titular Base CompilationUnits
            foreach (var o in new List <IGItemGroupInProjectUnit>()
            {
                ReactiveUtilitiesReferencesItemGroupInProjectUnit(),
                new GItemGroupInProjectUnit(
                    "References used by both the {Derived} and {Base}",
                    "References to the ConsoleSourceGHS and ConsoleSinkGHS Interfaces, used by both the used by both the {Derived CompilationUnit} and {Base CompilationUnit}",
                    new GBody(new List <string>()
                {
                    "<PackageReference Include=\"ConsoleSourceGHS.Interfaces\" />",
                    "<PackageReference Include=\"ConsoleSinkGHS.Interfaces\" />",
                }))
            }
                     )
            {
                mCreateAssemblyGroupResult.GTitularAssemblyUnit.GProjectUnit.GItemGroupInProjectUnits
                .Add(o.Philote, o);
            }
            #endregion
            #region Add References unique to the Titular Base CompilationUnit
            foreach (var o in new List <IGItemGroupInProjectUnit>()
            {
            }
                     )
            {
                mCreateAssemblyGroupResult.GTitularAssemblyUnit.GProjectUnit.GItemGroupInProjectUnits
                .Add(o.Philote, o);
            }
            #endregion
            #endregion
            /*******************************************************************************/
            #region Update the Interface Assembly for this service
            #region Add UsingGroups for the Titular Derived Interface CompilationUnit and Titular Base Interface CompilationUnit
            #region Add UsingGroups common to both the Titular Derived Interface CompilationUnit and the Titular Base Interface CompilationUnit
            gUsingGroup =
                new GUsingGroup(
                    $"UsingGroups common to both {mCreateAssemblyGroupResult.GTitularInterfaceDerivedCompilationUnit.GName} and {mCreateAssemblyGroupResult.GTitularInterfaceBaseCompilationUnit.GName}");
            foreach (var gName in new List <string>()
            {
                $"{baseNamespaceName}ConsoleSinkGHS", $"{baseNamespaceName}ConsoleSourceGHS"
            })
            {
                var gUsing = new GUsing(gName);
                gUsingGroup.GUsings.Add(gUsing.Philote, gUsing);
            }
            mCreateAssemblyGroupResult.GTitularInterfaceDerivedCompilationUnit.GUsingGroups.Add(gUsingGroup.Philote,
                                                                                                gUsingGroup);
            mCreateAssemblyGroupResult.GTitularInterfaceBaseCompilationUnit.GUsingGroups.Add(gUsingGroup.Philote,
                                                                                             gUsingGroup);
            #endregion
            #region Add UsingGroups specific to the Titular Base Interface
            #endregion
            #endregion
            #region Add References for the Titular Interface ProjectUnit
            #region Add References common to both the Titular Derived Interface and Titular Base Interface
            foreach (var o in new List <IGItemGroupInProjectUnit>()
            {
                ReactiveUtilitiesReferencesItemGroupInProjectUnit(),
                new GItemGroupInProjectUnit(
                    "References used by both the {Derived} and {Base}",
                    "References to the ConsoleSourceGHS and ConsoleSinkGHS Interfaces, used by both the used by both the {Derived CompilationUnit} and {Base CompilationUnit}",
                    new GBody(new List <string>()
                {
                    "<PackageReference Include=\"ConsoleSourceGHS.Interfaces\" />",
                    "<PackageReference Include=\"ConsoleSinkGHS.Interfaces\" />",
                })),
            }
                     )
            {
                mCreateAssemblyGroupResult.gTitularInterfaceAssemblyUnit.GProjectUnit.GItemGroupInProjectUnits
                .Add(o.Philote, o);
            }
            #endregion
            #region Add References unique to the Titular Base Interface CompilationUnit
            #endregion
            #endregion
            #endregion
            #region Finalize the GHHS
            GAssemblyGroupGHHSFinalizer(mCreateAssemblyGroupResult);
            #endregion
            return(mCreateAssemblyGroupResult.GAssemblyGroup);
        }