Skip to content

Commit

Permalink
Fixed #20, small changes to debug console; release 0.0.4.147 ready
Browse files Browse the repository at this point in the history
  • Loading branch information
BlackTasty committed Dec 25, 2018
1 parent 9a11c61 commit b4bb4ba
Show file tree
Hide file tree
Showing 14 changed files with 396 additions and 15 deletions.
Binary file modified Installer/Resources/Runtime.zip
Binary file not shown.
11 changes: 11 additions & 0 deletions Osmo/ConsoleWindow.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<Window x:Class="Osmo.ConsoleWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:Osmo"
xmlns:ui="clr-namespace:Osmo.UI"
mc:Ignorable="d"
Title="Console" Height="450" Width="800" WindowStyle="None" Loaded="Window_Loaded" Closing="Window_Closing">
<ui:DebugConsole IsWindowMode="True"/>
</Window>
38 changes: 38 additions & 0 deletions Osmo/ConsoleWindow.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
using Osmo.UI;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace Osmo
{
/// <summary>
/// Interaction logic for ConsoleWindow.xaml
/// </summary>
public partial class ConsoleWindow : Window
{
public ConsoleWindow()
{
InitializeComponent();
}

private void Window_Loaded(object sender, RoutedEventArgs e)
{
DebugConsole.Instance.Visibility = Visibility.Collapsed;
}

private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
DebugConsole.Instance.Visibility = Visibility.Visible;
}
}
}
2 changes: 1 addition & 1 deletion Osmo/Core/Configuration/ProfileManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ public AppConfiguration GetProfileByName(string profileName)
{
if (!string.IsNullOrWhiteSpace(profileName))
{
return Profiles.FirstOrDefault(x => x.ProfileName?.Equals(profileName) ?? false);
return Profiles.FirstOrDefault(x => x.ProfileName?.Equals(profileName, StringComparison.CurrentCultureIgnoreCase) ?? false);
}
else
{
Expand Down
54 changes: 54 additions & 0 deletions Osmo/Core/ConsoleHistory.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
using System.Collections.Generic;

namespace Osmo.Core
{
class ConsoleHistory
{
private List<string> history;
private int capacity;
private int index = -1;

public ConsoleHistory(int capacity)
{
this.capacity = capacity;
history = new List<string>(capacity);
}

public void Push(string command)
{
history.Insert(0, command);
index = -1;

if (history.Count > capacity)
history.RemoveAt(capacity - 1);
}

public string Peek(bool isUp)
{
if (isUp)
{
if (index < history.Count - 1)
index++;


if (index > -1)
return history[index];
else
return "";
}
else
{
if (index > 0)
{
index--;
return history[index];
}
else
{
index = -1;
return "";
}
}
}
}
}
9 changes: 5 additions & 4 deletions Osmo/Core/FixedValues.cs
Original file line number Diff line number Diff line change
Expand Up @@ -173,13 +173,14 @@ internal static void InitializeReader()
Logger.Instance.WriteLog("Skin element details loaded!");
}

//The index refers to the position inside the sidebar
internal const int WIZARD_INDEX = 1;
internal const int EDITOR_INDEX = 2;
internal const int MIXER_INDEX = 3;
internal const int CONFIG_INDEX = 6;
internal const int ABOUT_INDEX = 7;
internal const int TEMPLATE_EDITOR_INDEX = 8;
internal const int RESIZE_TOOL_INDEX = 20;
internal const int RESIZE_TOOL_INDEX = 5;
internal const int TEMPLATE_EDITOR_INDEX = 7;
internal const int CONFIG_INDEX = 8;
internal const int ABOUT_INDEX = 9;

internal const string LOCAL_FILENAME = "Runtime.zip";

Expand Down
1 change: 1 addition & 0 deletions Osmo/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -495,6 +495,7 @@ private void console_IsVisibleChanged(object sender, DependencyPropertyChangedEv
if ((bool)e.NewValue == true)
{
MinHeight += 200;
console.Height = 200;
}
else
{
Expand Down
9 changes: 9 additions & 0 deletions Osmo/Osmo.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,10 @@
<Reference Include="PresentationFramework" />
</ItemGroup>
<ItemGroup>
<Page Include="ConsoleWindow.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Controls\ModeProgressImage.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
Expand Down Expand Up @@ -168,6 +172,9 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Compile Include="ConsoleWindow.xaml.cs">
<DependentUpon>ConsoleWindow.xaml</DependentUpon>
</Compile>
<Compile Include="Controls\ModeProgressImage.xaml.cs">
<DependentUpon>ModeProgressImage.xaml</DependentUpon>
</Compile>
Expand Down Expand Up @@ -196,6 +203,7 @@
<Compile Include="Core\Configuration\ProfileEventArgs.cs" />
<Compile Include="Core\Configuration\ProfileRenamedEventArgs.cs" />
<Compile Include="Core\Configuration\RecallConfiguration.cs" />
<Compile Include="Core\ConsoleHistory.cs" />
<Compile Include="Core\DialogHelper.cs" />
<Compile Include="Core\ExtensionMethods.cs" />
<Compile Include="Core\FileExplorer\ClassicEntry.cs" />
Expand Down Expand Up @@ -468,6 +476,7 @@
<Content Include="bass.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Resource Include="Resources\ConsoleCommands.txt" />
<Resource Include="Resources\mode_ctb.png" />
<Resource Include="Resources\mode_mania.png" />
<Resource Include="Resources\mode_osu.png" />
Expand Down
4 changes: 2 additions & 2 deletions Osmo/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.0.4.140")]
[assembly: AssemblyFileVersion("0.0.4.140")]
[assembly: AssemblyVersion("0.0.4.147")]
[assembly: AssemblyFileVersion("0.0.4.147")]
21 changes: 21 additions & 0 deletions Osmo/Properties/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions Osmo/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -172,4 +172,7 @@
<data name="mode_taiko" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\mode_taiko.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="ConsoleCommands" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\ConsoleCommands.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252</value>
</data>
</root>
16 changes: 16 additions & 0 deletions Osmo/Resources/ConsoleCommands.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
=== Console stuff
clear Clears the console
testMessages Writes all types of messages into the console

=== Log management ===
wipeLog Delete the log.txt and generate a new one
wipeCrashLogs Delete all crash logs
wipeLogFolder Delete all logs inside the "Logs" folder
openLog Open the log.txt in your default editor

=== Configuration files
listProfiles Return a list of all profile names
printConfig Print the configuration for the current profile into the console
printConfig [ProfileName] Print the configuration for a specific profile into the console
openConfig Open the configuration for the current profile in your default editor
openConfig [ProfileName] Open the configuration for a specific profile in your default editor
20 changes: 18 additions & 2 deletions Osmo/UI/DebugConsole.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,28 @@
<Grid.RowDefinitions>
<RowDefinition Height="30"/>
<RowDefinition/>
<RowDefinition Height="33"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>

</Grid.ColumnDefinitions>
<TextBlock Text="Console" Style="{StaticResource MaterialDesignSubheadingTextBlock}" VerticalAlignment="Center" Margin="8,0"/>
<Button Padding="0" Width="22" HorizontalAlignment="Right" IsEnabled="{Binding PlayEnabled}" Foreground="{DynamicResource MaterialDesignBody}"
ToolTip="Close animation helper" Click="CloseConsole_Click" Background="{x:Null}" BorderBrush="{x:Null}"
<Button Padding="0" Width="22" Height="22" HorizontalAlignment="Right" IsEnabled="{Binding PlayEnabled}" Foreground="{DynamicResource MaterialDesignBody}"
ToolTip="Close console" Click="CloseConsole_Click" Background="{x:Null}" BorderBrush="{x:Null}"
Margin="8,0">
<material:PackIcon
Kind="Close"
Height="22"
Width="22" />
</Button>
<Button Padding="0" Visibility="Hidden" Width="22" Height="22" HorizontalAlignment="Right" IsEnabled="{Binding PlayEnabled}" Foreground="{DynamicResource MaterialDesignBody}"
ToolTip="Popout console" Click="Popout_Click" Background="{x:Null}" BorderBrush="{x:Null}"
Margin="46,0">
<material:PackIcon
Kind="WindowMaximize"
Height="22"
Width="22" />
</Button>
<RichTextBox x:Name="rtb_sessionLog" Grid.Row="1" IsReadOnly="True" BorderThickness="0"
FontFamily="pack://application:,,,/Osmo;component/Resources/#Inconsolata"
TextChanged="rtb_sessionLog_TextChanged" AllowDrop="False" VerticalScrollBarVisibility="Auto">
Expand All @@ -33,5 +42,12 @@
</Style>
</RichTextBox.Resources>
</RichTextBox>
<DockPanel Grid.Row="2" Background="{DynamicResource ControlBackgroundBrush}">
<TextBlock Text=">" DockPanel.Dock="Left" VerticalAlignment="Center" Margin="8,0,8,8"
FontFamily="pack://application:,,,/Osmo;component/Resources/#Inconsolata"/>
<TextBox x:Name="txt_cmd" HorizontalAlignment="Stretch" material:HintAssist.Hint="help for all commands" Margin="0,0,8,8"
PreviewKeyDown="TextBox_KeyDown"
FontFamily="pack://application:,,,/Osmo;component/Resources/#Inconsolata"/>
</DockPanel>
</Grid>
</Border>
Loading

0 comments on commit b4bb4ba

Please sign in to comment.