Example #1
0
        /// <summary>
        /// Parses a request URL query. Note that this is different from getting the <see cref="IHttpRequest.QueryString"/> property,
        /// in that fields without an equal sign are treated as if they have an empty value, instead of their keys being grouped
        /// as values of the <c>null</c> key.
        /// </summary>
        /// <param name="this">The <see cref="IHttpContext"/> on which this method is called.</param>
        /// <returns>A read-only <see cref="NameValueCollection"/>.</returns>
        /// <exception cref="NullReferenceException"><paramref name="this"/> is <see langword="null"/>.</exception>
        /// <remarks>
        /// <para>This method may safely be called more than once for the same <see cref="IHttpContext"/>:
        /// it will return the same collection instead of trying to parse the request body again.</para>
        /// </remarks>
        public static NameValueCollection GetRequestQueryData(this IHttpContext @this)
        {
            if ([email protected](QueryDataKey, out var previousResult))
            {
                NameValueCollection result;
                try
                {
                    result = UrlEncodedDataParser.Parse(@this.Request.Url.Query, false);
                }
                catch (Exception e)
                {
                    @this.Items[FormDataKey] = e;
                    throw;
                }

                @this.Items[FormDataKey] = result;
                return(result);
            }

            switch (previousResult)
            {
            case NameValueCollection collection:
                return(collection);

            case Exception exception:
                throw exception.RethrowPreservingStackTrace();

            case null:
                throw SelfCheck.Failure($"Previous result of {nameof(HttpContextExtensions)}.{nameof(GetRequestQueryData)} is null.");

            default:
                throw SelfCheck.Failure($"Previous result of {nameof(HttpContextExtensions)}.{nameof(GetRequestQueryData)} is of unexpected type {previousResult.GetType().FullName}");
            }
        }
Example #2
0
        /// <summary>
        /// Asynchronously parses a request body in <c>application/x-www-form-urlencoded</c> format.
        /// </summary>
        /// <param name="this">The <see cref="IHttpContext"/> on which this method is called.</param>
        /// <returns>A <see cref="Task{TResult}">Task</see>, representing the ongoing operation,
        /// whose result will be a read-only <see cref="NameValueCollection"/>of form field names and values.</returns>
        /// <exception cref="NullReferenceException"><paramref name="this"/> is <see langword="null"/>.</exception>
        /// <remarks>
        /// <para>This method may safely be called more than once for the same <see cref="IHttpContext"/>:
        /// it will return the same collection instead of trying to parse the request body again.</para>
        /// </remarks>
        public static async Task <NameValueCollection> GetRequestFormDataAsync(this IHttpContext @this)
        {
            if ([email protected](FormDataKey, out var previousResult))
            {
                NameValueCollection result;
                try
                {
                    using var reader = @this.OpenRequestText();
                    result           = UrlEncodedDataParser.Parse(await reader.ReadToEndAsync().ConfigureAwait(false), false);
                }
                catch (Exception e)
                {
                    @this.Items[FormDataKey] = e;
                    throw;
                }

                @this.Items[FormDataKey] = result;
                return(result);
            }

            switch (previousResult)
            {
            case NameValueCollection collection:
                return(collection);

            case Exception exception:
                throw exception.RethrowPreservingStackTrace();

            case null:
                throw SelfCheck.Failure($"Previous result of {nameof(HttpContextExtensions)}.{nameof(GetRequestFormDataAsync)} is null.");

            default:
                throw SelfCheck.Failure($"Previous result of {nameof(HttpContextExtensions)}.{nameof(GetRequestFormDataAsync)} is of unexpected type {previousResult.GetType().FullName}");
            }
        }
Example #3
0
 public static bool Run()
 {
     if (FileSystem.Backend.isError != null)
     {
         return(SelfCheck.Failed("Asset Bundle Error: " + (string)FileSystem.Backend.loadingError));
     }
     if (Object.op_Equality((Object)FileSystem.Load <GameManifest>("Assets/manifest.asset", true), (Object)null))
     {
         return(SelfCheck.Failed("Couldn't load game manifest - verify your game content!"));
     }
     if (!SelfCheck.TestRustNative())
     {
         return(false);
     }
     if (CommandLine.HasSwitch("-force-feature-level-9-3"))
     {
         return(SelfCheck.Failed("Invalid command line argument: -force-feature-level-9-3"));
     }
     if (CommandLine.HasSwitch("-force-feature-level-10-0"))
     {
         return(SelfCheck.Failed("Invalid command line argument: -force-feature-level-10-0"));
     }
     if (CommandLine.HasSwitch("-force-feature-level-10-1"))
     {
         return(SelfCheck.Failed("Invalid command line argument: -force-feature-level-10-1"));
     }
     return(true);
 }
