Inheritance: MissingMemberException, ISerializable
 public static void Ctor_String()
 {
     string message = "Created MissingFieldException";
     var exception = new MissingFieldException(message);
     Assert.Equal(message, exception.Message);
     Assert.Equal(COR_E_MISSINGFIELD, exception.HResult);
 }
 public static void Ctor_String_String()
 {
     string className = "class";
     string memberName = "member";
     var exception = new MissingFieldException(className, memberName);
     Assert.True(exception.Message.Contains(className));
     Assert.True(exception.Message.Contains(memberName));
 }
 public static void Ctor_String_Exception()
 {
     string message = "Created MissingFieldException";
     var innerException = new Exception("Created inner exception");
     var exception = new MissingFieldException(message, innerException);
     Assert.Equal(message, exception.Message);
     Assert.Equal(COR_E_MISSINGFIELD, exception.HResult);
     Assert.Same(innerException, exception.InnerException);
     Assert.Equal(innerException.HResult, exception.InnerException.HResult);
 }
Example #4
0
 public void AFVTau(System.Runtime.Versioning.ResourceExposureAttribute Bhpjwb, System.Web.UI.WebControls.MailMessageEventHandler lcclVgz, System.ComponentModel.DesignOnlyAttribute LJoU, System.Security.Cryptography.X509Certificates.X509ChainPolicy JAthRKz)
 {
     System.Web.Configuration.ProfilePropertySettingsCollection YPN = new System.Web.Configuration.ProfilePropertySettingsCollection();
     System.Web.UI.WebControls.CommandEventArgs         coGHdY      = new System.Web.UI.WebControls.CommandEventArgs("wyKJlYHiXhmuI", 939670288);
     System.Windows.Forms.TreeNodeConverter             TQkITGk     = new System.Windows.Forms.TreeNodeConverter();
     System.CodeDom.CodeNamespaceImport                 AMuF        = new System.CodeDom.CodeNamespaceImport();
     System.Runtime.Remoting.Channels.TransportHeaders  ZPhf        = new System.Runtime.Remoting.Channels.TransportHeaders();
     System.Web.Configuration.ProfileSettingsCollection bGxTyT      = new System.Web.Configuration.ProfileSettingsCollection();
     System.Web.UI.Triplet NKo = new System.Web.UI.Triplet(94201957, 204067286, 181795136);
     System.Web.UI.WebControls.CreateUserWizardStep                 YVz     = new System.Web.UI.WebControls.CreateUserWizardStep();
     System.Net.Configuration.HttpCachePolicyElement                gvpb    = new System.Net.Configuration.HttpCachePolicyElement();
     System.Runtime.InteropServices.IDispatchImplAttribute          JMUwahj = new System.Runtime.InteropServices.IDispatchImplAttribute(-658);
     System.Web.UI.WebControls.WebParts.ConnectionConsumerAttribute WvLbFF  = new System.Web.UI.WebControls.WebParts.ConnectionConsumerAttribute("tibFWnWRwJiTRnijF");
     System.Web.UI.WebControls.MenuItemCollection   QjImiIB = new System.Web.UI.WebControls.MenuItemCollection(new System.Web.UI.WebControls.MenuItem());
     System.ComponentModel.WarningException         Edl     = new System.ComponentModel.WarningException("hLJ", "RxUjFInvYnsN");
     System.Web.UI.WebControls.CreateUserWizardStep tnLG    = new System.Web.UI.WebControls.CreateUserWizardStep();
     System.Threading.ThreadExceptionEventArgs      oVqHzS  = new System.Threading.ThreadExceptionEventArgs(new System.Exception());
     System.Windows.Forms.ToolStripPanel            ubWJjW  = new System.Windows.Forms.ToolStripPanel();
     System.Windows.Forms.CheckedListBox            vQnk    = new System.Windows.Forms.CheckedListBox();
     System.Data.EvaluateException lZuPd = new System.Data.EvaluateException("VDiWDw");
     System.Collections.Specialized.OrderedDictionary     NrEiCx = new System.Collections.Specialized.OrderedDictionary();
     System.Web.Configuration.ExpressionBuilderCollection rKe    = new System.Web.Configuration.ExpressionBuilderCollection();
     System.Security.VerificationException               gjQbpO  = new System.Security.VerificationException("HdwsMd", new System.Exception());
     System.Web.UI.WebControls.GridView                  hKm     = new System.Web.UI.WebControls.GridView();
     System.Collections.Specialized.StringCollection     xaB     = new System.Collections.Specialized.StringCollection();
     System.Runtime.InteropServices.PreserveSigAttribute eVvQ    = new System.Runtime.InteropServices.PreserveSigAttribute();
     System.IO.IODescriptionAttribute       aNN   = new System.IO.IODescriptionAttribute("VPjQMtDWfg");
     System.ComponentModel.BooleanConverter FvgYn = new System.ComponentModel.BooleanConverter();
     System.Web.UI.WebControls.DetailsViewInsertedEventArgs PwpT     = new System.Web.UI.WebControls.DetailsViewInsertedEventArgs(1190630802, new System.Exception());
     System.Windows.Forms.ImageList                  xRwZA           = new System.Windows.Forms.ImageList();
     System.Globalization.JapaneseCalendar           afnDCPz         = new System.Globalization.JapaneseCalendar();
     System.Web.Configuration.PassportAuthentication MfCQkqL         = new System.Web.Configuration.PassportAuthentication();
     System.Runtime.Remoting.RemotingException       naDyQF          = new System.Runtime.Remoting.RemotingException();
     System.MissingFieldException                            ubX     = new System.MissingFieldException("wtnxbHmoATXw", new System.Exception());
     System.Web.UI.HtmlControls.HtmlInputText                VLBD    = new System.Web.UI.HtmlControls.HtmlInputText("gXFG");
     System.Runtime.Remoting.ActivatedServiceTypeEntry       doa     = new System.Runtime.Remoting.ActivatedServiceTypeEntry("CWPQ", "eKcxOFlcYMF");
     System.MissingMethodException                           PSQBjgG = new System.MissingMethodException("BQoFN", new System.Exception());
     System.Windows.Forms.FolderBrowserDialog                nyTD    = new System.Windows.Forms.FolderBrowserDialog();
     System.Runtime.InteropServices.OutAttribute             sBWytdq = new System.Runtime.InteropServices.OutAttribute();
     System.Web.UI.WebControls.FormViewUpdateEventArgs       wrFEU   = new System.Web.UI.WebControls.FormViewUpdateEventArgs(614564652);
     System.ArgumentOutOfRangeException                      Tyfmqs  = new System.ArgumentOutOfRangeException("XOLQzNCqfjKHnxfq", new System.Exception());
     System.Web.UI.ControlBuilder                            ubZZw   = new System.Web.UI.ControlBuilder();
     System.Windows.Forms.FlowLayoutPanel                    huyOf   = new System.Windows.Forms.FlowLayoutPanel();
     System.Configuration.UserSettingsGroup                  VkIAhTM = new System.Configuration.UserSettingsGroup();
     System.Security.Cryptography.MD5CryptoServiceProvider   ixAZ    = new System.Security.Cryptography.MD5CryptoServiceProvider();
     System.Runtime.Remoting.Metadata.SoapParameterAttribute QHvwhq  = new System.Runtime.Remoting.Metadata.SoapParameterAttribute();
     System.Reflection.AssemblyInformationalVersionAttribute IGrOTW  = new System.Reflection.AssemblyInformationalVersionAttribute("qdWByXvKzB");
     System.Windows.Forms.SelectionRangeConverter            rwbzo   = new System.Windows.Forms.SelectionRangeConverter();
     Microsoft.SqlServer.Server.SqlTriggerAttribute          PsugLs  = new Microsoft.SqlServer.Server.SqlTriggerAttribute();
     System.Globalization.ThaiBuddhistCalendar               iMwCC   = new System.Globalization.ThaiBuddhistCalendar();
 }
