当前位置: 首页>>代码示例>>C#>>正文


C# HttpServer.Clear方法代码示例

本文整理汇总了C#中HttpServer.Clear方法的典型用法代码示例。如果您正苦于以下问题:C# HttpServer.Clear方法的具体用法?C# HttpServer.Clear怎么用?C# HttpServer.Clear使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在HttpServer的用法示例。


在下文中一共展示了HttpServer.Clear方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Process


//.........这里部分代码省略.........
                        break;
                    default:
                        break;
                }
                 */

                if (Settings.AutoRemoveCompleteFiles)
                {
                    page.Replace("{fq3c}", Checked);
                }
                else
                {
                    page.Replace("{fq3c}", "");
                }

                response.Status = System.Net.HttpStatusCode.OK;
                response.ContentType = "text/html";
                byte[] data = Encoding.UTF8.GetBytes(page.ToString());
                response.ContentLength = data.Length;
                response.SendHeaders();
                response.SendBody(data);

                return true;
            }

            if (command.StartsWith("/settings/"))
            {
                // -------------- General Settings ------------
                Settings.AutoStartManuallyAddedThreads = request.QueryString["gs0"].Value == "1";
                Settings.ThumbnailOnly = request.QueryString["gs1"].Value == "1";
                Settings.EnableFileStats = request.QueryString["gs2"].Value == "1";
                Settings.UseHttps = request.QueryString["gs3"].Value == "1";
                Settings.RemoveThreadsWhenTheyEnterArchivedState = request.QueryString["gs4"].Value == "1";
                Settings.SaveBannedFileThumbnail = request.QueryString["gs5"].Value == "1";
                Settings.CacheAPIFilesInMemory = request.QueryString["gs6"].Value == "1";

                if (Settings.EnableFileStats) { FileSystemStats.Init(); }

                // -------------- Security Settings ------------
                Settings.EnableAuthentication = request.QueryString["ss0"].Value == "1";
                Settings.AllowGuestAccess = request.QueryString["ss1"].Value == "1";
                Settings.AuthUsername = request.QueryString["ba_user"].Value;
                Settings.AuthPassword = request.QueryString["ba_pass"].Value;

                // -------------- FFMPEG Settings ------------

                Settings.ConvertGifsToWebm = request.QueryString["ff0"].Value == "1";

                Settings.ConvertWebmToMp4 = request.QueryString["ff1"].Value == "1";
                Settings.Convert_Webmgif_To_Target = request.QueryString["ff2"].Value == "1";

                if (request.QueryString["ff2s1"].Value == "gif")
                {
                    Settings.Convert_Webmgif_Target = Settings.X_Target.GIF;
                }
                else
                {
                    Settings.Convert_Webmgif_Target = Settings.X_Target.MP4;
                }

                Settings.Convert_Webmgif_only_devices = request.QueryString["ff2s2"].Value == "ff2s2o1";

                // -------------- File Queue Settings ------------

                Settings.ListThumbsInQueue = request.QueryString["fq0"].Value == "1";
                /*
                Settings.PrioritizeBumpLimit = request.QueryString["fq1"].Value == "1";

                switch (request.QueryString["fq2s1"].Value)
                {
                    case "fq2s1o1":
                        Settings.FilePrioritizeMode = Settings.FilePrioritizeModeEnum.SmallerFirst;
                        break;
                    case "fq2s1o2":
                        Settings.FilePrioritizeMode = Settings.FilePrioritizeModeEnum.LargerFirst;
                        break;
                    case "fq2s1o3":
                        Settings.FilePrioritizeMode = Settings.FilePrioritizeModeEnum.BoardSpeed;
                        break;
                    default:
                        Settings.FilePrioritizeMode = Settings.FilePrioritizeModeEnum.SmallerFirst;
                        break;
                }*/

                Settings.AutoRemoveCompleteFiles = request.QueryString["fq3"].Value == "1";

                Settings.Save();

                if (!Settings.EnableAuthentication)
                {
                    session.Clear();
                    response.Cookies.Clear();
                }

                response.Redirect("/settings");
                return true;
            }

            return false;
        }
开发者ID:tyzmodo,项目名称:chan-archiver,代码行数:101,代码来源:SettingsPageHandler.cs


注:本文中的HttpServer.Clear方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。