Example #4
0
        /// <inheritdoc />
        protected override async Task OnRequestAsync(IHttpContext context)
        {
            var result = await _resolvers.ResolveAsync(context).ConfigureAwait(false);

            switch (result)
            {
            case RouteResolutionResult.RouteNotMatched:
            case RouteResolutionResult.NoHandlerSuccessful:
                await OnPathNotFoundAsync(context).ConfigureAwait(false);

                break;

            case RouteResolutionResult.NoHandlerSelected:
                await OnMethodNotAllowedAsync(context).ConfigureAwait(false);

                break;

            case RouteResolutionResult.Success:
                return;

            default:
                SelfCheck.Fail($"Internal error: unknown route resolution result {result}.");
                return;
            }
        }
Example #5
0
    private IEnumerator Start()
    {
        Bootstrap bootstrap = null;
        int       num;

        Bootstrap.WriteToLog("Bootstrap Startup");
        ExceptionReporter.InitializeFromUrl("https://*****:*****@sentry.io/51080");
        num = (!Facepunch.Utility.CommandLine.Full.Contains("-official") ? 0 : (int)Facepunch.Utility.CommandLine.Full.Contains("+official"));
        ExceptionReporter.Disabled = num == 0;
        Bootstrap.WriteToLog(SystemInfoGeneralText.currentInfo);
        UnityEngine.Texture.SetGlobalAnisotropicFilteringLimits(1, 16);
        yield return(bootstrap.StartCoroutine(Bootstrap.LoadingUpdate("Loading Bundles")));

        FileSystem.Backend = new AssetBundleBackend("Bundles/Bundles");
        if (FileSystem.Backend.isError)
        {
            bootstrap.ThrowError(FileSystem.Backend.loadingError);
        }
        if (Bootstrap.isErrored)
        {
            yield break;
        }
        yield return(bootstrap.StartCoroutine(Bootstrap.LoadingUpdate("Loading Game Manifest")));

        GameManifest.Load();
        yield return(bootstrap.StartCoroutine(Bootstrap.LoadingUpdate("DONE!")));

        yield return(bootstrap.StartCoroutine(Bootstrap.LoadingUpdate("Running Self Check")));

        SelfCheck.Run();
        if (Bootstrap.isErrored)
        {
            yield break;
        }
        yield return(bootstrap.StartCoroutine(Bootstrap.LoadingUpdate("Bootstrap Tier0")));

        Bootstrap.Init_Tier0();
        ConsoleSystem.UpdateValuesFromCommandLine();
        yield return(bootstrap.StartCoroutine(Bootstrap.LoadingUpdate("Bootstrap Systems")));

        Bootstrap.Init_Systems();
        yield return(bootstrap.StartCoroutine(Bootstrap.LoadingUpdate("Bootstrap Config")));

        Bootstrap.Init_Config();
        if (Bootstrap.isErrored)
        {
            yield break;
        }
        yield return(bootstrap.StartCoroutine(Bootstrap.LoadingUpdate("Loading Items")));

        ItemManager.Initialize();
        if (Bootstrap.isErrored)
        {
            yield break;
        }
        yield return(bootstrap.StartCoroutine(bootstrap.DedicatedServerStartup()));

        GameManager.Destroy(bootstrap.gameObject, 0f);
    }
