using System.Text.Json;
using XFEEDToolBox.Controls;
using XFEEDToolBox.Core.Galaxy;
namespace XFEEDToolBox;
public partial class App
{
private static async Task<object> RunGalaxyConstellationProbeAsync(string directory)
{
static void Require(bool value,string message){if(!value)throw new InvalidOperationException(message);}
var previous=MainWindow.Content;var host=new Grid();var map=new GalaxyMapView();host.Children.Add(map);MainWindow.Content=host;
// These three coordinates are declared geometry fixtures, never fed to
// the catalogue provider/cache or claimed as actual astrometry. The
// exact original Aries graph still supplies the names and edge order.
var fixture=new[]{new GalacticSystem("Hamal",new(0,0,6),StarClass:"G",Source:"Synthetic constellation geometry fixture"),
new GalacticSystem("Sheratan",new(2,0,8),StarClass:"G",Source:"Synthetic constellation geometry fixture"),
new GalacticSystem("Mesarthim",new(-2,0,10),StarClass:"G",Source:"Synthetic constellation geometry fixture")};
try
{
map.Systems=fixture;map.Filter=GalaxyMapFilter.Default with{ShowConstellations=true,ShowGrid=false,ShowLabels=false,ShowMarkers=false,
ShowBackground=false,ShowRegionNames=false,ShowNebulaNames=false,ShowGalacticZonesPlane=false,ShowGalacticZoneNames=false};
await Task.Delay(180);map.Centre=new(0,0,0);map.ResetCamera();map.Zoom(100);map.AdvanceCameraMotionForProbe(256);map.RenderNowForProbe();
var group=map.ConstellationResolutionForProbe.Groups.SingleOrDefault(g=>g.Name=="Aries");
Require(group is{Lines.Count:2}&&group.Lines[0].FromName=="Hamal"&&group.Lines[0].ToName=="Sheratan"&&group.Lines[1].ToName=="Mesarthim","Original authored Aries graph was replaced or only partly resolved.");
Require(map.VisibleConstellationSegments==2,"Complete original Aries fixture did not reach the shared line renderer.");
Require(map.OriginalConstellationWorldStyleForProbe&&map.OriginalConstellationSubmittedForProbe==2,"Original constellation style6 did not reach the world-line GPU buffer.");
var stars=map.VisibleStars;var linePixels=map.CapturePixelsForProbe();
using(await map.FreezeForXamlProbeAsync())await CaptureRefinementElementAsync(host,Path.Combine(directory,"synthetic-original-constellation-geometry.png"));
map.Filter=map.Filter with{ShowConstellations=false};map.RenderNowForProbe();var withoutLines=map.CapturePixelsForProbe();
Require(map.VisibleConstellationSegments==0&&map.OriginalConstellationSubmittedForProbe==0&&map.VisibleStars==stars&&!linePixels.Pixels.SequenceEqual(withoutLines.Pixels),"Constellation switch failed to change line pixels independently of models.");
map.Filter=map.Filter with{ShowConstellations=true};map.Systems=fixture.Where(s=>s.Name!="Sheratan").ToArray();map.RenderNowForProbe();
Require(map.VisibleConstellationSegments==0&&map.OriginalConstellationSubmittedForProbe==0&&map.ResolvedConstellationGroupsForProbe==0,"An unresolved endpoint left a partial original constellation visible.");
map.Systems=fixture;map.Filter=map.Filter with{Mode=GalaxyMapMode.Map,Values=new HashSet<string>(),IncludeUnknown=false};map.RenderNowForProbe();
Require(map.VisibleStars==0&&map.VisibleConstellationSegments==0&&map.OriginalConstellationSubmittedForProbe==0,"A constellation bypassed the empty query.");
var pendingCommodity=GalaxyMapFilter.Default with{Mode=GalaxyMapMode.Map,Category=GalaxyFilterCategory.Commodity,
Values=new HashSet<string>{"gold"},OriginalCommodityUid=123,OriginalCommodityOptions=[],IncludeUnknown=false,
ShowGrid=false,ShowBackground=false,ShowConstellations=true,ShowLabels=true};
map.Systems=fixture.Select(s=>s with{Data=new(){Commodities=["gold"],ConfirmedQueries=new HashSet<string>{pendingCommodity.QueryKey}}}).ToArray();
map.Filter=pendingCommodity;map.RenderNowForProbe();
Require(map.VisibleStars==0&&map.VisibleNameLabels==0&&map.VisibleConstellationSegments==0,"An unresolved imported commodity UID retained the previous public query's models or labels.");
var result=new{graphSource=GalaxyOriginalConstellations.SourceResource,groups=16,edges=206,fixtureCoordinatesSynthetic=true,
generatedCatalogueCoordinates=false,completeGroupSegments=2,independentDisplaySwitch=true,incompleteGroupHidden=true,strictQueryHidesSegments=true,
originalWorldGeometryAndGroupFade=true,originalWorldLineStyleRestored=true,originalStyleIndex=6,
GalaxyOriginalConstellations.WorldHalfWidth,GalaxyOriginalConstellations.TextureRepeatPerLightYear,
originalLineMaterialRestored=false,pendingOriginalCommodityUidDoesNotUsePublicSelection=true,gameAccess=false};
await File.WriteAllTextAsync(Path.Combine(directory,"constellation-probe.json"),JsonSerializer.Serialize(result,new JsonSerializerOptions{WriteIndented=true}));
return result;
}
finally{map.SuspendPage();MainWindow.Content=previous;}
}
}
using System.Text.Json;
using XFEEDToolBox.Controls;
using XFEEDToolBox.Core.Galaxy;
namespace XFEEDToolBox;
public partial class App
{
private static async Task<object> RunGalaxyConstellationProbeAsync(string directory)
{
static void Require(bool value,string message){if(!value)throw new InvalidOperationException(message);}
var previous=MainWindow.Content;var host=new Grid();var map=new GalaxyMapView();host.Children.Add(map);MainWindow.Content=host;
// These three coordinates are declared geometry fixtures, never fed to
// the catalogue provider/cache or claimed as actual astrometry. The
// exact original Aries graph still supplies the names and edge order.
var fixture=new[]{new GalacticSystem("Hamal",new(0,0,6),StarClass:"G",Source:"Synthetic constellation geometry fixture"),
new GalacticSystem("Sheratan",new(2,0,8),StarClass:"G",Source:"Synthetic constellation geometry fixture"),
new GalacticSystem("Mesarthim",new(-2,0,10),StarClass:"G",Source:"Synthetic constellation geometry fixture")};
try
{
map.Systems=fixture;map.Filter=GalaxyMapFilter.Default with{ShowConstellations=true,ShowGrid=false,ShowLabels=false,ShowMarkers=false,
ShowBackground=false,ShowRegionNames=false,ShowNebulaNames=false,ShowGalacticZonesPlane=false,ShowGalacticZoneNames=false};
await Task.Delay(180);map.Centre=new(0,0,0);map.ResetCamera();map.Zoom(100);map.AdvanceCameraMotionForProbe(256);map.RenderNowForProbe();
var group=map.ConstellationResolutionForProbe.Groups.SingleOrDefault(g=>g.Name=="Aries");
Require(group is{Lines.Count:2}&&group.Lines[0].FromName=="Hamal"&&group.Lines[0].ToName=="Sheratan"&&group.Lines[1].ToName=="Mesarthim","Original authored Aries graph was replaced or only partly resolved.");
Require(map.VisibleConstellationSegments==2,"Complete original Aries fixture did not reach the shared line renderer.");
Require(map.OriginalConstellationWorldStyleForProbe&&map.OriginalConstellationSubmittedForProbe==2,"Original constellation style6 did not reach the world-line GPU buffer.");
var stars=map.VisibleStars;var linePixels=map.CapturePixelsForProbe();
using(await map.FreezeForXamlProbeAsync())await CaptureRefinementElementAsync(host,Path.Combine(directory,"synthetic-original-constellation-geometry.png"));
map.Filter=map.Filter with{ShowConstellations=false};map.RenderNowForProbe();var withoutLines=map.CapturePixelsForProbe();
Require(map.VisibleConstellationSegments==0&&map.OriginalConstellationSubmittedForProbe==0&&map.VisibleStars==stars&&!linePixels.Pixels.SequenceEqual(withoutLines.Pixels),"Constellation switch failed to change line pixels independently of models.");
map.Filter=map.Filter with{ShowConstellations=true};map.Systems=fixture.Where(s=>s.Name!="Sheratan").ToArray();map.RenderNowForProbe();
Require(map.VisibleConstellationSegments==0&&map.OriginalConstellationSubmittedForProbe==0&&map.ResolvedConstellationGroupsForProbe==0,"An unresolved endpoint left a partial original constellation visible.");
map.Systems=fixture;map.Filter=map.Filter with{Mode=GalaxyMapMode.Map,Values=new HashSet<string>(),IncludeUnknown=false};map.RenderNowForProbe();
Require(map.VisibleStars==0&&map.VisibleConstellationSegments==0&&map.OriginalConstellationSubmittedForProbe==0,"A constellation bypassed the empty query.");
var pendingCommodity=GalaxyMapFilter.Default with{Mode=GalaxyMapMode.Map,Category=GalaxyFilterCategory.Commodity,
Values=new HashSet<string>{"gold"},OriginalCommodityUid=123,OriginalCommodityOptions=[],IncludeUnknown=false,
ShowGrid=false,ShowBackground=false,ShowConstellations=true,ShowLabels=true};
map.Systems=fixture.Select(s=>s with{Data=new(){Commodities=["gold"],ConfirmedQueries=new HashSet<string>{pendingCommodity.QueryKey}}}).ToArray();
map.Filter=pendingCommodity;map.RenderNowForProbe();
Require(map.VisibleStars==0&&map.VisibleNameLabels==0&&map.VisibleConstellationSegments==0,"An unresolved imported commodity UID retained the previous public query's models or labels.");
var result=new{graphSource=GalaxyOriginalConstellations.SourceResource,groups=16,edges=206,fixtureCoordinatesSynthetic=true,
generatedCatalogueCoordinates=false,completeGroupSegments=2,independentDisplaySwitch=true,incompleteGroupHidden=true,strictQueryHidesSegments=true,
originalWorldGeometryAndGroupFade=true,originalWorldLineStyleRestored=true,originalStyleIndex=6,
GalaxyOriginalConstellations.WorldHalfWidth,GalaxyOriginalConstellations.TextureRepeatPerLightYear,
originalLineMaterialRestored=false,pendingOriginalCommodityUidDoesNotUsePublicSelection=true,gameAccess=false};
await File.WriteAllTextAsync(Path.Combine(directory,"constellation-probe.json"),JsonSerializer.Serialize(result,new JsonSerializerOptions{WriteIndented=true}));
return result;
}
finally{map.SuspendPage();MainWindow.Content=previous;}
}
}