fix: BRB backdrop seed replaces existing instead of skipping
SeedBrbBackdrop() now updates the AssetId on an existing Background source instead of bailing when one already exists. This ensures the new brb-backdrop.jpg replaces any old image already in the DB.
This commit is contained in:
@@ -1771,7 +1771,6 @@ public class MainViewModel : ViewModelBase
|
||||
{
|
||||
var brb = Scenes.FirstOrDefault(s => SceneCatalog.Is(s.Name, "BRB"));
|
||||
if (brb == null) return;
|
||||
if (brb.Elements.OfType<Source>().Any(s => s.Type == SourceType.Background)) return;
|
||||
|
||||
var uri = new Uri("pack://application:,,,/Assets/brb-backdrop.jpg", UriKind.Absolute);
|
||||
using var stream = Application.GetResourceStream(uri)?.Stream;
|
||||
@@ -1781,6 +1780,16 @@ public class MainViewModel : ViewModelBase
|
||||
var bytes = ms.ToArray();
|
||||
var assetId = AddAsset(bytes);
|
||||
if (assetId == null) return;
|
||||
|
||||
var existing = brb.Elements.OfType<Source>().FirstOrDefault(s => s.Type == SourceType.Background);
|
||||
if (existing != null)
|
||||
{
|
||||
existing.AssetId = assetId;
|
||||
existing.Width = 1920;
|
||||
existing.Height = 1080;
|
||||
}
|
||||
else
|
||||
{
|
||||
brb.Elements.Add(new Source
|
||||
{
|
||||
Name = "Background",
|
||||
@@ -1790,6 +1799,7 @@ public class MainViewModel : ViewModelBase
|
||||
Height = 1080,
|
||||
});
|
||||
}
|
||||
}
|
||||
catch { /* non-critical — stream works fine without a default bg */ }
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user