Skip to content

Commit 3d1dd7e

Browse files
committed
- Added LaunchTarget to IOAPPDNA interface in OASIS.API.Core
- Added InstalledPath, InstalledOn & InstalledBy to InstalledOAPP and IInstalledOAPP interface in OASIS.API.ONODE.Core. - Updated InstallOAPPAsync and InstallOAPP overloads in OAPPManager in OASIS.API.ONODE.Core and now returns IInstalledOAPP instead of IOAPPDNA. - Added net and installoapp commands to STAR CLI (ReadyPlayerOne and ShowCommands functions). - Added InstallOAPPAsync, InstallOAPP, LaunchSTARNETAsync, LaunchSTARNET, ListAllOAPPsAsync & ListAllOAPPs to STAR.CLI.Lib.
1 parent a0d9b24 commit 3d1dd7e

6 files changed

Lines changed: 188 additions & 77 deletions

File tree

NextGenSoftware.OASIS.API.Core/Interfaces/IOAPPDNA.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ public interface IOAPPDNA
2222
Guid PublishedByAvatarId { get; set; }
2323
DateTime PublishedOn { get; set; }
2424
bool PublishedOnSTARNET { get; set; }
25+
public string LaunchTarget { get; set; }
2526
string Version { get; set; }
2627
}
2728
}

NextGenSoftware.OASIS.API.ONODE.Core/Holons/InstalledOAPP.cs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1-
using NextGenSoftware.OASIS.API.Core.Holons;
1+
using System;
2+
using NextGenSoftware.OASIS.API.Core.Holons;
23
using NextGenSoftware.OASIS.API.Core.Enums;
34
using NextGenSoftware.OASIS.API.Core.CustomAttrbiutes;
45
using NextGenSoftware.OASIS.API.ONode.Core.Interfaces.Holons;
56
using NextGenSoftware.OASIS.API.Core.Interfaces;
67

