2121using NextGenSoftware . OASIS . API . Core . Objects . NFT . Request ;
2222using NextGenSoftware . OASIS . API . Providers . SEEDSOASIS . Membranes ;
2323using NextGenSoftware . OASIS . API . Providers . EOSIOOASIS . Entities . DTOs . GetAccount ;
24+ using NextGenSoftware . OASIS . API . ONode . Core . Interfaces . Holons ;
2425using NextGenSoftware . OASIS . STAR . Zomes ;
2526using NextGenSoftware . OASIS . STAR . CelestialBodies ;
26- using NextGenSoftware . OASIS . API . ONode . Core . Interfaces . Holons ;
27- using NextGenSoftware . OASIS . API . ONode . Core . Holons ;
2827
2928namespace NextGenSoftware . OASIS . STAR . CLI . Lib
3029{
@@ -127,6 +126,8 @@ public static async Task LightWizard(ProviderType providerType = ProviderType.De
127126 }
128127 }
129128
129+ Console . WriteLine ( "" ) ;
130+
130131 if ( CLIEngine . GetConfirmation ( "Do you wish for your OAPP to appear in the Open World MMORPG One World game/platform? (recommeneded)" ) )
131132 {
132133 Console . WriteLine ( "" ) ;
@@ -167,6 +168,7 @@ public static async Task LightWizard(ProviderType providerType = ProviderType.De
167168 }
168169 }
169170
171+ Console . WriteLine ( "" ) ;
170172 value = CLIEngine . GetValidInputForEnum ( "What type of GenesisType do you wish to create? (New avatars will only be able to create moons that orbit Our World until you reach karma level 33 where you will then be able to create planets, when you reach level 77 you can create stars & beyond 77 you can create Galaxies and even entire Universes in your jounrey to become fully God realised!.)" , typeof ( GenesisType ) ) ;
171173
172174 if ( value != null )
@@ -309,6 +311,40 @@ public static async Task<OASISResult<CoronalEjection>> GenerateZomesAndHolons(st
309311 return lightResult ;
310312 }
311313
314+ public static async Task PublishOAPPAsync ( ProviderType providerType = ProviderType . Default )
315+ {
316+ string oappPath = CLIEngine . GetValidFolder ( "What is the full path to the OAPP you wish to publish?" , false ) ;
317+ string launchTarget = CLIEngine . GetValidFolder ( "What is the relative path (from the root of the path given above, e.g bin\\ launch.exe) to the launch target for the OAPP? (This could be the exe or batch file for a desktop or console app, or the index.html page for a website, etc)" , false ) ;
318+ bool registerOnSTARNET = CLIEngine . GetConfirmation ( "Do you wish to publish to STARNET? If you select 'Y' to this question then your OAPP will be published to STARNET where others will be able to find, download and install. If you select 'N' then only the .OAPP install file will be generated on your local device, which you can distribute as you please. This file will also be generated even if you publish to STARNET." ) ;
319+
320+ OASISResult < IOAPPDNA > publishResult = await STAR . OASISAPI . OAPPs . PublishOAPPAsync ( oappPath , launchTarget , STAR . BeamedInAvatar . Id , registerOnSTARNET , providerType ) ;
321+
322+ if ( publishResult != null && ! publishResult . IsError && publishResult . Result != null )
323+ {
324+ CLIEngine . ShowSuccessMessage ( "OAPP Successfully Published." ) ;
325+ ShowOAPP ( publishResult . Result ) ;
326+
327+ if ( CLIEngine . GetConfirmation ( "Do you wish to install the OAPP now?" ) )
328+ await InstallOAPPAsync ( ) ;
329+ }
330+ else
331+ CLIEngine . ShowErrorMessage ( $ "An error occured publishing the OAPP. Reason: { publishResult . Message } ") ;
332+ }
333+
334+ public static async Task UnPublishOAPPAsync ( ProviderType providerType = ProviderType . Default )
335+ {
336+ Guid OAPPId = CLIEngine . GetValidInputForGuid ( "What is the GUID/ID to the OAPP you wish to unpublish?" ) ;
337+ OASISResult < IOAPPDNA > unpublishResult = await STAR . OASISAPI . OAPPs . UnPublishOAPPAsync ( OAPPId , providerType ) ;
338+
339+ if ( unpublishResult != null && ! unpublishResult . IsError && unpublishResult . Result != null )
340+ {
341+ CLIEngine . ShowSuccessMessage ( "OAPP Successfully Unpublished." ) ;
342+ ShowOAPP ( unpublishResult . Result ) ;
343+ }
344+ else
345+ CLIEngine . ShowErrorMessage ( $ "An error occured unpublishing the OAPP. Reason: { unpublishResult . Message } ") ;
346+ }
347+
312348 public static async Task InstallOAPPAsync ( Guid OAPPId = new Guid ( ) , ProviderType providerType = ProviderType . Default )
313349 {
314350 OASISResult < IInstalledOAPP > installResult = null ;
@@ -379,6 +415,27 @@ public static async Task<OASISResult<CoronalEjection>> GenerateZomesAndHolons(st
379415 CLIEngine . ShowErrorMessage ( $ "Error installing OAPP. Reason: Unknown error occured!") ;
380416 }
381417
418+ public static async Task UnInstallOAPPAsync ( Guid OAPPId = new Guid ( ) , ProviderType providerType = ProviderType . Default )
419+ {
420+ if ( OAPPId == Guid . Empty )
421+ OAPPId = CLIEngine . GetValidInputForGuid ( "What is the GUID/ID to the OAPP you wish to uninstall?" ) ;
422+
423+ OASISResult < IOAPPDNA > uninstallResult = await STAR . OASISAPI . OAPPs . UnInstallOAPPAsync ( OAPPId , STAR . BeamedInAvatar . Id , providerType ) ;
424+
425+ if ( uninstallResult != null )
426+ {
427+ if ( ! uninstallResult . IsError && uninstallResult . Result != null )
428+ {
429+ CLIEngine . ShowSuccessMessage ( "OAPP Successfully Uninstalled." ) ;
430+ ShowOAPP ( uninstallResult . Result ) ;
431+ }
432+ else
433+ CLIEngine . ShowErrorMessage ( $ "Error installing OAPP. Reason: { uninstallResult . Message } ") ;
434+ }
435+ else
436+ CLIEngine . ShowErrorMessage ( $ "Error uninstalling OAPP. Reason: Unknown error occured!") ;
437+ }
438+
382439 public static async Task LaunchSTARNETAsync ( bool installOAPP = true )
383440 {
384441 CLIEngine . ShowMessage ( "Welcome to STARNET!" ) ;
@@ -693,6 +750,7 @@ public static void ShowGeoNFT(IOASISGeoSpatialNFT nft)
693750 CLIEngine . ShowDivider ( ) ;
694751 }
695752
753+ //TODO: Once OAPP has been changed to OAPPDNA in OAPPManager this method will be redundant so can just use the other ShowOAPP method below (removes redundant code and redundant storage).
696754 public static void ShowOAPP ( IOAPP oapp )
697755 {
698756 CLIEngine . ShowMessage ( string . Concat ( $ "Title: ", ! string . IsNullOrEmpty ( oapp . Name ) ? oapp . Name : "None" ) ) ;
@@ -708,22 +766,53 @@ public static void ShowOAPP(IOAPP oapp)
708766 }
709767
710768 CLIEngine . ShowMessage ( string . Concat ( $ "Created On: ", oapp . CreatedDate != DateTime . MinValue ? oapp . CreatedDate . ToString ( ) : "None" ) ) ;
711- CLIEngine . ShowMessage ( string . Concat ( $ "Created By: ", oapp . CreatedByAvatarId != Guid . Empty ? oapp . CreatedByAvatarId . ToString ( ) : "None" ) ) ;
769+ CLIEngine . ShowMessage ( string . Concat ( $ "Created By: ", oapp . CreatedByAvatarId != Guid . Empty ? string . Concat ( oapp . CreatedByAvatarUsername , " (" , oapp . CreatedByAvatarId . ToString ( ) , ")" ) : "None" ) ) ;
712770 CLIEngine . ShowMessage ( string . Concat ( $ "Published On: ", oapp . PublishedOn != DateTime . MinValue ? oapp . PublishedOn . ToString ( ) : "None" ) ) ;
713- CLIEngine . ShowMessage ( string . Concat ( $ "Published By: ", oapp . PublishedByAvatarId != Guid . Empty ? oapp . PublishedByAvatarId . ToString ( ) : "None" ) ) ;
771+ CLIEngine . ShowMessage ( string . Concat ( $ "Published By: ", oapp . PublishedByAvatarId != Guid . Empty ? string . Concat ( oapp . PublishedByAvatarUsername , " (" , oapp . PublishedByAvatarId . ToString ( ) , ")" ) : "None" ) ) ;
714772 CLIEngine . ShowMessage ( string . Concat ( $ "Published On STARNET: ", oapp . PublishedOAPP != null ? "True" : "False" ) ) ;
715773 CLIEngine . ShowMessage ( string . Concat ( $ "Version: ", oapp . Version ) ) ;
716774
717775 CLIEngine . ShowMessage ( $ "Zomes: ") ;
776+ Console . WriteLine ( "" ) ;
718777
719- if ( oapp . CelestialBody != null )
778+ if ( oapp . CelestialBody != null && oapp . CelestialBody . CelestialBodyCore != null && oapp . CelestialBody . CelestialBodyCore . Zomes != null )
720779 ShowZomesAndHolons ( oapp . CelestialBody . CelestialBodyCore . Zomes ) ;
721780 else
722781 ShowHolons ( oapp . Children ) ;
723782
724783 CLIEngine . ShowDivider ( ) ;
725784 }
726785
786+ public static void ShowOAPP ( IOAPPDNA oapp )
787+ {
788+ CLIEngine . ShowMessage ( string . Concat ( $ "Title: ", ! string . IsNullOrEmpty ( oapp . OAPPName ) ? oapp . OAPPName : "None" ) ) ;
789+ CLIEngine . ShowMessage ( string . Concat ( $ "Description: ", ! string . IsNullOrEmpty ( oapp . Description ) ? oapp . Description : "None" ) ) ;
790+ CLIEngine . ShowMessage ( string . Concat ( $ "OAPP Type: ", Enum . GetName ( typeof ( OAPPType ) , oapp . OAPPType ) ) ) ;
791+ CLIEngine . ShowMessage ( string . Concat ( $ "Genesis Type: ", Enum . GetName ( typeof ( GenesisType ) , oapp . GenesisType ) ) ) ;
792+ CLIEngine . ShowMessage ( string . Concat ( $ "Celestial Body Id: ", oapp . CelestialBodyId != Guid . Empty ? oapp . CelestialBodyId : "None" ) ) ;
793+ CLIEngine . ShowMessage ( string . Concat ( $ "Celestial Body Name: ", ! string . IsNullOrEmpty ( oapp . CelestialBodyName ) ? oapp . CelestialBodyName : "None" ) ) ;
794+ CLIEngine . ShowMessage ( string . Concat ( $ "Celestial Body Type: ", Enum . GetName ( typeof ( HolonType ) , oapp . CelestialBodyType ) ) ) ;
795+ CLIEngine . ShowMessage ( string . Concat ( $ "Created On: ", oapp . CreatedOn != DateTime . MinValue ? oapp . CreatedOn . ToString ( ) : "None" ) ) ;
796+ CLIEngine . ShowMessage ( string . Concat ( $ "Created By: ", oapp . CreatedByAvatarId != Guid . Empty ? string . Concat ( oapp . CreatedByAvatarUsername , " (" , oapp . CreatedByAvatarId . ToString ( ) , ")" ) : "None" ) ) ;
797+ CLIEngine . ShowMessage ( string . Concat ( $ "Published On: ", oapp . PublishedOn != DateTime . MinValue ? oapp . PublishedOn . ToString ( ) : "None" ) ) ;
798+ CLIEngine . ShowMessage ( string . Concat ( $ "Published By: ", oapp . PublishedByAvatarId != Guid . Empty ? string . Concat ( oapp . PublishedByAvatarUsername , " (" , oapp . PublishedByAvatarId . ToString ( ) , ")" ) : "None" ) ) ;
799+ CLIEngine . ShowMessage ( string . Concat ( $ "Published Path: ", ! string . IsNullOrEmpty ( oapp . PublishedPath ) ? oapp . PublishedPath : "None" ) ) ;
800+ CLIEngine . ShowMessage ( string . Concat ( $ "Published On STARNET: ", oapp . PublishedOnSTARNET ? "True" : "False" ) ) ;
801+ CLIEngine . ShowMessage ( string . Concat ( $ "Launch Target: ", ! string . IsNullOrEmpty ( oapp . LaunchTarget ) ? oapp . LaunchTarget : "None" ) ) ;
802+ CLIEngine . ShowMessage ( string . Concat ( $ "Version: ", oapp . Version ) ) ;
803+
804+ CLIEngine . ShowMessage ( $ "Zomes: ") ;
805+
806+ //TODO: Come back to this.
807+ //if (oapp.CelestialBody != null && oapp.CelestialBody.CelestialBodyCore != null && oapp.CelestialBody.CelestialBodyCore.Zomes != null)
808+ // ShowZomesAndHolons(oapp.CelestialBody.CelestialBodyCore.Zomes);
809+
810+ //else if (oapp.Zomes != null)
811+ // ShowZomesAndHolons(oapp.Zomes);
812+
813+ CLIEngine . ShowDivider ( ) ;
814+ }
815+
727816 public static void ShowInstalledOAPP ( IInstalledOAPP oapp )
728817 {
729818 CLIEngine . ShowMessage ( string . Concat ( $ "Title: ", ! string . IsNullOrEmpty ( oapp . OAPPDNA . OAPPName ) ? oapp . Name : "None" ) ) ;
@@ -739,13 +828,15 @@ public static void ShowInstalledOAPP(IInstalledOAPP oapp)
739828 }
740829
741830 CLIEngine . ShowMessage ( string . Concat ( $ "Created On: ", oapp . OAPPDNA . CreatedOn != DateTime . MinValue ? oapp . OAPPDNA . CreatedOn . ToString ( ) : "None" ) ) ;
742- CLIEngine . ShowMessage ( string . Concat ( $ "Created By: ", oapp . OAPPDNA . CreatedByAvatarId != Guid . Empty ? oapp . OAPPDNA . CreatedByAvatarId . ToString ( ) : "None" ) ) ;
831+ CLIEngine . ShowMessage ( string . Concat ( $ "Created By: ", oapp . CreatedByAvatarId != Guid . Empty ? string . Concat ( oapp . OAPPDNA . CreatedByAvatarUsername , " (" , oapp . CreatedByAvatarId . ToString ( ) , ")" ) : "None" ) ) ;
743832 CLIEngine . ShowMessage ( string . Concat ( $ "Published On: ", oapp . OAPPDNA . PublishedOn != DateTime . MinValue ? oapp . OAPPDNA . PublishedOn . ToString ( ) : "None" ) ) ;
744- CLIEngine . ShowMessage ( string . Concat ( $ "Published By: ", oapp . OAPPDNA . PublishedByAvatarId != Guid . Empty ? oapp . OAPPDNA . PublishedByAvatarId . ToString ( ) : "None" ) ) ;
833+ CLIEngine . ShowMessage ( string . Concat ( $ "Published By: ", oapp . OAPPDNA . PublishedByAvatarId != Guid . Empty ? string . Concat ( oapp . OAPPDNA . PublishedByAvatarUsername , " (" , oapp . OAPPDNA . PublishedByAvatarId . ToString ( ) , ")" ) : "None" ) ) ;
834+ CLIEngine . ShowMessage ( string . Concat ( $ "Published Path: ", ! string . IsNullOrEmpty ( oapp . OAPPDNA . PublishedPath ) ? oapp . OAPPDNA . PublishedPath : "None" ) ) ;
835+ CLIEngine . ShowMessage ( string . Concat ( $ "Published On STARNET: ", oapp . OAPPDNA . PublishedOnSTARNET ? "True" : "False" ) ) ;
836+ CLIEngine . ShowMessage ( string . Concat ( $ "Launch Target: ", ! string . IsNullOrEmpty ( oapp . OAPPDNA . LaunchTarget ) ? oapp . OAPPDNA . LaunchTarget : "None" ) ) ;
745837 CLIEngine . ShowMessage ( string . Concat ( $ "Installed On: ", oapp . InstalledOn != DateTime . MinValue ? oapp . InstalledOn . ToString ( ) : "None" ) ) ;
746- CLIEngine . ShowMessage ( string . Concat ( $ "Installed By: ", oapp . InstalledBy != Guid . Empty ? oapp . InstalledBy . ToString ( ) : "None" ) ) ;
838+ CLIEngine . ShowMessage ( string . Concat ( $ "Published By: ", oapp . InstalledBy != Guid . Empty ? string . Concat ( oapp . InstalledByAvatarUsername , " (" , oapp . InstalledBy . ToString ( ) , ")" ) : "None" ) ) ;
747839 CLIEngine . ShowMessage ( string . Concat ( $ "Installed Path: ", oapp . InstalledPath ) ) ;
748- CLIEngine . ShowMessage ( string . Concat ( $ "Published On STARNET: ", oapp . OAPPDNA . PublishedOnSTARNET ? "True" : "False" ) ) ;
749840 CLIEngine . ShowMessage ( string . Concat ( $ "Version: ", ! string . IsNullOrEmpty ( oapp . OAPPDNA . Version ) ? oapp . OAPPDNA . Version : "None" ) ) ;
750841
751842 //CLIEngine.ShowMessage($"Zomes: ");
@@ -971,7 +1062,8 @@ public static async Task BeamInAvatar(ProviderType providerType = ProviderType.D
9711062 CLIEngine . ShowErrorMessage ( "Error Beaming In. Username/Password may be incorrect." ) ;
9721063 }
9731064
974- //CLIEngine.ShowSuccessMessage(string.Concat("Successfully Beamed In! Welcome back ", STAR.BeamedInAvatar.Username, ". Have a nice day! :) You Are Level ", STAR.BeamedInAvatarDetail.Level, " And Have ", STAR.BeamedInAvatarDetail.Karma, " Karma."));
1065+ CLIEngine . ShowSuccessMessage ( string . Concat ( "Successfully Beamed In! Welcome back " , STAR . BeamedInAvatar . Username , ". Have a nice day! :) You Are Level " , STAR . BeamedInAvatarDetail . Level , " And Have " , STAR . BeamedInAvatarDetail . Karma , " Karma." ) ) ;
1066+ //CLIEngine.ShowSuccessMessage(string.Concat("Successfully Beamed In! Welcome back dellams. Have a nice day! :) You Are Level 77 And Have 777 Karma."));
9751067 //ShowAvatarStats();
9761068 //await ReadyPlayerOne();
9771069 }
@@ -1759,7 +1851,7 @@ public static async Task RunCOSMICTests(OAPPType OAPPType, string celestialBodyD
17591851 STAR . Dim ( result . Result . CelestialBody ) ;
17601852
17611853 // Deploy the planet (OApp)
1762- STAR . Seed ( result . Result . CelestialBody . Id , "" ) ; //TODO: Need to create test path for this.
1854+ // STAR.Seed(result.Result.CelestialBody.Id, ""); //TODO: Need to create test path for this.
17631855
17641856 // Run Tests
17651857 STAR . Twinkle ( result . Result . CelestialBody ) ;
@@ -2556,10 +2648,12 @@ private static void ListOAPPs(OASISResult<IEnumerable<IOAPP>> oapps)
25562648 {
25572649 if ( oapps . Result . Count ( ) > 0 )
25582650 {
2651+ Console . WriteLine ( ) ;
2652+
25592653 if ( oapps . Result . Count ( ) == 1 )
2560- CLIEngine . ShowErrorMessage ( $ "{ oapps . Result . Count ( ) } OAPP Found. ") ;
2654+ CLIEngine . ShowMessage ( $ "{ oapps . Result . Count ( ) } OAPP Found: ") ;
25612655 else
2562- CLIEngine . ShowErrorMessage ( $ "{ oapps . Result . Count ( ) } OAPP's Found. ") ;
2656+ CLIEngine . ShowMessage ( $ "{ oapps . Result . Count ( ) } OAPP's Found: ") ;
25632657
25642658 CLIEngine . ShowDivider ( ) ;
25652659
0 commit comments