public void OpenUrl(WebType type) { //if (UIWeb.Show(type, RestartAllSound)) { // StopAllSound(); //} UIWeb.Show(type); }
public void SetMsg(WebType webType, string url, Action <bool, UnityWebRequest> fun, WWWForm wwwForm = null) { this.webType = webType; this.url = url; this.fun = fun; this.wwwForm = wwwForm; }
/// <summary> /// 添加分类 /// </summary> /// <param name="id"></param> /// <param name="tid"></param> /// <returns></returns> public ActionResult AdminCategoryAdd(int id = 0, int tid = 0) { ViewBag.CateId = id; ViewBag.CateName = string.Empty; ViewBag.TypeName = string.Empty; ViewBag.Tid = tid; var typeid = tid; if (id > 0) { var currentcategory = MyService.GetCategoryById(id); ViewBag.CateName = currentcategory.CateName; typeid = currentcategory.Type; } ViewBag.TypeId = typeid; ViewData["Type"] = new SelectList(WebType.GetTypeList().Where(x => x.IsCustomView), "TypeId", "TypeName", typeid); if (typeid > 0) { ViewBag.TypeName = WebType.GetTypeList().Single(x => x.TypeId == typeid).TypeName; } var list = MyService.GetFCategoryList("", "", " -- ").Where(m => m.Type == typeid).Where(m => !("," + MyService.GetCategoryIds(typeid) + ",").Contains("," + m.CateId + ",")).ToList(); list.Add(new CategoryModel { CateId = 0, ViewName = "Root" }); ViewData["ParentId"] = new SelectList(list, "CateId", "ViewName", id); var category = new CategoryModel { ParentId = id, ListNum = 10 }; return(View(category)); }
void onWebContextReadyListener(object obj, Callback cb) { Debug2.Log("im here from callback"); string pageName = (string)obj; initData = ""; if (pageName.StartsWith("mru")) { webType = WebType.MAIL_RU; initData = mailRuKey; } else if (pageName.StartsWith("vk")) { webType = WebType.VK; initData = vkKey; } else if (pageName.StartsWith("fb")) { webType = WebType.FB; } else if (pageName.StartsWith("online")) { webType = WebType.ONLINE; } else { Debug2.LogError("unknown page"); } ready = true; activeStrategy = supportedWeb[webType]; activeStrategy.onStart(initData); }
public static void LogTxt(WebType webType, LogLevel level, string content) { string classname = GetClassName(); switch (level) { case LogLevel.Debug: WriteLog(webType, content); break; //Debug case LogLevel.Error: WriteLog(webType, content); break; //Error case LogLevel.Fatal: WriteLog(webType, content); break; //Fatal case LogLevel.Info: WriteLog(webType, content); break; //Info case LogLevel.Warn: WriteLog(webType, content); break; //Warn default: break; } }
public static bool Show(WebType type, Action closeCallback = null) { string url = null; switch (type) { case WebType.中行: url = "http://www.boc.cn/"; break; case WebType.专家连线: url = "https://cc.egoonet.com:8080/zhweb/index.html"; break; } var value = false; #if OPEN_WEB if (!string.IsNullOrEmpty(url)) { var uiWeb = Create(); uiWeb._closeCallback = closeCallback; uiWeb._Open(url); value = true; } #else value = true; System.Diagnostics.Process.Start("chrome.exe", "--kiosk " + url); System.Diagnostics.Process.Start(GetRootPath() + "/chrome_close.exe"); #endif return(value); }
public RemoteBundleCacheItem(string localPath, WebType webType) : base(localPath) { _www = _CreateWWW(webType); if (null != _www) { _stage = ProgressStage.Loading; } }
private double GetDistance(Point winner, Point looser, WebType type) { if (type == WebType.square) { return(Math.Abs(winner.X - looser.X) + Math.Abs(winner.Y - looser.Y)); } else { return(Math.Sqrt(Math.Pow(winner.X - looser.X, 2) + Math.Pow(winner.Y - looser.Y, 2))); } }
private static int GetLastIndex(WebType webtype) { string lastindex = ""; int value = 0; int r = IniFile._IniFile.ProfileIniRead(webtype.ToString(), "LastIndex", out lastindex); if (string.IsNullOrEmpty(lastindex.Trim())) { lastindex = "0"; } int.TryParse(lastindex, out value); return(value); }
public CWebManager(WebType type) : base(type) { _startURL = @"http://www.naver.com"; System.Diagnostics.Debug.WriteLine("CWebActor with WebType"); System.Diagnostics.Debug.WriteLine("Task Terminate:{0}", exit_flag); //Declare of Background Worker worker = new BackgroundWorker(); worker.WorkerReportsProgress = true; worker.WorkerSupportsCancellation = true; worker.DoWork += new DoWorkEventHandler(worker_DoWork); worker.ProgressChanged += new ProgressChangedEventHandler(worker_ProgressChanged); worker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(worker_RunWorkerCompleted); _workComplete = false; }
/// <summary> /// 编辑分类 /// </summary> /// <param name="id"></param> /// <param name="tab"></param> /// <returns></returns> public ActionResult AdminCategoryEdit(int id, int?tab) { var category = MyService.GetCategoryById(id); ViewBag.TypeId = category.Type; ViewBag.TypeName = WebType.GetTypeList().Single(x => x.TypeId == category.Type).TypeName; ViewData["Type"] = new SelectList(WebType.GetTypeList(), "TypeId", "TypeName", category.Type); var list = MyService.GetFCategoryList("", "", " -- ").Where(m => m.Type == category.Type).Where(m => !("," + MyService.GetCategoryIds(category.CateId) + ",").Contains("," + m.CateId + ",")).ToList(); list.Add(new CategoryModel { CateId = 0, ViewName = "Root" }); ViewData["ParentId"] = new SelectList(list, "CateId", "ViewName", category.ParentId); ViewBag.Tab = tab ?? 1; return(View(category)); }
/// <summary> /// 获取需要防御流量攻击的【Action】 /// </summary> public static AppStartup InitLimitAttack(this AppStartup startup, WebType webType, Assembly assembly) { var limitAttackModelList = new List <DefendAttackModel>(); if (webType == WebType.Mvc) { limitAttackModelList = DefendAttack_Mvc.GetLimitAttackModel(assembly); } else if (webType == WebType.WebApi) { limitAttackModelList = DefendAttack_WebApi.GetLimitAttackModel(assembly); } DefendAttackContainer.InitDefendAttackList(limitAttackModelList, assembly.GetName().Name); return(startup); }
//Constructor public CSeleniumBase(WebType type) { System.Diagnostics.Debug.WriteLine("CSeleniumBase with WebType"); _webType = type; //this.initSelenium(type); _keyList = KeyList.Instance; _myUtility = CUtility.Instance; string currTC = _keyList.k_testcase; string currNo = _keyList.k_testcase_no; _columnInfoDic = new Dictionary <string, string>(); //TOAN : 06/06/2019. set selenium retrycounter retryCounter = 3; _testTerminate = false; }
protected WWW _CreateWWW(WebType webType) { if (webType == WebType.LoadFromCacheOrDownload) { int version = 0; if (os.isEditor) { _GetFileVersion(ref version); } var www1 = WWW.LoadFromCacheOrDownload(url, version); return(www1); } var www2 = new WWW(url); return(www2); }
public CDocManager(WebType type) : base(type) { _keyList = KeyList.Instance; _myUtility = CUtility.Instance; //System.Diagnostics.Debug.WriteLine("key:{0}, value:{1}",currObj.Key,currObj.Value); System.Diagnostics.Debug.WriteLine("Default Constructor for CDocMaker"); // this.initSelenium(); _exit_flag = false; worker = new BackgroundWorker(); worker.WorkerReportsProgress = true; worker.WorkerSupportsCancellation = true; worker.DoWork += new DoWorkEventHandler(worker_DoWork); worker.ProgressChanged += new ProgressChangedEventHandler(worker_ProgressChanged); worker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(worker_RunWorkerCompleted); }
public static void WriteLog(WebType webType, string content) { DateTime dt = DateTime.Now; string filename = dt.Year.ToString() + dt.Month.ToString().PadLeft(2, '0') + dt.Day.ToString().PadLeft(2, '0') + dt.Hour.ToString().PadLeft(2, '0') + ".txt"; string path = AppPath; string fullpath = path + "log\\" + webType.ToString() + "\\" + filename; try { StreamWriter sw = new StreamWriter(fullpath, true, Encoding.Default); sw.Write(dt.ToString() + " | " + content + Environment.NewLine); sw.Close(); sw.Dispose(); } catch (Exception ex) { ex.ToString(); } }
public void Send(WebType webType, string url, Action <bool, UnityWebRequest> fun, WWWForm wwwForm = null) { WebRequestData data = ObjectPool <WebRequestData> .S.Allocate(); data.SetMsg(webType, url, fun, wwwForm); switch (data.webType) { case WebType.Get: getRequestList.AddLast(data); if (getWebCurrentData == null) { StartGetIEnumerator(); } break; case WebType.Post: postRequestList.AddLast(data); StartPostIEnumerator(); break; } }
public CDownLoadManager(WebType type) : base(type) { System.Diagnostics.Debug.WriteLine("Constructor with WebTyp e"); _webType = type; //_keyList = KeyList.Instance; //_myUtility = CUtility.Instance; //_testURL = "http://cocoknight.dothome.co.kr/frmLogin.php"; _testURL = @"http://www.codeapril.com/frmLogin.php"; //_saveURL = "http://www.codeapril.com/filedownloader.php"; _sUserName = "******"; _sPassWordName = "pw.1234"; _targetExist = false; _timerComplete = false; _exit_flag = false; _task_exit_flag = false; //File Download Path //TOAN : 02/10/2019. download완료 후, 삭제하기 위함. _downloadPath = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile) + "\\Downloads"; //downloadFileName = "Sample_Movie.mp4"; _downloadFileName = "sea_original.mp4"; _targetFilePath = _downloadPath + _combineOperand + _downloadFileName; //TOAN : 01/28/2019. Test Limitation을 임의로 10회로 지정. _testCounter = 0; _testLimitation = 20; // _finishTime = 20; worker = new BackgroundWorker(); worker.WorkerReportsProgress = true; worker.WorkerSupportsCancellation = true; worker.DoWork += new DoWorkEventHandler(worker_DoWork); worker.ProgressChanged += new ProgressChangedEventHandler(worker_ProgressChanged); worker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(worker_RunWorkerCompleted); }
// public CWebActor(WebType type):base(type) public CYoutubeManager(WebType type) : base(type) { System.Diagnostics.Debug.WriteLine("Constructor with WebType"); _webType = type; _targetExist = false; _isVideoEnd = false; _isFinishTimerElapsed = false; _isSkipAdvertisement = false; //this.initSelenium(type); _testRegion = "ALL"; _keyList = KeyList.Instance; _myUtility = CUtility.Instance; _exit_flag = false; _finishTime = 120; //2분. 실제 Release할 때는 혹시 모르니 30분으로 걸어놓는다. worker = new BackgroundWorker(); worker.WorkerReportsProgress = true; worker.WorkerSupportsCancellation = true; worker.DoWork += new DoWorkEventHandler(worker_DoWork); worker.ProgressChanged += new ProgressChangedEventHandler(worker_ProgressChanged); worker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(worker_RunWorkerCompleted); }
/// <summary> /// 添加HttpReports中间件 /// </summary> /// <param name="services">The services.</param> /// <param name="configuration">The configuration.</param> /// <param name="webType">Type of the web.</param> /// <param name="dbType">Type of the database.</param> /// <param name="Node">The node.</param> /// <returns></returns> public static IServiceCollection AddHttpReportsMiddleware(this IServiceCollection services, IConfiguration configuration, WebType webType, DBType dbType, string Node = "Default") { Action <HttpReportsOptions> options = (op) => { op.DBType = dbType; op.WebType = webType; op.Node = string.IsNullOrEmpty(Node) ? "Default":Node; }; services.AddOptions(); services.Configure(options); HttpReportsMiddleware.Configuration = configuration; return(services.AddTransient <IHttpReports, DefaultHttpReports>()); }
public static void Fatal(WebType webType, string msg) { LogTxt(webType, LogLevel.Fatal, msg); }
public static void Error(WebType webType, string msg) { LogTxt(webType, LogLevel.Error, msg); }
public static void Warn(WebType webType, string msg) { LogTxt(webType, LogLevel.Warn, msg); }
public static void Info(WebType webType, string msg) { LogTxt(webType, LogLevel.Info, msg); }
public static void Debug(WebType webType, string msg) { string className = MethodBase.GetCurrentMethod().ReflectedType.Name; LogTxt(webType, LogLevel.Debug, GetClassName() + msg); }
public static int SetLastIndex(WebType webtype, int lastindex) { int r = IniFile._IniFile.ProfileIniWrite(webtype.ToString(), "LastIndex", lastindex.ToString()); return(r); }
public static int SetMotifyType(WebType webtype, int modifyTypeID) { int r = IniFile._IniFile.ProfileIniWrite(webtype.ToString(), "ModifyType", modifyTypeID.ToString()); return(r); }
public static void EasyConfigureServices(IServiceCollection services, WebType webType, Action <CookieAuthenticationOptions> cookieOptionsAction = null, params Type[] filters) { if (webType == WebType.Mvc) { if (cookieOptionsAction == null) { throw new Exception("请先设置Cookie选项!"); } services.AddControllersWithViews().AddRazorRuntimeCompilation(); services.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme).AddCookie(cookieOptionsAction); } else if (webType == WebType.WebApi) { services.AddControllers(); } var mvcBuilder = services.AddMvc(options => { options.Filters.Add <GlobalExceptionFilter>(); options.Filters.Add <ModelValidatorFilter>(); if (webType == WebType.Mvc) { options.Filters.Add <IPMvcFilter>(); } else if (webType == WebType.WebApi) { options.Filters.Add <IPWebApiFilter>(); } if (filters?.Length > 0) { foreach (var filter in filters) { options.Filters.Add(filter); } } }) .AddNewtonsoftJson(options => { options.SerializerSettings.ContractResolver = new DefaultContractResolver(); options.SerializerSettings.DateTimeZoneHandling = DateTimeZoneHandling.Local; options.SerializerSettings.DateFormatString = "yyyy-MM-dd HH:mm:ss"; }) .AddControllersAsServices();//注册Controllers到IOC mvcBuilder.SetCompatibilityVersion(CompatibilityVersion.Version_3_0); //模型验证 mvcBuilder.AddFluentValidation(x => { //如果设置为false,那么FluentValidation是唯一执行的验证库 x.RunDefaultMvcValidationAfterFluentValidationExecutes = true; //自动注册 var typeInCurrAppDomain = Assembly.GetEntryAssembly().GetTypes().First(); x.RegisterValidatorsFromAssemblyContaining(typeInCurrAppDomain, lifetime: ServiceLifetime.Singleton); }); //注册压缩组件 services.AddResponseCompression(options => { options.Providers.Add <BrotliCompressionProvider>(); options.Providers.Add <GzipCompressionProvider>(); options.MimeTypes = ResponseCompressionDefaults.MimeTypes.Concat(new[] { "image/svg+xml" }); }); services.Configure <BrotliCompressionProviderOptions>(options => options.Level = CompressionLevel.Fastest); services.Configure <GzipCompressionProviderOptions>(options => options.Level = CompressionLevel.Fastest); }
public static void EasyConfigureContainer(ContainerBuilder builder, IConfiguration configuration, WebType webType, Assembly assembly) { string nlogFilePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "App_Config/nlog.config"); new AppStartup() .UseNLog(nlogFilePath) .InitMachineConfig() .InitLimitAttack(webType, assembly) .InitMEF() .RegConfig(configuration, builder) .RegRedisCache(builder) .RegExtraIoC(builder); }
public void initSelenium(WebType mode) { try { //case1 string driverPath = System.Reflection.Assembly.GetExecutingAssembly().CodeBase; //System.Diagnostics.Debug.WriteLine(string.Format("execution path: {0}", driverPath)); //IWebDriver driver = new ChromeDriver(driverPath); //case2 //string cPath = System.Reflection.Assembly.GetExecutingAssembly().Location; //executable path //string appPath = Path.GetDirectoryName(Application.ExecutablePath); //executable directory path //System.Diagnostics.Debug.WriteLine(string.Format("execution path: {0}", appPath)); //_driver = new OpenQA.Selenium.Chrome.ChromeDriver(); //case3 string appPath = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location); System.Diagnostics.Debug.WriteLine(string.Format("execution path: {0}", appPath)); //TOAN :06/25/2019. add option var options = new ChromeOptions(); options.AddAdditionalCapability("useAutomationExtension", false); options.AddArguments("--ignore-certificate-errors"); options.AddArguments("--ignore-ssl-errors"); //TOAN : 06/25/2019. increate timespan 1->2 minute //If we don't put value. Default value is 1 minute _driver = new OpenQA.Selenium.Chrome.ChromeDriver(appPath, options, TimeSpan.FromMinutes(2)); //_driver = new OpenQA.Selenium.Chrome.ChromeDriver() //_driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(100/*50*/); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(string.Format("Full Stacktrace: {0}", ex.ToString())); } finally { System.Diagnostics.Debug.WriteLine(string.Format("Finally Block Running")); } // switch (mode) // { // case WebType.WEB_Chrome: // { // //TOAN : 03/08/2019. // //var options = new ChromeOptions(); // //options.AddAdditionalCapability("useAutomationExtension", false); // //options.AddArguments("--ignore-certificate-errors"); // //options.AddArguments("--ignore-ssl-errors"); // ////TOAN : 03/16/2019. Chrome ignore save password pop-up // //options.AddUserProfilePreference("credentials_enable_service", false); // //options.AddUserProfilePreference("profile.password_manager_enabled", false); // //TOAN : 03/20/2019. Web Driver timeout after 60 seconds // //options.AddArgument("no-sandbox"); // //TOAN : 03/19/2019. driver생성 시 timespan추가해서 진행 // //_driver = new ChromeDriver(options); // _driver = new ChromeDriver(); // //TimeSpan이 포함된 생성자를 호출해야 한다. // //ChromeDriverService service = ChromeDriverService.CreateDefaultService(); // //service.SuppressInitialDiagnosticInformation = true; // //_driver = new ChromeDriver(service, options, TimeSpan.FromMinutes(3)); // //TOAN : 03/18/2019. applied to wait all sesseion with implicit waite. increase wait(300->500) // _driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(100); // //_driver = new ChromeDriver(); // break; // } // case WebType.WEB_FireFox: // { // _driver = new FirefoxDriver(); // break; // } // case WebType.WEB_IE: // { // _driver = new InternetExplorerDriver(); // _driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(500); // break; // } // case WebType.WEB_EDGE: // { // _driver = new EdgeDriver(); // break; // } // default: // break; //} }