├── website ├── SDNUOJ │ ├── .gitignore │ ├── Views │ │ ├── _ViewStart.cshtml │ │ ├── TopicPage │ │ │ └── Index.cshtml │ │ ├── News │ │ │ ├── Detail.cshtml │ │ │ └── List.cshtml │ │ ├── User │ │ │ └── Login.cshtml │ │ ├── Solution │ │ │ └── Info.cshtml │ │ ├── Shared │ │ │ ├── Error.cshtml │ │ │ └── _Pager.cshtml │ │ ├── Info │ │ │ └── Index.cshtml │ │ └── Contests │ │ │ └── Recent.cshtml │ ├── Areas │ │ ├── Contest │ │ │ └── Views │ │ │ │ ├── _ViewStart.cshtml │ │ │ │ ├── Home │ │ │ │ └── Index.cshtml │ │ │ │ └── Forum │ │ │ │ ├── List.cshtml │ │ │ │ └── New.cshtml │ │ └── Admin │ │ │ └── Views │ │ │ ├── _ViewStart.cshtml │ │ │ ├── Info │ │ │ └── Index.cshtml │ │ │ ├── Shared │ │ │ └── _Layout.cshtml │ │ │ ├── Database │ │ │ ├── Compact.cshtml │ │ │ ├── Restore.cshtml │ │ │ ├── Backup.cshtml │ │ │ └── Upload.cshtml │ │ │ ├── Judger │ │ │ └── Add.cshtml │ │ │ ├── Problem │ │ │ └── DataCreate.cshtml │ │ │ └── User │ │ │ └── Online.cshtml │ ├── Global.asax │ ├── static │ │ ├── img │ │ │ ├── working.gif │ │ │ ├── admin │ │ │ │ └── logo.png │ │ │ └── editoricons.png │ │ ├── fonts │ │ │ ├── glyphicons-halflings-regular.eot │ │ │ ├── glyphicons-halflings-regular.ttf │ │ │ ├── glyphicons-halflings-regular.woff │ │ │ └── glyphicons-halflings-regular.woff2 │ │ ├── Web.config │ │ └── js │ │ │ ├── admin-framework.js.bundle │ │ │ ├── admin-general.js.bundle │ │ │ └── foundation │ │ │ └── codemirror-package-5.2.js.bundle │ ├── js-source │ │ ├── parts-codemirror │ │ │ ├── clike.js │ │ │ └── fullscreen.js │ │ ├── parts-foreground │ │ │ ├── foreground-pages-user.js │ │ │ ├── foreground-page-initializer.js │ │ │ ├── foreground-pages-submit.js │ │ │ ├── foreground-pages-problem.js │ │ │ ├── foreground-pages-mail.js │ │ │ └── foreground-pages-recent.js │ │ ├── parts-admin │ │ │ └── admin-page-initializer.js │ │ └── parts-core │ │ │ └── sdnuoj-foundation.js │ ├── packages.config │ └── Properties │ │ └── AssemblyInfo.cs ├── SDNUOJ.Logging │ ├── packages.config │ ├── LogLevel.cs │ ├── LogLevelConverter.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ └── ExceptionLogContext.cs ├── SDNUOJ.Storage │ ├── packages.config │ ├── Problem │ │ └── ProblemDataPair.cs │ └── Properties │ │ └── AssemblyInfo.cs ├── SDNUOJ.Data │ ├── packages.config │ ├── DatabaseConfiguration.cs │ ├── MainDatabase.cs │ └── Properties │ │ └── AssemblyInfo.cs ├── SDNUOJ.Entity │ ├── Enum │ │ ├── ForumTopicType.cs │ │ ├── ContestStatus.cs │ │ ├── ContestType.cs │ │ ├── ResultType.cs │ │ └── PermissionType.cs │ ├── Complex │ │ ├── RankItemInfoType.cs │ │ ├── LanguageStatistic.cs │ │ └── ContestProblemStatistic.cs │ ├── SolutionErrorEntity.cs │ ├── ProblemCategoryEntity.cs │ ├── ContestProblemEntity.cs │ ├── ProblemCategoryItemEntity.cs │ ├── ResourceEntity.cs │ ├── NewsEntity.cs │ ├── ContestUserEntity.cs │ ├── UserForgetPasswordEntity.cs │ ├── TopicPageEntity.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── UserMailEntity.cs │ └── ForumTopicEntity.cs ├── SDNUOJ.Controllers │ ├── GlobalFiltersRegistration.cs │ ├── ScheduleTaskRegistration.cs │ ├── InfoController.cs │ ├── Admin │ │ ├── HomeController.cs │ │ ├── InfoController.cs │ │ ├── AdminAreaRegistration.cs │ │ └── JudgerController.cs │ ├── ResourceController.cs │ ├── Exception │ │ ├── UserException.cs │ │ ├── UserUnLoginException.cs │ │ ├── DatabaseNotSupportException.cs │ │ ├── InvalidInputException.cs │ │ ├── SystemNotOpenException.cs │ │ └── NoPermissionException.cs │ ├── Contest │ │ ├── HomeController.cs │ │ ├── RankController.cs │ │ ├── OverallController.cs │ │ ├── ContestAreaRegistration.cs │ │ └── StatusController.cs │ ├── UtilityController.cs │ ├── Attributes │ │ ├── NoClientCacheAttribute.cs │ │ ├── AccessDatabaseOnlyAttribute.cs │ │ └── ContestSubmitAttribute.cs │ ├── PageType.cs │ ├── Core │ │ ├── RequestType.cs │ │ ├── SolutionErrorManager.cs │ │ └── Judge │ │ │ └── JudgeProblemManager.cs │ ├── packages.config │ ├── RankController.cs │ ├── TopicPageController.cs │ ├── HomeController.cs │ ├── app.config │ ├── GlobalAuthenticateModule.cs │ ├── FAQController.cs │ ├── NewsController.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ └── Status │ │ └── UserIPStatus.cs ├── SDNUOJ.Storage.FreeProblemSet │ ├── Exception │ │ ├── FreeProblemSetInvalidException.cs │ │ ├── FreeProblemSetNotSupportException.cs │ │ ├── FreeProblemSetDataInvalidException.cs │ │ └── FreeProblemSetException.cs │ ├── FreeProblemDataPair.cs │ ├── FreeProblemImage.cs │ └── Properties │ │ └── AssemblyInfo.cs ├── SDNUOJ.Configuration │ ├── Helper │ │ └── FileHelper.cs │ ├── WebManager.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ └── Caching │ │ └── LanguageFilterCache.cs ├── SDNUOJ.Utilities │ ├── Security │ │ └── PassWordEncrypt.cs │ ├── Text │ │ └── RegularExpressions │ │ │ └── RegexParser.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── NumericExtension.cs │ └── Net │ │ └── MailClient.cs └── SDNUOJ.Caching │ ├── Properties │ └── AssemblyInfo.cs │ ├── RecentContestCache.cs │ ├── ResourceCache.cs │ ├── ScheduledTaskManager.cs │ ├── ProblemCategoryCache.cs │ └── ProblemDataCache.cs ├── oldJudger ├── setup │ ├── Readme.txt │ ├── Require.txt │ └── inno script.iss └── src │ ├── Definition │ ├── Run.cs │ ├── IProfile.cs │ ├── IModule.cs │ ├── IJudger.cs │ ├── Problem.cs │ ├── DataAccessorProfile.cs │ ├── TestData.cs │ ├── UnhandledException.cs │ ├── CreateAndConfigureModuleException.cs │ ├── IDataAccessor.cs │ ├── IFetcher.cs │ ├── ResultCode.cs │ ├── Task.cs │ ├── Result.cs │ ├── JudgerProfile.cs │ ├── Factory.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ └── FetcherProfile.cs │ ├── MainTest │ ├── MonitorTest.cs │ ├── ServiceTest.cs │ ├── JsonTest.cs │ └── Properties │ │ └── AssemblyInfo.cs │ ├── Judger │ ├── JudgerException.cs │ ├── ProcessorAffinityUsage.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ └── ProcessorAffinityManager.cs │ ├── TaskFetcher │ ├── FetcherException.cs │ ├── ResultJsonSerializer.cs │ ├── ServerMessage.cs │ ├── TestDataAccessor.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── SDNUDataEnumerator.cs │ └── TestFetcher.cs │ ├── JudgeService │ ├── ProjectInstaller.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ └── Service.Designer.cs │ └── TestJudger │ └── Properties │ └── AssemblyInfo.cs ├── judger ├── src │ ├── Judger.Models │ │ ├── Judger.Models.csproj │ │ ├── JudgeException.cs │ │ ├── FetcherException.cs │ │ ├── JudgeResultCode.cs │ │ ├── JudgeResult.cs │ │ └── JudgeTask.cs │ ├── MainUnitTest │ │ ├── MainUnitTest.cs │ │ ├── MainUnitTest.csproj │ │ ├── RuntimeMonitorTest.cs │ │ ├── ProcessRunnerTest.cs │ │ └── JudgerTest.cs │ ├── Judger.Managers │ │ ├── LogManager.cs │ │ └── Judger.Managers.csproj │ ├── Judger.Utils │ │ ├── Judger.Utils.csproj │ │ ├── PathHelper.cs │ │ ├── ZipArchiveExtends.cs │ │ ├── MD5Encrypt.cs │ │ ├── RandomString.cs │ │ └── FileHelper.cs │ ├── Judger.Fetcher.HUSTOJ │ │ └── Judger.Fetcher.HUSTOJ.csproj │ ├── Judger.Fetcher.SDNUOJ │ │ ├── Judger.Fetcher.SDNUOJ.csproj │ │ └── Models │ │ │ ├── ServerMessage.cs │ │ │ └── SDNUOJJudgeTask.cs │ ├── Judger.Fetcher.Generic │ │ ├── Judger.Fetcher.Generic.csproj │ │ ├── Token.cs │ │ └── TaskSubmitter.cs │ ├── Judger.Judger │ │ ├── Judger.Judger.csproj │ │ ├── Compilers │ │ │ ├── CompilerFactory.cs │ │ │ └── ICompiler.cs │ │ ├── Models │ │ │ └── SingleJudgeResult.cs │ │ ├── SingleJudgerFactory.cs │ │ └── ISingleJudger.cs │ ├── Judger.Fetcher │ │ ├── ITaskFetcher.cs │ │ ├── ITaskSubmitter.cs │ │ ├── Judger.Fetcher.csproj │ │ ├── ConfiguredClient.cs │ │ └── ITestDataFetcher.cs │ ├── Judger │ │ └── Judger.csproj │ └── Judger.Service │ │ └── Judger.Service.csproj ├── config │ └── InterceptionRules.txt └── README.md ├── LICENSE └── README.md /website/SDNUOJ/.gitignore: -------------------------------------------------------------------------------- 1 | /App_Data 2 | /uploads 3 | /data 4 | /logs -------------------------------------------------------------------------------- /oldJudger/setup/Readme.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sdnuacmicpc/sdnuoj/HEAD/oldJudger/setup/Readme.txt -------------------------------------------------------------------------------- /oldJudger/setup/Require.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sdnuacmicpc/sdnuoj/HEAD/oldJudger/setup/Require.txt -------------------------------------------------------------------------------- /website/SDNUOJ/Views/_ViewStart.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | Layout = "~/Views/Shared/_Layout.cshtml"; 3 | } 4 | -------------------------------------------------------------------------------- /oldJudger/setup/inno script.iss: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sdnuacmicpc/sdnuoj/HEAD/oldJudger/setup/inno script.iss -------------------------------------------------------------------------------- /website/SDNUOJ/Areas/Contest/Views/_ViewStart.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | Layout = "~/Views/Shared/_Layout.cshtml"; 3 | } 4 | -------------------------------------------------------------------------------- /website/SDNUOJ/Areas/Admin/Views/_ViewStart.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | Layout = "~/Areas/Admin/Views/Shared/_Layout.cshtml"; 3 | } 4 | -------------------------------------------------------------------------------- /website/SDNUOJ/Global.asax: -------------------------------------------------------------------------------- 1 | <%@ Application Codebehind="Global.asax.cs" Inherits="SDNUOJ.MvcApplication" Language="C#" %> 2 | -------------------------------------------------------------------------------- /website/SDNUOJ/static/img/working.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sdnuacmicpc/sdnuoj/HEAD/website/SDNUOJ/static/img/working.gif -------------------------------------------------------------------------------- /website/SDNUOJ/static/img/admin/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sdnuacmicpc/sdnuoj/HEAD/website/SDNUOJ/static/img/admin/logo.png -------------------------------------------------------------------------------- /website/SDNUOJ/static/img/editoricons.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sdnuacmicpc/sdnuoj/HEAD/website/SDNUOJ/static/img/editoricons.png -------------------------------------------------------------------------------- /website/SDNUOJ/js-source/parts-codemirror/clike.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sdnuacmicpc/sdnuoj/HEAD/website/SDNUOJ/js-source/parts-codemirror/clike.js -------------------------------------------------------------------------------- /website/SDNUOJ.Logging/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /website/SDNUOJ/static/fonts/glyphicons-halflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sdnuacmicpc/sdnuoj/HEAD/website/SDNUOJ/static/fonts/glyphicons-halflings-regular.eot -------------------------------------------------------------------------------- /website/SDNUOJ/static/fonts/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sdnuacmicpc/sdnuoj/HEAD/website/SDNUOJ/static/fonts/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /website/SDNUOJ/static/fonts/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sdnuacmicpc/sdnuoj/HEAD/website/SDNUOJ/static/fonts/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /website/SDNUOJ/static/fonts/glyphicons-halflings-regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sdnuacmicpc/sdnuoj/HEAD/website/SDNUOJ/static/fonts/glyphicons-halflings-regular.woff2 -------------------------------------------------------------------------------- /website/SDNUOJ.Storage/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /website/SDNUOJ.Data/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /judger/src/Judger.Models/Judger.Models.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netcoreapp2.1 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /website/SDNUOJ/Views/TopicPage/Index.cshtml: -------------------------------------------------------------------------------- 1 | @model SDNUOJ.Entity.TopicPageEntity 2 | 3 | @{ 4 | ViewBag.__Title = (Model != null ? Model.Title : "Topic Page"); 5 | } 6 | 7 | 8 | @Html.Raw(Model.Content) -------------------------------------------------------------------------------- /oldJudger/src/Definition/Run.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace JudgeClient.Definition 7 | { 8 | public class Run 9 | { 10 | 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /judger/src/MainUnitTest/MainUnitTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Xunit; 3 | 4 | namespace MainUnitTest 5 | { 6 | public class MainUnitTest 7 | { 8 | [Fact] 9 | public void TestMethod() 10 | { 11 | 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /oldJudger/src/Definition/IProfile.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace JudgeClient.Definition 7 | { 8 | public interface IProfile 9 | { 10 | string Type { get; } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /oldJudger/src/Definition/IModule.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace JudgeClient.Definition 7 | { 8 | public interface IModule 9 | { 10 | void Configure(IProfile Profile); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /website/SDNUOJ.Entity/Enum/ForumTopicType.cs: -------------------------------------------------------------------------------- 1 | namespace SDNUOJ.Entity 2 | { 3 | /// 4 | /// 论坛主题类型 5 | /// 6 | public enum ForumTopicType : byte 7 | { 8 | Default = 0, 9 | Problem = 1, 10 | Contest = 2 11 | } 12 | } -------------------------------------------------------------------------------- /oldJudger/src/Definition/IJudger.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace JudgeClient.Definition 7 | { 8 | public interface IJudger : IModule 9 | { 10 | Result Judge(Task task); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /judger/src/Judger.Managers/LogManager.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Judger.Managers 6 | { 7 | /// 8 | /// 日志管理器(暂未实现) 9 | /// 10 | public static class LogManager 11 | { 12 | 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /oldJudger/src/MainTest/MonitorTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Microsoft.VisualStudio.TestTools.UnitTesting; 3 | 4 | namespace MainTest 5 | { 6 | [TestClass] 7 | public class MonitorTest 8 | { 9 | [TestMethod] 10 | public void TestMethod1() 11 | { 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /oldJudger/src/MainTest/ServiceTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Microsoft.VisualStudio.TestTools.UnitTesting; 3 | 4 | namespace MainTest 5 | { 6 | [TestClass] 7 | public class ServiceTest 8 | { 9 | [TestMethod] 10 | public void TestMethod1() 11 | { 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /website/SDNUOJ/static/Web.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /judger/src/Judger.Utils/Judger.Utils.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netcoreapp2.1 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /oldJudger/src/Definition/Problem.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace JudgeClient.Definition 7 | { 8 | public class Problem 9 | { 10 | public string Id { get; set; } 11 | public string Version { get; set; } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /website/SDNUOJ.Entity/Complex/RankItemInfoType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace SDNUOJ.Entity.Complex 4 | { 5 | /// 6 | /// 排名信息类型 7 | /// 8 | public enum RankItemInfoType : byte 9 | { 10 | Normal = 0, 11 | Wrong = 1, 12 | Accepted = 2, 13 | FirstBlood = 3 14 | } 15 | } -------------------------------------------------------------------------------- /website/SDNUOJ.Entity/Enum/ContestStatus.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace SDNUOJ.Entity 4 | { 5 | /// 6 | /// 竞赛状态 7 | /// 8 | public enum ContestStatus : byte 9 | { 10 | Pending = 0, 11 | Registering = 1, 12 | Running = 2, 13 | Ended = 3 14 | } 15 | } -------------------------------------------------------------------------------- /website/SDNUOJ.Logging/LogLevel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace SDNUOJ.Logging 4 | { 5 | /// 6 | /// 日志级别 7 | /// 8 | public enum LogLevel 9 | { 10 | Debug = 1, 11 | Verbose = 2, 12 | Information = 3, 13 | Warning = 4, 14 | Error = 5, 15 | Critical = 6, 16 | } 17 | } -------------------------------------------------------------------------------- /oldJudger/src/Definition/DataAccessorProfile.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace JudgeClient.Definition 7 | { 8 | public class DataAccessorProfile : IProfile 9 | { 10 | public string Type { get; set; } 11 | public string TestDataSavePath { get; set; } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /oldJudger/src/Definition/TestData.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace JudgeClient.Definition 7 | { 8 | public class TestData 9 | { 10 | public string Name { get; set; } 11 | public string Input { get; set; } 12 | public string Output { get; set; } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /website/SDNUOJ.Entity/Enum/ContestType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace SDNUOJ.Entity 4 | { 5 | /// 6 | /// 竞赛类型 7 | /// 8 | public enum ContestType : byte 9 | { 10 | Private = 0, 11 | Public = 1, 12 | RegisterPrivate = 2, 13 | RegisterPublic = 3 14 | } 15 | } -------------------------------------------------------------------------------- /oldJudger/src/Judger/JudgerException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace JudgeClient.Judger 7 | { 8 | public class JudgerException : Exception 9 | { 10 | public JudgerException(string Message, Exception InnerException) 11 | : base(Message, InnerException) 12 | { } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /oldJudger/src/TaskFetcher/FetcherException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace JudgeClient.Fetcher 7 | { 8 | public class FetcherException : Exception 9 | { 10 | public FetcherException(string Message, Exception InnerException) 11 | : base(Message, InnerException) 12 | { } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /oldJudger/src/Definition/UnhandledException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace JudgeClient.Definition 7 | { 8 | public class UnhandledException : Exception 9 | { 10 | public UnhandledException(string Message, Exception InnerException) 11 | : base(Message, InnerException) 12 | { } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /website/SDNUOJ.Controllers/GlobalFiltersRegistration.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Web; 3 | using System.Web.Mvc; 4 | 5 | namespace SDNUOJ.Controllers 6 | { 7 | public class GlobalFiltersRegistration 8 | { 9 | public static void RegisterGlobalFilters(GlobalFilterCollection filters) 10 | { 11 | filters.Add(new HandleErrorAttribute()); 12 | } 13 | } 14 | } -------------------------------------------------------------------------------- /judger/src/Judger.Fetcher.HUSTOJ/Judger.Fetcher.HUSTOJ.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netcoreapp2.1 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /judger/src/Judger.Fetcher.SDNUOJ/Judger.Fetcher.SDNUOJ.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netcoreapp2.1 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /judger/src/Judger.Fetcher.Generic/Judger.Fetcher.Generic.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netcoreapp2.1 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /judger/config/InterceptionRules.txt: -------------------------------------------------------------------------------- 1 | ##格式 2 | ##[Language=语言] 3 | ##之后每行一条正则,代表禁止的内容 4 | 5 | [Language=java] 6 | java\.net\. 7 | FileOutputStream 8 | FileInputStream 9 | Runtime\. 10 | \.exec\( 11 | 12 | 13 | [Language=python] 14 | import(.*)(subprocess|os|sys|http|urllib|requests|win32api|win32process|ctypes) 15 | 16 | 17 | [Language=g] 18 | windows\.h 19 | windowsx\.h 20 | winbase\.h 21 | system\( 22 | fopen\( 23 | stderr 24 | cerr( *)<< -------------------------------------------------------------------------------- /oldJudger/src/Definition/CreateAndConfigureModuleException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace JudgeClient.Definition 7 | { 8 | public class CreateAndConfigureModuleException : Exception 9 | { 10 | public CreateAndConfigureModuleException(string Message, Exception InnerException) 11 | : base(Message, InnerException) 12 | { } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /website/SDNUOJ.Controllers/ScheduleTaskRegistration.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using SDNUOJ.Controllers.Core; 3 | 4 | namespace SDNUOJ.Controllers 5 | { 6 | public static class ScheduleTaskRegistration 7 | { 8 | /// 9 | /// 注册全部定时任务 10 | /// 11 | public static void RegisterAllScheduleTasks() 12 | { 13 | RecentContestManager.ScheduleGetAllRecentContestsJsonFromWeb(); 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /judger/src/Judger.Judger/Judger.Judger.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netcoreapp2.1 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /judger/src/Judger.Fetcher/ITaskFetcher.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using Judger.Models; 5 | 6 | namespace Judger.Fetcher 7 | { 8 | /// 9 | /// JudgeTask取回接口 10 | /// 11 | public interface ITaskFetcher : IDisposable 12 | { 13 | /// 14 | /// 从服务器取回JudgeTask 15 | /// 16 | /// JudgeTask数组 17 | JudgeTask[] Fetch(); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /judger/src/Judger.Managers/Judger.Managers.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Library 5 | netcoreapp2.1 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /judger/src/Judger.Models/JudgeException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Judger.Models 6 | { 7 | /// 8 | /// 判题异常 9 | /// 10 | public class JudgeException : Exception 11 | { 12 | /// 13 | /// 判题异常 14 | /// 15 | /// Message 16 | public JudgeException(string message) : base(message) 17 | { } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /oldJudger/src/Definition/IDataAccessor.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace JudgeClient.Definition 7 | { 8 | public interface IDataAccessor : IModule 9 | { 10 | bool CheckValid(Problem Problem); 11 | int GetDataCount(Problem Problem); 12 | IEnumerator GetDataEnumerator(Problem Problem); 13 | void Update(Problem Problem, IEnumerator DataEnumerator); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /oldJudger/src/Definition/IFetcher.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace JudgeClient.Definition 7 | { 8 | public interface IFetcher : IModule 9 | { 10 | IDataAccessor DataAccessor { get; } 11 | bool FetchData(string ProblemId); 12 | void ConfigureSupportedLanguages(IEnumerable Judgers); 13 | List FetchTask(); 14 | bool Submit(Result Result); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /oldJudger/src/Judger/ProcessorAffinityUsage.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace JudgeClient.Judger 7 | { 8 | internal class ProcessorAffinityUsage : IDisposable 9 | { 10 | internal protected IntPtr Affinity; 11 | 12 | internal protected ProcessorAffinityManager Manager; 13 | 14 | public void Dispose() 15 | { 16 | Manager.ReleaseProcessor(Affinity); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /judger/src/Judger.Models/FetcherException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Judger.Models 6 | { 7 | /// 8 | /// Fetcher异常 9 | /// 10 | public class FetcherException : Exception 11 | { 12 | /// 13 | /// Fetcher异常 14 | /// 15 | /// Message 16 | public FetcherException(string message) : base(message) 17 | { } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /oldJudger/src/JudgeService/ProjectInstaller.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | using System.Collections.Generic; 4 | using System.ComponentModel; 5 | using System.Configuration.Install; 6 | using System.Linq; 7 | 8 | namespace JudgeClient.JudgeService 9 | { 10 | [RunInstaller(true)] 11 | public partial class ProjectInstaller : System.Configuration.Install.Installer 12 | { 13 | public ProjectInstaller() 14 | { 15 | InitializeComponent(); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /oldJudger/src/Definition/ResultCode.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace JudgeClient.Definition 7 | { 8 | public enum ResultCode 9 | { 10 | CompileError = 3, 11 | RuntimeError = 4, 12 | TimeLimitExceeded = 5, 13 | MemoryLimitExceeded = 6, 14 | OutputLimitExcceeded = 7, 15 | WrongAnswer = 8, 16 | PresentationError = 9, 17 | Accepted = 10, 18 | UnJudgable = 255 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /website/SDNUOJ.Entity/SolutionErrorEntity.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace SDNUOJ.Entity 4 | { 5 | /// 6 | /// 提交错误实体类 7 | /// 8 | [Serializable] 9 | public class SolutionErrorEntity 10 | { 11 | /// 12 | /// 获取或设置提交ID 13 | /// 14 | public Int32 SolutionID { get; set; } 15 | 16 | /// 17 | /// 获取或设置错误信息 18 | /// 19 | public String ErrorInfo { get; set; } 20 | } 21 | } -------------------------------------------------------------------------------- /judger/src/Judger.Fetcher/ITaskSubmitter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using Judger.Models; 5 | 6 | namespace Judger.Fetcher 7 | { 8 | /// 9 | /// JudgeResult提交接口 10 | /// 11 | public interface ITaskSubmitter : IDisposable 12 | { 13 | /// 14 | /// 提交评测结果 15 | /// 16 | /// JudgeResult 17 | /// 是否成功 18 | bool Submit(JudgeResult result); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /website/SDNUOJ.Controllers/InfoController.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Web.Mvc; 3 | 4 | namespace SDNUOJ.Controllers 5 | { 6 | public class InfoController : Controller 7 | { 8 | /// 9 | /// 提示信息页面 10 | /// 11 | /// 操作后的结果 12 | public ActionResult Index(String c, String s, String b) 13 | { 14 | ViewBag.Description = c; 15 | ViewBag.Style = s; 16 | ViewBag.BackUrl = b; 17 | 18 | return View(); 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /judger/src/Judger.Fetcher/Judger.Fetcher.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netcoreapp2.1 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /oldJudger/src/Definition/Task.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace JudgeClient.Definition 7 | { 8 | public class Task 9 | { 10 | public int Id { get; set; } 11 | public Problem Problem { get; set; } 12 | public string LanguageAndSpecial { get; set; } 13 | public string SourceCode { get; set; } 14 | public string Author { get; set; } 15 | public int MemoryLimit { get; set; } 16 | public int TimeLimit { get; set; } 17 | public IFetcher Fetcher; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /judger/src/Judger/Judger.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | netcoreapp2.1 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /judger/src/Judger.Service/Judger.Service.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netcoreapp2.1 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /oldJudger/src/Definition/Result.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace JudgeClient.Definition 7 | { 8 | public class Result 9 | { 10 | public ResultCode ResultCode { get; set; } 11 | public string Detail { get; set; } 12 | public int TimeCost { get; set; } 13 | public int MemoryCost { get; set; } 14 | public double PassRate { get; set; } 15 | public Task Task { get; set; } 16 | 17 | public bool Submit() 18 | { 19 | return Task.Fetcher.Submit(this); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /website/SDNUOJ.Data/DatabaseConfiguration.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace SDNUOJ.Data 4 | { 5 | /// 6 | /// 数据库管理类 7 | /// 8 | public static class DatabaseConfiguration 9 | { 10 | /// 11 | /// 获取当前数据库类型 12 | /// 13 | public static String DataBaseType { get { return MainDatabase.Instance.DatabaseType.ToString(); } } 14 | 15 | /// 16 | /// 获取当前数据库连接字符串 17 | /// 18 | public static String DataBaseConnectionString { get { return MainDatabase.Instance.ConnectionString; } } 19 | } 20 | } -------------------------------------------------------------------------------- /website/SDNUOJ.Storage.FreeProblemSet/Exception/FreeProblemSetInvalidException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.Serialization; 3 | 4 | namespace SDNUOJ.Storage.FreeProblemSet.Exception 5 | { 6 | /// 7 | /// Free Problem Set无效异常 8 | /// 9 | [Serializable] 10 | public class FreeProblemSetInvalidException : FreeProblemSetException 11 | { 12 | #region 方法 13 | /// 14 | /// 初始化新的异常 15 | /// 16 | public FreeProblemSetInvalidException() : base("This free problem set is INVALID!") { } 17 | #endregion 18 | } 19 | } -------------------------------------------------------------------------------- /website/SDNUOJ.Controllers/Admin/HomeController.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Web.Mvc; 3 | 4 | using SDNUOJ.Controllers.Core; 5 | 6 | namespace SDNUOJ.Areas.Admin.Controllers 7 | { 8 | [Authorize(Roles = "Administrator")] 9 | public class HomeController : AdminBaseController 10 | { 11 | /// 12 | /// 后台首页页面 13 | /// 14 | /// 操作后的结果 15 | public ActionResult Index() 16 | { 17 | ViewBag.IsAccessDatabase = DatabaseManager.IsAccessDB.ToString().ToLowerInvariant(); 18 | 19 | return View(); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /website/SDNUOJ.Controllers/Admin/InfoController.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Web.Mvc; 3 | 4 | namespace SDNUOJ.Areas.Admin.Controllers 5 | { 6 | [Authorize(Roles = "Administrator")] 7 | public class InfoController : AdminBaseController 8 | { 9 | /// 10 | /// 提示信息页面 11 | /// 12 | /// 操作后的结果 13 | public ActionResult Index(String c, String s, String b) 14 | { 15 | ViewBag.Description = c; 16 | ViewBag.Style = s; 17 | ViewBag.BackUrl = b; 18 | 19 | return View(); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /website/SDNUOJ.Storage.FreeProblemSet/Exception/FreeProblemSetNotSupportException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.Serialization; 3 | 4 | namespace SDNUOJ.Storage.FreeProblemSet.Exception 5 | { 6 | /// 7 | /// Free Problem Set不支持异常 8 | /// 9 | [Serializable] 10 | public class FreeProblemSetNotSupportException : FreeProblemSetException 11 | { 12 | #region 方法 13 | /// 14 | /// 初始化新的异常 15 | /// 16 | public FreeProblemSetNotSupportException() : base("This free problem set is not supported!") { } 17 | #endregion 18 | } 19 | } -------------------------------------------------------------------------------- /website/SDNUOJ/js-source/parts-foreground/foreground-pages-user.js: -------------------------------------------------------------------------------- 1 | SDNUOJ.namespace("SDNUOJ.pages.userinfo"); 2 | 3 | SDNUOJ.pages.userinfo = (function () { 4 | var user = SDNUOJ.user; 5 | 6 | return { 7 | init: function () { 8 | if (user.getIsLogined()) { 9 | var username = user.getCurrentUserName().toLowerCase(); 10 | var container = $("#downloadcode_" + username); 11 | 12 | if (container.length > 0) { 13 | container.html("(Download)"); 14 | } 15 | } 16 | } 17 | } 18 | })(); -------------------------------------------------------------------------------- /judger/src/Judger.Fetcher.SDNUOJ/Models/ServerMessage.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using Newtonsoft.Json; 5 | 6 | namespace Judger.Fetcher.SDNUOJ.Models 7 | { 8 | [Serializable] 9 | public class ServerMessage 10 | { 11 | [JsonProperty(PropertyName = "status")] 12 | public string Status { get; set; } 13 | 14 | [JsonProperty(PropertyName = "message")] 15 | public string Message { get; set; } 16 | public bool IsSuccessful 17 | { 18 | get 19 | { 20 | return Status == "success"; 21 | } 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /website/SDNUOJ.Entity/ProblemCategoryEntity.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace SDNUOJ.Entity 4 | { 5 | /// 6 | /// 题目类型种类实体类 7 | /// 8 | [Serializable] 9 | public class ProblemCategoryEntity 10 | { 11 | /// 12 | /// 获取或设置题目类型种类ID 13 | /// 14 | public Int32 TypeID { get; set; } 15 | 16 | /// 17 | /// 获取或设置题目类型种类名称 18 | /// 19 | public String Title { get; set; } 20 | 21 | /// 22 | /// 获取或设置显示顺序 23 | /// 24 | public Int32 Order { get; set; } 25 | } 26 | } -------------------------------------------------------------------------------- /website/SDNUOJ.Storage.FreeProblemSet/Exception/FreeProblemSetDataInvalidException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.Serialization; 3 | 4 | namespace SDNUOJ.Storage.FreeProblemSet.Exception 5 | { 6 | /// 7 | /// Free Problem Set题目数据无效异常 8 | /// 9 | [Serializable] 10 | public class FreeProblemSetDataInvalidException : FreeProblemSetException 11 | { 12 | #region 方法 13 | /// 14 | /// 初始化新的异常 15 | /// 16 | public FreeProblemSetDataInvalidException() : base("The problem data in this free problem set is INVALID!") { } 17 | #endregion 18 | } 19 | } -------------------------------------------------------------------------------- /website/SDNUOJ.Entity/Complex/LanguageStatistic.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace SDNUOJ.Entity.Complex 4 | { 5 | /// 6 | /// 题目语言统计信息实体类 7 | /// 8 | [Serializable] 9 | public class LanguageStatistic 10 | { 11 | /// 12 | /// 获取或设置题目ID 13 | /// 14 | public Int32 ProblemID { get; set; } 15 | 16 | /// 17 | /// 获取或设置语言ID 18 | /// 19 | public Byte LanguageID { get; set; } 20 | 21 | /// 22 | /// 获取或设置数量 23 | /// 24 | public Int32 Count { get; set; } 25 | } 26 | } -------------------------------------------------------------------------------- /website/SDNUOJ.Entity/ContestProblemEntity.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace SDNUOJ.Entity 4 | { 5 | /// 6 | /// 竞赛题目实体类 7 | /// 8 | [Serializable] 9 | public class ContestProblemEntity 10 | { 11 | /// 12 | /// 获取或设置竞赛ID 13 | /// 14 | public Int32 ContestID { get; set; } 15 | 16 | /// 17 | /// 获取或设置题目ID 18 | /// 19 | public Int32 ProblemID { get; set; } 20 | 21 | /// 22 | /// 获取或设置竞赛题目ID 23 | /// 24 | public Int32 ContestProblemID { get; set; } 25 | } 26 | } -------------------------------------------------------------------------------- /website/SDNUOJ.Entity/ProblemCategoryItemEntity.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace SDNUOJ.Entity 4 | { 5 | /// 6 | /// 题目类型对实体类 7 | /// 8 | [Serializable] 9 | public class ProblemCategoryItemEntity 10 | { 11 | /// 12 | /// 获取或设置题目类型对ID 13 | /// 14 | public Int32 PTID { get; set; } 15 | 16 | /// 17 | /// 获取或设置题目类型种类ID 18 | /// 19 | public Int32 TypeID { get; set; } 20 | 21 | /// 22 | /// 获取或设置题目ID 23 | /// 24 | public Int32 ProblemID { get; set; } 25 | } 26 | } -------------------------------------------------------------------------------- /website/SDNUOJ.Configuration/Helper/FileHelper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | using System.Web; 4 | 5 | namespace SDNUOJ.Configuration.Helper 6 | { 7 | /// 8 | /// 文件辅助类 9 | /// 10 | internal static class FileHelper 11 | { 12 | /// 13 | /// 获取文件绝对路径 14 | /// 15 | /// 文件相对路径 16 | /// 文件绝对路径 17 | internal static String GetRealPath(String relativePath) 18 | { 19 | String realPath = Path.Combine(HttpRuntime.AppDomainAppPath, relativePath); 20 | 21 | return realPath; 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /website/SDNUOJ/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /website/SDNUOJ.Controllers/ResourceController.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Web.Mvc; 3 | 4 | using SDNUOJ.Controllers.Attributes; 5 | using SDNUOJ.Controllers.Core; 6 | 7 | namespace SDNUOJ.Controllers 8 | { 9 | [Function(PageType.Resource)] 10 | public class ResourceController : BaseController 11 | { 12 | /// 13 | /// 下载资源页面 14 | /// 15 | /// 操作后的结果 16 | [Authorize] 17 | [OutputCache(CacheProfile = "DynamicPageCache", VaryByParam = "None", VaryByCustom = "in")] 18 | public ActionResult Index() 19 | { 20 | return View(ResourceManager.GetResourcesTreeList()); 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /judger/src/Judger.Judger/Compilers/CompilerFactory.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using Judger.Models; 5 | 6 | namespace Judger.Judger.Compilers 7 | { 8 | public static class CompilerFactory 9 | { 10 | /// 11 | /// 创建Compiler 12 | /// 13 | public static ICompiler Create(JudgeTask task) 14 | { 15 | ICompiler compiler = new Compiler( 16 | task.LangConfig.CompilerPath, 17 | task.LangConfig.CompilerWorkDirectory); 18 | 19 | compiler.TimeLimit = task.LangConfig.MaxCompileTime; 20 | 21 | return compiler; 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /website/SDNUOJ.Controllers/Exception/UserException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.Serialization; 3 | 4 | namespace SDNUOJ.Controllers.Exception 5 | { 6 | /// 7 | /// 用户异常基类 8 | /// 9 | [Serializable] 10 | public abstract class UserException : ApplicationException, ISerializable 11 | { 12 | #region 属性 13 | /// 14 | /// 获取是否需要记录 15 | /// 16 | public abstract Boolean IsNeedLog { get; } 17 | #endregion 18 | 19 | #region 方法 20 | /// 21 | /// 初始化新的用户异常 22 | /// 23 | public UserException(String message) 24 | : base(message) { } 25 | #endregion 26 | } 27 | } -------------------------------------------------------------------------------- /judger/src/MainUnitTest/MainUnitTest.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netcoreapp2.1 5 | 6 | false 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /website/SDNUOJ/Views/News/Detail.cshtml: -------------------------------------------------------------------------------- 1 | @model SDNUOJ.Entity.NewsEntity 2 | 3 | @{ 4 | ViewBag.__Title = "News" + ((Model != null && !String.IsNullOrEmpty(Model.Title)) ? " - " + Model.Title : ""); 5 | } 6 | 7 |
8 |
9 |
10 |

@Model.Title

11 |
12 |
13 |
14 |
15 | @Html.Raw(Model.Description) 16 |
17 |
18 |
19 |
20 |
Publish Date: @Model.PublishDate.ToString("yyyy-MM-dd HH:mm:ss")
21 |
22 |
23 |
-------------------------------------------------------------------------------- /website/SDNUOJ.Entity/ResourceEntity.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace SDNUOJ.Entity 4 | { 5 | /// 6 | /// 资源实体类 7 | /// 8 | [Serializable] 9 | public class ResourceEntity 10 | { 11 | /// 12 | /// 获取或设置资源ID 13 | /// 14 | public Int32 ResourceID { get; set; } 15 | 16 | /// 17 | /// 获取或设置资源标题 18 | /// 19 | public String Title { get; set; } 20 | 21 | /// 22 | /// 获取或设置资源URL 23 | /// 24 | public String Url { get; set; } 25 | 26 | /// 27 | /// 获取或设置资源类型 28 | /// 29 | public String Type { get; set; } 30 | } 31 | } -------------------------------------------------------------------------------- /website/SDNUOJ.Controllers/Contest/HomeController.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Web.Mvc; 3 | 4 | using SDNUOJ.Controllers.Core; 5 | using SDNUOJ.Entity; 6 | 7 | namespace SDNUOJ.Areas.Contest.Controllers 8 | { 9 | public class HomeController : ContestBaseController 10 | { 11 | /// 12 | /// 竞赛首页页面 13 | /// 14 | /// 竞赛ID 15 | /// 操作后的结果 16 | [OutputCache(CacheProfile = "DynamicPageCache", VaryByParam = "None", VaryByCustom = "nm")] 17 | public ActionResult Index(Int32 cid) 18 | { 19 | ContestEntity entity = ViewData["Contest"] as ContestEntity; 20 | 21 | return View(entity); 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /website/SDNUOJ.Controllers/Exception/UserUnLoginException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.Serialization; 3 | 4 | namespace SDNUOJ.Controllers.Exception 5 | { 6 | /// 7 | /// 用户未登录异常 8 | /// 9 | [Serializable] 10 | public class UserUnLoginException : UserException, ISerializable 11 | { 12 | #region 属性 13 | /// 14 | /// 获取是否需要记录 15 | /// 16 | public override Boolean IsNeedLog { get { return false; } } 17 | #endregion 18 | 19 | #region 方法 20 | /// 21 | /// 初始化新的用户未登录异常 22 | /// 23 | public UserUnLoginException() 24 | : base("Please login first!") { } 25 | #endregion 26 | } 27 | } -------------------------------------------------------------------------------- /website/SDNUOJ.Controllers/UtilityController.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Web.Mvc; 3 | 4 | using SDNUOJ.Controllers.Attributes; 5 | using SDNUOJ.Controllers.Status; 6 | using SDNUOJ.Utilities.Drawing; 7 | 8 | namespace SDNUOJ.Controllers 9 | { 10 | public class UtilityController : Controller 11 | { 12 | /// 13 | /// 验证码图片 14 | /// 15 | /// 验证码图片 16 | [NoClientCache] 17 | public ActionResult CheckCode() 18 | { 19 | CheckCode checkCode = new CheckCode(); 20 | CheckCodeStatus.SetCheckCode(checkCode.CodeText); 21 | Byte[] data = checkCode.GetBitmapData(); 22 | 23 | return File(data, "image/jpeg"); 24 | } 25 | } 26 | } -------------------------------------------------------------------------------- /website/SDNUOJ.Entity/NewsEntity.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace SDNUOJ.Entity 4 | { 5 | /// 6 | /// 公告实体类 7 | /// 8 | [Serializable] 9 | public class NewsEntity 10 | { 11 | /// 12 | /// 获取或设置公告ID 13 | /// 14 | public Int32 AnnounceID { get; set; } 15 | 16 | /// 17 | /// 获取或设置公告标题 18 | /// 19 | public String Title { get; set; } 20 | 21 | /// 22 | /// 获取或设置公告描述 23 | /// 24 | public String Description { get; set; } 25 | 26 | /// 27 | /// 获取或设置公告日期 28 | /// 29 | public DateTime PublishDate { get; set; } 30 | } 31 | } -------------------------------------------------------------------------------- /website/SDNUOJ.Controllers/Attributes/NoClientCacheAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Web; 3 | using System.Web.Mvc; 4 | 5 | namespace SDNUOJ.Controllers.Attributes 6 | { 7 | /// 8 | /// 禁用客户端本地缓存特性 9 | /// 10 | [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = false)] 11 | public class NoClientCacheAttribute : ActionFilterAttribute 12 | { 13 | public override void OnActionExecuting(ActionExecutingContext filterContext) 14 | { 15 | HttpResponseBase Response = filterContext.HttpContext.Response; 16 | 17 | Response.Expires = 0; 18 | Response.AppendHeader("Pragma", "No-Cache"); 19 | Response.CacheControl = "No-Cache"; 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /website/SDNUOJ.Controllers/PageType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace SDNUOJ.Controllers 4 | { 5 | /// 6 | /// 页面类别 7 | /// 8 | public enum PageType : int 9 | { 10 | None = 0x0, 11 | Register = 0x1, 12 | ForgetPassword = 0x2, 13 | UserControl = 0x10, 14 | UserMail = 0x20, 15 | UserInfo = 0x40, 16 | SourceView = 0x100, 17 | MainSubmit = 0x200, 18 | MainForum = 0x400, 19 | MainProblem = 0x800, 20 | MainRanklist = 0x1000, 21 | MainStatus = 0x2000, 22 | Resource = 0x4000, 23 | Contest = 0x8000 24 | } 25 | } -------------------------------------------------------------------------------- /oldJudger/src/TaskFetcher/ResultJsonSerializer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | using Burst.Json; 7 | 8 | using JudgeClient.Definition; 9 | 10 | namespace JudgeClient.Fetcher 11 | { 12 | public class ResultJsonSerializer : JsonObjectSerializerBase 13 | { 14 | public override string SerializeToJsonString(object ori, int layer, JsonFormatOption option) 15 | { 16 | var res = ori as Result; 17 | return string.Format(@"{{""task"":{{""id"":{0}}},""result"":{1},""detail"":""{2}"",""time_cost"":{3},""memory_cost"":{4},""pass_rate"":{5}}}", 18 | res.Task.Id, (int)res.ResultCode, JsonUtils.EncodeCRLFTabQuote(res.Detail), res.TimeCost, res.MemoryCost, res.PassRate); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /website/SDNUOJ.Utilities/Security/PassWordEncrypt.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace SDNUOJ.Utilities.Security 4 | { 5 | /// 6 | /// 用户密码加密类 7 | /// 8 | public static class PassWordEncrypt 9 | { 10 | private const String SALT = "__SDNU ACM-ICPC__"; 11 | 12 | /// 13 | /// 对指定用户名和密码进行加密 14 | /// 15 | /// 用户名 16 | /// 原始密码 17 | /// 加密后的密码 18 | public static String Encrypt(String userName, String passWord) 19 | { 20 | String temp = MD5Encrypt.EncryptToHexString(userName + passWord, true) + SALT; 21 | 22 | return MD5Encrypt.EncryptToHexString(temp, true); 23 | } 24 | } 25 | } -------------------------------------------------------------------------------- /website/SDNUOJ.Controllers/Attributes/AccessDatabaseOnlyAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Web.Mvc; 3 | 4 | using SDNUOJ.Controllers.Core; 5 | using SDNUOJ.Controllers.Exception; 6 | 7 | namespace SDNUOJ.Controllers.Attributes 8 | { 9 | /// 10 | /// 仅限Access数据库特性 11 | /// 12 | [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = false)] 13 | public class AccessDatabaseOnlyAttribute : ActionFilterAttribute 14 | { 15 | #region 方法 16 | public override void OnActionExecuting(ActionExecutingContext filterContext) 17 | { 18 | if (!DatabaseManager.IsAccessDB) 19 | { 20 | throw new DatabaseNotSupportException(); 21 | } 22 | } 23 | #endregion 24 | } 25 | } -------------------------------------------------------------------------------- /website/SDNUOJ/Views/User/Login.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewBag.__Title = "Sign in"; 3 | } 4 | 5 |
6 |

Sign in

7 |
8 | 9 | @using (Html.BeginForm("Login", "User", FormMethod.Post, new { @data_verify = "true" })) 10 | { 11 | 17 | 18 | } -------------------------------------------------------------------------------- /website/SDNUOJ.Controllers/Core/RequestType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace SDNUOJ.Controllers.Core 4 | { 5 | /// 6 | /// 请求项目类型 7 | /// 8 | public enum RequestType : byte 9 | { 10 | None = 0, 11 | User = 10, 12 | Problem = 20, 13 | ProblemCategory = 21, 14 | Contest = 30, 15 | Solution = 40, 16 | SolutionError = 41, 17 | ForumTopic = 50, 18 | ForumPost = 51, 19 | News = 60, 20 | UserMail = 70, 21 | UserForgetPassword = 80, 22 | TopicPage = 90, 23 | Resource = 100 24 | } 25 | } -------------------------------------------------------------------------------- /website/SDNUOJ/js-source/parts-admin/admin-page-initializer.js: -------------------------------------------------------------------------------- 1 | (function () { 2 | if (SDNUOJ.util.browser.ltIE8()) { 3 | $("#browser-warning").show(); 4 | window.close(); 5 | } 6 | 7 | SDNUOJ.admin.page.setForm(); 8 | SDNUOJ.admin.page.setPager(); 9 | SDNUOJ.admin.page.setAdvanceLink(); 10 | SDNUOJ.admin.page.setSwitchLink(); 11 | SDNUOJ.admin.page.setCollapseLink(); 12 | SDNUOJ.admin.page.setButtonLink(); 13 | SDNUOJ.admin.page.setRadio(); 14 | SDNUOJ.admin.page.setDatetimePicker(); 15 | SDNUOJ.admin.page.generateSelectItems(); 16 | SDNUOJ.admin.page.setSelect(); 17 | SDNUOJ.admin.page.disableEnter(); 18 | 19 | SDNUOJ.admin.editor.setAllEditors(); 20 | 21 | SDNUOJ.util.list.setCheckboxSelectAll(); 22 | 23 | SDNUOJ.admin.page.initPage(); 24 | })(); -------------------------------------------------------------------------------- /judger/src/Judger.Fetcher/ConfiguredClient.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using Judger.Managers; 5 | using Judger.Utils; 6 | 7 | namespace Judger.Fetcher 8 | { 9 | public static class ConfiguredClient 10 | { 11 | /// 12 | /// 创建含有基本配置的HttpWebClient 13 | /// 14 | /// 15 | public static HttpWebClient Create() 16 | { 17 | HttpWebClient client = new HttpWebClient(); 18 | client.Proxy = null; 19 | client.Timeout = ConfigManager.Config.FetchTimeout; 20 | client.ReadWriteTimeout = ConfigManager.Config.FetchTimeout; 21 | client.DefaultContentType = "application/x-www-form-urlencoded"; 22 | 23 | return client; 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /website/SDNUOJ/Views/Solution/Info.cshtml: -------------------------------------------------------------------------------- 1 | @model SDNUOJ.Entity.SolutionErrorEntity 2 | 3 | @{ 4 | ViewBag.__Title = "Solution Error View"; 5 | } 6 | 7 |
8 |
9 |
10 |

Judge Information

11 |
12 |
13 |
14 |
15 | Run ID: @Model.SolutionID 16 |
17 |
18 | @Html.Raw(!String.IsNullOrEmpty(Model.ErrorInfo) ? Model.ErrorInfo : "No relevant information")@*!TIP:SoultionError.ErrorInfo获取时已Encode*@ 19 |
20 |
21 |
-------------------------------------------------------------------------------- /website/SDNUOJ.Controllers/Exception/DatabaseNotSupportException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.Serialization; 3 | 4 | namespace SDNUOJ.Controllers.Exception 5 | { 6 | /// 7 | /// 数据库不支持异常 8 | /// 9 | [Serializable] 10 | public class DatabaseNotSupportException : UserException, ISerializable 11 | { 12 | #region 属性 13 | /// 14 | /// 获取是否需要记录 15 | /// 16 | public override Boolean IsNeedLog { get { return false; } } 17 | #endregion 18 | 19 | #region 方法 20 | /// 21 | /// 初始化新的数据库不支持异常 22 | /// 23 | public DatabaseNotSupportException() 24 | : base("Current database does not support this function!") { } 25 | #endregion 26 | } 27 | } -------------------------------------------------------------------------------- /website/SDNUOJ.Controllers/Exception/InvalidInputException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.Serialization; 3 | 4 | namespace SDNUOJ.Controllers.Exception 5 | { 6 | /// 7 | /// 非法输入异常 8 | /// 9 | [Serializable] 10 | public class InvalidInputException : UserException, ISerializable 11 | { 12 | #region 属性 13 | /// 14 | /// 获取是否需要记录 15 | /// 16 | public override Boolean IsNeedLog { get { return false; } } 17 | #endregion 18 | 19 | #region 方法 20 | /// 21 | /// 初始化新的非法输入异常 22 | /// 23 | /// 异常信息 24 | public InvalidInputException(String message) 25 | : base(message) { } 26 | #endregion 27 | } 28 | } -------------------------------------------------------------------------------- /website/SDNUOJ.Controllers/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /website/SDNUOJ.Controllers/RankController.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Web.Mvc; 3 | 4 | using SDNUOJ.Controllers.Attributes; 5 | using SDNUOJ.Controllers.Core; 6 | using SDNUOJ.Entity; 7 | using SDNUOJ.Utilities; 8 | 9 | namespace SDNUOJ.Controllers 10 | { 11 | [Function(PageType.MainRanklist)] 12 | public class RankController : BaseController 13 | { 14 | /// 15 | /// 排行列表页面 16 | /// 17 | /// 页面索引 18 | /// 操作后的结果 19 | [OutputCache(CacheProfile = "DynamicPageCache", VaryByParam= "id")] 20 | public ActionResult List(Int32 id = 1) 21 | { 22 | PagedList list = UserManager.GetUserRanklist(id); 23 | 24 | return ViewWithPager(list, id); 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /judger/src/Judger.Judger/Models/SingleJudgeResult.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using Judger.Models; 5 | 6 | namespace Judger.Judger.Models 7 | { 8 | /// 9 | /// 单例Judge结果 10 | /// 11 | public class SingleJudgeResult 12 | { 13 | /// 14 | /// 判题结果码 15 | /// 16 | public JudgeResultCode ResultCode { get; set; } 17 | 18 | /// 19 | /// 详细信息(用于返回错误信息) 20 | /// 21 | public string JudgeDetail { get; set; } 22 | 23 | /// 24 | /// 时间消耗 25 | /// 26 | public int TimeCost { get; set; } 27 | 28 | /// 29 | /// 内存消耗 30 | /// 31 | public int MemoryCost { get; set; } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /judger/src/Judger.Utils/PathHelper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using System.IO; 5 | 6 | namespace Judger.Utils 7 | { 8 | /// 9 | /// 路径辅助类 10 | /// 11 | public static class PathHelper 12 | { 13 | /// 14 | /// 获取以程序所在目录(非工作目录)为准的绝对路径 15 | /// 16 | /// 相对路径(绝对路径不处理) 17 | /// 绝对路径 18 | public static string GetBaseAbsolutePath(string path) 19 | { 20 | // 绝对路径不处理 21 | if (path.IndexOf(':') != -1 || path.StartsWith('/') || path.StartsWith('\\')) 22 | { 23 | return path; 24 | } 25 | 26 | return Path.Combine(AppDomain.CurrentDomain.BaseDirectory, path); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /website/SDNUOJ.Controllers/TopicPageController.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Web.Mvc; 3 | 4 | using SDNUOJ.Controllers.Core; 5 | using SDNUOJ.Entity; 6 | 7 | namespace SDNUOJ.Controllers 8 | { 9 | public class TopicPageController : BaseController 10 | { 11 | /// 12 | /// 专题页面 13 | /// 14 | /// 专题页面名称 15 | /// 操作后的结果 16 | [OutputCache(CacheProfile = "DynamicPageCache", VaryByParam = "name", VaryByCustom = "sa")] 17 | public ActionResult Index(String name) 18 | { 19 | try 20 | { 21 | return View(TopicPageManager.GetTopicPage(name)); 22 | } 23 | catch 24 | { 25 | return HttpNotFound(); 26 | } 27 | } 28 | } 29 | } -------------------------------------------------------------------------------- /website/SDNUOJ.Data/MainDatabase.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | using DotMaysWind.Data; 4 | 5 | namespace SDNUOJ.Data 6 | { 7 | /// 8 | /// 数据库类 9 | /// 10 | internal static class MainDatabase 11 | { 12 | #region 字段 13 | private static IDatabase _database; 14 | #endregion 15 | 16 | #region 属性 17 | /// 18 | /// 获取当前数据库实例 19 | /// 20 | internal static IDatabase Instance 21 | { 22 | get { return _database; } 23 | } 24 | #endregion 25 | 26 | #region 构造方法 27 | /// 28 | /// 初始化新的数据库类 29 | /// 30 | static MainDatabase() 31 | { 32 | _database = DatabaseFactory.CreateDatabase(); 33 | } 34 | #endregion 35 | } 36 | } -------------------------------------------------------------------------------- /judger/src/Judger.Utils/ZipArchiveExtends.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using System.IO.Compression; 5 | using System.Reflection; 6 | 7 | namespace Judger.Utils 8 | { 9 | /// 10 | /// ZipArchive扩展类 11 | /// 12 | public static class ZipArchiveExtends 13 | { 14 | /// 15 | /// 强制更新基础流 16 | /// 17 | /// ZipArchive实例 18 | public static void UpdateBaseStream(this ZipArchive zipArchive) 19 | { 20 | foreach (MethodInfo method in zipArchive.GetType().GetRuntimeMethods()) 21 | { 22 | if (method.Name == "WriteFile") 23 | { 24 | method.Invoke(zipArchive, new object[0]); 25 | } 26 | } 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /oldJudger/src/MainTest/JsonTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Diagnostics; 3 | using System.Collections.Generic; 4 | using Microsoft.VisualStudio.TestTools.UnitTesting; 5 | 6 | using Burst.Json; 7 | 8 | using JudgeClient.Definition; 9 | using JudgeClient.Fetcher; 10 | 11 | namespace MainTest 12 | { 13 | [TestClass] 14 | public class JsonTest 15 | { 16 | [TestMethod] 17 | public void TestMethod1() 18 | { 19 | var _parser_dic = new Dictionary(); 20 | _parser_dic.Add(typeof(Task), new TaskJsonParser()); 21 | //_parser_dic.Add(typeof(Problem), new ProblemJsonParser()); 22 | 23 | var res = JsonUtils.ParseAs>("[{'id':2,'problem':{'id':34,'last_modified_date':'2012-1-1'},'language_and_special':'g++[]'}]", _parser_dic); 24 | Assert.AreEqual(2, res[0].Id); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /website/SDNUOJ.Utilities/Text/RegularExpressions/RegexParser.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Text.RegularExpressions; 3 | 4 | namespace SDNUOJ.Utilities.Text.RegularExpressions 5 | { 6 | /// 7 | /// 正则表达式文字提取类 8 | /// 9 | public static class RegexParser 10 | { 11 | /// 12 | /// 从给定字符串中获取电子邮件地址 13 | /// 14 | /// 字符串 15 | /// 电子邮件地址 16 | public static String ParseEmail(String s) 17 | { 18 | if (String.IsNullOrEmpty(s)) 19 | { 20 | return String.Empty; 21 | } 22 | 23 | Regex regex = new Regex(@"[\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)+"); 24 | Match match = regex.Match(s); 25 | return (match.Success ? match.Value : String.Empty); 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /oldJudger/src/TaskFetcher/ServerMessage.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using Burst.Json; 6 | 7 | namespace JudgeClient.Fetcher 8 | { 9 | public class ServerMessage : IJsonDeserializeObject 10 | { 11 | public string Message { get; set; } 12 | public string Status { get; set; } 13 | 14 | public void SetFieldValue(string fieldName, object value) 15 | { 16 | switch (fieldName) 17 | { 18 | case "status": 19 | Status = value as string; 20 | break; 21 | case "message": 22 | Message = value as string; 23 | break; 24 | } 25 | } 26 | 27 | public Type GetFieldType(string fieldName) 28 | { 29 | return typeof(string); 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /judger/src/Judger.Fetcher.Generic/Token.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using Judger.Managers; 5 | using Judger.Utils; 6 | 7 | namespace Judger.Fetcher.Generic 8 | { 9 | /// 10 | /// 校验Token 11 | /// 12 | public static class Token 13 | { 14 | /// 15 | /// 生成校验Token 16 | /// 17 | public static string Create() 18 | { 19 | //Token = MD5( MD5( JudgerName + SecretKey ) + UtcDate ) 20 | 21 | string name = ConfigManager.Config.JudgerName; 22 | string secret = ConfigManager.Config.Password; 23 | string date = DateTime.UtcNow.ToString("yyyy-MM-dd"); 24 | 25 | string ns = MD5Encrypt.EncryptToHexString(name + secret); 26 | string token = MD5Encrypt.EncryptToHexString(ns + date); 27 | 28 | return token; 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /website/SDNUOJ.Entity/ContestUserEntity.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace SDNUOJ.Entity 4 | { 5 | /// 6 | /// 竞赛用户实体类 7 | /// 8 | [Serializable] 9 | public class ContestUserEntity 10 | { 11 | /// 12 | /// 获取或设置竞赛ID 13 | /// 14 | public Int32 ContestID { get; set; } 15 | 16 | /// 17 | /// 获取或设置用户名称 18 | /// 19 | public String UserName { get; set; } 20 | 21 | /// 22 | /// 获取或设置真实姓名 23 | /// 24 | public String RealName { get; set; } 25 | 26 | /// 27 | /// 获取或设置注册时间 28 | /// 29 | public DateTime RegisterTime { get; set; } 30 | 31 | /// 32 | /// 获取或设置是否启用该用户 33 | /// 34 | public Boolean IsEnable { get; set; } 35 | } 36 | } -------------------------------------------------------------------------------- /website/SDNUOJ/Areas/Admin/Views/Info/Index.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewBag.__Title = "System Message"; 3 | } 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 16 | 17 | 18 | 19 | 20 | 23 | 24 | 25 |
System Message
14 | @Html.Raw((String.IsNullOrEmpty(ViewBag.Description) || String.IsNullOrEmpty(HttpUtility.UrlDecode(ViewBag.Description.Trim()))) ? "(# ゜Д゜)" : HttpUtility.UrlDecode(ViewBag.Description.Trim())) 15 |
21 | Back 22 |
-------------------------------------------------------------------------------- /website/SDNUOJ.Controllers/HomeController.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Web.Mvc; 4 | 5 | using SDNUOJ.Controllers.Core; 6 | using SDNUOJ.Entity; 7 | 8 | namespace SDNUOJ.Controllers 9 | { 10 | public class HomeController : BaseController 11 | { 12 | /// 13 | /// 首页页面 14 | /// 15 | /// 操作后的结果 16 | [OutputCache(CacheProfile = "DynamicPageCache", VaryByParam = "None")] 17 | public ActionResult Index() 18 | { 19 | NewsEntity defaultNews = NewsManager.GetDefaultNews(); 20 | List lastestNews = NewsManager.GetLastestNewsList(); 21 | List topTenUsers = UserManager.GetWeeklyUserTop10Ranklist(); 22 | 23 | return View(new Tuple, List> 24 | (defaultNews, lastestNews, topTenUsers)); 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /judger/src/Judger.Judger/SingleJudgerFactory.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using Judger.Models; 5 | 6 | namespace Judger.Judger 7 | { 8 | /// 9 | /// 单例Judger工厂 10 | /// 11 | public static class SingleJudgerFactory 12 | { 13 | /// 14 | /// 创建单例Judger 15 | /// 16 | public static ISingleJudger Create(JudgeTask task) 17 | { 18 | LanguageConfiguration config = task.LangConfig; 19 | 20 | ISingleJudger judger = new SingleJudger(config.RunnerPath) 21 | { 22 | RunnerWorkDirectory = config.RunnerWorkDirectory, 23 | RunnerArgs = config.RunnerArgs, 24 | TimeLimit = task.TimeLimit, 25 | MemoryLimit = task.MemoryLimit, 26 | OutputLimit = config.OutputLimit 27 | }; 28 | 29 | return judger; 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /judger/src/Judger.Fetcher/ITestDataFetcher.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using Judger.Models; 5 | 6 | namespace Judger.Fetcher 7 | { 8 | /// 9 | /// 测试数据取回接口 10 | /// 11 | public interface ITestDataFetcher : IDisposable 12 | { 13 | /// 14 | /// 取回数据 15 | /// 16 | /// 题目ID 17 | /// byte[]形式的ZIP文件 18 | byte[] Fetch(int problemID); 19 | 20 | /// 21 | /// 取回数据 22 | /// 23 | /// 题目ID 24 | /// byte[]形式的ZIP文件 25 | byte[] Fetch(string problemID); 26 | 27 | /// 28 | /// 取回数据 29 | /// 30 | /// JudgeTask 31 | /// byte[]形式的ZIP文件 32 | byte[] Fetch(JudgeTask task); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /judger/src/MainUnitTest/RuntimeMonitorTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using System.Diagnostics; 5 | using Xunit; 6 | using Judger.Utils; 7 | 8 | namespace MainUnitTest 9 | { 10 | public class RuntimeMonitorTest 11 | { 12 | [Fact] 13 | public void TestMonitor() 14 | { 15 | Process process = new Process(); 16 | process.StartInfo.FileName = "cmd"; 17 | 18 | RuntimeMonitor monitor = new RuntimeMonitor(process) 19 | { 20 | MemoryLimit = 100000, 21 | TimeLimit = 3000, 22 | TotalTimeLimit = 5000 23 | }; 24 | 25 | monitor.Start(); 26 | process.Start(); 27 | process.WaitForExit(); 28 | 29 | Assert.True(process.ExitCode == -1); 30 | Assert.True(monitor.TimeCost == monitor.TimeLimit); 31 | Assert.True(monitor.LimitExceed); 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /judger/README.md: -------------------------------------------------------------------------------- 1 | # OpenJudger 2 | ![GitHub](https://img.shields.io/github/license/mashape/apistatus.svg) 3 | ![.NET Core](https://img.shields.io/badge/.netcore-2.1-brightgreen.svg) 4 | ![Build Status](https://travis-ci.com/Azure99/OpenJudger.svg?branch=master) 5 | 6 | ## Introduction 7 | OpenJudger is a universal program judger designed to simplify Online Judge System development.
8 | It is now used to judge solutions on the SDNUOJ. 9 | 10 | ## Overview 11 | * Based on .Net Core: cross platform. 12 | * Lightweight: easy to deploy. 13 | * Configurable: all settings are in the Config.json file, have unusual readability. 14 | * Multiple languages support: `C`, `C++`, `Java`, `Python`, `Kotlin` and any language that I/O in console. 15 | * Adaptable: OpenJudger can load your `Fetcher` by reflection. Implement `Fetcher` interface to adapt any OnlineJudge System. 16 | * High performance: reliable concurrency control, auto distribute processor affinity. 17 | 18 | ## License 19 | [MIT](http://opensource.org/licenses/MIT) 20 | -------------------------------------------------------------------------------- /judger/src/Judger.Judger/Compilers/ICompiler.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Judger.Judger.Compilers 6 | { 7 | /// 8 | /// 编译器接口 9 | /// 10 | public interface ICompiler 11 | { 12 | /// 13 | /// 编译器路径 14 | /// 15 | string CompilerPath { get; set; } 16 | 17 | /// 18 | /// 编译器工作目录 19 | /// 20 | string CompilerWorkDirectory { get; set; } 21 | 22 | /// 23 | /// 编译超时时间 24 | /// 25 | int TimeLimit { get; set; } 26 | 27 | /// 28 | /// 处理器亲和性 29 | /// 30 | IntPtr ProcessorAffinity { get; set; } 31 | 32 | /// 33 | /// 编译指定代码 34 | /// 35 | /// 调用编译器时传递的参数 36 | /// 37 | string Compile(string args); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /oldJudger/src/Definition/JudgerProfile.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace JudgeClient.Definition 7 | { 8 | [Serializable] 9 | public class JudgerProfile : IProfile 10 | { 11 | public string Type { get; set; } 12 | public string SourceCodeFileName { get; set; } 13 | public string CompilerPath { get; set; } 14 | public string CompilerWorkingDirectory { get; set; } 15 | public string CompileParameters { get; set; } 16 | public int CompilerWaitTime { get; set; } 17 | public string RunnerFileName { get; set; } 18 | public string RunnerParameters { get; set; } 19 | public string RunnerWorkingDirectory { get; set; } 20 | public string Language { get; set; } 21 | public string Special { get; set; } 22 | public double TimeLimitScale { get; set; } 23 | public int OutputLimit { get; set; } 24 | public string JudgeDirectory { get; set; } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /website/SDNUOJ.Storage.FreeProblemSet/Exception/FreeProblemSetException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.Serialization; 3 | 4 | namespace SDNUOJ.Storage.FreeProblemSet.Exception 5 | { 6 | /// 7 | /// Free Problem Set异常抽象类 8 | /// 9 | [Serializable] 10 | public abstract class FreeProblemSetException : System.Exception, ISerializable 11 | { 12 | #region 字段 13 | protected String _newmessage; 14 | #endregion 15 | 16 | #region 属性 17 | /// 18 | /// 获取描述当前异常的消息 19 | /// 20 | public override String Message 21 | { 22 | get { return this._newmessage; } 23 | } 24 | #endregion 25 | 26 | #region 方法 27 | /// 28 | /// 初始化新的异常 29 | /// 30 | public FreeProblemSetException(String message) 31 | { 32 | this._newmessage = message; 33 | } 34 | #endregion 35 | } 36 | } -------------------------------------------------------------------------------- /website/SDNUOJ.Controllers/Exception/SystemNotOpenException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.Serialization; 3 | 4 | namespace SDNUOJ.Controllers.Exception 5 | { 6 | /// 7 | /// 系统未开放异常 8 | /// 9 | [Serializable] 10 | public class SystemNotOpenException : UserException, ISerializable 11 | { 12 | #region 属性 13 | /// 14 | /// 获取是否需要记录 15 | /// 16 | public override Boolean IsNeedLog { get { return false; } } 17 | #endregion 18 | 19 | #region 方法 20 | /// 21 | /// 初始化新的系统未开放异常 22 | /// 23 | public SystemNotOpenException() 24 | : base("System is not open.") { } 25 | 26 | /// 27 | /// 初始化新的系统未开放异常 28 | /// 29 | /// 提示信息 30 | public SystemNotOpenException(String message) 31 | : base(message) { } 32 | #endregion 33 | } 34 | } -------------------------------------------------------------------------------- /website/SDNUOJ/Views/Shared/Error.cshtml: -------------------------------------------------------------------------------- 1 | @model System.Web.Mvc.HandleErrorInfo 2 | 3 | @{ 4 | ViewBag.__Title = "Error"; 5 | } 6 | 7 |
8 |
9 |
10 |

≥﹏≤

11 |
12 |
13 |
14 |
15 |
16 | @Html.Raw(Model.Exception.Message.Replace(Environment.NewLine, "
")) 17 | @Html.Raw(SDNUOJ.Configuration.ConfigurationManager.IsDebugMode && !(Model.Exception is SDNUOJ.Controllers.Exception.UserException) ? "
" + Model.Exception.StackTrace.Replace(Environment.NewLine, "
") : "") 18 |
19 |
20 |
21 |
22 |
23 | Back 24 |
25 |
26 |
-------------------------------------------------------------------------------- /oldJudger/src/Definition/Factory.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Reflection; 6 | 7 | namespace JudgeClient.Definition 8 | { 9 | public class Factory 10 | { 11 | public static T CreateAndConfigure(IProfile Profile) 12 | { 13 | try 14 | { 15 | IModule res = Activator.CreateInstance(System.Type.GetType(Profile.Type)) as IModule; 16 | if (res == null) 17 | ExceptionManager.Throw(new CreateAndConfigureModuleException("Factory: Could not create " + Profile.Type, null)); 18 | res.Configure(Profile); 19 | return (T)(res as object); 20 | } 21 | catch (Exception ex) 22 | { 23 | ExceptionManager.Throw(new CreateAndConfigureModuleException("Factory: Could not create or configure or cast " + Profile.Type, ex)); 24 | return default(T); 25 | } 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /website/SDNUOJ.Logging/LogLevelConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace SDNUOJ.Logging 5 | { 6 | /// 7 | /// 日志级别转换器 8 | /// 9 | internal static class LogLevelConverter 10 | { 11 | #region 常量 12 | private static readonly Dictionary LevelMappingTable = new Dictionary() 13 | { 14 | { LogLevel.Debug, NLog.LogLevel.Debug }, 15 | { LogLevel.Verbose, NLog.LogLevel.Trace }, 16 | { LogLevel.Information, NLog.LogLevel.Info }, 17 | { LogLevel.Warning, NLog.LogLevel.Warn }, 18 | { LogLevel.Error, NLog.LogLevel.Error }, 19 | { LogLevel.Critical, NLog.LogLevel.Fatal } 20 | }; 21 | #endregion 22 | 23 | #region 方法 24 | internal static NLog.LogLevel Convert(LogLevel level) 25 | { 26 | return LevelMappingTable[level]; 27 | } 28 | #endregion 29 | } 30 | } -------------------------------------------------------------------------------- /website/SDNUOJ.Controllers/app.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /website/SDNUOJ.Controllers/Contest/RankController.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Web.Mvc; 4 | 5 | using SDNUOJ.Controllers.Core; 6 | using SDNUOJ.Entity; 7 | using SDNUOJ.Entity.Complex; 8 | 9 | namespace SDNUOJ.Areas.Contest.Controllers 10 | { 11 | public class RankController : ContestBaseController 12 | { 13 | /// 14 | /// 排行列表页面 15 | /// 16 | /// 操作后的结果 17 | [OutputCache(CacheProfile = "MinimumPageCache", VaryByParam = "None", VaryByCustom = "nm")] 18 | public ActionResult List() 19 | { 20 | ContestEntity contest = ViewData["Contest"] as ContestEntity; 21 | 22 | List ranklist = ContestManager.GetContestRanklist(contest); 23 | List problems = ContestProblemManager.GetContestProblemList(contest.ContestID); 24 | 25 | ViewBag.Problems = problems; 26 | 27 | return View(ranklist); 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /website/SDNUOJ.Controllers/Exception/NoPermissionException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.Serialization; 3 | 4 | namespace SDNUOJ.Controllers.Exception 5 | { 6 | /// 7 | /// 没有权限异常 8 | /// 9 | [Serializable] 10 | public class NoPermissionException : UserException, ISerializable 11 | { 12 | #region 属性 13 | /// 14 | /// 获取是否需要记录 15 | /// 16 | public override Boolean IsNeedLog { get { return false; } } 17 | #endregion 18 | 19 | #region 方法 20 | /// 21 | /// 初始化新的没有权限异常 22 | /// 23 | /// 异常信息 24 | public NoPermissionException(String message) 25 | : base(message) { } 26 | 27 | /// 28 | /// 初始化新的没有权限异常 29 | /// 30 | public NoPermissionException() 31 | : this("You do not have privileges to access this page!") { } 32 | #endregion 33 | } 34 | } -------------------------------------------------------------------------------- /website/SDNUOJ/js-source/parts-core/sdnuoj-foundation.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * SDNU Online Judge 3 | * https://github.com/sdnuacmicpc/sdnuoj 4 | * 5 | * Copyright 2012-2015 SDNU ACM-ICPC TEAM 6 | * Licensed under the MIT license 7 | */ 8 | 9 | var SDNUOJ = SDNUOJ || {}; 10 | 11 | SDNUOJ.namespace = function (ns_string) { 12 | var parts = ns_string.split('.'), 13 | parent = SDNUOJ; 14 | 15 | if (parts[0] === "SDNUOJ") { 16 | parts = parts.slice(1); 17 | } 18 | 19 | for (var i = 0; i < parts.length; i += 1) { 20 | if (typeof parent[parts[i]] === "undefined") { 21 | parent[parts[i]] = {}; 22 | } 23 | 24 | parent = parent[parts[i]]; 25 | } 26 | 27 | return parent; 28 | }; 29 | 30 | SDNUOJ.PM = { 31 | SOURCEVIEW: 0x2, 32 | ADMINISTRATOR: 0x80, 33 | NEWSMANAGE: 0x100, 34 | RESOURCEMANAGE: 0x200, 35 | FORUMMANAGE: 0x400, 36 | PROBLEMMANAGE: 0x800, 37 | CONTESTMANAGE: 0x1000, 38 | SOLUTIONMANAGE: 0x2000, 39 | SUPERADMINISTRATOR: 0x3FFFFFFE 40 | }; -------------------------------------------------------------------------------- /website/SDNUOJ/Views/Info/Index.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewBag.__Title = "System Message"; 3 | } 4 | 5 |
6 |
7 |
8 |

System Message

9 |
10 |
11 |
12 |
13 |
14 | @Html.Raw((String.IsNullOrEmpty(ViewBag.Description) || String.IsNullOrEmpty(HttpUtility.UrlDecode(ViewBag.Description.Trim()))) ? "(# ゜Д゜)" : HttpUtility.UrlDecode(ViewBag.Description.Trim())) 15 |
16 |
17 |
18 |
19 |
20 | Back 21 |
22 |
23 |
-------------------------------------------------------------------------------- /website/SDNUOJ/js-source/parts-foreground/foreground-page-initializer.js: -------------------------------------------------------------------------------- 1 | (function () { 2 | if (SDNUOJ.util.browser.ltIE8()) { 3 | $("#browser-warning").show(); 4 | } 5 | 6 | $("[placeholder]").placeholder(); 7 | $(".img-checkcode").trigger("click"); 8 | 9 | SDNUOJ.util.form.setFormAutoVerify(); 10 | SDNUOJ.util.form.setTextboxQuickSubmit(); 11 | SDNUOJ.util.list.setCheckboxSelectAll(); 12 | 13 | SDNUOJ.page.highlight.setAllHighlightEditors(); 14 | SDNUOJ.page.highlight.setAllHighlightViewers(); 15 | 16 | SDNUOJ.page.tree.setImageCollapse(); 17 | 18 | SDNUOJ.page.foreground.initPage(); 19 | SDNUOJ.page.foreground.contest.initPage(); 20 | })(); 21 | 22 | var _hmt = _hmt || []; 23 | (function () { 24 | var id = $("#main-container").attr("data-tjid"); 25 | 26 | if (id != "") { 27 | var hm = document.createElement("script"); 28 | hm.src = "//hm.baidu.com/hm.js?" + id; 29 | var s = document.getElementsByTagName("script")[0]; 30 | s.parentNode.insertBefore(hm, s); 31 | } 32 | })(); -------------------------------------------------------------------------------- /website/SDNUOJ.Configuration/WebManager.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Web; 3 | 4 | namespace SDNUOJ.Configuration 5 | { 6 | /// 7 | /// 网络信息管理器 8 | /// 9 | public static class WebManager 10 | { 11 | /// 12 | /// 获取系统域名路径(末尾有“/”) 13 | /// 14 | /// Http请求 15 | /// 系统域名路径(末尾有“/”) 16 | public static String GetDomainUrl(HttpRequestBase request) 17 | { 18 | if (!String.IsNullOrEmpty(ConfigurationManager.DomainUrl)) 19 | { 20 | return ConfigurationManager.DomainUrl; 21 | } 22 | 23 | if (request != null && !String.IsNullOrEmpty(request.Url.AbsoluteUri)) 24 | { 25 | String url = request.Url.AbsoluteUri.Replace(request.Url.AbsolutePath, ""); 26 | if (url[url.Length - 1] != '/') url += '/'; 27 | 28 | return url; 29 | } 30 | 31 | return String.Empty; 32 | } 33 | } 34 | } -------------------------------------------------------------------------------- /website/SDNUOJ/static/js/admin-framework.js.bundle: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | true 6 | 7 | true 8 | 9 | 10 | 11 | 12 | 13 | /js-source/parts-core/sdnuoj-foundation.js 14 | /js-source/parts-core/sdnuoj-utilities.js 15 | /js-source/parts-core/sdnuoj-core.js 16 | /js-source/parts-admin/admin-framework.js 17 | 18 | -------------------------------------------------------------------------------- /judger/src/Judger.Utils/MD5Encrypt.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using System.Security.Cryptography; 5 | 6 | namespace Judger.Utils 7 | { 8 | /// 9 | /// MD5加密辅助类 10 | /// 11 | public static class MD5Encrypt 12 | { 13 | /// 14 | /// 计算String的MD5(小写32位) 15 | /// 16 | /// 欲加密的string 17 | /// 计算结果 18 | public static string EncryptToHexString(string str) 19 | { 20 | if(str == null) 21 | { 22 | str = ""; 23 | } 24 | 25 | byte[] res; 26 | using (MD5 md5 = MD5.Create()) 27 | { 28 | res = md5.ComputeHash(Encoding.UTF8.GetBytes(str)); 29 | } 30 | 31 | StringBuilder sb = new StringBuilder(); 32 | foreach(byte b in res) 33 | { 34 | sb.Append(b.ToString("x2")); 35 | } 36 | 37 | return sb.ToString(); 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /website/SDNUOJ.Entity/UserForgetPasswordEntity.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace SDNUOJ.Entity 4 | { 5 | /// 6 | /// 用户密码找回实体类 7 | /// 8 | [Serializable] 9 | public class UserForgetPasswordEntity 10 | { 11 | /// 12 | /// 获取或设置找回密码的用户名 13 | /// 14 | public String UserName { get; set; } 15 | 16 | /// 17 | /// 获取或设置哈希值 18 | /// 19 | public String HashKey { get; set; } 20 | 21 | /// 22 | /// 获取或设置申请找回的日期 23 | /// 24 | public DateTime SubmitDate { get; set; } 25 | 26 | /// 27 | /// 获取或设置申请找回的IP 28 | /// 29 | public String SubmitIP { get; set; } 30 | 31 | /// 32 | /// 获取或设置找回的日期 33 | /// 34 | public DateTime AccessDate { get; set; } 35 | 36 | /// 37 | /// 获取或设置找回的IP 38 | /// 39 | public String AccessIP { get; set; } 40 | } 41 | } -------------------------------------------------------------------------------- /website/SDNUOJ/Views/Contests/Recent.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewBag.__Title = "Recent Contest"; 3 | ViewBag.__Type = "recent"; 4 | } 5 | 6 |
7 |

Recent Contest

8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 |
CIDContest NameStartTypeOJ
Loading recent contest...
Data Source : @SDNUOJ.Configuration.ConfigurationManager.RecentContestURL
-------------------------------------------------------------------------------- /website/SDNUOJ.Controllers/GlobalAuthenticateModule.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Web; 3 | 4 | using SDNUOJ.Controllers.Core; 5 | using SDNUOJ.Controllers.Status; 6 | using SDNUOJ.Entity; 7 | 8 | namespace SDNUOJ.Controllers 9 | { 10 | public static class GlobalAuthenticateModule 11 | { 12 | /// 13 | /// 替换系统认证模型 14 | /// 15 | /// HttpContext 16 | /// 应放在Global.asax.cs的Application_AuthenticateRequest时执行 17 | public static void ReplaceFormAuthenticateModel(HttpContext context) 18 | { 19 | UserStatus user = UserCurrentStatus.ReplaceFormAuthenticateModel(context); 20 | 21 | if (user != null && !AdminManager.InternalCheckPermission(user.Permission, PermissionType.HttpJudge)) 22 | { 23 | Int32 unreadMailCount = UserMailManager.InternalCountUserUnReadMails(user.UserName); 24 | 25 | UserBrowserStatus.SetCurrentUserBrowserStatus(user.UserName, user.Permission, unreadMailCount); 26 | } 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /oldJudger/src/MainTest/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // 有关程序集的常规信息通过以下特性集 6 | // 控制。更改这些特性值可修改 7 | // 与程序集关联的信息。 8 | [assembly: AssemblyTitle("MainTest")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("Microsoft")] 12 | [assembly: AssemblyProduct("MainTest")] 13 | [assembly: AssemblyCopyright("Copyright © Microsoft 2013")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // 将 ComVisible 设置为 false 会使此程序集中的类型 18 | // 对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型, 19 | // 请将该类型上的 ComVisible 特性设置为 true。 20 | [assembly: ComVisible(false)] 21 | 22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 23 | [assembly: Guid("e8f2feb7-8352-4860-8307-99370abe940a")] 24 | 25 | // 程序集的版本信息由以下四个值组成: 26 | // 27 | // 主版本 28 | // 次版本 29 | // 生成号 30 | // 修订号 31 | // 32 | // 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, 33 | // 方法是按如下所示使用“*”: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /oldJudger/src/TaskFetcher/TestDataAccessor.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | using JudgeClient.Definition; 7 | 8 | namespace JudgeClient.Fetcher 9 | { 10 | public class TestDataAccessor : IDataAccessor 11 | { 12 | public int GetDataCount(Problem Problem) 13 | { 14 | return 1; 15 | } 16 | 17 | int _c_v_count = 0; 18 | public bool CheckValid(Problem Problem) 19 | { 20 | return _c_v_count++ % 5 != 0; 21 | } 22 | 23 | public IEnumerator GetDataEnumerator(Problem Problem) 24 | { 25 | return (new TestData[] { 26 | new TestData() { Input = "1 2", Output = "3", Name = "sample" } 27 | } as IEnumerable).GetEnumerator(); 28 | } 29 | 30 | public void Update(Problem Problem, IEnumerator DataEnumerator) 31 | { 32 | throw new NotImplementedException(); 33 | } 34 | 35 | public void Configure(IProfile Profile) 36 | { 37 | 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /website/SDNUOJ.Controllers/FAQController.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Web.Mvc; 3 | 4 | namespace SDNUOJ.Controllers 5 | { 6 | public class FAQController : Controller 7 | { 8 | /// 9 | /// FAQ页面 10 | /// 11 | /// 操作后的结果 12 | [OutputCache(CacheProfile = "DynamicPageCache", VaryByParam = "None")] 13 | public ActionResult Index() 14 | { 15 | return View(); 16 | } 17 | 18 | /// 19 | /// FAQ英文页面 20 | /// 21 | /// 操作后的结果 22 | [OutputCache(CacheProfile = "DynamicPageCache", VaryByParam = "None")] 23 | public ActionResult EN_US() 24 | { 25 | return View("Index"); 26 | } 27 | 28 | /// 29 | /// FAQ中文页面 30 | /// 31 | /// 操作后的结果 32 | [OutputCache(CacheProfile = "DynamicPageCache", VaryByParam = "None")] 33 | public ActionResult ZH_CN() 34 | { 35 | return View(); 36 | } 37 | } 38 | } -------------------------------------------------------------------------------- /oldJudger/src/TestJudger/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // 有关程序集的常规信息通过以下 6 | // 特性集控制。更改这些特性值可修改 7 | // 与程序集关联的信息。 8 | [assembly: AssemblyTitle("TestJudger")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("Microsoft")] 12 | [assembly: AssemblyProduct("TestJudger")] 13 | [assembly: AssemblyCopyright("Copyright © Microsoft 2013")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // 将 ComVisible 设置为 false 使此程序集中的类型 18 | // 对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型, 19 | // 则将该类型上的 ComVisible 特性设置为 true。 20 | [assembly: ComVisible(false)] 21 | 22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 23 | [assembly: Guid("a407cd15-1e0f-4cb6-bd96-691b50810aea")] 24 | 25 | // 程序集的版本信息由下面四个值组成: 26 | // 27 | // 主版本 28 | // 次版本 29 | // 生成号 30 | // 修订号 31 | // 32 | // 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, 33 | // 方法是按如下所示使用“*”: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /oldJudger/src/Judger/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // 有关程序集的常规信息通过以下 6 | // 特性集控制。更改这些特性值可修改 7 | // 与程序集关联的信息。 8 | [assembly: AssemblyTitle("JudgeClient.Judger")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("SDNUACM")] 12 | [assembly: AssemblyProduct("JudgeClient.Judger")] 13 | [assembly: AssemblyCopyright("Copyright © SDNUACM 2013")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // 将 ComVisible 设置为 false 使此程序集中的类型 18 | // 对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型, 19 | // 则将该类型上的 ComVisible 特性设置为 true。 20 | [assembly: ComVisible(false)] 21 | 22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 23 | [assembly: Guid("10cc741c-e219-4e26-85ac-78104b42ac8d")] 24 | 25 | // 程序集的版本信息由下面四个值组成: 26 | // 27 | // 主版本 28 | // 次版本 29 | // 生成号 30 | // 修订号 31 | // 32 | // 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, 33 | // 方法是按如下所示使用“*”: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /judger/src/Judger.Fetcher.SDNUOJ/Models/SDNUOJJudgeTask.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using Newtonsoft.Json; 5 | 6 | namespace Judger.Fetcher.SDNUOJ.Models 7 | { 8 | [Serializable] 9 | public class SDNUOJJudgeTask 10 | { 11 | [JsonProperty(PropertyName = "sid")] 12 | public string SubmitID { get; set; } 13 | 14 | [JsonProperty(PropertyName = "pid")] 15 | public string ProblemID { get; set; } 16 | 17 | [JsonProperty(PropertyName = "username")] 18 | public string Author { get; set; } 19 | 20 | [JsonProperty(PropertyName = "dataversion")] 21 | public string DataVersion { get; set; } 22 | 23 | [JsonProperty(PropertyName = "timelimit")] 24 | public string TimeLimit { get; set; } 25 | 26 | [JsonProperty(PropertyName = "memorylimit")] 27 | public string MemoryLimit { get; set; } 28 | 29 | [JsonProperty(PropertyName = "language")] 30 | public string Language { get; set; } 31 | 32 | [JsonProperty(PropertyName = "sourcecode")] 33 | public string SourceCode { get; set; } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /website/SDNUOJ.Controllers/NewsController.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Web.Mvc; 3 | 4 | using SDNUOJ.Controllers.Core; 5 | using SDNUOJ.Entity; 6 | using SDNUOJ.Utilities; 7 | 8 | namespace SDNUOJ.Controllers 9 | { 10 | public class NewsController : BaseController 11 | { 12 | /// 13 | /// 新闻列表页面 14 | /// 15 | /// 页面索引 16 | /// 操作后的结果 17 | [OutputCache(CacheProfile = "DynamicPageCache", VaryByParam = "id")] 18 | public ActionResult List(Int32 id = 1) 19 | { 20 | PagedList list = NewsManager.GetNewsList(id); 21 | 22 | return ViewWithPager(list, id); 23 | } 24 | 25 | /// 26 | /// 新闻页面 27 | /// 28 | /// 新闻ID 29 | /// 操作后的结果 30 | [OutputCache(CacheProfile = "DynamicPageCache", VaryByParam = "id")] 31 | public ActionResult Detail(Int32 id = -1) 32 | { 33 | return View(NewsManager.GetNews(id)); 34 | } 35 | } 36 | } -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2012-2015 SDNU ACM-ICPC TEAM 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /oldJudger/src/TaskFetcher/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // 有关程序集的常规信息通过以下 6 | // 特性集控制。更改这些特性值可修改 7 | // 与程序集关联的信息。 8 | [assembly: AssemblyTitle("JudgeClient.Fetcher")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("SDNUACM")] 12 | [assembly: AssemblyProduct("JudgeClient.Fetcher")] 13 | [assembly: AssemblyCopyright("Copyright © SDNUACM 2013")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // 将 ComVisible 设置为 false 使此程序集中的类型 18 | // 对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型, 19 | // 则将该类型上的 ComVisible 特性设置为 true。 20 | [assembly: ComVisible(false)] 21 | 22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 23 | [assembly: Guid("4d0181e4-9450-402b-b9d4-d7293084afb3")] 24 | 25 | // 程序集的版本信息由下面四个值组成: 26 | // 27 | // 主版本 28 | // 次版本 29 | // 生成号 30 | // 修订号 31 | // 32 | // 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, 33 | // 方法是按如下所示使用“*”: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /oldJudger/src/Definition/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // 有关程序集的常规信息通过以下 6 | // 特性集控制。更改这些特性值可修改 7 | // 与程序集关联的信息。 8 | [assembly: AssemblyTitle("JudgeClient.Definition")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("SDNUACM")] 12 | [assembly: AssemblyProduct("JudgeClient.Definition")] 13 | [assembly: AssemblyCopyright("Copyright © SDNUACM 2013")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // 将 ComVisible 设置为 false 使此程序集中的类型 18 | // 对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型, 19 | // 则将该类型上的 ComVisible 特性设置为 true。 20 | [assembly: ComVisible(false)] 21 | 22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 23 | [assembly: Guid("d78d8de7-4588-46cc-961a-4a60cb422e2b")] 24 | 25 | // 程序集的版本信息由下面四个值组成: 26 | // 27 | // 主版本 28 | // 次版本 29 | // 生成号 30 | // 修订号 31 | // 32 | // 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, 33 | // 方法是按如下所示使用“*”: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /oldJudger/src/JudgeService/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // 有关程序集的常规信息通过以下 6 | // 特性集控制。更改这些特性值可修改 7 | // 与程序集关联的信息。 8 | [assembly: AssemblyTitle("JudgeClient.JudgeService")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("SDNUACM")] 12 | [assembly: AssemblyProduct("JudgeClient.JudgeService")] 13 | [assembly: AssemblyCopyright("Copyright © SDNUACM 2013")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // 将 ComVisible 设置为 false 使此程序集中的类型 18 | // 对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型, 19 | // 则将该类型上的 ComVisible 特性设置为 true。 20 | [assembly: ComVisible(false)] 21 | 22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 23 | [assembly: Guid("33693f83-82df-4dcf-ae39-e29b4d126d14")] 24 | 25 | // 程序集的版本信息由下面四个值组成: 26 | // 27 | // 主版本 28 | // 次版本 29 | // 生成号 30 | // 修订号 31 | // 32 | // 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, 33 | // 方法是按如下所示使用“*”: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /website/SDNUOJ.Entity/Enum/ResultType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel; 3 | 4 | namespace SDNUOJ.Entity 5 | { 6 | /// 7 | /// 提交结果 8 | /// 9 | public enum ResultType : byte 10 | { 11 | [Description("Pending")] Pending = 0, 12 | [Description("Rejudge Pending")] RejudgePending = 1, 13 | [Description("Judging")] Judging = 2, 14 | [Description("Compile Error")] CompileError = 3, 15 | [Description("Runtime Error")] RuntimeError = 4, 16 | [Description("Time Limit Exceeded")] TimeLimitExceeded = 5, 17 | [Description("Memory Limit Exceeded")] MemoryLimitExceeded = 6, 18 | [Description("Output Limit Exceeded")] OutputLimitExceeded = 7, 19 | [Description("Wrong Answer")] WrongAnswer = 8, 20 | [Description("Presentation Error")] PresentationError = 9, 21 | [Description("Accepted")] Accepted = 10, 22 | [Description("Judge Failed")] JudgeFailed = 255 23 | } 24 | } -------------------------------------------------------------------------------- /oldJudger/src/TaskFetcher/SDNUDataEnumerator.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using JudgeClient.Definition; 6 | 7 | namespace JudgeClient.SDNU 8 | { 9 | public class SDNUDataEnumerator : IEnumerator 10 | { 11 | protected int index; 12 | protected Func callback; 13 | protected Action dispose; 14 | public SDNUDataEnumerator(Func callback) 15 | { 16 | this.index = 0; 17 | this.callback = callback; 18 | } 19 | 20 | protected TestData current; 21 | public TestData Current 22 | { 23 | get { return current; } 24 | } 25 | 26 | public void Dispose() 27 | { 28 | } 29 | 30 | object System.Collections.IEnumerator.Current 31 | { 32 | get { return current; } 33 | } 34 | 35 | public bool MoveNext() 36 | { 37 | current = callback(index++); 38 | return current != null; 39 | } 40 | 41 | public void Reset() 42 | { 43 | index = 0; 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /website/SDNUOJ/js-source/parts-foreground/foreground-pages-submit.js: -------------------------------------------------------------------------------- 1 | SDNUOJ.namespace("SDNUOJ.pages.submitcode"); 2 | 3 | SDNUOJ.pages.submitcode = (function () { 4 | var user = SDNUOJ.user; 5 | var highlight = SDNUOJ.page.highlight; 6 | 7 | return { 8 | init: function () { 9 | var lastlang = user.getLastLanguage(); 10 | var haslang = false; 11 | 12 | var options = $("#lang").children("option"); 13 | 14 | for (var i = 0; i < options.length; i++) { 15 | if (options[i].value == lastlang) { 16 | haslang = true; 17 | break; 18 | } 19 | } 20 | 21 | if (haslang) { 22 | $("#lang").val(lastlang); 23 | } 24 | 25 | $("#lang").change(function () { 26 | var langID = $("#lang").val(); 27 | 28 | user.setLastLanguage(langID); 29 | highlight.setAllLanguage(langID); 30 | }); 31 | 32 | $("button[type='reset']").click(function () { 33 | highlight.clearAllText(""); 34 | }); 35 | } 36 | } 37 | })(); -------------------------------------------------------------------------------- /website/SDNUOJ.Storage/Problem/ProblemDataPair.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace SDNUOJ.Storage.Problem 4 | { 5 | /// 6 | /// 测试数据对 7 | /// 8 | public class ProblemDataPair 9 | { 10 | #region 字段 11 | private String _input; 12 | private String _output; 13 | #endregion 14 | 15 | #region 属性 16 | /// 17 | /// 获取题目输入数据 18 | /// 19 | public String Input 20 | { 21 | get { return this._input; } 22 | } 23 | 24 | /// 25 | /// 获取题目输出数据 26 | /// 27 | public String Output 28 | { 29 | get { return this._output; } 30 | } 31 | #endregion 32 | 33 | #region 构造方法 34 | /// 35 | /// 创建新的题目数据类 36 | /// 37 | /// 输入数据 38 | /// 输出数据 39 | public ProblemDataPair(String input, String output) 40 | { 41 | this._input = input; 42 | this._output = output; 43 | } 44 | #endregion 45 | } 46 | } -------------------------------------------------------------------------------- /website/SDNUOJ/Views/Shared/_Pager.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | Int32 pageCount = ViewBag.PageCount; 3 | Int32 pageIndex = ViewBag.PageIndex; 4 | 5 | RouteData routeData = ViewContext.RouteData.Route.GetRouteData(this.Context); 6 | String action = routeData.Values["action"] as String; 7 | String controller = routeData.Values["controller"] as String; 8 | } 9 | 10 | @functions { 11 | private RouteValueDictionary GetRouteValues(RouteData routeData, Int32 id) 12 | { 13 | RouteValueDictionary dict = new RouteValueDictionary(routeData.Values); 14 | dict["id"] = id; 15 | 16 | return dict; 17 | } 18 | } 19 | 20 | -------------------------------------------------------------------------------- /website/SDNUOJ.Entity/TopicPageEntity.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace SDNUOJ.Entity 4 | { 5 | /// 6 | /// 专题页面实体类 7 | /// 8 | [Serializable] 9 | public class TopicPageEntity 10 | { 11 | /// 12 | /// 获取或设置专题页面名称 13 | /// 14 | public String PageName { get; set; } 15 | 16 | /// 17 | /// 获取或设置专题页面标题 18 | /// 19 | public String Title { get; set; } 20 | 21 | /// 22 | /// 获取或设置专题页面描述 23 | /// 24 | public String Description { get; set; } 25 | 26 | /// 27 | /// 获取或设置专题页面内容 28 | /// 29 | public String Content { get; set; } 30 | 31 | /// 32 | /// 获取或设置最后更新日期 33 | /// 34 | public DateTime LastDate { get; set; } 35 | 36 | /// 37 | /// 获取或设置创建用户名 38 | /// 39 | public String CreateUser { get; set; } 40 | 41 | /// 42 | /// 获取或设置是否隐藏 43 | /// 44 | public Boolean IsHide { get; set; } 45 | } 46 | } -------------------------------------------------------------------------------- /website/SDNUOJ/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // 有关程序集的常规信息是通过以下项进行控制的 6 | // 控制。更改这些特性值可修改 7 | // 与程序集关联的信息。 8 | [assembly: AssemblyTitle("SDNU ACM-ICPC Online Judge")] 9 | [assembly: AssemblyDescription("SDNU ACM-ICPC Online Judge Web UI")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("SDNU ACM-ICPC TEAM")] 12 | [assembly: AssemblyProduct("SDNU ACM-ICPC Online Judge")] 13 | [assembly: AssemblyCopyright("Copyright © 2012-2015 SDNU ACM-ICPC TEAM")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // 将 ComVisible 设置为 false 将使此程序集中的类型 18 | // 对 COM 组件不可见。如果需要 19 | // 从 COM 访问此程序集中的某个类型,请针对该类型将 ComVisible 特性设置为 true。 20 | [assembly: ComVisible(false)] 21 | 22 | // 如果此项目向 COM 公开,则下列 GUID 用于 typelib 的 ID 23 | [assembly: Guid("3468caac-42ca-4baa-8f42-13c99f51797d")] 24 | 25 | // 程序集的版本信息由下列四个值组成: 26 | // 27 | // 主版本 28 | // 次版本 29 | // 内部版本号 30 | // 修订版本 31 | // 32 | // 你可以指定所有值,也可以让修订版本和内部版本号采用默认值, 33 | // 方法是按如下所示使用 "*": 34 | [assembly: AssemblyVersion("1.2.0.0")] 35 | [assembly: AssemblyFileVersion("1.2.0.0")] 36 | -------------------------------------------------------------------------------- /website/SDNUOJ/Views/News/List.cshtml: -------------------------------------------------------------------------------- 1 | @model SDNUOJ.Utilities.PagedList 2 | 3 | @{ 4 | ViewBag.__Title = "News List"; 5 | } 6 | 7 |
8 |

News List

9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | @foreach (var Item in Model) 21 | { 22 | 23 | 24 | 25 | 26 | 27 | } 28 | @if (Model.Count == 0) 29 | { 30 | 31 | 32 | 33 | } 34 | 35 |
NIDTitlePost Date
@Item.AnnounceID@Item.Title@Item.PublishDate.ToString("yyyy-MM-dd HH:mm:ss")
No news
36 | 37 |
38 | @RenderPage("~/Views/Shared/_SimplePager.cshtml") 39 |
-------------------------------------------------------------------------------- /oldJudger/src/Definition/FetcherProfile.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Xml.Serialization; 6 | using Burst.Crypt; 7 | using Burst.Json; 8 | 9 | namespace JudgeClient.Definition 10 | { 11 | [Serializable] 12 | public class FetcherProfile : IProfile 13 | { 14 | public string Type { get; set; } 15 | 16 | public string AuthenticationURL { get; set; } 17 | public string Username { get; set; } 18 | //[JsonIgnore] 19 | //[XmlIgnore] 20 | public string Password { get; set; } 21 | //private static string Key = "key : sdnu acm."; 22 | //public string EncryptedPassword 23 | //{ 24 | // get { return CryptUtils.EncryptDES(Password, Key); } 25 | // set { Password = CryptUtils.DecryptDES(value, Key); } 26 | //} 27 | 28 | public string TaskFetchURL { get; set; } 29 | public string ResultSubmitURL { get; set; } 30 | public string DataFetchURL { get; set; } 31 | 32 | public int FetchInterval { get; set; } 33 | 34 | public int FetchTimeout { get; set; } 35 | 36 | public DataAccessorProfile DataAccessorProfile { get; set; } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /website/SDNUOJ.Storage.FreeProblemSet/FreeProblemDataPair.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace SDNUOJ.Storage.FreeProblemSet 4 | { 5 | /// 6 | /// Free Problem Data Pair 7 | /// 8 | public class FreeProblemDataPair 9 | { 10 | #region 字段 11 | private String _input; 12 | private String _output; 13 | #endregion 14 | 15 | #region 属性 16 | /// 17 | /// 获取题目输入数据 18 | /// 19 | public String Input 20 | { 21 | get { return this._input; } 22 | } 23 | 24 | /// 25 | /// 获取题目输出数据 26 | /// 27 | public String Output 28 | { 29 | get { return this._output; } 30 | } 31 | #endregion 32 | 33 | #region 构造方法 34 | /// 35 | /// 创建新的题目数据类 36 | /// 37 | /// 输入数据 38 | /// 输出数据 39 | public FreeProblemDataPair(String input, String output) 40 | { 41 | this._input = input; 42 | this._output = output; 43 | } 44 | #endregion 45 | } 46 | } -------------------------------------------------------------------------------- /website/SDNUOJ.Entity/Complex/ContestProblemStatistic.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace SDNUOJ.Entity.Complex 5 | { 6 | /// 7 | /// 竞赛题目统计信息实体类 8 | /// 9 | [Serializable] 10 | public class ContestProblemStatistic : ProblemStatistic 11 | { 12 | #region 字段 13 | private Dictionary _langStatistic; 14 | #endregion 15 | 16 | #region 方法 17 | public ContestProblemStatistic() 18 | { 19 | this._langStatistic = new Dictionary(); 20 | } 21 | 22 | public void SetLanguageStatistic(Byte langID, Int32 count) 23 | { 24 | this._langStatistic[langID] = new LanguageStatistic() { ProblemID = this.ProblemID, LanguageID = langID, Count = count }; 25 | } 26 | 27 | public LanguageStatistic GetLanguageStatistic(Byte langID) 28 | { 29 | LanguageStatistic statistic = null; 30 | 31 | return this._langStatistic.TryGetValue(langID, out statistic) ? statistic : new LanguageStatistic() { ProblemID = this.ProblemID, LanguageID = langID, Count = 0 }; 32 | } 33 | #endregion 34 | } 35 | } -------------------------------------------------------------------------------- /oldJudger/src/JudgeService/Service.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace JudgeClient.JudgeService 2 | { 3 | partial class Service 4 | { 5 | /// 6 | /// 必需的设计器变量。 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// 清理所有正在使用的资源。 12 | /// 13 | /// 如果应释放托管资源,为 true;否则为 false。 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region 组件设计器生成的代码 24 | 25 | /// 26 | /// 设计器支持所需的方法 - 不要 27 | /// 使用代码编辑器修改此方法的内容。 28 | /// 29 | private void InitializeComponent() 30 | { 31 | // 32 | // Service 33 | // 34 | this.ServiceName = "SDNUACM JudgeService"; 35 | this.CanStop = true; 36 | this.CanShutdown = true; 37 | this.CanPauseAndContinue = true; 38 | this.AutoLog = true; 39 | } 40 | 41 | #endregion 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /website/SDNUOJ.Data/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // 有关程序集的常规信息通过下列属性集 6 | // 控制。更改这些属性值可修改 7 | // 与程序集关联的信息。 8 | [assembly: AssemblyTitle("SDNU ACM-ICPC Online Judge")] 9 | [assembly: AssemblyDescription("SDNU ACM-ICPC Online Judge Data Library")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("SDNU ACM-ICPC TEAM")] 12 | [assembly: AssemblyProduct("SDNU ACM-ICPC Online Judge")] 13 | [assembly: AssemblyCopyright("Copyright © 2012-2015 SDNU ACM-ICPC TEAM")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // 将 ComVisible 设置为 false 使此程序集中的类型 18 | // 对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型, 19 | // 则将该类型上的 ComVisible 属性设置为 true。 20 | [assembly: ComVisible(false)] 21 | 22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 23 | [assembly: Guid("d8fc0dc0-9ef1-4508-9bc3-d4ee9a654d45")] 24 | 25 | // 程序集的版本信息由下面四个值组成: 26 | // 27 | // 主版本 28 | // 次版本 29 | // 内部版本号 30 | // 修订号 31 | // 32 | // 可以指定所有这些值,也可以使用“内部版本号”和“修订号”的默认值, 33 | // 方法是按如下所示使用“*”: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.2.0.0")] 36 | [assembly: AssemblyFileVersion("1.2.0.0")] 37 | -------------------------------------------------------------------------------- /judger/src/MainUnitTest/ProcessRunnerTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using Xunit; 5 | using Judger.Utils; 6 | 7 | namespace MainUnitTest 8 | { 9 | public class ProcessRunnerTest 10 | { 11 | [Fact] 12 | public void TestProcessRunnerKill() 13 | { 14 | using (ProcessRunner pr = new ProcessRunner("cmd", "", "")) 15 | { 16 | new System.Threading.Thread(() => { System.Threading.Thread.Sleep(1000); pr.Process.Kill(); }).Start(); 17 | int code = pr.Run("ping 127.0.0.1\nping 127.0.0.1", out string output, out string error); 18 | 19 | Assert.True(code == -1); 20 | } 21 | } 22 | 23 | [Fact] 24 | public void TestProcessRunnerRun() 25 | { 26 | using (ProcessRunner pr = new ProcessRunner("cmd", "", "")) 27 | { 28 | //new System.Threading.Thread(() => { System.Threading.Thread.Sleep(1000); pr.Process.Kill(); }).Start(); 29 | int code = pr.Run("ping 127.0.0.1\nping 127.0.0.1", out string output, out string error); 30 | 31 | Assert.True(code == 0 && output.IndexOf("127.0.0.1") != -1); 32 | } 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /website/SDNUOJ.Entity/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // 有关程序集的常规信息通过下列属性集 6 | // 控制。更改这些属性值可修改 7 | // 与程序集关联的信息。 8 | [assembly: AssemblyTitle("SDNU ACM-ICPC Online Judge")] 9 | [assembly: AssemblyDescription("SDNU ACM-ICPC Online Judge Entity Library")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("SDNU ACM-ICPC TEAM")] 12 | [assembly: AssemblyProduct("SDNU ACM-ICPC Online Judge")] 13 | [assembly: AssemblyCopyright("Copyright © 2012-2015 SDNU ACM-ICPC TEAM")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // 将 ComVisible 设置为 false 使此程序集中的类型 18 | // 对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型, 19 | // 则将该类型上的 ComVisible 属性设置为 true。 20 | [assembly: ComVisible(false)] 21 | 22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 23 | [assembly: Guid("91aa4307-89a9-400f-9cc9-7708aec74950")] 24 | 25 | // 程序集的版本信息由下面四个值组成: 26 | // 27 | // 主版本 28 | // 次版本 29 | // 内部版本号 30 | // 修订号 31 | // 32 | // 可以指定所有这些值,也可以使用“内部版本号”和“修订号”的默认值, 33 | // 方法是按如下所示使用“*”: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.2.0.0")] 36 | [assembly: AssemblyFileVersion("1.2.0.0")] 37 | -------------------------------------------------------------------------------- /website/SDNUOJ.Caching/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // 有关程序集的常规信息通过下列属性集 6 | // 控制。更改这些属性值可修改 7 | // 与程序集关联的信息。 8 | [assembly: AssemblyTitle("SDNU ACM-ICPC Online Judge")] 9 | [assembly: AssemblyDescription("SDNU ACM-ICPC Online Judge Caching Library")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("SDNU ACM-ICPC TEAM")] 12 | [assembly: AssemblyProduct("SDNU ACM-ICPC Online Judge")] 13 | [assembly: AssemblyCopyright("Copyright © 2012-2015 SDNU ACM-ICPC TEAM")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // 将 ComVisible 设置为 false 使此程序集中的类型 18 | // 对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型, 19 | // 则将该类型上的 ComVisible 属性设置为 true。 20 | [assembly: ComVisible(false)] 21 | 22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 23 | [assembly: Guid("526b4298-0edb-4eae-bf6c-94825e35fec2")] 24 | 25 | // 程序集的版本信息由下面四个值组成: 26 | // 27 | // 主版本 28 | // 次版本 29 | // 内部版本号 30 | // 修订号 31 | // 32 | // 可以指定所有这些值,也可以使用“内部版本号”和“修订号”的默认值, 33 | // 方法是按如下所示使用“*”: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.2.0.0")] 36 | [assembly: AssemblyFileVersion("1.2.0.0")] 37 | -------------------------------------------------------------------------------- /website/SDNUOJ.Logging/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // 有关程序集的常规信息通过以下 6 | // 特性集控制。更改这些特性值可修改 7 | // 与程序集关联的信息。 8 | [assembly: AssemblyTitle("SDNU ACM-ICPC Online Judge")] 9 | [assembly: AssemblyDescription("SDNU ACM-ICPC Online Judge Logging Library")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("SDNU ACM-ICPC TEAM")] 12 | [assembly: AssemblyProduct("SDNU ACM-ICPC Online Judge")] 13 | [assembly: AssemblyCopyright("Copyright © 2012-2015 SDNU ACM-ICPC TEAM")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // 将 ComVisible 设置为 false 使此程序集中的类型 18 | // 对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型, 19 | // 则将该类型上的 ComVisible 特性设置为 true。 20 | [assembly: ComVisible(false)] 21 | 22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 23 | [assembly: Guid("07035b2e-2cf2-4cd7-9f1a-bf6d8938109a")] 24 | 25 | // 程序集的版本信息由下面四个值组成: 26 | // 27 | // 主版本 28 | // 次版本 29 | // 生成号 30 | // 修订号 31 | // 32 | // 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, 33 | // 方法是按如下所示使用“*”: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.2.0.0")] 36 | [assembly: AssemblyFileVersion("1.2.0.0")] 37 | -------------------------------------------------------------------------------- /website/SDNUOJ.Storage/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // 有关程序集的常规信息通过以下 6 | // 特性集控制。更改这些特性值可修改 7 | // 与程序集关联的信息。 8 | [assembly: AssemblyTitle("SDNU ACM-ICPC Online Judge")] 9 | [assembly: AssemblyDescription("SDNU ACM-ICPC Online Judge Storage Library")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("SDNU ACM-ICPC TEAM")] 12 | [assembly: AssemblyProduct("SDNU ACM-ICPC Online Judge")] 13 | [assembly: AssemblyCopyright("Copyright © 2012-2015 SDNU ACM-ICPC TEAM")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // 将 ComVisible 设置为 false 使此程序集中的类型 18 | // 对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型, 19 | // 则将该类型上的 ComVisible 特性设置为 true。 20 | [assembly: ComVisible(false)] 21 | 22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 23 | [assembly: Guid("a830378c-0415-4f33-93dd-d991dd61d04e")] 24 | 25 | // 程序集的版本信息由下面四个值组成: 26 | // 27 | // 主版本 28 | // 次版本 29 | // 生成号 30 | // 修订号 31 | // 32 | // 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, 33 | // 方法是按如下所示使用“*”: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.2.0.0")] 36 | [assembly: AssemblyFileVersion("1.2.0.0")] 37 | -------------------------------------------------------------------------------- /website/SDNUOJ.Utilities/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // 有关程序集的常规信息通过以下 6 | // 特性集控制。更改这些特性值可修改 7 | // 与程序集关联的信息。 8 | [assembly: AssemblyTitle("SDNU ACM-ICPC Online Judge")] 9 | [assembly: AssemblyDescription("SDNU ACM-ICPC Online Judge Utilities Library")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("SDNU ACM-ICPC TEAM")] 12 | [assembly: AssemblyProduct("SDNU ACM-ICPC Online Judge")] 13 | [assembly: AssemblyCopyright("Copyright © 2012-2015 SDNU ACM-ICPC TEAM")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // 将 ComVisible 设置为 false 使此程序集中的类型 18 | // 对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型, 19 | // 则将该类型上的 ComVisible 特性设置为 true。 20 | [assembly: ComVisible(false)] 21 | 22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 23 | [assembly: Guid("99276829-9044-48ba-8a69-95a620baa36d")] 24 | 25 | // 程序集的版本信息由下面四个值组成: 26 | // 27 | // 主版本 28 | // 次版本 29 | // 生成号 30 | // 修订号 31 | // 32 | // 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, 33 | // 方法是按如下所示使用“*”: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.2.0.0")] 36 | [assembly: AssemblyFileVersion("1.2.0.0")] 37 | -------------------------------------------------------------------------------- /website/SDNUOJ.Controllers/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // 有关程序集的常规信息通过以下 6 | // 特性集控制。更改这些特性值可修改 7 | // 与程序集关联的信息。 8 | [assembly: AssemblyTitle("SDNU ACM-ICPC Online Judge")] 9 | [assembly: AssemblyDescription("SDNU ACM-ICPC Online Judge Controller Library")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("SDNU ACM-ICPC TEAM")] 12 | [assembly: AssemblyProduct("SDNU ACM-ICPC Online Judge")] 13 | [assembly: AssemblyCopyright("Copyright © 2012-2015 SDNU ACM-ICPC TEAM")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // 将 ComVisible 设置为 false 使此程序集中的类型 18 | // 对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型, 19 | // 则将该类型上的 ComVisible 特性设置为 true。 20 | [assembly: ComVisible(false)] 21 | 22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 23 | [assembly: Guid("19b58484-62ae-4738-9c4d-11d5de715368")] 24 | 25 | // 程序集的版本信息由下面四个值组成: 26 | // 27 | // 主版本 28 | // 次版本 29 | // 生成号 30 | // 修订号 31 | // 32 | // 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, 33 | // 方法是按如下所示使用“*”: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.2.0.0")] 36 | [assembly: AssemblyFileVersion("1.2.0.0")] 37 | -------------------------------------------------------------------------------- /website/SDNUOJ.Configuration/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // 有关程序集的常规信息通过下列属性集 6 | // 控制。更改这些属性值可修改 7 | // 与程序集关联的信息。 8 | [assembly: AssemblyTitle("SDNU ACM-ICPC Online Judge")] 9 | [assembly: AssemblyDescription("SDNU ACM-ICPC Online Judge Configuration Library")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("SDNU ACM-ICPC TEAM")] 12 | [assembly: AssemblyProduct("SDNU ACM-ICPC Online Judge")] 13 | [assembly: AssemblyCopyright("Copyright © 2012-2015 SDNU ACM-ICPC TEAM")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // 将 ComVisible 设置为 false 使此程序集中的类型 18 | // 对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型, 19 | // 则将该类型上的 ComVisible 属性设置为 true。 20 | [assembly: ComVisible(false)] 21 | 22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 23 | [assembly: Guid("c37a519f-7364-4ab9-9aad-fc94e299f8db")] 24 | 25 | // 程序集的版本信息由下面四个值组成: 26 | // 27 | // 主版本 28 | // 次版本 29 | // 内部版本号 30 | // 修订号 31 | // 32 | // 可以指定所有这些值,也可以使用“内部版本号”和“修订号”的默认值, 33 | // 方法是按如下所示使用“*”: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.2.0.65")] 36 | [assembly: AssemblyFileVersion("1.2.0.65")] 37 | -------------------------------------------------------------------------------- /website/SDNUOJ.Storage.FreeProblemSet/FreeProblemImage.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace SDNUOJ.Storage.FreeProblemSet 4 | { 5 | /// 6 | /// Free Problem Image 7 | /// 8 | public class FreeProblemImage 9 | { 10 | #region 字段 11 | private String _src; 12 | private String _base64; 13 | #endregion 14 | 15 | #region 属性 16 | /// 17 | /// 获取图像来源URL 18 | /// 19 | public String SourceUrl 20 | { 21 | get { return this._src; } 22 | } 23 | 24 | /// 25 | /// 获取图像Base64内容 26 | /// 27 | public String Base64Content 28 | { 29 | get { return this._base64; } 30 | } 31 | 32 | /// 33 | /// 获取图像二进制内容数组 34 | /// 35 | public Byte[] Content 36 | { 37 | get { return Convert.FromBase64String(this._base64); } 38 | } 39 | #endregion 40 | 41 | #region 构造方法 42 | public FreeProblemImage(String src, String base64) 43 | { 44 | this._src = src; 45 | this._base64 = base64; 46 | } 47 | #endregion 48 | } 49 | } -------------------------------------------------------------------------------- /website/SDNUOJ/static/js/admin-general.js.bundle: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | true 6 | 7 | true 8 | 9 | 10 | 11 | 12 | 13 | /js-source/parts-core/sdnuoj-foundation.js 14 | /js-source/parts-core/sdnuoj-utilities.js 15 | /js-source/parts-core/sdnuoj-core.js 16 | /js-source/parts-admin/admin-page.js 17 | /js-source/parts-admin/admin-pages-welcome.js 18 | /js-source/parts-admin/admin-pages-problem.js 19 | /js-source/parts-admin/admin-page-initializer.js 20 | 21 | -------------------------------------------------------------------------------- /judger/src/Judger.Models/JudgeResultCode.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Judger.Models 6 | { 7 | /// 8 | /// 判题结果码 9 | /// 10 | public enum JudgeResultCode 11 | { 12 | /// 13 | /// 判题失败 14 | /// 15 | JudgeFailed = -1, 16 | 17 | /// 18 | /// 正确 19 | /// 20 | Accepted = 0, 21 | 22 | /// 23 | /// 答案错误 24 | /// 25 | WrongAnswer = 1, 26 | 27 | /// 28 | /// 编译错误 29 | /// 30 | CompileError = 2, 31 | 32 | /// 33 | /// 运行时错误 34 | /// 35 | RuntimeError = 3, 36 | 37 | /// 38 | /// 时间超限 39 | /// 40 | TimeLimitExceed = 4, 41 | 42 | /// 43 | /// 内存超限 44 | /// 45 | MemoryLimitExceed = 5, 46 | 47 | /// 48 | /// 输出超限(输出了过多的内容) 49 | /// 50 | OutputLimitExceed = 6, 51 | 52 | /// 53 | /// 格式错误(输出了多余的空格或换行符) 54 | /// 55 | PresentationError = 7, 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # SDNU Online Judge 2 | SDNU Online Judge是基于Microsoft .NET Framework开发的高校在线评测系统,整个系统包括Web服务与评测模块两部分,两个模块使用Http进行通信,支持分布式评测。其中Web服务基于.NET 4.5 + ASP.NET MVC 5开发,支持Microsoft SQL Server、Microsoft Access等多种数据库。Judger基于.Net Core开发,可跨平台运行。 3 | 网站初始管理员账户 admin,初始密码 admin。 4 | 5 | 项目网站:http://www.acmicpc.sdnu.edu.cn 6 | 7 | 本项目使用了以下开源项目: 8 | 9 | Website: 10 | 11 | 1. [DotMaysWind.Data](http://github.com/mayswind/DotMaysWind.Data) 12 | 2. [NLog](http://nlog-project.org) 13 | 3. [NPOI](http://github.com/tonyqus/npoi) 14 | 4. [DotNetZip](http://dotnetzip.codeplex.com) 15 | 5. [LowercaseRoutesMVC](http://lowercaseroutesmvc.codeplex.com) 16 | 6. [jQuery](http://jquery.com) 17 | 7. [Bootstrap](http://getbootstrap.com) 18 | 8. [CodeMirror](http://codemirror.net) 19 | 9. [Flot](http://www.flotcharts.org) 20 | 10. [DateTimePicker](http://xdsoft.net/jqplugins/datetimepicker) 21 | 11. [TinyEditor](http://www.leigeber.com/2010/02/javascript-wysiwyg-editor) 22 | 12. [HTML5 Shiv](http://code.google.com/p/html5shiv) 23 | 13. [explorercanvas](http://code.google.com/p/explorercanvas) 24 | 14. [Respond.js](http://j.mp/respondjs) 25 | 15. [Json2](https://github.com/douglascrockford/JSON-js) 26 | 16. [jquery-placeholder](http://mths.be/placeholder) 27 | 28 | 评测机: 29 | 30 | 1. [Newtonsoft.Json](https://github.com/JamesNK/Newtonsoft.Json) 31 | -------------------------------------------------------------------------------- /website/SDNUOJ.Storage.FreeProblemSet/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // 有关程序集的常规信息通过以下 6 | // 特性集控制。更改这些特性值可修改 7 | // 与程序集关联的信息。 8 | [assembly: AssemblyTitle("SDNU ACM-ICPC Online Judge")] 9 | [assembly: AssemblyDescription("SDNU ACM-ICPC Online Judge Free Problem Set Support Library")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("SDNU ACM-ICPC TEAM")] 12 | [assembly: AssemblyProduct("SDNU ACM-ICPC Online Judge")] 13 | [assembly: AssemblyCopyright("Copyright © 2012-2015 SDNU ACM-ICPC TEAM")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // 将 ComVisible 设置为 false 使此程序集中的类型 18 | // 对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型, 19 | // 则将该类型上的 ComVisible 特性设置为 true。 20 | [assembly: ComVisible(false)] 21 | 22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 23 | [assembly: Guid("de53d20c-f4b6-47e7-990c-752dbc6136a3")] 24 | 25 | // 程序集的版本信息由下面四个值组成: 26 | // 27 | // 主版本 28 | // 次版本 29 | // 生成号 30 | // 修订号 31 | // 32 | // 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, 33 | // 方法是按如下所示使用“*”: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.2.0.0")] 36 | [assembly: AssemblyFileVersion("1.2.0.0")] 37 | -------------------------------------------------------------------------------- /website/SDNUOJ/Areas/Admin/Views/Shared/_Layout.cshtml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | @ViewBag.__Title 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | @RenderBody() 19 |
20 | 21 |
22 | 页面执行时间 @ViewBag.ExecutedTime 秒, 23 | 刷新本页面 24 |
25 |
26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /website/SDNUOJ.Entity/Enum/PermissionType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace SDNUOJ.Entity 4 | { 5 | /// 6 | /// 权限类型 7 | /// 8 | [Flags] 9 | public enum PermissionType : int 10 | { 11 | None = 0x0, //0000 0000 0000 0000 0000 0000 0000 0000 //没有权限 12 | HttpJudge = 0x1, //0000 0000 0000 0000 0000 0000 0000 0001 //0 //独立权限 不得与其他共有 13 | SourceView = 0x2, //0000 0000 0000 0000 0000 0000 0000 0010 //1 14 | Administrator = 0x80, //0000 0000 0000 0000 0000 0000 1000 0000 //7 //基本管理员权限 所有管理员必须添加 15 | NewsManage = 0x100, //0000 0000 0000 0000 0000 0001 0000 0000 //8 16 | ResourceManage = 0x200, //0000 0000 0000 0000 0000 0010 0000 0000 //9 17 | ForumManage = 0x400, //0000 0000 0000 0000 0000 0100 0000 0000 //10 18 | ProblemManage = 0x800, //0000 0000 0000 0000 0000 1000 0000 0000 //11 19 | ContestManage = 0x1000, //0000 0000 0000 0000 0001 0000 0000 0000 //12 20 | SolutionManage = 0x2000, //0000 0000 0000 0000 0010 0000 0000 0000 //13 21 | SuperAdministrator = 0x3FFFFFFE//0011 1111 1111 1111 1111 1111 1111 1110 //30 //-1 去除HttpJudge 超级管理员 22 | } 23 | } -------------------------------------------------------------------------------- /judger/src/Judger.Models/JudgeResult.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Judger.Models 6 | { 7 | /// 8 | /// 判题结果 9 | /// 10 | public class JudgeResult 11 | { 12 | /// 13 | /// 提交ID 14 | /// 15 | public int SubmitID { get; set; } 16 | 17 | /// 18 | /// 问题ID 19 | /// 20 | public int ProblemID { get; set; } 21 | 22 | /// 23 | /// 提交者 24 | /// 25 | public string Author { get; set; } 26 | 27 | /// 28 | /// 判题结果码 29 | /// 30 | public JudgeResultCode ResultCode { get; set; } 31 | 32 | /// 33 | /// 判题详情(用于获取错误详情) 34 | /// 35 | public string JudgeDetail{ get; set; } 36 | 37 | /// 38 | /// 通过率, 标识通过了几组数据 39 | /// 40 | public double PassRate { get; set; } 41 | 42 | /// 43 | /// 时间消耗 44 | /// 45 | public int TimeCost { get; set; } 46 | 47 | /// 48 | /// 内存消耗 49 | /// 50 | public int MemoryCost { get; set; } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /website/SDNUOJ.Caching/RecentContestCache.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | 4 | namespace SDNUOJ.Caching 5 | { 6 | /// 7 | /// 最近比赛缓存类 8 | /// 9 | public static class RecentContestCache 10 | { 11 | #region 最近比赛信息 12 | /// 13 | /// 缓存中存储最近比赛信息的KEY 14 | /// 15 | private const String RECENTCONTEST_CACHE_KEY = "oj.c.recent"; 16 | 17 | /// 18 | /// 缓存时间 19 | /// 20 | private const Int32 RECENTCONTEST_CACHE_TIME = 3600; 21 | 22 | /// 23 | /// 向缓存中写入最近比赛信息 24 | /// 25 | /// 最近比赛信息 26 | public static void SetRecentContestCache(String recentContest) 27 | { 28 | if (!String.IsNullOrEmpty(recentContest)) 29 | { 30 | CacheManager.Set(RECENTCONTEST_CACHE_KEY, recentContest); 31 | } 32 | } 33 | 34 | /// 35 | /// 从缓存中读取最近比赛信息 36 | /// 37 | /// 最近比赛信息 38 | public static String GetRecentContestCache() 39 | { 40 | return CacheManager.Get(RECENTCONTEST_CACHE_KEY); 41 | } 42 | #endregion 43 | } 44 | } -------------------------------------------------------------------------------- /website/SDNUOJ.Controllers/Admin/AdminAreaRegistration.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Web.Mvc; 3 | 4 | using LowercaseRoutesMVC; 5 | 6 | namespace SDNUOJ.Areas.Admin 7 | { 8 | public class AdminAreaRegistration : AreaRegistration 9 | { 10 | public override String AreaName 11 | { 12 | get 13 | { 14 | return "Admin"; 15 | } 16 | } 17 | 18 | public override void RegisterArea(AreaRegistrationContext context) 19 | { 20 | context.MapRouteLowercase( 21 | name: "Admin_ContestUser", 22 | url: "admin/contest/userlist/{cid}/{id}", 23 | defaults: new { controller = "Contest", action = "UserList", id = UrlParameter.Optional }, 24 | constraints: new { cid = @"\d+", id = @"\d+" }, 25 | namespaces: new String[] { "SDNUOJ.Areas.Admin.Controllers" } 26 | ); 27 | 28 | context.MapRouteLowercase( 29 | name: "Admin_Default", 30 | url: "admin/{controller}/{action}/{id}", 31 | defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }, 32 | namespaces: new String[] { "SDNUOJ.Areas.Admin.Controllers" } 33 | ); 34 | } 35 | } 36 | } -------------------------------------------------------------------------------- /website/SDNUOJ.Controllers/Contest/OverallController.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Web.Mvc; 4 | 5 | using SDNUOJ.Configuration; 6 | using SDNUOJ.Controllers.Core; 7 | using SDNUOJ.Entity; 8 | using SDNUOJ.Entity.Complex; 9 | 10 | namespace SDNUOJ.Areas.Contest.Controllers 11 | { 12 | public class OverallController : ContestBaseController 13 | { 14 | /// 15 | /// 竞赛统计页面 16 | /// 17 | /// 操作后的结果 18 | [Authorize(Roles = "ContestManage")] 19 | [OutputCache(CacheProfile = "DynamicPageCache", VaryByParam = "None", VaryByCustom = "nm")] 20 | public ActionResult Statistics() 21 | { 22 | ContestEntity contest = ViewData["Contest"] as ContestEntity; 23 | 24 | IDictionary statistics = SolutionManager.GetContestStatistic(contest.ContestID); 25 | List problems = ContestProblemManager.GetContestProblemList(contest.ContestID); 26 | Dictionary langs = LanguageManager.GetSupportLanguages(contest.SupportLanguage); 27 | 28 | ViewBag.Problems = problems; 29 | ViewBag.Languages = langs; 30 | 31 | return View(statistics); 32 | } 33 | } 34 | } -------------------------------------------------------------------------------- /website/SDNUOJ.Entity/UserMailEntity.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace SDNUOJ.Entity 4 | { 5 | /// 6 | /// 用户邮件实体类 7 | /// 8 | [Serializable] 9 | public class UserMailEntity 10 | { 11 | /// 12 | /// 获取或设置邮件ID 13 | /// 14 | public Int32 MailID { get; set; } 15 | 16 | /// 17 | /// 获取或设置来源用户名 18 | /// 19 | public String FromUserName { get; set; } 20 | 21 | /// 22 | /// 获取或设置去向用户名 23 | /// 24 | public String ToUserName { get; set; } 25 | 26 | /// 27 | /// 获取或设置邮件标题 28 | /// 29 | public String Title { get; set; } 30 | 31 | /// 32 | /// 获取或设置邮件内容 33 | /// 34 | public String Content { get; set; } 35 | 36 | /// 37 | /// 获取或设置邮件发送日期 38 | /// 39 | public DateTime SendDate { get; set; } 40 | 41 | /// 42 | /// 获取或设置是否已读 43 | /// 44 | public Boolean IsRead { get; set; } 45 | 46 | /// 47 | /// 获取或设置是否已删除 48 | /// 49 | public Boolean IsDeleted { get; set; } 50 | } 51 | } -------------------------------------------------------------------------------- /website/SDNUOJ.Controllers/Core/SolutionErrorManager.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | using SDNUOJ.Controllers.Exception; 4 | using SDNUOJ.Data; 5 | using SDNUOJ.Entity; 6 | using SDNUOJ.Utilities.Text; 7 | 8 | namespace SDNUOJ.Controllers.Core 9 | { 10 | /// 11 | /// 提交错误数据管理类 12 | /// 13 | /// 14 | /// HtmlEncode : 程序代码 / 调取时转换 15 | /// 16 | internal static class SolutionErrorManager 17 | { 18 | #region 用户方法 19 | /// 20 | /// 根据ID得到一个提交错误实体 21 | /// 22 | /// 提交ID 23 | /// 提交错误实体 24 | public static SolutionErrorEntity GetSolutionError(Int32 id) 25 | { 26 | if (id <= 0) 27 | { 28 | throw new InvalidRequstException(RequestType.SolutionError); 29 | } 30 | 31 | SolutionErrorEntity entity = SolutionErrorRepository.Instance.GetEntity(id); 32 | 33 | if (entity == null) 34 | { 35 | throw new NullResponseException(RequestType.SolutionError); 36 | } 37 | 38 | entity.ErrorInfo = HtmlEncoder.HtmlEncode(entity.ErrorInfo, 0, false, true); 39 | 40 | return entity; 41 | } 42 | #endregion 43 | } 44 | } -------------------------------------------------------------------------------- /website/SDNUOJ.Entity/ForumTopicEntity.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace SDNUOJ.Entity 4 | { 5 | /// 6 | /// 论坛主题实体类 7 | /// 8 | [Serializable] 9 | public class ForumTopicEntity 10 | { 11 | /// 12 | /// 获取或设置主题ID 13 | /// 14 | public Int32 TopicID { get; set; } 15 | 16 | /// 17 | /// 获取或设置发布用户名 18 | /// 19 | public String UserName { get; set; } 20 | 21 | /// 22 | /// 获取或设置主题标题 23 | /// 24 | public String Title { get; set; } 25 | 26 | /// 27 | /// 获取或设置主题类型 28 | /// 29 | public ForumTopicType Type { get; set; } 30 | 31 | /// 32 | /// 获取或设置是否锁定主题 33 | /// 34 | public Boolean IsLocked { get; set; } 35 | 36 | /// 37 | /// 获取或设置是否隐藏主题 38 | /// 39 | public Boolean IsHide { get; set; } 40 | 41 | /// 42 | /// 获取或设置关联题目/比赛ID 43 | /// 44 | public Int32 RelativeID { get; set; } 45 | 46 | /// 47 | /// 获取或设置主题的最后帖子日期 48 | /// 49 | public DateTime LastDate { get; set; } 50 | } 51 | } -------------------------------------------------------------------------------- /website/SDNUOJ/js-source/parts-foreground/foreground-pages-problem.js: -------------------------------------------------------------------------------- 1 | SDNUOJ.namespace("SDNUOJ.pages.problems"); 2 | 3 | SDNUOJ.pages.problems = (function () { 4 | var user = SDNUOJ.user; 5 | 6 | function setProblemStatus(pid, status) { 7 | var td = $("#S" + pid); 8 | 9 | if (td.length > 0) { 10 | td.addClass(status == 2 ? "problem-ac" : (status == 1 ? "problem-wa" : "problem-normal")); 11 | td.html(status == 2 ? "Y" : (status == 1 ? "N" : "")); 12 | } 13 | } 14 | 15 | return { 16 | init: function () { 17 | if (user.getIsLogined() && $("#SOpen").length > 0) { 18 | user.getSubmitList(function (data) { 19 | var solved = data.solved; 20 | var unsolved = data.unsolved; 21 | 22 | if (unsolved) { 23 | for (var i = 0; i < unsolved.length; i++) { 24 | setProblemStatus(unsolved[i], 1); 25 | } 26 | } 27 | 28 | if (solved) { 29 | for (var i = 0; i < solved.length; i++) { 30 | setProblemStatus(solved[i], 2); 31 | } 32 | } 33 | }); 34 | } 35 | } 36 | } 37 | })(); -------------------------------------------------------------------------------- /website/SDNUOJ.Controllers/Status/UserIPStatus.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Web; 3 | using System.Web.Caching; 4 | 5 | using SDNUOJ.Configuration; 6 | 7 | namespace SDNUOJ.Controllers.Status 8 | { 9 | /// 10 | /// 用户IP管理器 11 | /// 12 | public static class UserIPStatus 13 | { 14 | #region 字段 15 | private static Cache _ips; 16 | #endregion 17 | 18 | #region 构造方法 19 | static UserIPStatus() 20 | { 21 | _ips = HttpRuntime.Cache; 22 | } 23 | #endregion 24 | 25 | #region 方法 26 | /// 27 | /// 判断注册间隔是否满足 28 | /// 29 | /// IP 30 | /// IP是否存在 31 | public static Boolean CheckLastRegisterTime(String ip) 32 | { 33 | if (ConfigurationManager.RegisterInterval <= 0) 34 | { 35 | return true; 36 | } 37 | 38 | if (_ips.Get(ip) != null) 39 | { 40 | return false; 41 | } 42 | 43 | _ips.Add(ip, true, null, Cache.NoAbsoluteExpiration, new TimeSpan(0, 0, ConfigurationManager.RegisterInterval), CacheItemPriority.NotRemovable, null); 44 | 45 | return true; 46 | } 47 | #endregion 48 | } 49 | } -------------------------------------------------------------------------------- /website/SDNUOJ.Caching/ResourceCache.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | using SDNUOJ.Entity; 5 | 6 | namespace SDNUOJ.Caching 7 | { 8 | /// 9 | /// 资源信息缓存类 10 | /// 11 | public static class ResourceCache 12 | { 13 | #region 资源信息列表 14 | /// 15 | /// 缓存中存储资源信息的KEY 16 | /// 17 | private const String RESOURCE_LIST_CACHE_KEY = "oj.r.all"; 18 | 19 | /// 20 | /// 向缓存中写入资源信息 21 | /// 22 | /// 资源信息 23 | public static void SetResourceListCache(List list) 24 | { 25 | if (list != null) CacheManager.Set(RESOURCE_LIST_CACHE_KEY, list); 26 | } 27 | 28 | /// 29 | /// 从缓存中读取资源信息 30 | /// 31 | /// 资源信息 32 | public static List GetResourceListCache() 33 | { 34 | return CacheManager.Get>(RESOURCE_LIST_CACHE_KEY); 35 | } 36 | 37 | /// 38 | /// 从缓存中删除资源信息 39 | /// 40 | public static void RemoveResourceListCache() 41 | { 42 | CacheManager.Remove(RESOURCE_LIST_CACHE_KEY); 43 | } 44 | #endregion 45 | } 46 | } -------------------------------------------------------------------------------- /judger/src/Judger.Utils/RandomString.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Judger.Utils 6 | { 7 | /// 8 | /// 随机字符串辅助类 9 | /// 10 | public static class RandomString 11 | { 12 | // 字符表 13 | private static char[] _chars; 14 | 15 | static RandomString() 16 | { 17 | List charsList = new List(); 18 | 19 | for (int i = 0; i <= 9; i++) 20 | { 21 | charsList.Add((char)('0' + i)); 22 | } 23 | 24 | for (int i = 0; i < 26; i++) 25 | { 26 | charsList.Add((char)('a' + i)); 27 | charsList.Add((char)('A' + i)); 28 | } 29 | 30 | _chars = charsList.ToArray(); 31 | } 32 | 33 | /// 34 | /// 生成大小写字母与数字混合的随机字符串 35 | /// 36 | /// 长度 37 | /// 随机字符串 38 | public static string Next(int length) 39 | { 40 | Random random = new Random(); 41 | StringBuilder sb = new StringBuilder(); 42 | 43 | for (int i = 0; i < length; i++) 44 | { 45 | sb.Append(_chars[random.Next(0, _chars.Length - 1)]); 46 | } 47 | 48 | return sb.ToString(); 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /website/SDNUOJ.Caching/ScheduledTaskManager.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Threading; 4 | 5 | namespace SDNUOJ.Caching 6 | { 7 | /// 8 | /// 定时任务管理器 9 | /// 10 | public static class ScheduledTaskManager 11 | { 12 | #region 字段 13 | private static Dictionary _tasks; 14 | #endregion 15 | 16 | #region 构造方法 17 | static ScheduledTaskManager() 18 | { 19 | _tasks = new Dictionary(); 20 | } 21 | #endregion 22 | 23 | #region 方法 24 | /// 25 | /// 设置定时任务 26 | /// 27 | /// 任务名称 28 | /// 开始延时(秒) 29 | /// 间隔时间(秒) 30 | /// 执行回调方法 31 | public static void Schedule(String taskName, Int32 startDelay, Int32 interval, TimerCallback callback) 32 | { 33 | Timer timer = null; 34 | 35 | if (_tasks.TryGetValue(taskName, out timer) && timer != null) 36 | { 37 | timer.Dispose(); 38 | } 39 | 40 | timer = new Timer(callback, null, TimeSpan.FromSeconds(startDelay), TimeSpan.FromSeconds(interval)); 41 | _tasks[taskName] = timer; 42 | } 43 | #endregion 44 | } 45 | } -------------------------------------------------------------------------------- /judger/src/Judger.Fetcher.Generic/TaskSubmitter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using Newtonsoft.Json.Linq; 5 | using Judger.Managers; 6 | using Judger.Models; 7 | using Judger.Utils; 8 | 9 | namespace Judger.Fetcher.Generic 10 | { 11 | /// 12 | /// JudgeResult提交器 13 | /// 14 | public class TaskSubmitter : ITaskSubmitter 15 | { 16 | private readonly Configuration _config = ConfigManager.Config; 17 | 18 | public bool Submit(JudgeResult result) 19 | { 20 | using (HttpWebClient client = ConfiguredClient.Create()) 21 | { 22 | client.DefaultContentType = "application/json"; 23 | 24 | client.UploadString(_config.ResultSubmitUrl, GetDataForSubmit(result), 3); 25 | } 26 | return true; 27 | } 28 | 29 | /// 30 | /// 根据JudgeResult生成用于提交的数据 31 | /// 32 | /// JudgeResult 33 | private string GetDataForSubmit(JudgeResult result) 34 | { 35 | JObject obj = JObject.FromObject(result); 36 | obj.Add("JudgerName", ConfigManager.Config.JudgerName); 37 | obj.Add("Token", Token.Create()); 38 | 39 | return obj.ToString(); 40 | } 41 | 42 | public void Dispose() 43 | { 44 | 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /website/SDNUOJ.Controllers/Attributes/ContestSubmitAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Web.Mvc; 3 | 4 | using SDNUOJ.Controllers.Core; 5 | using SDNUOJ.Controllers.Exception; 6 | using SDNUOJ.Entity; 7 | 8 | namespace SDNUOJ.Controllers.Attributes 9 | { 10 | /// 11 | /// 竞赛需要提交特性 12 | /// 13 | [AttributeUsage(AttributeTargets.Method, AllowMultiple = false)] 14 | public class ContestSubmitAttribute : ActionFilterAttribute 15 | { 16 | #region 方法 17 | public override void OnActionExecuting(ActionExecutingContext filterContext) 18 | { 19 | ContestEntity contest = filterContext.ActionParameters["Contest"] as ContestEntity; 20 | Boolean hasPermission = AdminManager.HasPermission(PermissionType.ContestManage); 21 | 22 | if (contest.EndTime < DateTime.Now) 23 | { 24 | throw new NoPermissionException("This contest has ended!"); 25 | } 26 | 27 | if (!hasPermission && contest.ContestType == ContestType.RegisterPublic) 28 | { 29 | if (!ContestUserManager.ContestContainsUser(contest.ContestID, UserManager.CurrentUserName)) 30 | { 31 | throw new NoPermissionException("You have no privilege to submit in this contest!"); 32 | } 33 | } 34 | } 35 | #endregion 36 | } 37 | } -------------------------------------------------------------------------------- /website/SDNUOJ/Areas/Contest/Views/Home/Index.cshtml: -------------------------------------------------------------------------------- 1 | @model SDNUOJ.Entity.ContestEntity 2 | 3 | @{ 4 | ViewBag.__Title = "Contest Information"; 5 | ViewBag.__ContestPageTitle = Model.Title; 6 | ViewBag.__Type = "contest.index"; 7 | 8 | DateTime Now = DateTime.Now; 9 | } 10 | 11 |
12 |
13 | Start Time: @Model.StartTime.ToString("yyyy-MM-dd HH:mm:ss")     14 | End Time: @Model.EndTime.ToString("yyyy-MM-dd HH:mm:ss")
15 | Contest Type: @Model.ContestTypeString     16 | Contest Status: @Model.ContestStatus
17 |
@Html.Raw(Model.Description)
18 | Current Server Time: @Now.ToString("yyyy-MM-dd HH:mm:ss") 19 |
20 |
21 | 22 | -------------------------------------------------------------------------------- /website/SDNUOJ/static/js/foundation/codemirror-package-5.2.js.bundle: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | true 6 | 7 | true 8 | 9 | 10 | 11 | 12 | 13 | /js-source/parts-codemirror/codemirror.js 14 | /js-source/parts-codemirror/active-line.js 15 | /js-source/parts-codemirror/fullscreen.js 16 | /js-source/parts-codemirror/matchbrackets.js 17 | /js-source/parts-codemirror/placeholder.js 18 | /js-source/parts-codemirror/clike.js 19 | /js-source/parts-codemirror/pascal.js 20 | /js-source/parts-codemirror/python.js 21 | /js-source/parts-codemirror/ruby.js 22 | /js-source/parts-codemirror/vb.js 23 | 24 | -------------------------------------------------------------------------------- /judger/src/Judger.Utils/FileHelper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using System.IO; 5 | 6 | namespace Judger.Utils 7 | { 8 | /// 9 | /// 文件辅助类 10 | /// 11 | public static class FileHelper 12 | { 13 | /// 14 | /// 尝试读取文件文本 15 | /// 16 | /// 文件路径 17 | /// 文本内容 18 | /// 是否成功 19 | public static bool TryReadAllText(string path, out string contents) 20 | { 21 | try 22 | { 23 | contents = File.ReadAllText(path, Encoding.UTF8); 24 | return true; 25 | } 26 | catch 27 | { 28 | contents = ""; 29 | return false; 30 | } 31 | } 32 | 33 | /// 34 | /// 尝试写出文本文件 35 | /// 36 | /// 文件路径 37 | /// 欲写入的文本 38 | /// 是否成功 39 | public static bool TryWriteAllText(string path, string contents) 40 | { 41 | try 42 | { 43 | File.WriteAllText(path, contents, Encoding.UTF8); 44 | return true; 45 | } 46 | catch 47 | { 48 | return false; 49 | } 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /judger/src/Judger.Judger/ISingleJudger.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using Judger.Judger.Models; 5 | 6 | namespace Judger.Judger 7 | { 8 | /// 9 | /// 单例Judger接口 10 | /// 11 | public interface ISingleJudger 12 | { 13 | /// 14 | /// 运行器路径 15 | /// 16 | string RunnerPath { get; set; } 17 | 18 | /// 19 | /// 运行器工作目录 20 | /// 21 | string RunnerWorkDirectory { get; set; } 22 | 23 | /// 24 | /// 运行器运行参数 25 | /// 26 | string RunnerArgs { get; set; } 27 | 28 | /// 29 | /// 时间限制 30 | /// 31 | int TimeLimit { get; set; } 32 | 33 | /// 34 | /// 内存限制 35 | /// 36 | int MemoryLimit { get; set; } 37 | 38 | /// 39 | /// 输出限制 40 | /// 41 | int OutputLimit { get; set; } 42 | 43 | /// 44 | /// 处理器亲和性 45 | /// 46 | IntPtr ProcessorAffinity { get; set; } 47 | 48 | /// 49 | /// 评测 50 | /// 51 | /// 答案输入 52 | /// 答案输出 53 | /// 单组评测结果 54 | SingleJudgeResult Judge(string input, string output); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /website/SDNUOJ.Configuration/Caching/LanguageFilterCache.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace SDNUOJ.Configuration.Caching 5 | { 6 | /// 7 | /// 语言过滤器缓存 8 | /// 9 | internal static class LanguageFilterCache 10 | { 11 | #region 字段 12 | private static Dictionary> _cache; 13 | #endregion 14 | 15 | #region 构造方法 16 | static LanguageFilterCache() 17 | { 18 | _cache = new Dictionary>(); 19 | } 20 | #endregion 21 | 22 | #region 方法 23 | /// 24 | /// 设置语言过滤器结果缓存 25 | /// 26 | /// 过滤器 27 | /// 过滤器结果 28 | internal static void SetLanguageFilterResultCache(String filter, Dictionary result) 29 | { 30 | _cache[filter] = result; 31 | } 32 | 33 | /// 34 | /// 获取语言过滤器结果缓存 35 | /// 36 | /// 过滤器 37 | /// 过滤器结果 38 | internal static Dictionary GetLanguageFilterResultCache(String filter) 39 | { 40 | Dictionary result = null; 41 | 42 | return (_cache.TryGetValue(filter, out result) ? result : null); 43 | } 44 | #endregion 45 | } 46 | } -------------------------------------------------------------------------------- /website/SDNUOJ.Controllers/Contest/ContestAreaRegistration.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Web.Mvc; 3 | 4 | using LowercaseRoutesMVC; 5 | 6 | namespace SDNUOJ.Areas.Contest 7 | { 8 | public class ContestAreaRegistration : AreaRegistration 9 | { 10 | public override String AreaName 11 | { 12 | get 13 | { 14 | return "Contest"; 15 | } 16 | } 17 | 18 | public override void RegisterArea(AreaRegistrationContext context) 19 | { 20 | context.MapRouteLowercase( 21 | name: "Contest_ProblemStatistic", 22 | url: "contest/{cid}/problem/statistic/{pid}/{id}/{lang}/{order}", 23 | defaults: new { controller = "Problem", action = "Statistic", id = UrlParameter.Optional, lang = UrlParameter.Optional, order = UrlParameter.Optional }, 24 | constraints: new { cid = @"\d+", pid = @"\d+" }, 25 | namespaces: new String[] { "SDNUOJ.Areas.Contest.Controllers" } 26 | ); 27 | 28 | context.MapRouteLowercase( 29 | name: "Contest_Default", 30 | url: "contest/{cid}/{controller}/{action}/{id}", 31 | defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }, 32 | constraints: new { cid = @"\d+" }, 33 | namespaces: new String[] { "SDNUOJ.Areas.Contest.Controllers" } 34 | ); 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /website/SDNUOJ.Caching/ProblemCategoryCache.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | using SDNUOJ.Entity; 5 | 6 | namespace SDNUOJ.Caching 7 | { 8 | /// 9 | /// 题目类别种类信息缓存类 10 | /// 11 | public static class ProblemCategoryCache 12 | { 13 | #region 所有题目类别种类信息 14 | /// 15 | /// 缓存中存储题目类别种类信息的KEY 16 | /// 17 | private const String PROBLEM_CATEGORY_LIST_CACHE_KEY = "oj.p.categorys"; 18 | 19 | /// 20 | /// 向缓存中写入题目类别种类信息 21 | /// 22 | /// 题目类别种类信息 23 | public static void SetProblemCategoryListCache(List list) 24 | { 25 | if (list != null) CacheManager.Set(PROBLEM_CATEGORY_LIST_CACHE_KEY, list); 26 | } 27 | 28 | /// 29 | /// 从缓存中读取题目类别种类信息 30 | /// 31 | /// 题目类别种类信息 32 | public static List GetProblemCategoryListCache() 33 | { 34 | return CacheManager.Get>(PROBLEM_CATEGORY_LIST_CACHE_KEY); 35 | } 36 | 37 | /// 38 | /// 从缓存中删除题目类别种类信息 39 | /// 40 | public static void RemoveProblemCategoryListCache() 41 | { 42 | CacheManager.Remove(PROBLEM_CATEGORY_LIST_CACHE_KEY); 43 | } 44 | #endregion 45 | } 46 | } -------------------------------------------------------------------------------- /website/SDNUOJ/Areas/Contest/Views/Forum/List.cshtml: -------------------------------------------------------------------------------- 1 | @model SDNUOJ.Utilities.PagedList 2 | 3 | @{ 4 | var Contest = ViewData["Contest"] as SDNUOJ.Entity.ContestEntity; 5 | 6 | ViewBag.__Title = "Contest Clarification"; 7 | ViewBag.__ContestPageTitle = "Contest Clarification | New"; 8 | } 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | @foreach (var Item in Model) 19 | { 20 | 21 | 22 | 23 | 24 | 25 | } 26 | @if (Model.Count == 0) 27 | { 28 | 29 | 30 | 31 | } 32 |
Last ReplyTitleAuthor
@Item.LastDate.ToString("yyyy-MM-dd HH:mm:ss")@Html.Raw(Item.Title)@*!TIP:ForumTopic.Title添加时已Encode*@@Html.ActionLink(Item.UserName, "Info", "User", new { area = "", id = Item.UserName }, null)
No topic
33 | 34 |
35 | @RenderPage("~/Views/Shared/_SimplePager.cshtml") 36 |
-------------------------------------------------------------------------------- /oldJudger/src/Judger/ProcessorAffinityManager.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace JudgeClient.Judger 7 | { 8 | internal class ProcessorAffinityManager 9 | { 10 | private object _processor_affinity_lock = new object(); 11 | private object _processor_affinity_modify_lock = new object(); 12 | private int _processor_status = 0; 13 | internal protected ProcessorAffinityUsage GetUsage(IntPtr default_affinity) 14 | { 15 | lock (_processor_affinity_lock) 16 | { 17 | var aff = ((_processor_status + 1) & ~_processor_status & (int)default_affinity); 18 | while (aff == 0) 19 | { 20 | System.Threading.Thread.Sleep(100); 21 | aff = ((_processor_status + 1) & ~_processor_status & (int)default_affinity); 22 | } 23 | lock (_processor_affinity_modify_lock) 24 | _processor_status |= aff; 25 | return new ProcessorAffinityUsage() 26 | { 27 | Manager = this, 28 | Affinity = (IntPtr)aff 29 | }; 30 | } 31 | } 32 | internal protected void ReleaseProcessor(IntPtr processor_affinity) 33 | { 34 | lock (_processor_affinity_modify_lock) 35 | { 36 | _processor_status &= ~(int)processor_affinity; 37 | } 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /website/SDNUOJ.Logging/ExceptionLogContext.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace SDNUOJ.Logging 4 | { 5 | /// 6 | /// 异常日志上下文 7 | /// 8 | [Serializable] 9 | public class ExceptionLogContext : LogContext 10 | { 11 | #region 字段 12 | private Exception _exception; 13 | #endregion 14 | 15 | #region 属性 16 | /// 17 | /// 获取日志级别 18 | /// 19 | public override LogLevel Level 20 | { 21 | get { return LogLevel.Error; } 22 | } 23 | 24 | /// 25 | /// 获取日志类型 26 | /// 27 | public override String Type 28 | { 29 | get { return "error"; } 30 | } 31 | 32 | /// 33 | /// 获取日志内容 34 | /// 35 | public override String Message 36 | { 37 | get { return this._exception.Message; } 38 | } 39 | 40 | /// 41 | /// 获取当前异常 42 | /// 43 | public Exception Exception 44 | { 45 | get { return this._exception; } 46 | } 47 | #endregion 48 | 49 | #region 构造方法 50 | /// 51 | /// 初始化新的异常日志上下文 52 | /// 53 | /// 异常 54 | public ExceptionLogContext(Exception ex) 55 | { 56 | this._exception = ex; 57 | } 58 | #endregion 59 | } 60 | } -------------------------------------------------------------------------------- /website/SDNUOJ/js-source/parts-foreground/foreground-pages-mail.js: -------------------------------------------------------------------------------- 1 | SDNUOJ.namespace("SDNUOJ.pages.mailbox"); 2 | 3 | SDNUOJ.pages.mailbox = (function () { 4 | var user = SDNUOJ.user; 5 | 6 | return { 7 | init: function () { 8 | $("#form-mailbox-delete").submit(function (e) { 9 | if ($(this).serialize().indexOf("mailid") < 0) { 10 | alert("Please select at least one mail!"); 11 | return false; 12 | } 13 | 14 | if (!window.confirm("Are you sure you want to delete selected mail(s)?")) { 15 | return false; 16 | } 17 | 18 | return true; 19 | }); 20 | 21 | $("button[data-loading-text]").click(function (e) { 22 | $(this).button("loading"); 23 | }); 24 | } 25 | }; 26 | })(); 27 | 28 | SDNUOJ.namespace("SDNUOJ.pages.mail"); 29 | 30 | SDNUOJ.pages.mail = (function () { 31 | var user = SDNUOJ.user; 32 | 33 | return { 34 | init: function () { 35 | $("#form-mail-delete").submit(function (e) { 36 | if (!window.confirm("Are you sure you want to delete this mail?")) { 37 | return false; 38 | } 39 | 40 | return true; 41 | }); 42 | 43 | $("button[data-loading-text]").click(function (e) { 44 | $(this).button("loading"); 45 | }); 46 | } 47 | }; 48 | })(); -------------------------------------------------------------------------------- /website/SDNUOJ/Areas/Admin/Views/Database/Compact.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewBag.__Title = "数据库压缩"; 3 | } 4 | 5 | @using (Html.BeginForm("Compact", "Database", FormMethod.Post, new { @data_confirm = "true", @data_verify = "true", @data_waiting = "true" })) 6 | { 7 | @Html.AntiForgeryToken() 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 20 | 21 | 22 |
数据库压缩说明
17 | 1. 您可以在本页压缩当前使用的或备份的数据库,建议压缩备份数据库。
18 | 2. 若数据库无法压缩表示当前数据库正在使用,请稍后重试。 19 |
23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 42 | 43 | 44 |
数据库压缩
*待压缩数据库文件名
39 | 40 | 41 |
45 | } -------------------------------------------------------------------------------- /website/SDNUOJ.Utilities/NumericExtension.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Text; 3 | 4 | namespace SDNUOJ.Utilities 5 | { 6 | /// 7 | /// 数值扩展类 8 | /// 9 | public static class NumericExtension 10 | { 11 | /// 12 | /// 转换为62进制 13 | /// 14 | /// 原数字 15 | /// 62进制数字字符串 16 | public static String ToSixtyTwoRadix(this Int64 value) 17 | { 18 | if (value == 0) 19 | { 20 | return "0"; 21 | } 22 | 23 | StringBuilder result = new StringBuilder(); 24 | 25 | while (value > 0) 26 | { 27 | Int64 num = value % 62; 28 | result.Insert(0, GetChar(num)); 29 | value = (Int64)(value / 62); 30 | } 31 | 32 | return result.ToString(); 33 | } 34 | 35 | private static Char GetChar(Int64 num) 36 | { 37 | if (0 <= num && num <= 9) 38 | { 39 | return (Char)('0' + num); 40 | } 41 | else if (10 <= num && num <= 35) 42 | { 43 | return (Char)('a' + num - 10); 44 | } 45 | else if (36 <= num && num <= 61) 46 | { 47 | return (Char)('A' + num - 36); 48 | } 49 | else 50 | { 51 | return '\0'; 52 | } 53 | } 54 | } 55 | } -------------------------------------------------------------------------------- /website/SDNUOJ/Areas/Admin/Views/Database/Restore.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewBag.__Title = "数据库还原"; 3 | } 4 | 5 | @using (Html.BeginForm("Restore", "Database", FormMethod.Post, new { @data_confirm = "true", @data_verify = "true", @data_waiting = "true" })) 6 | { 7 | @Html.AntiForgeryToken() 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 20 | 21 | 22 |
数据库还原说明
17 | 1. 您可以在本页恢复数据库,备份数据库的文件名格式为:年_月_日_时_分_秒.resx。
18 | 2. 若数据库无法恢复表示当前数据库正在使用,请稍后重试。 19 |
23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 42 | 43 | 44 |
数据库还原
*备份数据库文件名
39 | 40 | 41 |
45 | } -------------------------------------------------------------------------------- /website/SDNUOJ/js-source/parts-foreground/foreground-pages-recent.js: -------------------------------------------------------------------------------- 1 | SDNUOJ.namespace("SDNUOJ.pages.recent"); 2 | 3 | SDNUOJ.pages.recent = (function () { 4 | return { 5 | init: function () { 6 | if ($("#table-recent").length > 0) { 7 | $.getJSON("/contests/recentinfo").done(function (data) { 8 | $("#tr-recent-info").remove(); 9 | 10 | for (var i = data.length - 1; i >= 0; i--) { 11 | if (data[i].access == "") { 12 | data[i].access = "Public"; 13 | } 14 | 15 | var cid = $("").addClass("text-center").html(i + 1000); 16 | var cname = $("").html("" + data[i].name + ""); 17 | var start = $("").addClass("text-center").html(data[i].start_time); 18 | var type = $("").addClass("text-center").html("" + data[i].access + ""); 19 | var oj = $("").addClass("text-center").html(data[i].oj); 20 | var line = $("").append(cid).append(cname).append(start).append(type).append(oj); 21 | 22 | $("#table-recent").append(line); 23 | } 24 | }).fail(function () { 25 | $("td-recent-info").html("No such contest"); 26 | }); 27 | } 28 | } 29 | } 30 | })(); -------------------------------------------------------------------------------- /website/SDNUOJ.Caching/ProblemDataCache.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace SDNUOJ.Caching 5 | { 6 | /// 7 | /// 题目数据缓存类 8 | /// 9 | public static class ProblemDataCache 10 | { 11 | #region 指定题目数据版本信息 12 | private static Dictionary _lastModified = null; 13 | 14 | static ProblemDataCache() 15 | { 16 | _lastModified = new Dictionary(); 17 | } 18 | 19 | /// 20 | /// 向缓存中写入指定题目数据版本 21 | /// 22 | /// 题目ID 23 | /// 数据版本 24 | public static void SetProblemDataVersionCache(Int32 pid, String version) 25 | { 26 | _lastModified[pid] = version; 27 | } 28 | 29 | /// 30 | /// 从缓存中读取指定题目数据版本 31 | /// 32 | /// 题目ID 33 | /// 数据版本 34 | public static String GetProblemDataVersionCache(Int32 pid) 35 | { 36 | String version = String.Empty; 37 | return _lastModified.TryGetValue(pid, out version) ? version : String.Empty; 38 | } 39 | 40 | /// 41 | /// 从缓存中删除指定题目数据版本 42 | /// 43 | /// 题目ID 44 | public static void RemoveProblemDataVersionCache(Int32 pid) 45 | { 46 | _lastModified.Remove(pid); 47 | } 48 | #endregion 49 | } 50 | } -------------------------------------------------------------------------------- /website/SDNUOJ/Areas/Admin/Views/Judger/Add.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewBag.__Title = "评测机添加"; 3 | } 4 | 5 | @using (Html.BeginForm("Add", "Judger", FormMethod.Post, new { @data_confirm = "true", @data_verify = "true", @data_waiting = "true" })) 6 | { 7 | @Html.AntiForgeryToken() 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 20 | 21 | 22 |
评测机添加说明
17 | 1. 您可以在本页面设置现有用户账号为评测机账号,评测机账号设置后则不能通过普通途径登陆。
18 | 2. 评测机权限与其他管理权限冲突,一旦设置为评测机账号则其他权限自动取消。 19 |
23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 42 | 43 | 44 |
评测机添加
*评测机用户名
39 | 40 | 41 |
45 | } -------------------------------------------------------------------------------- /website/SDNUOJ.Controllers/Core/Judge/JudgeProblemManager.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | using SDNUOJ.Utilities; 4 | 5 | namespace SDNUOJ.Controllers.Core.Judge 6 | { 7 | internal static class JudgeProblemManager 8 | { 9 | #region 评测机获取题目数据 10 | /// 11 | /// 获取题目数据 12 | /// 13 | /// 题目ID 14 | /// 题目数据路径 15 | /// 错误信息 16 | /// 获取是否成功 17 | public static Boolean TryGetProblemDataPath(String pid, out String dataPath, out String error) 18 | { 19 | dataPath = String.Empty; 20 | 21 | try 22 | { 23 | error = JudgeStatusManager.GetJudgeServerLoginStatus(); 24 | 25 | if (!String.IsNullOrEmpty(error)) 26 | { 27 | return false; 28 | } 29 | 30 | Int32 problemID = pid.ToInt32(0); 31 | String path = ProblemDataManager.GetProblemDataRealPath(problemID); 32 | 33 | if (String.IsNullOrEmpty(path)) 34 | { 35 | error = "Problem data does not exist!"; 36 | return false; 37 | } 38 | 39 | dataPath = path; 40 | return true; 41 | } 42 | catch (System.Exception ex) 43 | { 44 | error = ex.Message; 45 | return false; 46 | } 47 | } 48 | #endregion 49 | } 50 | } -------------------------------------------------------------------------------- /website/SDNUOJ.Controllers/Contest/StatusController.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Web.Mvc; 4 | 5 | using SDNUOJ.Configuration; 6 | using SDNUOJ.Controllers.Core; 7 | using SDNUOJ.Entity; 8 | using SDNUOJ.Utilities; 9 | 10 | namespace SDNUOJ.Areas.Contest.Controllers 11 | { 12 | public class StatusController : ContestBaseController 13 | { 14 | /// 15 | /// 提交状态列表页面 16 | /// 17 | /// 页面索引 18 | /// 题目ID 19 | /// 用户名 20 | /// 提交语言 21 | /// 评测结果 22 | /// 操作后的结果 23 | [OutputCache(CacheProfile = "MinimumPageCache", VaryByParam = "id;pid;name;lang;type", VaryByCustom = "nm")] 24 | public ActionResult List(Int32 id = 1, Int32 pid = -1, String name = "", String lang = "", String type = "") 25 | { 26 | ContestEntity contest = ViewData["Contest"] as ContestEntity; 27 | Dictionary langs = LanguageManager.GetSupportLanguages(contest.SupportLanguage); 28 | ViewBag.Languages = langs; 29 | 30 | PagedList list = SolutionManager.GetSolutionList(id, contest.ContestID, pid, name, lang, type, null); 31 | 32 | ViewBag.ProblemID = pid; 33 | ViewBag.UserName = name; 34 | ViewBag.Language = lang; 35 | ViewBag.SearchType = type; 36 | 37 | return ViewWithPager(list, id); 38 | } 39 | } 40 | } -------------------------------------------------------------------------------- /website/SDNUOJ/Areas/Admin/Views/Database/Backup.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewBag.__Title = "数据库备份"; 3 | } 4 | 5 | @using (Html.BeginForm("Backup", "Database", FormMethod.Post, new { @data_confirm = "true", @data_verify = "true", @data_waiting = "true" })) 6 | { 7 | @Html.AntiForgeryToken() 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 20 | 21 | 22 |
数据库备份说明
17 | 1. 您可以在本页备份数据库,备份数据库存放于与当前数据库相同的目录下(默认为App_Data目录)。
18 | 2. 备份数据库的文件名格式为:年_月_日_时_分_秒.resx。 19 |
23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 42 | 43 | 44 |
数据库备份
*备份数据库文件名
39 | 40 | 41 |
45 | } -------------------------------------------------------------------------------- /website/SDNUOJ.Utilities/Net/MailClient.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Net; 3 | using System.Net.Mail; 4 | using System.Threading.Tasks; 5 | 6 | namespace SDNUOJ.Utilities.Net 7 | { 8 | /// 9 | /// 电子邮件客户端 10 | /// 11 | public static class MailClient 12 | { 13 | /// 14 | /// 发送邮件 15 | /// 16 | /// SMTP服务器地址 17 | /// 发件人邮箱 18 | /// 收件人信箱 19 | /// 信件主题 20 | /// 信件内容 21 | /// 信件内容是否是Html 22 | /// 是否高优先级 23 | /// SMTP登录用户名 24 | /// SMTP登录密码 25 | public static async Task SendMailAsync(String mailServer, String mailFrom, String mailTo, String mailSubject, String mailBody, Boolean isBodyHtml, Boolean isHighPriority, String userName, String userPass) 26 | { 27 | using (MailMessage message = new MailMessage(mailFrom, mailTo, mailSubject, mailBody)) 28 | { 29 | message.IsBodyHtml = isBodyHtml; 30 | message.Priority = (isHighPriority ? MailPriority.High : MailPriority.Normal); 31 | 32 | SmtpClient client = new SmtpClient(mailServer); 33 | client.Credentials = new NetworkCredential(userName, userPass); 34 | await client.SendMailAsync(message); 35 | } 36 | } 37 | } 38 | } -------------------------------------------------------------------------------- /website/SDNUOJ/Areas/Admin/Views/Problem/DataCreate.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewBag.__Title = "题目数据创建"; 3 | ViewBag.__Type = "problemdata"; 4 | } 5 | 6 | @using (Html.BeginForm("DataCreate", "Problem", FormMethod.Post, new { @id = "form-createproblemdata", @enctype = "multipart/form-data" })) 7 | { 8 | @Html.AntiForgeryToken() 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 22 | 23 | 24 |
题目数据创建说明
18 | 1. 您可以在本页创建题目的数据,若题目数据较大,建议在本地创建完成后上传题目数据包。
19 | 2. 如果题目之前存在数据包,则操作后会自动替换之前的数据包,请谨慎操作。
20 | 3. 如果通过上传数据文件创建题目数据包,请保证输入文件扩展名为.in,输出文件扩展名为.out或.ans。 21 |
25 |
26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 43 | 44 | 45 |
题目数据创建 | 添加测试数据
题目ID
41 | 42 |
46 | } -------------------------------------------------------------------------------- /oldJudger/src/TaskFetcher/TestFetcher.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading; 6 | 7 | using JudgeClient.Definition; 8 | 9 | namespace JudgeClient.Fetcher 10 | { 11 | public class TestFetcher : IFetcher 12 | { 13 | private TestDataAccessor data_accessor = new TestDataAccessor(); 14 | public IDataAccessor DataAccessor 15 | { 16 | get { return data_accessor; } 17 | } 18 | 19 | public bool FetchData(string ProblemId) 20 | { 21 | Thread.Sleep(1000); 22 | return true; 23 | } 24 | 25 | public void ConfigureSupportedLanguages(IEnumerable Judgers) 26 | { 27 | } 28 | 29 | public List FetchTask() 30 | { 31 | var res = new List(); 32 | for (int i = 0; i < 5; ++i) 33 | res.Add(new Task() 34 | { 35 | Fetcher = this, 36 | Id = 3434, 37 | LanguageAndSpecial = "g++[]", 38 | MemoryLimit = 65536, 39 | TimeLimit = 1000, 40 | Problem = new Problem() { Id = "1000" }, 41 | SourceCode = "#include\nusing namespace std;\n\nint main()\n{\nint a, b;\ncin>>a>>b;\ncout< 9 | 10 | 11 | 数据库上传说明 12 | 13 | 14 | 15 | 16 | 17 | 1. 您可以在本页上传扩展名为.resx的数据库文件,如果扩展名无效,请手动修改为此扩展名。
18 | 2. 数据库上传后将以“年_月_日_时_分_秒.resx”的形式重新命名。 19 | 20 | 21 | 22 | 23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 42 | 43 | 44 |
数据库上传
*文件路径
39 | 40 | 41 |
45 | } -------------------------------------------------------------------------------- /judger/src/Judger.Models/JudgeTask.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Judger.Models 6 | { 7 | public class JudgeTask 8 | { 9 | /// 10 | /// 提交ID 11 | /// 12 | public int SubmitID { get; set; } 13 | 14 | /// 15 | /// 题目ID 16 | /// 17 | public int ProblemID { get; set; } 18 | 19 | /// 20 | /// 测试数据版本号 21 | /// 22 | public string DataVersion { get; set; } 23 | 24 | /// 25 | /// 提交者 26 | /// 27 | public string Author { get; set; } = ""; 28 | 29 | 30 | /// 31 | /// 提交语言 32 | /// 33 | public string Language { get; set; } 34 | 35 | /// 36 | /// 时间限制 37 | /// 38 | public int TimeLimit { get; set; } = 1000; 39 | 40 | /// 41 | /// 内存限制 42 | /// 43 | public int MemoryLimit { get; set; } = 262144; 44 | 45 | /// 46 | /// 是否为SpecialJudge 47 | /// 48 | public bool SpecialJudge { get; set; } = false; 49 | 50 | /// 51 | /// 源代码 52 | /// 53 | public string SourceCode { get; set; } = ""; 54 | 55 | /// 56 | /// 编程语言配置信息 57 | /// 58 | public LanguageConfiguration LangConfig { get; set; } 59 | 60 | /// 61 | /// 判题所用临时目录 62 | /// 63 | public string TempJudgeDirectory { get; set; } 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /website/SDNUOJ.Controllers/Admin/JudgerController.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Web.Mvc; 4 | 5 | using SDNUOJ.Controllers.Core; 6 | using SDNUOJ.Entity; 7 | 8 | namespace SDNUOJ.Areas.Admin.Controllers 9 | { 10 | [Authorize(Roles = "SuperAdministrator")] 11 | public class JudgerController : AdminBaseController 12 | { 13 | /// 14 | /// 评测机管理页面 15 | /// 16 | /// 操作后的结果 17 | public ActionResult List() 18 | { 19 | return ResultToView(JudgeServerManager.AdminGetJudgers); 20 | } 21 | 22 | /// 23 | /// 评测机添加页面 24 | /// 25 | /// 操作后的结果 26 | public ActionResult Add() 27 | { 28 | return View(); 29 | } 30 | 31 | /// 32 | /// 评测机添加 33 | /// 34 | /// Form集合 35 | /// 操作后的结果 36 | [HttpPost] 37 | [ValidateAntiForgeryToken] 38 | public ActionResult Add(FormCollection form) 39 | { 40 | return ResultToMessagePage(JudgeServerManager.AdminCreateJudgeAccount, form["username"], "Your have created judger successfully!"); 41 | } 42 | 43 | /// 44 | /// 评测机删除 45 | /// 46 | /// 评测机用户名 47 | /// 操作后的结果 48 | public ActionResult Delete(String id) 49 | { 50 | return ResultToJson(JudgeServerManager.AdminDeleteJudgeAccount, id); 51 | } 52 | } 53 | } -------------------------------------------------------------------------------- /judger/src/MainUnitTest/JudgerTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using Xunit; 5 | using Judger.Judger; 6 | 7 | namespace MainUnitTest 8 | { 9 | public class JudgerTest 10 | { 11 | [Fact] 12 | public void TestSingleJudgerCompare() 13 | { 14 | SingleJudger judger = new SingleJudger(""); 15 | 16 | string test1 = @"123123"; 17 | string test2 = @"123123"; 18 | Assert.True(judger.CompareAnswer(test1, test2) == SingleJudger.CompareResult.Accepted); 19 | 20 | test1 = "123\r\n123"; 21 | test2 = "123\n123"; 22 | Assert.True(judger.CompareAnswer(test1, test2) == SingleJudger.CompareResult.Accepted); 23 | 24 | test1 = "123\r\n123\r\n"; 25 | test2 = "123\n123"; 26 | Assert.True(judger.CompareAnswer(test1, test2) == SingleJudger.CompareResult.Accepted); 27 | 28 | test1 = "123\r\n123\r\n"; 29 | test2 = "123 \n123"; 30 | Assert.True(judger.CompareAnswer(test1, test2) == SingleJudger.CompareResult.PresentationError); 31 | 32 | test1 = "123123\n\n\r\n"; 33 | test2 = "123123"; 34 | Assert.True(judger.CompareAnswer(test1, test2) == SingleJudger.CompareResult.Accepted); 35 | 36 | test1 = "123\n123\n\n\r\n"; 37 | test2 = "\r\r\n\r\n 123\n123"; 38 | Assert.True(judger.CompareAnswer(test1, test2) == SingleJudger.CompareResult.PresentationError); 39 | 40 | test1 = "123\n123\n"; 41 | test2 = "1232\n123\n"; 42 | Assert.True(judger.CompareAnswer(test1, test2) == SingleJudger.CompareResult.WrongAnswer); 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /website/SDNUOJ/Areas/Contest/Views/Forum/New.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | var Contest = ViewData["Contest"] as SDNUOJ.Entity.ContestEntity; 3 | 4 | ViewBag.__Title = "Contest New Topic"; 5 | ViewBag.__ContestPageTitle = "New Topic"; 6 | } 7 | 8 | @using (Html.BeginForm("New", "Forum", new { area = "Contest", cid = Contest.ContestID }, FormMethod.Post, new { @class = "form-horizontal", @data_verify = "true" })) 9 | { 10 | @Html.AntiForgeryToken() 11 |
12 |
13 |
14 | 15 |
16 | 17 |
18 |
19 |
20 | 21 |
22 | 23 |
24 |
25 |
26 |
27 |
28 | 29 | 30 |
31 |
32 |
33 | } -------------------------------------------------------------------------------- /website/SDNUOJ/Areas/Admin/Views/User/Online.cshtml: -------------------------------------------------------------------------------- 1 | @model List 2 | 3 | @{ 4 | ViewBag.__Title = "在线用户管理"; 5 | } 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 19 | 20 | 21 |
在线用户管理说明
16 | 1. 您可以在本页查看在线的用户列表,信息根据用户未读邮件缓存获取,最大误差为 5分钟。
17 | 2. 请确保系统内容缓存以及系统邮件已经开启,否则系统不会记录用户在线情况。 18 |
22 |
23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | @foreach (var Item in Model) 36 | { 37 | 38 | 39 | 40 | 41 | 42 | } 43 | @if (Model.Count == 0) 44 | { 45 | 46 | 47 | 48 | } 49 | 50 | 51 | 52 | 55 | 56 | 57 |
在线用户管理
用户名信息
@Html.ActionLink(Item, "Info", "User", new { area = "", id = Item }, new { @target = "_blank" })@Html.ActionLink("查看", "Detail", "User", new { id = Item }, null)
没有在线的用户
53 | 共 @Model.Count 个在线用户 54 |
--------------------------------------------------------------------------------