78
namespace NextGenSoftware.OASIS.API.ONode.Core.Holons
89
{
9-
public class InstalledOAPP : Holon, IInstalledOAPP
10+
public class InstalledOAPP : Holon, IInstalledOAPP //TODO: Do we want to use Holon? What was the reason again?! ;-) Think so can be used with Data API and HolonManager?
1011
{
1112
public InstalledOAPP()
1213
{
@@ -16,6 +17,15 @@ public InstalledOAPP()
1617
[CustomOASISProperty]
1718
public IOAPPDNA OAPPDNA { get; set; }
1819

20+
[CustomOASISProperty]
21+
public string InstalledPath { get; set; }
22+
23+
[CustomOASISProperty]
24+
public DateTime InstalledOn { get; set; }
25+
26+
[CustomOASISProperty]
27+
public Guid InstalledBy { get; set; }
28+
1929
//[CustomOASISProperty]
2030
//public IOAPP OAPP { get; set; }
2131

NextGenSoftware.OASIS.API.ONODE.Core/Interfaces/Holons/IInstalledOAPP.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
1-
using NextGenSoftware.OASIS.API.Core.Interfaces;
2-
using NextGenSoftware.OASIS.API.ONode.Core.Interfaces.Objects;
1+
using System;
2+
using NextGenSoftware.OASIS.API.Core.Interfaces;
33

44
namespace NextGenSoftware.OASIS.API.ONode.Core.Interfaces.Holons
55
{
66
public interface IInstalledOAPP : IHolon
77
{
88
IOAPPDNA OAPPDNA { get; set; }
9+
public string InstalledPath { get; set; }
10+
public DateTime InstalledOn { get; set; }
11+
public Guid InstalledBy { get; set; }
12+
913
//IOAPP OAPP { get; set; }
1014
//Guid OAPPId { get; set; }
1115
}

NextGenSoftware.OASIS.API.ONODE.Core/Managers/OAPPManager.cs

Lines changed: 34 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -661,9 +661,9 @@ public OASISResult<IOAPPDNA> UnPublishOAPP(Guid OAPPId, ProviderType providerTyp
661661
// return result;
662662
//}
663663

664-
public async Task<OASISResult<IOAPPDNA>> InstallOAPPAsync(string fullPathToPublishedOAPPFile, string fullInstallPath, ProviderType providerType = ProviderType.Default)
664+
public async Task<OASISResult<IInstalledOAPP>> InstallOAPPAsync(Guid avatarId, string fullPathToPublishedOAPPFile, string fullInstallPath, ProviderType providerType = ProviderType.Default)
665665
{
666-
OASISResult<IOAPPDNA> result = new OASISResult<IOAPPDNA>();
666+
OASISResult<IInstalledOAPP> result = new OASISResult<IInstalledOAPP>();
667667
string errorMessage = "Error occured in OAPPManager.InstallOAPPAsync. Reason: ";
668668

669669
try
@@ -674,13 +674,20 @@ public async Task<OASISResult<IOAPPDNA>> InstallOAPPAsync(string fullPathToPubli
674674

675675
if (OAPPDNA != null)
676676
{
677-
InstalledOAPP installedOAPP = new InstalledOAPP() { OAPPDNA = OAPPDNA };
677+
InstalledOAPP installedOAPP = new InstalledOAPP()
678+
{
679+
OAPPDNA = OAPPDNA,
680+
InstalledBy = avatarId,
681+
InstalledOn = DateTime.Now,
682+
InstalledPath = fullInstallPath
683+
};
684+
678685
OASISResult<IHolon> saveResult = await installedOAPP.SaveAsync();
679686

680687
if (saveResult != null && saveResult.Result != null && !saveResult.IsError)
681688
{
682689
result.Message = "OAPP Installed";
683-
result.Result = OAPPDNA;
690+
result.Result = installedOAPP;
684691
}
685692
else
686693
OASISErrorHandling.HandleError(ref result, $"{errorMessage} Error occured calling SaveAsync method. Reason: {saveResult.Message}");
@@ -694,9 +701,9 @@ public async Task<OASISResult<IOAPPDNA>> InstallOAPPAsync(string fullPathToPubli
694701
return result;
695702
}
696703

697-
public OASISResult<IOAPPDNA> InstallOAPP(string fullPathToPublishedOAPPFile, string fullInstallPath, ProviderType providerType = ProviderType.Default)
704+
public OASISResult<IInstalledOAPP> InstallOAPP(Guid avatarId, string fullPathToPublishedOAPPFile, string fullInstallPath, ProviderType providerType = ProviderType.Default)
698705
{
699-
OASISResult<IOAPPDNA> result = new OASISResult<IOAPPDNA>();
706+
OASISResult<IInstalledOAPP> result = new OASISResult<IInstalledOAPP>();
700707
string errorMessage = "Error occured in OAPPManager.InstallOAPP. Reason: ";
701708

702709
try
@@ -707,13 +714,20 @@ public OASISResult<IOAPPDNA> InstallOAPP(string fullPathToPublishedOAPPFile, str
707714

708715
if (OAPPDNA != null)
709716
{
710-
InstalledOAPP installedOAPP = new InstalledOAPP() { OAPPDNA = OAPPDNA };
717+
InstalledOAPP installedOAPP = new InstalledOAPP()
718+
{
719+
OAPPDNA = OAPPDNA,
720+
InstalledBy = avatarId,
721+
InstalledOn = DateTime.Now,
722+
InstalledPath = fullInstallPath
723+
};
724+
711725
OASISResult<IHolon> saveResult = installedOAPP.Save();
712726

713727
if (saveResult != null && saveResult.Result != null && !saveResult.IsError)
714728
{
715729
result.Message = "OAPP Installed";
716-
result.Result = OAPPDNA;
730+
result.Result = installedOAPP;
717731
}
718732
else
719733
OASISErrorHandling.HandleError(ref result, $"{errorMessage} Error occured calling Save method. Reason: {saveResult.Message}");
@@ -727,16 +741,16 @@ public OASISResult<IOAPPDNA> InstallOAPP(string fullPathToPublishedOAPPFile, str
727741
return result;
728742
}
729743

730-
public async Task<OASISResult<IOAPPDNA>> InstallOAPPAsync(IOAPP OAPP, string fullInstallPath, ProviderType providerType = ProviderType.Default)
744+
public async Task<OASISResult<IInstalledOAPP>> InstallOAPPAsync(Guid avatarId, IOAPP OAPP, string fullInstallPath, ProviderType providerType = ProviderType.Default)
731745
{
732-
OASISResult<IOAPPDNA> result = new OASISResult<IOAPPDNA>();
746+
OASISResult<IInstalledOAPP> result = new OASISResult<IInstalledOAPP>();
733747
string errorMessage = "Error occured in OAPPManager.InstallOAPPAsync. Reason: ";
734748

735749
try
736750
{
737751
string OAPPPath = Path.Combine("temp", OAPP.Name, ".oapp");
738752
await File.WriteAllBytesAsync(OAPPPath, OAPP.PublishedOAPP);
739-
result = await InstallOAPPAsync(OAPPPath, fullInstallPath, providerType);
753+
result = await InstallOAPPAsync(avatarId, OAPPPath, fullInstallPath, providerType);
740754
}
741755
catch (Exception ex)
742756
{
@@ -746,16 +760,16 @@ public async Task<OASISResult<IOAPPDNA>> InstallOAPPAsync(IOAPP OAPP, string ful
746760
return result;
747761
}
748762

749-
public OASISResult<IOAPPDNA> InstallOAPP(IOAPP OAPP, string fullInstallPath, ProviderType providerType = ProviderType.Default)
763+
public OASISResult<IInstalledOAPP> InstallOAPP(Guid avatarId, IOAPP OAPP, string fullInstallPath, ProviderType providerType = ProviderType.Default)
750764
{
751-
OASISResult<IOAPPDNA> result = new OASISResult<IOAPPDNA>();
765+
OASISResult<IInstalledOAPP> result = new OASISResult<IInstalledOAPP>();
752766
string errorMessage = "Error occured in OAPPManager.InstallOAPP. Reason: ";
753767

754768
try
755769
{
756770
string OAPPPath = Path.Combine("temp", OAPP.Name, ".oapp");
757771
File.WriteAllBytes(OAPPPath, OAPP.PublishedOAPP);
758-
result = InstallOAPP(OAPPPath, fullInstallPath, providerType);
772+
result = InstallOAPP(avatarId, OAPPPath, fullInstallPath, providerType);
759773
}
760774
catch (Exception ex)
761775
{
@@ -765,26 +779,26 @@ public OASISResult<IOAPPDNA> InstallOAPP(IOAPP OAPP, string fullInstallPath, Pro
765779
return result;
766780
}
767781

768-
public async Task<OASISResult<IOAPPDNA>> InstallOAPPAsync(Guid OAPPId, string fullInstallPath, ProviderType providerType = ProviderType.Default)
782+
public async Task<OASISResult<IInstalledOAPP>> InstallOAPPAsync(Guid avatarId, Guid OAPPId, string fullInstallPath, ProviderType providerType = ProviderType.Default)
769783
{
770-
OASISResult<IOAPPDNA> result = new OASISResult<IOAPPDNA>();
784+
OASISResult<IInstalledOAPP> result = new OASISResult<IInstalledOAPP>();
771785
OASISResult<IOAPP> OAPPResult = await LoadOAPPAsync(OAPPId, providerType);
772786

773787
if (OAPPResult != null && !OAPPResult.IsError && OAPPResult.Result != null)
774-
result = await InstallOAPPAsync(OAPPResult.Result, fullInstallPath, providerType);
788+
result = await InstallOAPPAsync(avatarId, OAPPResult.Result, fullInstallPath, providerType);
775789
else
776790
OASISErrorHandling.HandleError(ref result, $"Error occured in OAPPManager.InstallOAPPAsync loading the OAPP with the LoadOAPPAsync method, reason: {result.Message}");
777791

778792
return result;
779793
}
780794

781-
public OASISResult<IOAPPDNA> InstallOAPP(Guid OAPPId, string fullInstallPath, ProviderType providerType = ProviderType.Default)
795+
public OASISResult<IInstalledOAPP> InstallOAPP(Guid avatarId, Guid OAPPId, string fullInstallPath, ProviderType providerType = ProviderType.Default)
782796
{
783-
OASISResult<IOAPPDNA> result = new OASISResult<IOAPPDNA>();
797+
OASISResult<IInstalledOAPP> result = new OASISResult<IInstalledOAPP>();
784798
OASISResult<IOAPP> OAPPResult = LoadOAPP(OAPPId, providerType);
785799

786800
if (OAPPResult != null && !OAPPResult.IsError && OAPPResult.Result != null)
787-
result = InstallOAPP(OAPPResult.Result, fullInstallPath, providerType);
801+
result = InstallOAPP(avatarId, OAPPResult.Result, fullInstallPath, providerType);
788802
else
789803
OASISErrorHandling.HandleError(ref result, $"Error occured in OAPPManager.InstallOAPP loading the OAPP with the LoadOAPP method, reason: {result.Message}");
790804

0 commit comments

Comments
 (0)