Example #6
0
        //[TestCase(new[] { "[0,start]:4000", "[0,end]:3000", "[1,start]:2000", "[1,end]:1000" }, GroupCheck.Asc, SelfCheck.BasedOnStart, new double[] { "[0,start]:4000", "[0,end]:4000", "[1,start]:4000", "[1,end]:4000" })]
        //[TestCase(new[] { "[0,start]:4000", "[0,end]:3000", "[1,start]:2000", "[1,end]:1000" }, GroupCheck.Asc, SelfCheck.BasedOnEnd, new double[] { "[0,start]:3000", "[0,end]:3000", "[1,start]:3000", "[1,end]:3000" })]
        //[TestCase(new[] { "[0,start]:4000", "[0,end]:3000", "[1,start]:2000", "[1,end]:1000" }, GroupCheck.Desc, SelfCheck.BasedOnStart, new double[] { "[0,start]:2000", "[0,end]:2000", "[1,start]:2000", "[1,end]:2000" })]
        //[TestCase(new[] { "[0,start]:4000", "[0,end]:3000", "[1,start]:2000", "[1,end]:1000" }, GroupCheck.Desc, SelfCheck.BasedOnEnd, new double[] { "[0,start]:1000", "[0,end]:1000", "[1,start]:1000", "[1,end]:1000" })]
        public void TestFixInvalid(string[] timeTagTexts, GroupCheck other, SelfCheck self, string[] actualTimeTagTexts)
        {
            // check which part is fixed, using list of time to check result.
            var timeTags     = TestCaseTagHelper.ParseTimeTags(timeTagTexts);
            var fixedTimeTag = TimeTagsUtils.FixInvalid(timeTags, other, self);

            TimeTagAssert.AreEqual(fixedTimeTag, TestCaseTagHelper.ParseTimeTags(actualTimeTagTexts));
        }
Example #7
0
        public void TestFindOverlapping(string[] timeTagTexts, GroupCheck other, SelfCheck self, int[] errorIndex)
        {
            // run all and find overlapping indexes.
            var timeTags                  = TestCaseTagHelper.ParseTimeTags(timeTagTexts);
            var overlappingTimeTags       = TimeTagsUtils.FindOverlapping(timeTags, other, self);
            var overlappingTimeTagIndexed = overlappingTimeTags.Select(v => timeTags.IndexOf(v)).ToArray();

            Assert.AreEqual(overlappingTimeTagIndexed, errorIndex);
        }
Example #8
0
        public void TestFindInvalid(string[] timeTagTexts, GroupCheck other, SelfCheck self, int[] errorIndex)
        {
            // run all and find invalid indexes.
            var timeTags       = TestCaseTagHelper.ParseTimeTags(timeTagTexts);
            var invalidTimeTag = TimeTagsUtils.FindInvalid(timeTags, other, self);
            var invalidIndexes = invalidTimeTag.Select(v => timeTags.IndexOf(v)).ToArray();

            Assert.AreEqual(invalidIndexes, errorIndex);
        }
Example #9
0
        protected override async Task <HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
        {
            var serverRequest        = new TestRequest(Validate.NotNull(nameof(request), request));
            var cookiesFromContainer = CookieContainer.GetCookieHeader(serverRequest.Url);

            if (!string.IsNullOrEmpty(cookiesFromContainer))
            {
                serverRequest.Headers.Add(HttpHeaderNames.Cookie, cookiesFromContainer);
            }

            var context = new TestContext(serverRequest)
            {
                CancellationToken = cancellationToken,
                Route             = RouteMatch.UnsafeFromRoot(UrlPath.Normalize(serverRequest.Url.AbsolutePath, false)),
            };

            await _handler.HandleContextAsync(context).ConfigureAwait(false);

            var serverResponse  = context.TestResponse;
            var responseCookies = serverResponse.Headers.Get(HttpHeaderNames.SetCookie);

            if (!string.IsNullOrEmpty(responseCookies))
            {
                CookieContainer.SetCookies(serverRequest.Url, responseCookies);
            }

            var response = new HttpResponseMessage((HttpStatusCode)serverResponse.StatusCode)
            {
                RequestMessage = request,
                Version        = serverResponse.ProtocolVersion,
                ReasonPhrase   = serverResponse.StatusDescription,
                Content        = serverResponse.Body == null ? null : new ByteArrayContent(serverResponse.Body),
            };

            foreach (var key in serverResponse.Headers.AllKeys)
            {
                var responseHeaderType = GetResponseHeaderType(key);
                switch (responseHeaderType)
                {
                case ResponseHeaderType.Content:
                    response.Content?.Headers.Add(key, serverResponse.Headers.GetValues(key));
                    break;

                case ResponseHeaderType.Response:
                    response.Headers.Add(key, serverResponse.Headers.GetValues(key));
                    break;

                case ResponseHeaderType.None:
                    break;

                default:
                    throw SelfCheck.Failure("Unexpected response header type {responseHeaderType}.");
                }
            }

            return(response);
        }
