From c31fd4fdc83fc7bb378ec0a7ed18bb9a89d4baba Mon Sep 17 00:00:00 2001 From: raylu Date: Sun, 14 Jun 2015 00:49:51 -0700 Subject: handle doubleclick, reload root --- .gitattributes | 17 ++++++ .gitignore | 56 +++++++++++++++++++ App.config | 6 ++ App.xaml | 8 +++ App.xaml.cs | 15 +++++ MainWindow.xaml | 13 +++++ MainWindow.xaml.cs | 91 ++++++++++++++++++++++++++++++ Properties/AssemblyInfo.cs | 55 ++++++++++++++++++ Properties/Resources.Designer.cs | 62 +++++++++++++++++++++ Properties/Resources.resx | 117 +++++++++++++++++++++++++++++++++++++++ Properties/Settings.Designer.cs | 26 +++++++++ Properties/Settings.settings | 7 +++ ftpmpv.csproj | 104 ++++++++++++++++++++++++++++++++++ ftpmpv.sln | 22 ++++++++ 14 files changed, 599 insertions(+) create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 App.config create mode 100644 App.xaml create mode 100644 App.xaml.cs create mode 100644 MainWindow.xaml create mode 100644 MainWindow.xaml.cs create mode 100644 Properties/AssemblyInfo.cs create mode 100644 Properties/Resources.Designer.cs create mode 100644 Properties/Resources.resx create mode 100644 Properties/Settings.Designer.cs create mode 100644 Properties/Settings.settings create mode 100644 ftpmpv.csproj create mode 100644 ftpmpv.sln diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..bdb0cab --- /dev/null +++ b/.gitattributes @@ -0,0 +1,17 @@ +# Auto detect text files and perform LF normalization +* text=auto + +# Custom for Visual Studio +*.cs diff=csharp + +# Standard to msysgit +*.doc diff=astextplain +*.DOC diff=astextplain +*.docx diff=astextplain +*.DOCX diff=astextplain +*.dot diff=astextplain +*.DOT diff=astextplain +*.pdf diff=astextplain +*.PDF diff=astextplain +*.rtf diff=astextplain +*.RTF diff=astextplain diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4da7fb7 --- /dev/null +++ b/.gitignore @@ -0,0 +1,56 @@ +# User-specific files +*.suo +*.user +*.userosscache +*.sln.docstates + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +build/ +bld/ +[Bb]in/ +[Oo]bj/ + +# Visual Studio 2015 cache/options directory +.vs/ + +*_i.c +*_p.c +*_i.h +*.ilk +*.meta +*.obj +*.pch +*.pdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# The packages folder can be ignored because of Package Restore +**/packages/* +# except build/, which is used as an MSBuild target. +!**/packages/build/ + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!*.[Cc]ache/ diff --git a/App.config b/App.config new file mode 100644 index 0000000..8e15646 --- /dev/null +++ b/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/App.xaml b/App.xaml new file mode 100644 index 0000000..2e62976 --- /dev/null +++ b/App.xaml @@ -0,0 +1,8 @@ + + + + + diff --git a/App.xaml.cs b/App.xaml.cs new file mode 100644 index 0000000..fb836fc --- /dev/null +++ b/App.xaml.cs @@ -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 ftpmpv { + /// + /// Interaction logic for App.xaml + /// + public partial class App : Application { + } +} diff --git a/MainWindow.xaml b/MainWindow.xaml new file mode 100644 index 0000000..4f5e72d --- /dev/null +++ b/MainWindow.xaml @@ -0,0 +1,13 @@ + + + + + + + + + + diff --git a/MainWindow.xaml.cs b/MainWindow.xaml.cs new file mode 100644 index 0000000..380b3cc --- /dev/null +++ b/MainWindow.xaml.cs @@ -0,0 +1,91 @@ +using System; +using System.IO; +using System.Net; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Input; + +namespace ftpmpv { + public partial class MainWindow : Window { + string currentPath; + + public MainWindow() { + InitializeComponent(); + } + + private void Window_Loaded(object sender, RoutedEventArgs e) { + TreeViewItem tvi = new TreeViewItem() {Header = "/"}; + dirs.Items.Add(tvi); + listDir("/", tvi); + } + + void listDir(string path, TreeViewItem tree) { + FtpWebRequest request = (FtpWebRequest)WebRequest.Create("ftp://xis" + path); + request.Method = WebRequestMethods.Ftp.ListDirectoryDetails; + FtpWebResponse response = (FtpWebResponse)request.GetResponse(); + StreamReader sr = new StreamReader(response.GetResponseStream()); + + files.Items.Clear(); + tree.Items.Clear(); + + while (true) { + string line = sr.ReadLine(); + if (line == null || line.Length == 0) + break; + string[] split = line.Split(new char[]{' '}, 9, StringSplitOptions.RemoveEmptyEntries); + + string mode = split[0]; + string name = split[8]; + if (mode[0] == 'd') { + TreeViewItem tvi = new TreeViewItem() {Header = name}; + tree.Items.Add(tvi); + } else + files.Items.Add(name); + } + + tree.ExpandSubtree(); + currentPath = path; + } + + private void dirs_KeyUp(object sender, KeyEventArgs e) { + if (e.Key == Key.Enter) + dirsActivate(); + } + + private void dirs_MouseDoubleClick(object sender, MouseButtonEventArgs e) { + dirsActivate(); + } + + private void dirsActivate() { + TreeViewItem tvi = (TreeViewItem)dirs.SelectedItem; + + string path = ""; + TreeViewItem cur = tvi; + while (true) { + path = "/" + (string)cur.Header + path; + if (cur.Parent != null && cur.Parent.GetType() == typeof(TreeViewItem)) + cur = (TreeViewItem)cur.Parent; + else + break; + } + path += "/"; + + listDir(path, tvi); + } + + private void files_KeyUp(object sender, KeyEventArgs e) { + if (e.Key == Key.Enter) + filesActivate(); + } + + private void files_MouseDoubleClick(object sender, MouseButtonEventArgs e) { + filesActivate(); + } + + private void filesActivate() { + string filename = (string)files.SelectedItem; + Console.WriteLine("ftp://xis" + currentPath + filename); + System.Diagnostics.Process.Start(@"D:\PRGMs\mpv\mpv.exe", "\"ftp://xis" + currentPath + filename + "\""); + } + } +} diff --git a/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..9a756d7 --- /dev/null +++ b/Properties/AssemblyInfo.cs @@ -0,0 +1,55 @@ +using System.Reflection; +using System.Resources; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Windows; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("ftpmpv")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("ftpmpv")] +[assembly: AssemblyCopyright("Copyright © 2015")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +//In order to begin building localizable applications, set +//CultureYouAreCodingWith in your .csproj file +//inside a . For example, if you are using US english +//in your source files, set the to en-US. Then uncomment +//the NeutralResourceLanguage attribute below. Update the "en-US" in +//the line below to match the UICulture setting in the project file. + +//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] + + +[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) +)] + + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// 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("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Properties/Resources.Designer.cs b/Properties/Resources.Designer.cs new file mode 100644 index 0000000..ad8f366 --- /dev/null +++ b/Properties/Resources.Designer.cs @@ -0,0 +1,62 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.34209 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace ftpmpv.Properties { + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if ((resourceMan == null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ftpmpv.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + } +} diff --git a/Properties/Resources.resx b/Properties/Resources.resx new file mode 100644 index 0000000..af7dbeb --- /dev/null +++ b/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/Properties/Settings.Designer.cs b/Properties/Settings.Designer.cs new file mode 100644 index 0000000..d239c1f --- /dev/null +++ b/Properties/Settings.Designer.cs @@ -0,0 +1,26 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.34209 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace ftpmpv.Properties { + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default { + get { + return defaultInstance; + } + } + } +} diff --git a/Properties/Settings.settings b/Properties/Settings.settings new file mode 100644 index 0000000..033d7a5 --- /dev/null +++ b/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/ftpmpv.csproj b/ftpmpv.csproj new file mode 100644 index 0000000..200ddd4 --- /dev/null +++ b/ftpmpv.csproj @@ -0,0 +1,104 @@ + + + + + Debug + AnyCPU + {E1E35EB6-9B62-43CA-8E8B-C4521A4B52BD} + WinExe + Properties + ftpmpv + ftpmpv + v4.5 + 512 + {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + 4 + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + 4.0 + + + + + + + + MSBuild:Compile + Designer + + + MSBuild:Compile + Designer + + + App.xaml + Code + + + MainWindow.xaml + Code + + + + + Code + + + True + True + Resources.resx + + + True + Settings.settings + True + + + ResXFileCodeGenerator + Resources.Designer.cs + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + + + + + + + \ No newline at end of file diff --git a/ftpmpv.sln b/ftpmpv.sln new file mode 100644 index 0000000..5ca6db9 --- /dev/null +++ b/ftpmpv.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2013 +VisualStudioVersion = 12.0.31101.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ftpmpv", "ftpmpv.csproj", "{E1E35EB6-9B62-43CA-8E8B-C4521A4B52BD}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {E1E35EB6-9B62-43CA-8E8B-C4521A4B52BD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E1E35EB6-9B62-43CA-8E8B-C4521A4B52BD}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E1E35EB6-9B62-43CA-8E8B-C4521A4B52BD}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E1E35EB6-9B62-43CA-8E8B-C4521A4B52BD}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal -- cgit v1.2.3