Ejemplo n.º 1
0
        public object Clone()
        {
            JudgeContext context = MemberwiseClone() as JudgeContext;

            context.Task       = Task.Clone() as JudgeTask;
            context.LangConfig = LangConfig.Clone() as ILangConfig;
            context.Result     = Result.Clone() as JudgeResult;

            return(context);
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            SetupLogger();
            LangConfig config = new LangConfig()
            {
                NemskaGrupa = false,
                Link        = "https://classroom.google.com/u/1/c/MjEwMzIwNDY5MjYz",
            };

            config.Driver.Browser      = "firefox";
            config.Driver.DriverFolder = "/home/lyubenk/.webdrivers/";
            CancellationTokenSource source = new();

            using (Classroom cr = new Classroom(config, source.Token))
            {
                using (Meet meet = cr.InitMeetInstance(source.Token))
                {
                    try
                    {
                        Task crTask   = cr.Start();
                        Task meetTask = meet.Start();
                        Console.ReadLine();
                        source.Cancel();
                        Task.WaitAll(crTask, meetTask);
                    }
                    catch (AggregateException agex)
                    {
                        foreach (Exception ex in agex.InnerExceptions)
                        {
                            if (ex is TaskCanceledException)
                            {
                                logger.Debug("Successful cancel");
                            }
                            else
                            {
                                logger.Error(ex);
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        logger.Error(ex);
                    }
                }
            }
        }
Ejemplo n.º 3
0
        public virtual IActionResult Index([FromRoute] string id, [FromQuery] LangConfig conf)
        {
            if (!Request.IsHttps && RestrictHttps)
            {
                string url = (HttpsUrl ?? "https://" + Request.Host) + Request.Path;
                return(Redirect(url));
            }

            string dom        = RequestedDomain;
            bool   isDevBuild = JsEnvironment == "dev";

            TenantInfoItem info = null;

            if (Tenants.TryGetValue(dom, out TenantInfoItem item))
            {
                info = item;
            }

            string version = Shell.ProjectAssembly.GetVersionString();

            if (item != null && item.Version != null)
            {
                version = item.Version;
            }

            string loc = conf?.lang == null?Request.GetLocaleFromCookie() : conf.lang;

            string package = isDevBuild ? "dev" : "v" + version;
            string path    = Path.Combine(Shell.AppRootPath, Shell.PublicRoot, "dist", package);
            string search  = isDevBuild ? "dev*.js" : dom + "-" + package + "*.js";

            Utils.CreateFolderForFile(path + "\\n.x");
            string[] files = Directory.GetFiles(path, search);

            var mod = new IndexModel
            {
                Title     = GetDefaultTitle(loc),
                Config    = ServerConfig,
                PackageId = package
            };

            mod.Config.Locale  = loc;
            mod.Config.Env     = JsEnvironment;
            mod.Config.Version = version;
            var urls = Shell.GetConfigAs <Dictionary <string, string> >("Services", false);

            if (urls != null)
            {
                mod.Config.Urls = new Dictionary <string, string>();
                foreach (var s in urls)
                {
                    mod.Config.Urls[s.Key] = WebUtils.FillConfigUrlParams(s.Value, Request);
                }
            }


            if (EmptyUrlHandler != null && Request.PathIsEmpty())
            {
                return(EmptyUrlHandler.Invoke(mod));
            }

            mod.Config.Domain  = dom;
            mod.Config.BaseURL = dom == DefaultDomain ? "/" : "/" + dom;
            mod.Config.Hash    = isDevBuild ? "" : "~7d078181";
            mod.Chunks         = files.Select(d => d.GetAfterLast("\\")).ToArray();

            return(IndexPage(mod));
        }
Ejemplo n.º 4
0
 /// <summary>
 /// 构造函数
 /// </summary>
 public ConfigManager()
 {
     m_langConfig = new LangConfig();
     m_loadList   = new Dictionary <string, Action <string> >();
 }