Example #10
0
        public byte[]? GetContent(CompressionMethod compressionMethod)
        {
            // If there are both entity tag and content, use them.
            switch (compressionMethod)
            {
            case CompressionMethod.Deflate:
                if (_deflatedContent != null)
                {
                    return(_deflatedContent);
                }
                break;

            case CompressionMethod.Gzip:
                if (_gzippedContent != null)
                {
                    return(_gzippedContent);
                }
                break;

            case CompressionMethod.None:
                if (_uncompressedContent != null)
                {
                    return(_uncompressedContent);
                }
                break;

            default:
                throw SelfCheck.Failure($"Unexpected compression method {compressionMethod}.");
            }

            // Try to convert existing content, if any.
            byte[]? content;
            if (_uncompressedContent != null)
            {
                content = CompressionUtility.ConvertCompression(_uncompressedContent, CompressionMethod.None, compressionMethod);
            }
            else if (_gzippedContent != null)
            {
                content = CompressionUtility.ConvertCompression(_gzippedContent, CompressionMethod.Gzip, compressionMethod);
            }
            else if (_deflatedContent != null)
            {
                content = CompressionUtility.ConvertCompression(_deflatedContent, CompressionMethod.Deflate, compressionMethod);
            }
            else
            {
                // No content whatsoever.
                return(null);
            }

            return(SetContent(compressionMethod, content));
        }
Example #11
0
        private TResolver GetResolver(RouteMatcher matcher)
        {
            var resolver = _resolvers.FirstOrDefault(r => r.Matcher.Equals(matcher));

            if (resolver != null)
            {
                return(resolver);
            }

            resolver = CreateResolver(matcher);
            _resolvers.Add(resolver ?? throw SelfCheck.Failure($"{nameof(CreateResolver)} returned null."));
            return(resolver);
        }
Example #12
0
    private IEnumerator Start()
    {
        Bootstrap bootstrap = this;

        Bootstrap.WriteToLog("Bootstrap Startup");
        Bootstrap.WriteToLog(SystemInfoGeneralText.currentInfo);
        Texture.SetGlobalAnisotropicFilteringLimits(1, 16);
        yield return((object)((MonoBehaviour)bootstrap).StartCoroutine(Bootstrap.LoadingUpdate("Loading Bundles")));

        FileSystem.Backend = (FileSystemBackend) new AssetBundleBackend("Bundles/Bundles");
        if (FileSystem.Backend.isError != null)
        {
            bootstrap.ThrowError((string)FileSystem.Backend.loadingError);
        }
        if (!Bootstrap.isErrored)
        {
            yield return((object)((MonoBehaviour)bootstrap).StartCoroutine(Bootstrap.LoadingUpdate("Loading Game Manifest")));

            GameManifest.Load();
            yield return((object)((MonoBehaviour)bootstrap).StartCoroutine(Bootstrap.LoadingUpdate("DONE!")));

            yield return((object)((MonoBehaviour)bootstrap).StartCoroutine(Bootstrap.LoadingUpdate("Running Self Check")));

            SelfCheck.Run();
            if (!Bootstrap.isErrored)
            {
                yield return((object)((MonoBehaviour)bootstrap).StartCoroutine(Bootstrap.LoadingUpdate("Bootstrap Tier0")));

                Bootstrap.Init_Tier0();
                ConsoleSystem.UpdateValuesFromCommandLine();
                yield return((object)((MonoBehaviour)bootstrap).StartCoroutine(Bootstrap.LoadingUpdate("Bootstrap Systems")));

                Bootstrap.Init_Systems();
                yield return((object)((MonoBehaviour)bootstrap).StartCoroutine(Bootstrap.LoadingUpdate("Bootstrap Config")));

                Bootstrap.Init_Config();
                if (!Bootstrap.isErrored)
                {
                    yield return((object)((MonoBehaviour)bootstrap).StartCoroutine(Bootstrap.LoadingUpdate("Loading Items")));

                    ItemManager.Initialize();
                    if (!Bootstrap.isErrored)
                    {
                        yield return((object)((MonoBehaviour)bootstrap).StartCoroutine(bootstrap.DedicatedServerStartup()));

                        GameManager.Destroy(((Component)bootstrap).get_gameObject(), 0.0f);
                    }
                }
            }
        }
    }