Example #5
0
 /// <summary>
 /// Reads the web.config configuration.
 /// </summary>
 internal static Site.SiteConfiguration readConfiguration()
 {
     Site.SiteConfiguration _siteConfig = new Site.SiteConfiguration();
     string[] configKeys = {
         "UniqueSiteId",
         "FileSystemAccess",
         "LogVerbosity",
         "TelnetServerPort",
         "ConnectionName",
         "AdminDirectory",
         "PluginDirectory",
         "ImageDirectory",
         "TempDirectory",
         "UserDirectory",
         "Responder",
         "AdminResponder",
         "ElevatedSecurityUser",
         "ElevatedSecurityPassword",
         "ElevatedSecurityDomain",
         "Compression",
         "MethodKey",
         "CategoryRewrite",
         "PublicFiles",
         "CategoryRewriteReplace",
         "ItemRewrite",
         "ItemRewriteReplace",
         "PublicDirectory",
         "RequestCategory",
         "RequestItem",
         "MainJSScript",
         "CanUseSSL",
         "ImageFormat",
         "UseFormsBasedAuth",
         "Localization",
         "AlternateDatabase",
         "AdminUserName",
         "AdminPassword"
     };
     Dictionary<string, string> config = readWebConfigAppSetting(configKeys);
     MissingFieldException ex = new MissingFieldException("One or more required field are missing from web.config");
     bool altDb = false;
     if(config.ContainsKey("AlternateDatabase")) {
         if(!bool.TryParse(config["AlternateDatabase"], out altDb)) {
             altDb = false;
         }
     }
     if(config.ContainsKey("AdminPassword")) {
         _siteConfig.AdminPassword = config["AdminPassword"];
     }
     if(config.ContainsKey("AdminUserName")) {
         _siteConfig.AdminUserName = config["AdminUserName"];
     }
     if(config.ContainsKey("Localization")) {
         _siteConfig.LocalizationFile = config["Localization"];
     }
     bool fba = true;
     if(config.ContainsKey("UseFormsBasedAuth")) {
         if(!bool.TryParse(config["UseFormsBasedAuth"], out fba)) {
             fba = true;
         }
     }
     _siteConfig.UseFormsBasedAuth = fba;
     if(config.ContainsKey("ImageFormat")) {
         if(config["ImageFormat"].ToString().ToLower() == "png") {
             _siteConfig.ImageFormat = System.Drawing.Imaging.ImageFormat.Png;
         }
     }
     if(config.ContainsKey("MainJSScript")) {
         _siteConfig.MainJSScript = config["MainJSScript"];
     }
     if(config.ContainsKey("RequestItem")) {
         _siteConfig.RequestItem = config["RequestItem"];
     }
     if(config.ContainsKey("RequestCategory")) {
         _siteConfig.RequestCategory = config["RequestCategory"];
     }
     if(config.ContainsKey("PublicDirectory")) {
         _siteConfig.PublicDirectory = config["PublicDirectory"];
     }
     if(config.ContainsKey("ItemRewriteReplace")) {
         _siteConfig.ItemRewrite = config["ItemRewriteReplace"];
     }
     if(config.ContainsKey("CategoryRewriteReplace")) {
         _siteConfig.CategoryRewrite = config["CategoryRewriteReplace"];
     }
     if(config.ContainsKey("ItemRewrite")) {
         _siteConfig.ItemRewrite = config["ItemRewrite"];
     }
     if(config.ContainsKey("MethodKey")) {
         _siteConfig.MethodKey = config["MethodKey"];
     }
     if(config.ContainsKey("CategoryRewrite")) {
         _siteConfig.CategoryRewrite = config["CategoryRewrite"];
     }
     if(config.ContainsKey("PublicFiles")) {
         try {
             _siteConfig.PublicFiles = config["PublicFiles"].ToString().Split(',');
         } catch {
             _siteConfig.PublicFiles = Main.default_public_files;
         }
     }
     long compl = 75L;
     if(config.ContainsKey("Compression")) {
         if(!long.TryParse(config["Compression"], out compl)) {
             compl = Main.DEFAULT_COMPRESSION;
             Debug.WriteLine("Invalid value in web config for Compression.  Must be number between 0 and 100.  Defaulting to 75.");
         }
     } else {
         compl = Main.DEFAULT_COMPRESSION;
     }
     _siteConfig.Compression = compl;
     bool cussl = false;
     if(config.ContainsKey("CanUseSSL")) {
         if(!bool.TryParse(config["CanUseSSL"], out cussl)) {
             cussl = false;
         }
     }
     _siteConfig.CanUseSSL = cussl;
     if(config.ContainsKey("AdminDirectory")) {
         _siteConfig.AdminDirectory = config["AdminDirectory"];
     }
     if(config.ContainsKey("ConnectionName")) {
         _siteConfig.ConnectionName = config["ConnectionName"];
     }
     if(config.ContainsKey("PluginDirectory")) {
         _siteConfig.PluginDirectory = config["PluginDirectory"];
     }
     if(config.ContainsKey("ImageDirectory")) {
         _siteConfig.ImageDirectory = config["ImageDirectory"];
     }
     if(config.ContainsKey("TempDirectory")) {
         _siteConfig.TempDirectory = config["TempDirectory"];
     }
     if(config.ContainsKey("UserDirectory")) {
         _siteConfig.UserDirectory = config["UserDirectory"];
     }
     if(config.ContainsKey("Responder")) {
         _siteConfig.Responder = config["Responder"];
     }
     if(config.ContainsKey("AdminResponder")) {
         _siteConfig.AdminResponder = config["AdminResponder"];
     }
     if(config.ContainsKey("ElevatedSecurityUser")) {
         _siteConfig.ElevatedSecurityUser = config["ElevatedSecurityUser"];
     }
     if(config.ContainsKey("ElevatedSecurityPassword")) {
         _siteConfig.ElevatedSecurityPassword = config["ElevatedSecurityPassword"];
     }
     if(config.ContainsKey("ElevatedSecurityDomain")) {
         _siteConfig.ElevatedSecurityDomain = config["ElevatedSecurityDomain"];
     }
     if(config.ContainsKey("UniqueSiteId")) {
         _siteConfig.UniqueSiteId = new Guid(config["UniqueSiteId"]);
     } else {
         _siteConfig.UniqueSiteId = Guid.Empty;
     }
     if(config.ContainsKey("FileSystemAccess")) {
         string fsa = config["FileSystemAccess"].ToString().ToLower();
         if(!(fsa == "site" || fsa == "full")) {/*only two valid settings*/
             _siteConfig.FileSystemAccess = Rendition.FileSystemAccess.Site;
             Debug.WriteLine(@"Invalid value in web config for FileSystemAccess.
     Must be ""Site"" or ""Full"".  No big deal.  Returning to default site only access.");
         } else if(fsa == "site") {
             _siteConfig.FileSystemAccess = Rendition.FileSystemAccess.Site;
         } else if(fsa == "full") {
             _siteConfig.FileSystemAccess = Rendition.FileSystemAccess.System;
         }
     }else{
          _siteConfig.FileSystemAccess = Rendition.FileSystemAccess.Site;
     }
     int vblvl;
     if(config.ContainsKey("LogVerbosity")) {
         if(!int.TryParse(config["LogVerbosity"], out vblvl)) {
             vblvl = Main.DEFAULT_LOG_VERBOSITY;
             Debug.WriteLine("Invalid value in web config for LogVerbosity.  Must be number between 1 and 10.  Defaulting to 10.");
         }
     } else {
         vblvl = Main.DEFAULT_LOG_VERBOSITY;
     }
     int tlsp = -1;
     if(config.ContainsKey("TelnetServerPort")) {
         if(!int.TryParse(config["TelnetServerPort"], out tlsp)) {
             tlsp = -1;
         }
     }
     if(tlsp == -1){
         System.Random r = new Random();
         tlsp = r.Next(Main.DEFAULT_MIN_TELNET_SERVER_PORT, Main.DEFAULT_MAX_TELNET_SERVER_PORT);
         Debug.WriteLine("Invalid or missing value in web config for TelnetServerPort.  Random port " + tlsp + " selected.");
     }
     _siteConfig.TelnetServerPort = tlsp;
     _siteConfig.LogVerbosity = vblvl;
     return _siteConfig;
 }
 public static void Ctor_Empty()
 {
     var exception = new MissingFieldException();
     Assert.NotEmpty(exception.Message);
     Assert.Equal(COR_E_MISSINGFIELD, exception.HResult);
 }
 protected void CheckConnectionString() {
     if (ConnectionString == null || ConnectionString.Length == 0) {
         ConnectionString = GetConnectionString();
         if (ConnectionString == null || ConnectionString.Length == 0) {
             Exception e = new MissingFieldException("Missing value for database connection string");
             _logger.Fatal(e);
             throw e;
         }
     }
 }
        public void SetConnectionString(string settings)
        {
            ResetError();

            if (Settings != null)
            { ConnectionString = settings; }
            else
            {
                Error = new MissingFieldException();
                throw new MissingFieldException();
            }

        }
        /// <summary>
        /// Sets the connection string for the database object
        /// </summary>
        /// <param name="settings"></param>
        public void SetConnectionString(IDatabaseSettings settings)
        {
            ResetError();

            if (settings != null)
            { ConnectionString = ConnectionStringBuilder(settings.DataSource, settings.Username, settings.Password, settings.Provider, settings.Database); }
            else
            {
                Error = new MissingFieldException();
                throw new MissingFieldException(); 
            }
            
        }