public void GetFilter_7z() { var dest = ViewResource.GetFilter("7z"); Assert.That(dest.Contains("*.*"), Is.True); Assert.That(dest.Contains("*.7z"), Is.True); Assert.That(dest.Contains("*.7Z"), Is.True); }
/// <summary> /// Loads the view resource from the specified stream. /// </summary> public override void LoadResource(ViewResource resource, Stream stream) { if (resource.Name == nameof(TemplateBindings)) { templateBindings = new TemplateBindings(); templateBindings.Load(stream); } }
public void GetFilter(Format format, string piece) { var dest = ViewResource.GetFilter(format); Assert.That(dest.Contains("*.*"), Is.True); Assert.That(dest.Contains(piece), Is.True); Assert.That(dest.Contains(piece.ToUpperInvariant()), Is.True); }
public void SetView(ViewObject view, ViewResource resource) { if (view == null) { throw new ArgumentNullException(nameof(view)); } view.ViewResource = resource ?? throw new ArgumentNullException(nameof(resource)); view.ViewCur = resource.ResourceIndex; view.LoopTotal = (byte)resource.Loops.Length; if (view.LoopCur >= view.LoopTotal) { this.SetViewLoop(view, 0); } else { this.SetViewLoop(view, view.LoopCur); } }
public void GetFilter_NotSupported() => Assert.That( ViewResource.GetFilter(Format.Rar), Is.EqualTo("すべてのファイル (*.*)|*.*") );
public void GetCompressionMethod(Format format, int expected) { Assert.That(ViewResource.GetCompressionMethod(format)?.Count ?? 0, Is.EqualTo(expected)); Assert.That(ViewResource.GetCompressionMethod(format)?.Count ?? 0, Is.EqualTo(expected)); }
public string GetTimeString(int day, int hour, int min, int sec) => ViewResource.GetTimeString(new TimeSpan(day, hour, min, sec));
public bool IsEncryptionSupported(Format format) => ViewResource.IsEncryptionSupported(format);
void HandleCursorChanged(object sender, EventArgs e) { TreeSelection selection = tree.Selection; TreeModel model; TreeIter iter; Value v; string type, info; View view = null; if (!selection.GetSelected(out model, out iter)) { return; } // Create a view based on what we got v = new Value(); store.GetValue(iter, 2, ref v); info = v.Val as string; v = new Value(); store.GetValue(iter, 1, ref v); type = v.Val as string; switch (type) { case "Class": Console.WriteLine("JB, We need your decompiler."); break; case "Resource": Resource res; v = new Value(); store.GetValue(iter, 3, ref v); res = v.Val as Resource; if (res != null) { view = new ViewResource(res); } else { Console.WriteLine("{0} didn't have a Resource, it had a {1}.", type, v.Val == null ? "null" : v.Val.GetType().ToString()); } break; case "Method": case "Getter": case "Setter": case "Remover": case "Adder": case "Invoker": case "Constructor": MethodDefinition def; v = new Value(); store.GetValue(iter, 3, ref v); def = v.Val as MethodDefinition; if (def != null) { view = new ViewCode(def); } else { Console.WriteLine("{0} didn't have a MethodDefinition.", type); } break; default: Console.WriteLine("Unhandled case: {0}", type); break; } // Remove old views and add the new one while (box.Children.Length > 1) { box.Remove(box.Children [1]); } if (view != null) { box.PackStart(view.GetView(), true, true, 0); box.ShowAll(); } }
void HandleCursorChanged (object sender, EventArgs e) { TreeSelection selection = tree.Selection; TreeModel model; TreeIter iter; Value v; string type, info; View view = null; if (!selection.GetSelected (out model, out iter)) return; // Create a view based on what we got v = new Value (); store.GetValue (iter, 2, ref v); info = v.Val as string; v = new Value (); store.GetValue (iter, 1, ref v); type = v.Val as string; switch (type) { case "Class": Console.WriteLine ("JB, We need your decompiler."); break; case "Resource": Resource res; v = new Value (); store.GetValue (iter, 3, ref v); res = v.Val as Resource; if (res != null) { view = new ViewResource (res); } else { Console.WriteLine ("{0} didn't have a Resource, it had a {1}.", type, v.Val == null ? "null" : v.Val.GetType ().ToString ()); } break; case "Method": case "Getter": case "Setter": case "Remover": case "Adder": case "Invoker": case "Constructor": MethodDefinition def; v = new Value (); store.GetValue (iter, 3, ref v); def = v.Val as MethodDefinition; if (def != null) { view = new ViewCode (def); } else { Console.WriteLine ("{0} didn't have a MethodDefinition.", type); } break; default: Console.WriteLine ("Unhandled case: {0}", type); break; } // Remove old views and add the new one while (box.Children.Length > 1) box.Remove (box.Children [1]); if (view != null) { box.PackStart (view.GetView (), true, true, 0); box.ShowAll (); } }