Example #13
0
        public async Task ListDirectoryAsync(
            MappedResourceInfo info,
            string absolutePath,
            IEnumerable <MappedResourceInfo> entries,
            Stream stream,
            CancellationToken cancellationToken)
        {
            const int MaxEntryLength = 50;
            const int SizeIndent     = -20; // Negative for right alignment

            if (!info.IsDirectory)
            {
                throw SelfCheck.Failure($"{nameof(HtmlDirectoryLister)}.{nameof(ListDirectoryAsync)} invoked with a file, not a directory.");
            }

            var encodedPath = WebUtility.HtmlEncode(absolutePath);

            using var text = new StreamWriter(stream, Encoding.UTF8);
            text.Write("<html><head><title>Index of ");
            text.Write(encodedPath);
            text.Write("</title></head><body><h1>Index of ");
            text.Write(encodedPath);
            text.Write("</h1><hr/><pre>");

            if (encodedPath.Length > 1)
            {
                text.Write("<a href='../'>../</a>\n");
            }

            entries = entries.ToArray();

            foreach (var directory in entries.Where(m => m.IsDirectory).OrderBy(e => e.Name))
            {
                text.Write($"<a href=\"{Uri.EscapeDataString(directory.Name)}{Path.DirectorySeparatorChar}\">{WebUtility.HtmlEncode(directory.Name)}</a>");
                text.Write(new string(' ', Math.Max(1, MaxEntryLength - directory.Name.Length + 1)));
                text.Write(HttpDate.Format(directory.LastModifiedUtc));
                text.Write('\n');
                await Task.Yield();
            }

            foreach (var file in entries.Where(m => m.IsFile).OrderBy(e => e.Name))
            {
                text.Write($"<a href=\"{Uri.EscapeDataString(file.Name)}{Path.DirectorySeparatorChar}\">{WebUtility.HtmlEncode(file.Name)}</a>");
                text.Write(new string(' ', Math.Max(1, MaxEntryLength - file.Name.Length + 1)));
                text.Write(HttpDate.Format(file.LastModifiedUtc));
                text.Write($" {file.Length.ToString("#,###", CultureInfo.InvariantCulture),SizeIndent}\n");
                await Task.Yield();
            }

            text.Write("</pre><hr/></body></html>");
        }
        private TResolver GetResolver(string route)
        {
            var resolver = _resolvers.FirstOrDefault(r => r.Route == route);

            if (resolver == null)
            {
                resolver = CreateResolver(route);
                SelfCheck.Assert(resolver != null, $"{nameof(CreateResolver)} returned null.");

                _resolvers.Add(resolver);
            }

            return(resolver);
        }
Example #15
0
 private static bool TestRustNative()
 {
     try
     {
         if (!SelfCheck.RustNative_VersionCheck(5))
         {
             return(SelfCheck.Failed("RustNative is wrong version!"));
         }
     }
     catch (DllNotFoundException ex)
     {
         return(SelfCheck.Failed("RustNative library couldn't load! " + ex.Message));
     }
     return(true);
 }
    private static bool TestRustNative()
    {
        bool flag;

        try
        {
            if (SelfCheck.RustNative_VersionCheck(5))
            {
                return(true);
            }
            else
            {
                flag = SelfCheck.Failed("RustNative is wrong version!");
            }
        }
        catch (DllNotFoundException dllNotFoundException1)
        {
            DllNotFoundException dllNotFoundException = dllNotFoundException1;
            flag = SelfCheck.Failed(string.Concat("RustNative library couldn't load! ", dllNotFoundException.Message));
        }
        return(flag);
    }
Example #17
0
    private IEnumerator Start()
    {
        WriteToLog("Bootstrap Startup");
        BenchmarkTimer.Enabled = Facepunch.Utility.CommandLine.Full.Contains("+autobench");
        BenchmarkTimer timer = BenchmarkTimer.New("bootstrap");

        if (!UnityEngine.Application.isEditor)
        {
            ExceptionReporter.InitializeFromUrl("https://*****:*****@sentry.io/51080");
            ExceptionReporter.Disabled = !Facepunch.Utility.CommandLine.Full.Contains("-official") && !Facepunch.Utility.CommandLine.Full.Contains("-server.official") && !Facepunch.Utility.CommandLine.Full.Contains("+official") && !Facepunch.Utility.CommandLine.Full.Contains("+server.official");
            BuildInfo current = BuildInfo.Current;
            if (current.Scm.Branch != null && current.Scm.Branch.StartsWith("main"))
            {
                ExceptionReporter.InitializeFromUrl("https://*****:*****@sentry.io/1836389");
                ExceptionReporter.Disabled = false;
            }
        }
        if (AssetBundleBackend.Enabled)
        {
            AssetBundleBackend newBackend = new AssetBundleBackend();
            using (BenchmarkTimer.New("bootstrap;bundles"))
            {
                yield return(StartCoroutine(LoadingUpdate("Opening Bundles")));

                newBackend.Load("Bundles/Bundles");
                FileSystem.Backend = newBackend;
            }
            if (FileSystem.Backend.isError)
            {
                ThrowError(FileSystem.Backend.loadingError);
                yield break;
            }
            using (BenchmarkTimer.New("bootstrap;bundlesindex"))
            {
                newBackend.BuildFileIndex();
            }
        }
        if (FileSystem.Backend.isError)
        {
            ThrowError(FileSystem.Backend.loadingError);
            yield break;
        }
        if (!UnityEngine.Application.isEditor)
        {
            WriteToLog(SystemInfoGeneralText.currentInfo);
        }
        UnityEngine.Texture.SetGlobalAnisotropicFilteringLimits(1, 16);
        if (isErrored)
        {
            yield break;
        }
        using (BenchmarkTimer.New("bootstrap;gamemanifest"))
        {
            yield return(StartCoroutine(LoadingUpdate("Loading Game Manifest")));

            GameManifest.Load();
            yield return(StartCoroutine(LoadingUpdate("DONE!")));
        }
        using (BenchmarkTimer.New("bootstrap;selfcheck"))
        {
            yield return(StartCoroutine(LoadingUpdate("Running Self Check")));

            SelfCheck.Run();
        }
        if (isErrored)
        {
            yield break;
        }
        yield return(StartCoroutine(LoadingUpdate("Bootstrap Tier0")));

        using (BenchmarkTimer.New("bootstrap;tier0"))
        {
            Init_Tier0();
        }
        using (BenchmarkTimer.New("bootstrap;commandlinevalues"))
        {
            ConsoleSystem.UpdateValuesFromCommandLine();
        }
        yield return(StartCoroutine(LoadingUpdate("Bootstrap Systems")));

        using (BenchmarkTimer.New("bootstrap;init_systems"))
        {
            Init_Systems();
        }
        yield return(StartCoroutine(LoadingUpdate("Bootstrap Config")));

        using (BenchmarkTimer.New("bootstrap;init_config"))
        {
            Init_Config();
        }
        if (!isErrored)
        {
            yield return(StartCoroutine(LoadingUpdate("Loading Items")));

            using (BenchmarkTimer.New("bootstrap;itemmanager"))
            {
                ItemManager.Initialize();
            }
            if (!isErrored)
            {
                yield return(StartCoroutine(DedicatedServerStartup()));

                timer?.Dispose();
                GameManager.Destroy(base.gameObject);
            }
        }
    }
 /// <summary>
 /// <para>Gets the underlying <see cref="IHttpContextImpl"/> interface of an <see cref="IHttpContext"/>.</para>
 /// <para>This API mainly supports the EmbedIO infrastructure; it is not intended to be used directly from your code,
 /// unless to fulfill very specific needs in the development of plug-ins (modules, etc.) for EmbedIO.</para>
 /// </summary>
 /// <param name="this">The <see cref="IHttpContext"/> interface on which this method is called.</param>
 /// <returns>The underlying <see cref="IHttpContextImpl"/> interface representing
 /// the HTTP context implementation.</returns>
 /// <exception cref="ArgumentNullException">
 /// <paramref name="this"/> is <see langword="null"/>.
 /// </exception>
 /// <exception cref="EmbedIOInternalErrorException">
 /// <paramref name="this"/> does not implement <see cref="IHttpContextImpl"/>.
 /// </exception>
 public static IHttpContextImpl GetImplementation(this IHttpContext @this)
 => Validate.NotNull(nameof(@this), @this) as IHttpContextImpl
 ?? throw SelfCheck.Failure($"{@this.GetType().FullName} does not implement {nameof(IHttpContextImpl)}.");
 private void SelfCheckBtn_Click(object sender, RoutedEventArgs e)
 {
     SelfCheck.ShowWindow();
 }
Example #20
0
        private bool Passed(SelfCheck check)
        {
            string propertyName = Utilities.ToPropertyName(check.Column);
              string value = Convert.ToString(_dataObject.GetPropertyValue(propertyName));

              if (check.Operator == null)
              {
            return value == check.Value;
              }

              switch (check.Operator.ToLower())
              {
            case "<>": return value != check.Value;
            case "contains": return value.Contains(check.Value);
            case "startswith": return value.StartsWith(check.Value);
            case "endswith": return value.EndsWith(check.Value);
            default: return value == check.Value;
              }
        }