Skip to content
This repository has been archived by the owner on Sep 16, 2022. It is now read-only.

Commit

Permalink
Loading open source
Browse files Browse the repository at this point in the history
  • Loading branch information
Akkihi committed Jul 4, 2019
1 parent 50898d4 commit 4b6b695
Show file tree
Hide file tree
Showing 18 changed files with 852 additions and 0 deletions.
6 changes: 6 additions & 0 deletions App.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
</configuration>
9 changes: 9 additions & 0 deletions App.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<Application x:Class="osu_akuboplayer.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:osu_akuboplayer"
StartupUri="MainWindow.xaml">
<Application.Resources>

</Application.Resources>
</Application>
17 changes: 17 additions & 0 deletions App.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;

namespace osu_akuboplayer
{
/// <summary>
/// Логика взаимодействия для App.xaml
/// </summary>
public partial class App : Application
{
}
}
25 changes: 25 additions & 0 deletions MainWindow.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<Window x:Class="osu_akuboplayer.MainWindow"
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:osu_akuboplayer"
mc:Ignorable="d"
Title="osu! Akubo Player" Height="450" Width="800">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<ListBox x:Name="Playlist" HorizontalAlignment="Left" Height="262" Margin="10,57,0,0" VerticalAlignment="Top" Width="512" SelectionChanged="ListBox_SelectionChanged" FontSize="14"/>
<Button x:Name="Import" Content="Import" HorizontalAlignment="Left" Margin="710,10,0,0" VerticalAlignment="Top" Width="75" Click="Import_Click" Height="20"/>
<TextBox x:Name="Search" HorizontalAlignment="Left" Height="23" Margin="58,10,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="464" AutomationProperties.Name="Search" TextChanged="Search_TextChanged" IsEnabled="False"/>
<Button x:Name="PlaySong" Content="Play" HorizontalAlignment="Left" Margin="541,57,0,0" VerticalAlignment="Top" Width="64" Height="32" Click="PlaySong_Click" FontSize="14"/>
<Button x:Name="StopSong" Content="Stop" HorizontalAlignment="Left" Margin="541,101,0,0" VerticalAlignment="Top" Width="64" Height="32" Click="StopSong_Click" FontSize="14"/>
<TextBlock x:Name="NowLengh" HorizontalAlignment="Left" Margin="10,324,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Height="19" Width="64"/>
<TextBlock x:Name="MaxLengh" HorizontalAlignment="Left" Margin="99,324,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Height="19" Width="64" RenderTransformOrigin="-0.172,1.368"/>
<Slider x:Name="sliderlengh" HorizontalAlignment="Left" Margin="10,359,0,0" VerticalAlignment="Top" Width="512" Value="11" Maximum="100000" ValueChanged="Sliderlengh_ValueChanged" SmallChange="0" TickFrequency="0" Height="18"/>
<Slider x:Name="SliderVol" HorizontalAlignment="Left" Margin="564,298,0,0" VerticalAlignment="Top" Orientation="Vertical" Height="79" ValueChanged="Slider_ValueChanged" Maximum="100" Value="75" Width="18"/>
<TextBlock HorizontalAlignment="Left" Margin="58,12,0,0" TextWrapping="Wrap" Text="Search, now working yet." VerticalAlignment="Top" Height="18" Width="245" FontSize="14" IsEnabled="False"/>

</Grid>
</Window>
143 changes: 143 additions & 0 deletions MainWindow.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
using System;
using System.Collections.Generic;
using System.IO;
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.Navigation;
using System.Windows.Shapes;
using System.Windows.Forms;
using osu_akuboplayer.Properties;
using static System.Windows.Controls.DockPanel;
using System.Windows.Threading;
using System.Timers;

