Initial Checkin
This commit is contained in:
25
Organizer.sln
Normal file
25
Organizer.sln
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
|
# Visual Studio Version 16
|
||||||
|
VisualStudioVersion = 16.0.31205.134
|
||||||
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Organizer", "Organizer\Organizer.csproj", "{51AFE729-134D-4EB5-91CE-95DD4565B4FE}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
Release|Any CPU = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{51AFE729-134D-4EB5-91CE-95DD4565B4FE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{51AFE729-134D-4EB5-91CE-95DD4565B4FE}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{51AFE729-134D-4EB5-91CE-95DD4565B4FE}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{51AFE729-134D-4EB5-91CE-95DD4565B4FE}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
|
HideSolutionNode = FALSE
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
|
SolutionGuid = {95F696C9-76B6-4E34-82E9-D96FCFF58A9D}
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
||||||
9
Organizer/App.xaml
Normal file
9
Organizer/App.xaml
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
<Application x:Class="Organizer.App"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:local="clr-namespace:Organizer"
|
||||||
|
StartupUri="MainWindow.xaml">
|
||||||
|
<Application.Resources>
|
||||||
|
|
||||||
|
</Application.Resources>
|
||||||
|
</Application>
|
||||||
15
Organizer/App.xaml.cs
Normal file
15
Organizer/App.xaml.cs
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Configuration;
|
||||||
|
using System.Data;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
|
|
||||||
|
namespace Organizer {
|
||||||
|
/// <summary>
|
||||||
|
/// Interaction logic for App.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class App : Application {
|
||||||
|
}
|
||||||
|
}
|
||||||
10
Organizer/AssemblyInfo.cs
Normal file
10
Organizer/AssemblyInfo.cs
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
using System.Windows;
|
||||||
|
|
||||||
|
[assembly: ThemeInfo(
|
||||||
|
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
|
||||||
|
//(used if a resource is not found in the page,
|
||||||
|
// or application resource dictionaries)
|
||||||
|
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
|
||||||
|
//(used if a resource is not found in the page,
|
||||||
|
// app, or any theme specific resource dictionaries)
|
||||||
|
)]
|
||||||
28
Organizer/MainWindow.xaml
Normal file
28
Organizer/MainWindow.xaml
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
<Window x:Class="Organizer.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:Organizer"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
Title="MainWindow" Height="741" Width="1340">
|
||||||
|
<Grid>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="400"/>
|
||||||
|
<ColumnDefinition Width="150"/>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="*"></RowDefinition>
|
||||||
|
<RowDefinition Height="260"></RowDefinition>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<ListBox x:Name="tags" SelectionChanged="tags_SelectionChanged" SelectionMode="Extended" Grid.Column="0" Grid.RowSpan="2" />
|
||||||
|
<ListBox x:Name="dates" SelectionChanged="dates_SelectionChanged" SelectionMode="Extended" Grid.Column="1" Grid.RowSpan="2" />
|
||||||
|
<ListBox x:Name="allFiles" Grid.Row="0" Grid.Column="2" SelectionChanged="allFiles_SelectionChanged" />
|
||||||
|
|
||||||
|
<Button x:Name="rename" Grid.Row="1" Grid.Column="2" Content="Rename" HorizontalAlignment="Right" Height="50" VerticalAlignment="Top" Width="190" Click="rename_Click" Visibility="Hidden"/>
|
||||||
|
<TextBox x:Name="renNewName" Grid.Row="1" Grid.Column="2" HorizontalAlignment="Left" Height="20" VerticalAlignment="Top" TextChanged="renameNewName_TextChanged" Visibility="Hidden"/>
|
||||||
|
<Image x:Name="preview" Grid.Row="1" Grid.Column="2" HorizontalAlignment="Left" Height="239" VerticalAlignment="Bottom" Width="410"/>
|
||||||
|
<Button x:Name="open" Grid.Row="1" Grid.Column="2" Content="Open" HorizontalAlignment="Right" Height="50" VerticalAlignment="Bottom" Width="190" Click="open_Click" />
|
||||||
|
</Grid>
|
||||||
|
</Window>
|
||||||
137
Organizer/MainWindow.xaml.cs
Normal file
137
Organizer/MainWindow.xaml.cs
Normal file
@@ -0,0 +1,137 @@
|
|||||||
|
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.Navigation;
|
||||||
|
using System.Windows.Shapes;
|
||||||
|
using System.IO;
|
||||||
|
using Microsoft.WindowsAPICodePack.Shell;
|
||||||
|
using System.Diagnostics;
|
||||||
|
|
||||||
|
namespace Organizer {
|
||||||
|
/// <summary>
|
||||||
|
/// Interaction logic for MainWindow.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class MainWindow : Window {
|
||||||
|
|
||||||
|
string tgtDir = ".\\"; //"C:\\Users\\U15020\\Kimberly-Clark\\RGM Analytics Battle - RGM Advanced Analytics\\Recordings\\";
|
||||||
|
string searchPattern = "*.mp4";
|
||||||
|
List<DateTime> filterDates = null;
|
||||||
|
List<string> filterTags = null;
|
||||||
|
|
||||||
|
public MainWindow() {
|
||||||
|
InitializeComponent();
|
||||||
|
filterDates = new List<DateTime>();
|
||||||
|
filterTags = new List<string>();
|
||||||
|
reloadDir(tgtDir);
|
||||||
|
this.dates.SelectAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void reloadDir(string directory) {
|
||||||
|
string[] allDirFiles = null;
|
||||||
|
allDirFiles = Directory.GetFiles(directory, searchPattern);
|
||||||
|
|
||||||
|
List<SingleFile> allFileNames=new List<SingleFile>();
|
||||||
|
List<string> allTags = new List<string>();
|
||||||
|
List<DateTime> allDates = new List<DateTime>();
|
||||||
|
|
||||||
|
foreach (string theFile in allDirFiles) {
|
||||||
|
SingleFile singleFile=new SingleFile(theFile);
|
||||||
|
foreach(string theTag in singleFile.allTags) {
|
||||||
|
if (!allTags.Contains(theTag)) {
|
||||||
|
allTags.Add(theTag);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!allDates.Contains(singleFile.date)) {
|
||||||
|
allDates.Add(singleFile.date);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool tagMatch = true;
|
||||||
|
foreach (string theTag in filterTags) {
|
||||||
|
if (!singleFile.allTags.Contains(theTag)) {
|
||||||
|
tagMatch = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (filterDates.Contains(singleFile.date) && (tagMatch)) {
|
||||||
|
allFileNames.Add(singleFile);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.allFiles.ItemsSource = allFileNames;
|
||||||
|
allTags.Sort();
|
||||||
|
allDates.Sort();
|
||||||
|
this.tags.ItemsSource = allTags;
|
||||||
|
this.dates.ItemsSource = allDates;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void dates_SelectionChanged(object sender, SelectionChangedEventArgs e) {
|
||||||
|
filterDates.Clear();
|
||||||
|
foreach (DateTime theDate in this.dates.SelectedItems) {
|
||||||
|
filterDates.Add(theDate);
|
||||||
|
}
|
||||||
|
reloadDir(tgtDir);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void tags_SelectionChanged(object sender, SelectionChangedEventArgs e) {
|
||||||
|
filterTags.Clear();
|
||||||
|
foreach (string theDate in this.tags.SelectedItems) {
|
||||||
|
filterTags.Add(theDate);
|
||||||
|
}
|
||||||
|
reloadDir(tgtDir);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void allFiles_SelectionChanged(object sender, SelectionChangedEventArgs e) {
|
||||||
|
SingleFile selectedFile = (SingleFile) this.allFiles.SelectedItem;
|
||||||
|
if (selectedFile != null) {
|
||||||
|
this.preview.Source = ShellFile.FromFilePath(selectedFile.fileFullName).Thumbnail.BitmapSource;
|
||||||
|
|
||||||
|
this.rename.Visibility= Visibility.Hidden;
|
||||||
|
this.renNewName.Visibility = Visibility.Hidden;
|
||||||
|
|
||||||
|
if (selectedFile.isInvalid) {
|
||||||
|
this.renNewName.Text = selectedFile.fileBaseName;
|
||||||
|
|
||||||
|
this.rename.IsEnabled = false;
|
||||||
|
this.rename.Visibility = Visibility.Visible;
|
||||||
|
this.renNewName.Visibility = Visibility.Visible;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void open_Click(object sender, RoutedEventArgs e) {
|
||||||
|
SingleFile selectedFile = (SingleFile)this.allFiles.SelectedItem;
|
||||||
|
if (selectedFile != null) {
|
||||||
|
var p = new Process();
|
||||||
|
p.StartInfo = new ProcessStartInfo(selectedFile.fileFullName) {
|
||||||
|
UseShellExecute = true
|
||||||
|
};
|
||||||
|
p.Start();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void rename_Click(object sender, RoutedEventArgs e) {
|
||||||
|
SingleFile selectedFile = (SingleFile)this.allFiles.SelectedItem;
|
||||||
|
string newFileName = tgtDir + this.renNewName.Text;
|
||||||
|
System.IO.File.Move(selectedFile.fileFullName, newFileName);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void renameNewName_TextChanged(object sender, TextChangedEventArgs e) {
|
||||||
|
if (!(new SingleFile(this.renNewName.Text).isInvalid)) {
|
||||||
|
this.rename.IsEnabled = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
18
Organizer/Organizer.csproj
Normal file
18
Organizer/Organizer.csproj
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<OutputType>WinExe</OutputType>
|
||||||
|
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||||
|
<UseWPF>true</UseWPF>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
|
||||||
|
<DebugType>none</DebugType>
|
||||||
|
<DebugSymbols>false</DebugSymbols>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Microsoft-WindowsAPICodePack-Shell" Version="1.1.4" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
8
Organizer/Properties/launchSettings.json
Normal file
8
Organizer/Properties/launchSettings.json
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"profiles": {
|
||||||
|
"Organizer": {
|
||||||
|
"commandName": "Project",
|
||||||
|
"workingDirectory": "C:\\Users\\U15020\\Kimberly-Clark\\RGM Analytics Battle - RGM Advanced Analytics\\Recordings"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
35
Organizer/SingleFile.cs
Normal file
35
Organizer/SingleFile.cs
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace Organizer {
|
||||||
|
class SingleFile {
|
||||||
|
public string fileFullName;
|
||||||
|
public string fileBaseName;
|
||||||
|
public DateTime date;
|
||||||
|
public List<string> allTags;
|
||||||
|
public string description;
|
||||||
|
public Boolean isInvalid;
|
||||||
|
|
||||||
|
public SingleFile(string fullFileName) {
|
||||||
|
fileFullName = fullFileName;
|
||||||
|
fileBaseName = System.IO.Path.GetFileName(fullFileName);
|
||||||
|
try {
|
||||||
|
isInvalid = false;
|
||||||
|
string[] mainSplit = fileBaseName.Split("_");
|
||||||
|
date = DateTime.Parse(mainSplit[0]);
|
||||||
|
allTags = new List<string>();
|
||||||
|
foreach (string singleTag in mainSplit[1].Split("-")) {
|
||||||
|
allTags.Add(singleTag);
|
||||||
|
}
|
||||||
|
description = mainSplit[2];
|
||||||
|
} catch (Exception ex) {
|
||||||
|
isInvalid = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string ToString() {
|
||||||
|
return fileBaseName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user