mirror of
https://github.com/bloxstraplabs/bloxstrap.git
synced 2025-05-13 03:34:42 -07:00
Add manual channel entry (#132)
This commit is contained in:
parent
7fa4a0b989
commit
1f40efd10d
@ -19,35 +19,16 @@ namespace Bloxstrap.Helpers
|
|||||||
public string BaseUrl { get; private set; } = DefaultBaseUrl;
|
public string BaseUrl { get; private set; } = DefaultBaseUrl;
|
||||||
public string Channel { get; private set; } = DefaultChannel;
|
public string Channel { get; private set; } = DefaultChannel;
|
||||||
|
|
||||||
// basically any channel that has had a deploy within the past month with a windowsplayer build
|
// most commonly used/interesting channels
|
||||||
public static readonly List<string> ChannelsAbstracted = new()
|
public static readonly List<string> SelectableChannels = new()
|
||||||
{
|
{
|
||||||
"LIVE",
|
"LIVE",
|
||||||
"ZNext",
|
|
||||||
"ZCanary",
|
|
||||||
"ZIntegration"
|
|
||||||
};
|
|
||||||
|
|
||||||
// why not?
|
|
||||||
public static readonly List<string> ChannelsAll = new()
|
|
||||||
{
|
|
||||||
"LIVE",
|
|
||||||
"ZAvatarTeam",
|
|
||||||
"ZAvatarRelease",
|
|
||||||
"ZCanary",
|
|
||||||
"ZCanary1",
|
|
||||||
"ZCanary2",
|
|
||||||
"ZCanary3",
|
|
||||||
"ZCanaryApps",
|
|
||||||
"ZFlag",
|
"ZFlag",
|
||||||
"ZIntegration",
|
|
||||||
"ZIntegration1",
|
|
||||||
"ZLive",
|
|
||||||
"ZLive1",
|
|
||||||
"ZNext",
|
"ZNext",
|
||||||
"ZSocialTeam",
|
"ZCanary",
|
||||||
"ZStudioInt1",
|
"ZIntegration",
|
||||||
"ZStudioInt2"
|
"ZAvatarTeam",
|
||||||
|
"ZSocialTeam"
|
||||||
};
|
};
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
@ -1,17 +1,15 @@
|
|||||||
using Bloxstrap.Enums;
|
using System;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Diagnostics;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Forms;
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
using CommunityToolkit.Mvvm.Input;
|
using CommunityToolkit.Mvvm.Input;
|
||||||
using System.Windows.Forms;
|
|
||||||
using Wpf.Ui.Mvvm.Interfaces;
|
|
||||||
using System.ComponentModel;
|
|
||||||
using Bloxstrap.Helpers;
|
using Bloxstrap.Helpers;
|
||||||
using Bloxstrap.Models;
|
using Bloxstrap.Models;
|
||||||
using System.Diagnostics;
|
|
||||||
|
|
||||||
namespace Bloxstrap.ViewModels
|
namespace Bloxstrap.ViewModels
|
||||||
{
|
{
|
||||||
@ -20,14 +18,13 @@ namespace Bloxstrap.ViewModels
|
|||||||
public event PropertyChangedEventHandler? PropertyChanged;
|
public event PropertyChangedEventHandler? PropertyChanged;
|
||||||
public void OnPropertyChanged(string propertyName) => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
public void OnPropertyChanged(string propertyName) => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||||
|
|
||||||
private IEnumerable<string> _channels = DeployManager.ChannelsAbstracted.Contains(App.Settings.Prop.Channel) ? DeployManager.ChannelsAbstracted : DeployManager.ChannelsAll;
|
private bool _manualChannelEntry = !DeployManager.SelectableChannels.Contains(App.Settings.Prop.Channel);
|
||||||
private bool _showAllChannels = !DeployManager.ChannelsAbstracted.Contains(App.Settings.Prop.Channel);
|
|
||||||
|
|
||||||
public ICommand BrowseInstallLocationCommand => new RelayCommand(BrowseInstallLocation);
|
public ICommand BrowseInstallLocationCommand => new RelayCommand(BrowseInstallLocation);
|
||||||
public ICommand OpenFolderCommand => new RelayCommand(OpenFolder);
|
public ICommand OpenFolderCommand => new RelayCommand(OpenFolder);
|
||||||
|
|
||||||
|
public DeployInfo? ChannelDeployInfo { get; private set; } = null;
|
||||||
public DeployInfo? ChannelDeployInfo { get; private set; } = null; //new DeployInfo(){ Version = "hi", VersionGuid = "hi", Timestamp = "January 25 2023 at 6:03:48 PM" };
|
public string ChannelInfoLoadingText { get; private set; } = null!;
|
||||||
|
|
||||||
public InstallationViewModel()
|
public InstallationViewModel()
|
||||||
{
|
{
|
||||||
@ -36,20 +33,32 @@ namespace Bloxstrap.ViewModels
|
|||||||
|
|
||||||
private async Task LoadChannelDeployInfo(string channel)
|
private async Task LoadChannelDeployInfo(string channel)
|
||||||
{
|
{
|
||||||
|
ChannelInfoLoadingText = "Fetching latest deploy info, please wait...";
|
||||||
|
OnPropertyChanged(nameof(ChannelInfoLoadingText));
|
||||||
|
|
||||||
ChannelDeployInfo = null;
|
ChannelDeployInfo = null;
|
||||||
OnPropertyChanged(nameof(ChannelDeployInfo));
|
OnPropertyChanged(nameof(ChannelDeployInfo));
|
||||||
|
|
||||||
App.DeployManager.SetChannel(channel);
|
App.DeployManager.SetChannel(channel);
|
||||||
ClientVersion info = await App.DeployManager.GetLastDeploy(true);
|
|
||||||
|
|
||||||
ChannelDeployInfo = new DeployInfo
|
try
|
||||||
{
|
{
|
||||||
Version = info.Version,
|
ClientVersion info = await App.DeployManager.GetLastDeploy(true);
|
||||||
VersionGuid = info.VersionGuid,
|
|
||||||
Timestamp = info.Timestamp?.ToString("dddd, d MMMM yyyy 'at' h:mm:ss tt", App.CultureFormat)!
|
|
||||||
};
|
|
||||||
|
|
||||||
OnPropertyChanged(nameof(ChannelDeployInfo));
|
ChannelDeployInfo = new DeployInfo
|
||||||
|
{
|
||||||
|
Version = info.Version,
|
||||||
|
VersionGuid = info.VersionGuid,
|
||||||
|
Timestamp = info.Timestamp?.ToString("dddd, d MMMM yyyy 'at' h:mm:ss tt", App.CultureFormat)!
|
||||||
|
};
|
||||||
|
|
||||||
|
OnPropertyChanged(nameof(ChannelDeployInfo));
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
ChannelInfoLoadingText = "Failed to get deploy info.\nIs the channel name valid?";
|
||||||
|
OnPropertyChanged(nameof(ChannelInfoLoadingText));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void BrowseInstallLocation()
|
private void BrowseInstallLocation()
|
||||||
@ -74,53 +83,36 @@ namespace Bloxstrap.ViewModels
|
|||||||
set => App.BaseDirectory = value;
|
set => App.BaseDirectory = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerable<string> Channels
|
public IEnumerable<string> Channels => DeployManager.SelectableChannels;
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
if (_channels == DeployManager.ChannelsAll && !_channels.Contains(App.Settings.Prop.Channel))
|
|
||||||
_channels = _channels.Append(App.Settings.Prop.Channel);
|
|
||||||
|
|
||||||
return _channels;
|
|
||||||
}
|
|
||||||
set => _channels = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public string Channel
|
public string Channel
|
||||||
{
|
{
|
||||||
get => App.Settings.Prop.Channel;
|
get => App.Settings.Prop.Channel;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
//Task.Run(() => GetChannelInfo(value));
|
|
||||||
Task.Run(() => LoadChannelDeployInfo(value));
|
Task.Run(() => LoadChannelDeployInfo(value));
|
||||||
App.Settings.Prop.Channel = value;
|
App.Settings.Prop.Channel = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool ShowAllChannels
|
public bool ManualChannelEntry
|
||||||
{
|
{
|
||||||
get => _showAllChannels;
|
get => _manualChannelEntry;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (value)
|
_manualChannelEntry = value;
|
||||||
{
|
|
||||||
Channels = DeployManager.ChannelsAll;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Channels = DeployManager.ChannelsAbstracted;
|
|
||||||
|
|
||||||
if (!Channels.Contains(Channel))
|
if (!value && !Channels.Contains(Channel))
|
||||||
{
|
Channel = DeployManager.DefaultChannel;
|
||||||
Channel = DeployManager.DefaultChannel;
|
|
||||||
OnPropertyChanged(nameof(Channel));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
OnPropertyChanged(nameof(Channels));
|
OnPropertyChanged(nameof(Channel));
|
||||||
|
OnPropertyChanged(nameof(ChannelComboBoxVisibility));
|
||||||
_showAllChannels = value;
|
OnPropertyChanged(nameof(ChannelTextBoxVisibility));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// cant use data bindings so i have to do whatever tf this is
|
||||||
|
public Visibility ChannelComboBoxVisibility => ManualChannelEntry ? Visibility.Collapsed : Visibility.Visible;
|
||||||
|
public Visibility ChannelTextBoxVisibility => ManualChannelEntry ? Visibility.Visible : Visibility.Collapsed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -59,7 +59,8 @@
|
|||||||
<TextBlock FontSize="14" Text="Channel" />
|
<TextBlock FontSize="14" Text="Channel" />
|
||||||
<TextBlock Margin="0,2,0,0" FontSize="12" Text="Choose which release channel to download Roblox from." Foreground="{DynamicResource TextFillColorTertiaryBrush}" />
|
<TextBlock Margin="0,2,0,0" FontSize="12" Text="Choose which release channel to download Roblox from." Foreground="{DynamicResource TextFillColorTertiaryBrush}" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<ComboBox Grid.Column="1" Margin="8,0,8,0" Padding="10,5,10,5" Width="200" ItemsSource="{Binding Channels, Mode=OneWay}" Text="{Binding Channel, Mode=TwoWay}" />
|
<ComboBox Grid.Column="1" Margin="8,0,8,0" Padding="10,5,10,5" Width="200" ItemsSource="{Binding Channels, Mode=OneWay}" Text="{Binding Channel, Mode=TwoWay}" Visibility="{Binding ChannelComboBoxVisibility, Mode=OneWay}" />
|
||||||
|
<ui:TextBox Grid.Column="1" Margin="8,0,8,0" Padding="10,5,10,5" Width="200" Text="{Binding Channel, Mode=TwoWay}" Visibility="{Binding ChannelTextBoxVisibility, Mode=OneWay}" />
|
||||||
</Grid>
|
</Grid>
|
||||||
</ui:CardExpander.Header>
|
</ui:CardExpander.Header>
|
||||||
<StackPanel>
|
<StackPanel>
|
||||||
@ -114,10 +115,10 @@
|
|||||||
<ColumnDefinition Width="*" />
|
<ColumnDefinition Width="*" />
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<ui:ProgressRing Grid.Column="0" Margin="6" IsIndeterminate="True" />
|
<ui:ProgressRing Grid.Column="0" Margin="6" IsIndeterminate="True" />
|
||||||
<TextBlock Grid.Column="1" Margin="16" VerticalAlignment="Center" Text="Fetching latest deploy info, please wait..." />
|
<TextBlock Grid.Column="1" Margin="16" VerticalAlignment="Center" Text="{Binding ChannelInfoLoadingText, Mode=OneWay}" />
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
<CheckBox Grid.Column="1" Margin="4,0,0,0" Content="Show all available channels" VerticalAlignment="Top" IsChecked="{Binding ShowAllChannels, Mode=TwoWay}" />
|
<CheckBox Grid.Column="1" Margin="4,0,0,0" Content="Manually enter channel name" VerticalAlignment="Top" IsChecked="{Binding ManualChannelEntry, Mode=TwoWay}" />
|
||||||
</Grid>
|
</Grid>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</ui:CardExpander>
|
</ui:CardExpander>
|
||||||
|
@ -135,7 +135,7 @@
|
|||||||
<ui:CardControl.Header>
|
<ui:CardControl.Header>
|
||||||
<StackPanel>
|
<StackPanel>
|
||||||
<TextBlock FontSize="14" Text="Use alternate graphics quality selector" />
|
<TextBlock FontSize="14" Text="Use alternate graphics quality selector" />
|
||||||
<TextBlock Margin="0,2,0,0" FontSize="12" Text="Toggle between using the consolidated 0-10 / fine-grained 0-21 graphics quality slider." Foreground="{DynamicResource TextFillColorTertiaryBrush}" />
|
<TextBlock Margin="0,2,0,0" FontSize="12" Text="Toggle between using the consolidated 1-10 / fine-grained 1-21 graphics quality slider." Foreground="{DynamicResource TextFillColorTertiaryBrush}" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</ui:CardControl.Header>
|
</ui:CardControl.Header>
|
||||||
<ui:ToggleSwitch IsChecked="{Binding AlternateGraphicsSelectorEnabled, Mode=TwoWay}" />
|
<ui:ToggleSwitch IsChecked="{Binding AlternateGraphicsSelectorEnabled, Mode=TwoWay}" />
|
||||||
|
Loading…
Reference in New Issue
Block a user