namespace osu_akuboplayer
{
/// <summary>
/// Логика взаимодействия для MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public static FolderBrowserDialog fbd = new FolderBrowserDialog();
public MainWindow()
{

InitializeComponent();
DispatcherTimer timer = new DispatcherTimer();
}

public static string path = fbd.SelectedPath + @"\Songs";
private void Import_Click(object sender, RoutedEventArgs e)
{



System.Windows.Forms.MessageBox.Show("Choose the path");



if (fbd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
Playlist.Items.Clear();
System.Windows.Forms.MessageBox.Show(fbd.SelectedPath);

DirectoryInfo dirInfo = new DirectoryInfo(fbd.SelectedPath);

var Song = new Song(dirInfo);






//Playlist.Items.Add(Song.Artist + " - " + Song.Title);
for (int i = 0; i < Song.Files.Count; i++)
{
Playlist.Items.Add(Song.Files[i]); //(Song.Artist + " - " + Song.Title);

}

}


}

private void ListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
{

}

private void Search_TextChanged(object sender, TextChangedEventArgs e)
{
{
string txtOrig = Search.Text;

Playlist.FindName(txtOrig);

}
}

DispatcherTimer timer = new DispatcherTimer();


private void PlaySong_Click(object sender, RoutedEventArgs e)
{
if((Playlist.Items.Count != 0) && (Playlist.SelectedIndex != -1))
{
string current = Song.mp3[Playlist.SelectedIndex];
Player.Play(current, Player.Volume);
DispatcherTimer timer = new DispatcherTimer();
timer.Start();


NowLengh.Text = TimeSpan.FromSeconds(Player.GetOfPosTrack(Player.Stream)).ToString();
MaxLengh.Text = TimeSpan.FromSeconds(Player.GetTimeStream(Player.Stream)).ToString();
sliderlengh.Value = Player.GetOfPosTrack(Player.Stream);
sliderlengh.Maximum = Player.GetTimeStream(Player.Stream);
timer.Tick += new EventHandler(timer_Tick);






}
}

private void StopSong_Click(object sender, RoutedEventArgs e)
{
timer.Stop();
Player.Stop();
MaxLengh.Text = "Stopped";
sliderlengh.Value = 0;

}

private void Sliderlengh_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
{
//Player.PosScroll(Player.Stream, Player.GetOfPosTrack(Player.Stream));
}
public static double mili;
private void timer_Tick(object sender, EventArgs e)
{

mili = 1;
timer.Interval = TimeSpan.FromMilliseconds(mili);
NowLengh.Text = TimeSpan.FromSeconds(Player.GetOfPosTrack(Player.Stream)).ToString();
sliderlengh.Value = Player.GetOfPosTrack(Player.Stream);
}

private void Slider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
{
Player.SetVolumeToStream(Player.Stream, (int)SliderVol.Value);
}
}
}
55 changes: 55 additions & 0 deletions Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Windows;

// Общие сведения об этой сборке предоставляются следующим набором
// набор атрибутов. Измените значения этих атрибутов, чтобы изменить сведения,
// связанные со сборкой.
[assembly: AssemblyTitle("osu_akuboplayer")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("osu_akuboplayer")]
[assembly: AssemblyCopyright("Copyright © 2019")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// Установка значения False для параметра ComVisible делает типы в этой сборке невидимыми
// для компонентов COM. Если необходимо обратиться к типу в этой сборке через
// из модели COM, установите атрибут ComVisible для этого типа в значение true.
[assembly: ComVisible(false)]

//Чтобы начать создание локализуемых приложений, задайте
//<UICulture>CultureYouAreCodingWith</UICulture> в файле .csproj
//в <PropertyGroup>. Например, при использовании английского (США)
//в своих исходных файлах установите <UICulture> в en-US. Затем отмените преобразование в комментарий
//атрибута NeutralResourceLanguage ниже. Обновите "en-US" в
//строка внизу для обеспечения соответствия настройки UICulture в файле проекта.

//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]


[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //где расположены словари ресурсов по конкретным тематикам
//(используется, если ресурс не найден на странице,
// или в словарях ресурсов приложения)
ResourceDictionaryLocation.SourceAssembly //где расположен словарь универсальных ресурсов
//(используется, если ресурс не найден на странице,
// в приложении или в каких-либо словарях ресурсов для конкретной темы)
)]


// Сведения о версии для сборки включают четыре следующих значения:
//
// Основной номер версии
// Дополнительный номер версии
// Номер сборки
// Номер редакции
//
// Можно задать все значения или принять номера сборки и редакции по умолчанию
// используя "*", как показано ниже:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
71 changes: 71 additions & 0 deletions Properties/Resources.Designer.cs

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

Loading

0 comments on commit 4b6b695

Please sign in to comment.