From 302fd15f6c9cd455d61965f1edfae6415eacd1ca Mon Sep 17 00:00:00 2001 From: jpbruyere Date: Wed, 9 Sep 2015 10:44:37 +0200 Subject: [PATCH] directory viewer tests --- Tests/GOLIBTest_DirViewer.cs | 54 ++++++++++++---------------- Tests/Interfaces/testDirViewer.goml | 4 +-- Tests/Interfaces/testTypeViewer.goml | 2 +- Tests/Interfaces/tmpDirItem.goml | 6 ++-- Tests/Tests.csproj | 7 ++++ 5 files changed, 35 insertions(+), 38 deletions(-) diff --git a/Tests/GOLIBTest_DirViewer.cs b/Tests/GOLIBTest_DirViewer.cs index 1980f582..f5c31921 100644 --- a/Tests/GOLIBTest_DirViewer.cs +++ b/Tests/GOLIBTest_DirViewer.cs @@ -14,71 +14,61 @@ using go; using System.Threading; using System.Reflection; using System.Linq; +using System.IO; -namespace test +namespace test2 { - class GOLIBTest_TypeViewer : OpenTKGameWindow + class GOLIBTest_DirViewer : OpenTKGameWindow { - public GOLIBTest_TypeViewer () + public GOLIBTest_DirViewer () : base(1024, 600,"test") {} - VerticalStack g; - TypeContainer type; + public DirContainer CurDir; protected override void OnLoad (EventArgs e) { base.OnLoad (e); - type = new TypeContainer(typeof (GraphicObject)); + CurDir = new DirContainer(new DirectoryInfo ("/home/jp/")); - this.AddWidget(Interface.Load ("Interfaces/testTypeViewer.goml", type)); + this.AddWidget(Interface.Load ("Interfaces/testDirViewer.goml", CurDir)); //LoadInterface("Interfaces/testTypeViewer.goml", out g); } - protected override void OnRenderFrame (FrameEventArgs e) - { - GL.Clear (ClearBufferMask.ColorBufferBit); - base.OnRenderFrame (e); - SwapBuffers (); - - MemberInfo mi; - - - } - [STAThread] static void Main () { Console.WriteLine ("starting example"); - using (GOLIBTest_TypeViewer win = new GOLIBTest_TypeViewer( )) { + using (GOLIBTest_DirViewer win = new GOLIBTest_DirViewer( )) { win.Run (30.0); } } } - public class TypeContainer + public class DirContainer { - public Type Type; - public TypeContainer(Type _type){ - Type = _type; + public DirectoryInfo CurDir; + public DirContainer(DirectoryInfo _dir){ + CurDir = _dir; } public string Name { - get { return Type.Name; } + get { return CurDir.Name; } } - public MemberInfo[] Members { + public FileSystemInfo[] GetFileSystemInfos + { get { - MemberInfo[] mi = Properties.Cast ().Concat (Methods.Cast ()).ToArray(); - return mi; + return CurDir.GetFileSystemInfos ().Where(fi => !fi.Attributes.HasFlag(FileAttributes.Hidden)).ToArray(); } } - public MethodInfo[] Methods { - get { return Type.GetMethods (BindingFlags.Public | BindingFlags.Instance).Where (m => !m.IsSpecialName).ToArray(); } + void onDirUp(object sender, MouseButtonEventArgs e) + { + } - public PropertyInfo[] Properties { - get { return Type.GetProperties (); } + public void onMouseDown(object sender, MouseButtonEventArgs e) + { + Debug.WriteLine (sender.ToString ()); } - } } \ No newline at end of file diff --git a/Tests/Interfaces/testDirViewer.goml b/Tests/Interfaces/testDirViewer.goml index aea7ca07..7383dc12 100755 --- a/Tests/Interfaces/testDirViewer.goml +++ b/Tests/Interfaces/testDirViewer.goml @@ -1,10 +1,10 @@  - + - +