internal int GetByteSize() { long size; byte head = TypeCode; int valueLength = ValueLengthUtil.Get(head); if (valueLength != 0) { size = valueLength; } else { switch (Type) { case SliceType.Array: case SliceType.Object: if (head == 0x13 || head == 0x14) { // compact Array or Object size = NumberUtil.ReadVariableValueLength(vpack, start + 1, false); } else /* if (head <= 0x14) */ { size = NumberUtil.ToLong(vpack, start + 1, ObjectArrayUtil.GetOffsetSize(head)); } break; case SliceType.String: // long UTF-8 String size = GetLongStringLength() + 1 + 8; break; case SliceType.Binary: size = 1 + head - ((byte)0xbf) + GetBinaryLengthUnchecked(); break; case SliceType.Bcd: if (head <= 0xcf) { size = 1 + head + ((byte)0xc7) + NumberUtil.ToLong(vpack, start + 1, head - ((byte)0xc7)); } else { size = 1 + head - ((byte)0xcf) + NumberUtil.ToLong(vpack, start + 1, head - ((byte)0xcf)); } break; case SliceType.Custom: if (head == 0xf4 || head == 0xf5 || head == 0xf6) { size = 2 + NumberUtil.ToLong(vpack, start + 1, 1); } else if (head == 0xf7 || head == 0xf8 || head == 0xf9) { size = 3 + NumberUtil.ToLong(vpack, start + 1, 2); } else if (head == 0xfa || head == 0xfb || head == 0xfc) { size = 5 + NumberUtil.ToLong(vpack, start + 1, 4); } else /* if (head == 0xfd || head == 0xfe || head == 0xff) */ { size = 9 + NumberUtil.ToLong(vpack, start + 1, 8); } break; default: // TODO throw new Exception("Internal error"); } } return((int)size); }
public override short readxml(GXXMLReader oReader, String sName) { short GXSoapError = 1; sTagName = oReader.Name; if (oReader.IsSimple == 0) { GXSoapError = oReader.Read(); nOutParmCount = 0; while (((StringUtil.StrCmp(oReader.Name, sTagName) != 0) || (oReader.NodeType == 1)) && (GXSoapError > 0)) { readOk = 0; if (StringUtil.StrCmp2(oReader.LocalName, "SdtResultadoPanamax")) { gxTv_SdtSdtResultadoPortaContenedores_Sdtresultadopanamax = NumberUtil.Val(oReader.Value, "."); if (GXSoapError > 0) { readOk = 1; } GXSoapError = oReader.Read(); } if (StringUtil.StrCmp2(oReader.LocalName, "SdtResultadoNeoPanamax")) { gxTv_SdtSdtResultadoPortaContenedores_Sdtresultadoneopanamax = NumberUtil.Val(oReader.Value, "."); if (GXSoapError > 0) { readOk = 1; } GXSoapError = oReader.Read(); } if (StringUtil.StrCmp2(oReader.LocalName, "SdtResultadoPanamaxC3")) { gxTv_SdtSdtResultadoPortaContenedores_Sdtresultadopanamaxc3 = NumberUtil.Val(oReader.Value, "."); if (GXSoapError > 0) { readOk = 1; } GXSoapError = oReader.Read(); } if (StringUtil.StrCmp2(oReader.LocalName, "SdtResultadoNeoPanamaxC3")) { gxTv_SdtSdtResultadoPortaContenedores_Sdtresultadoneopanamaxc3 = NumberUtil.Val(oReader.Value, "."); if (GXSoapError > 0) { readOk = 1; } GXSoapError = oReader.Read(); } if (StringUtil.StrCmp2(oReader.LocalName, "SdtResultadoPanamaxC2")) { gxTv_SdtSdtResultadoPortaContenedores_Sdtresultadopanamaxc2 = NumberUtil.Val(oReader.Value, "."); if (GXSoapError > 0) { readOk = 1; } GXSoapError = oReader.Read(); } if (StringUtil.StrCmp2(oReader.LocalName, "SdtResultadoNeoPanamaxC2")) { gxTv_SdtSdtResultadoPortaContenedores_Sdtresultadoneopanamaxc2 = NumberUtil.Val(oReader.Value, "."); if (GXSoapError > 0) { readOk = 1; } GXSoapError = oReader.Read(); } if (StringUtil.StrCmp2(oReader.LocalName, "SdtResultadoPanamaxC1")) { gxTv_SdtSdtResultadoPortaContenedores_Sdtresultadopanamaxc1 = NumberUtil.Val(oReader.Value, "."); if (GXSoapError > 0) { readOk = 1; } GXSoapError = oReader.Read(); } if (StringUtil.StrCmp2(oReader.LocalName, "SdtResultadoNeoPanamaxC1")) { gxTv_SdtSdtResultadoPortaContenedores_Sdtresultadoneopanamaxc1 = NumberUtil.Val(oReader.Value, "."); if (GXSoapError > 0) { readOk = 1; } GXSoapError = oReader.Read(); } nOutParmCount = (short)(nOutParmCount + 1); if (readOk == 0) { context.sSOAPErrMsg = context.sSOAPErrMsg + "Error reading " + sTagName + StringUtil.NewLine( ); context.sSOAPErrMsg = context.sSOAPErrMsg + "Message: " + oReader.ReadRawXML(); GXSoapError = (short)(nOutParmCount * -1); } } } return(GXSoapError); }
public string GetTotalAsString(Booking booking) { return(NumberUtil.FormatMoney(GetTotal(booking))); }
static public String read_section(IGxContext context, GXXMLReader oReader, GxLocation oLocation) { String sSection; sSection = ""; if (oReader.NodeType == 1) { sSection = oReader.Name; oReader.Read(); while (!((StringUtil.StrCmp(oReader.Name, sSection) == 0) && (oReader.NodeType == 2))) { if (StringUtil.StrCmp(StringUtil.Lower(oReader.Name), "host") == 0) { oLocation.Host = oReader.Value; } else if (StringUtil.StrCmp(StringUtil.Lower(oReader.Name), "port") == 0) { oLocation.Port = (int)(NumberUtil.Val(oReader.Value, ".")); } else if (StringUtil.StrCmp(StringUtil.Lower(oReader.Name), "baseurl") == 0) { oLocation.BaseUrl = oReader.Value; } else if (StringUtil.StrCmp(StringUtil.Lower(oReader.Name), "resourcename") == 0) { oLocation.ResourceName = oReader.Value; } else if (StringUtil.StrCmp(StringUtil.Lower(oReader.Name), "secure") == 0) { oLocation.Secure = (short)(NumberUtil.Val(oReader.Value, ".")); } else if (StringUtil.StrCmp(StringUtil.Lower(oReader.Name), "proxyserverhost") == 0) { oLocation.ProxyServerHost = oReader.Value; } else if (StringUtil.StrCmp(StringUtil.Lower(oReader.Name), "proxyserverport") == 0) { oLocation.ProxyServerPort = (int)(NumberUtil.Val(oReader.Value, ".")); } else if (StringUtil.StrCmp(StringUtil.Lower(oReader.Name), "timeout") == 0) { oLocation.Timeout = (short)(NumberUtil.Val(oReader.Value, ".")); } else if (StringUtil.StrCmp(StringUtil.Lower(oReader.Name), "cancelonerror") == 0) { oLocation.CancelOnError = (short)(NumberUtil.Val(oReader.Value, ".")); } else if (StringUtil.StrCmp(oReader.Name, "Authentication") == 0) { oLocation.Authentication = 1; oLocation.AuthenticationMethod = (short)(NumberUtil.Val(StringUtil.Str((decimal)(0), 1, 0), ".")); oReader.Read(); while (!((StringUtil.StrCmp(oReader.Name, "Authentication") == 0) && (oReader.NodeType == 2))) { if (StringUtil.StrCmp(StringUtil.Lower(oReader.Name), "authenticationmethod") == 0) { oLocation.AuthenticationMethod = (short)(NumberUtil.Val(oReader.Value, ".")); } else if (StringUtil.StrCmp(StringUtil.Lower(oReader.Name), "authenticationuser") == 0) { oLocation.AuthenticationUser = oReader.Value; } else if (StringUtil.StrCmp(StringUtil.Lower(oReader.Name), "authenticationrealm") == 0) { oLocation.AuthenticationRealm = oReader.Value; } else if (StringUtil.StrCmp(StringUtil.Lower(oReader.Name), "authenticationpassword") == 0) { oLocation.AuthenticationPassword = oReader.Value; } oReader.Read(); } } else if (StringUtil.StrCmp(oReader.Name, "Proxyauthentication") == 0) { oLocation.ProxyAuthenticationMethod = (short)(NumberUtil.Val(StringUtil.Str((decimal)(0), 1, 0), ".")); oReader.Read(); while (!((StringUtil.StrCmp(oReader.Name, "Proxyauthentication") == 0) && (oReader.NodeType == 2))) { if (StringUtil.StrCmp(StringUtil.Lower(oReader.Name), "proxyauthenticationmethod") == 0) { oLocation.ProxyAuthenticationMethod = (short)(NumberUtil.Val(oReader.Value, ".")); } else if (StringUtil.StrCmp(StringUtil.Lower(oReader.Name), "proxyauthenticationuser") == 0) { oLocation.ProxyAuthenticationUser = oReader.Value; } else if (StringUtil.StrCmp(StringUtil.Lower(oReader.Name), "proxyauthenticationrealm") == 0) { oLocation.ProxyAuthenticationRealm = oReader.Value; } else if (StringUtil.StrCmp(StringUtil.Lower(oReader.Name), "proxyauthenticationpassword") == 0) { oLocation.ProxyAuthenticationPassword = oReader.Value; } oReader.Read(); } } oReader.Read(); } } return(sSection); }
protected void EVT2O2( ) { if ( StringUtil.StrCmp(context.GetRequestMethod( ), "POST") == 0 ) { if ( ! context.WillRedirect( ) && ( context.nUserReturn != 1 ) && ! wbErr ) { /* Read Web Panel buttons. */ sEvt = cgiGet( "_EventName"); EvtGridId = cgiGet( "_EventGridId"); EvtRowId = cgiGet( "_EventRowId"); if ( StringUtil.Len( sEvt) > 0 ) { sEvtType = StringUtil.Left( sEvt, 1); sEvt = StringUtil.Right( sEvt, (short)(StringUtil.Len( sEvt)-1)); if ( StringUtil.StrCmp(sEvtType, "M") != 0 ) { if ( StringUtil.StrCmp(sEvtType, "E") == 0 ) { sEvtType = StringUtil.Right( sEvt, 1); if ( StringUtil.StrCmp(sEvtType, ".") == 0 ) { sEvt = StringUtil.Left( sEvt, (short)(StringUtil.Len( sEvt)-1)); if ( StringUtil.StrCmp(sEvt, "RFR") == 0 ) { context.wbHandled = 1; dynload_actions( ) ; } else if ( StringUtil.StrCmp(sEvt, "START") == 0 ) { context.wbHandled = 1; dynload_actions( ) ; /* Execute user event: Start */ E122O2 (); } else if ( StringUtil.StrCmp(sEvt, "LOAD") == 0 ) { context.wbHandled = 1; dynload_actions( ) ; /* Execute user event: Load */ E132O2 (); } else if ( StringUtil.StrCmp(sEvt, "ENTER") == 0 ) { context.wbHandled = 1; if ( ! wbErr ) { Rfr0gs = false; if ( ! Rfr0gs ) { } dynload_actions( ) ; } /* No code required for Cancel button. It is implemented as the Reset button. */ } else if ( StringUtil.StrCmp(sEvt, "LSCR") == 0 ) { context.wbHandled = 1; dynload_actions( ) ; dynload_actions( ) ; } } else { } } else if ( StringUtil.StrCmp(sEvtType, "W") == 0 ) { sEvtType = StringUtil.Left( sEvt, 4); sEvt = StringUtil.Right( sEvt, (short)(StringUtil.Len( sEvt)-4)); nCmpId = (short)(NumberUtil.Val( sEvtType, ".")); if ( nCmpId == 26 ) { OldGeneralwc = cgiGet( "W0026"); if ( ( StringUtil.Len( OldGeneralwc) == 0 ) || ( StringUtil.StrCmp(OldGeneralwc, WebComp_Generalwc_Component) != 0 ) ) { WebComp_Generalwc = getWebComponent(GetType(), "GeneXus.Programs", OldGeneralwc, new Object[] {context} ); WebComp_Generalwc.ComponentInit(); WebComp_Generalwc.Name = "OldGeneralwc"; WebComp_Generalwc_Component = OldGeneralwc; } if ( StringUtil.Len( WebComp_Generalwc_Component) != 0 ) { WebComp_Generalwc.componentprocess("W0026", "", sEvt); } WebComp_Generalwc_Component = OldGeneralwc; } } context.wbHandled = 1; } } } } }
public IActionResult LoginView(LoginModel model) { string conStr = GetConfiguration().GetConnectionString(DEFAULT_CONNECTION); if (model == null && TempData["LoginModel"] != null) { string modelStr = TempData["LoginModel"].ToString(); model = JsonConvert.DeserializeObject <LoginModel>(modelStr); } User user = UserDB.Login(model.User.Type, model.User.Email, model.User.Password, model.User.TimezoneOffset, conStr); if (user != null) { if (model.Token != null) { model.Token.Approved = true; } else { model.Token = new AccessToken { Approved = false }; } user.Picture = null; //because picture is too long for the uri HttpContext.Response.Cookies.Append("user", JsonConvert.SerializeObject(user), cookieOptions); //new CookieOptions() { Path = "/", Domain = null, IsEssential = true }); if (user.Type == EntityType.Tutor) { Tutor tutor = (Tutor)user; TutorModel tutorModel = new TutorModel { User = tutor, Languages = AppContentDB.GetLanguages(conStr) }; string tutorStr = JsonConvert.SerializeObject(tutorModel); HttpContext.Response.Cookies.Append("tutor", tutorStr, cookieOptions); TempData["TutorModel"] = tutorStr; if (tutorModel.RedirectController != null && tutorModel.RedirectController.Length > 0) { string controller = tutorModel.RedirectController; tutorModel.RedirectController = null; if (tutorModel.RedirectAction != null && tutorModel.RedirectAction.Length > 0) { string action = tutorModel.RedirectAction; tutorModel.RedirectAction = null; return(RedirectToAction(action, controller)); //, tutorModel); } return(RedirectToAction(null, controller)); //, tutorModel); } RegistrationStep step = StepsDB.NextRegStep(user.UserId, 1, (byte)user.Type, model.Language, GetConfiguration().GetConnectionString(DEFAULT_CONNECTION)); if (step != null) { return(RedirectToAction(step.UIName, "Tutor")); } } else if (user.Type == EntityType.Student) { //jinan Student student = (Student)user; HttpContext.Session.Set("StudentId", NumberUtil.ToBytes(student.Id)); student.RegStepsCompleted = StepsDB.CheckCompletedSteps(user.UserId, 1, (byte)user.Type, conStr); StudentModel studentModel = new StudentModel { User = student, Languages = AppContentDB.GetLanguages(conStr) }; string studentStr = JsonConvert.SerializeObject(studentModel); HttpContext.Response.Cookies.Append("student", studentStr, cookieOptions); TempData["StudentModel"] = studentStr; if (studentModel.RedirectController != null && studentModel.RedirectController.Length > 0) { string controller = studentModel.RedirectController; studentModel.RedirectController = null; if (studentModel.RedirectAction != null && studentModel.RedirectAction.Length > 0) { string action = studentModel.RedirectAction; studentModel.RedirectAction = null; return(RedirectToAction(action, controller)); //, studentModel); } return(RedirectToAction(null, controller)); //, studentModel); } if (student.RegStepsCompleted) { return(RedirectToAction("DisplayDashboard", "Student")); } } } else { ViewData["Message"] = "User Login failed !!"; Response.StatusCode = (int)HttpStatusCode.BadRequest; } return(RedirectToAction("Index", "Home")); }
/// <summary> /// Creates an anonymous usage record. This method spends 10 seconds measuring CPU usage. Returns null if any BlueIris.exe processes close while CPU usage is being measured, or if no BlueIris.exe processes were open. /// </summary> /// <returns></returns> public static Upload_Record GetPerfDataRecord() { Upload_Record record = new Upload_Record(); BlueIrisConfiguration c = new BlueIrisConfiguration(); c.Load(); record.CpuUsage = c.activeStats.CpuUsage; record.BiCpuUsage = c.activeStats.BiCpuUsage; record.CpuThreads = (short)Environment.ProcessorCount; record.BiVersion = c.activeStats.BiVersion; record.BiMemUsageMB = c.activeStats.BiMemUsageMB; record.BiPeakVirtualMemUsageMB = c.activeStats.BiPeakVirtualMemUsageMB; record.ConsoleOpen = c.activeStats.ConsoleOpen; record.ConsoleWidth = c.activeStats.ConsoleWidth; record.ConsoleHeight = c.activeStats.ConsoleHeight; record.Secret = Program.settings.secret; record.OS = c.OS; if (c.cpu == null) { record.CpuModel = "Unknown"; record.CpuMHz = 0; } else { record.CpuModel = c.cpu.GetModel(); record.CpuMHz = NumberUtil.ParseInt(c.cpu.maxClockSpeed); } record.HelperVersion = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString(); record.HwAccel = (byte)c.global.HardwareAcceleration; record.ServiceMode = c.global.ServiceMode; record.LivePreviewFPS = (short)c.global.LivePreviewFPS; record.MemMB = c.activeStats.MemMB; record.MemFreeMB = c.activeStats.MemFreeMB; record.RamGiB = c.mem.GiB; record.RamChannels = c.mem.Channels; record.DimmLocations = c.mem.DimmLocations; record.RamMHz = c.mem.MHz; // Get camera info. // Get frame rates, current profile (only accessible via BI's web server). Dictionary <string, double> fpsMap = new Dictionary <string, double>(); int currentProfile = 1; bool isAdmin = false; bool gotCamlist = false; bool gotStatus = false; BiServerInfo.Reload(); //BiUserInfo.Reload(); if (BiServerInfo.enabled) { try { using (WebClient wc = new WebClient()) { UserInfo user = BiUserInfo.CreateTemporaryUser(); string session = CameraWebInterfaceLinker.GetSecureAuthenticatedSession(wc, out isAdmin, user.name, user.GetDecodedPassword()); try { try { string response = wc.UploadString(CameraWebInterfaceLinker.GetJsonURL(), "{\"cmd\":\"camlist\",\"session\":\"" + session + "\"}"); CamListResponse camListResponse = JsonConvert.DeserializeObject <CamListResponse>(response); if (camListResponse != null && camListResponse.result == "success") { foreach (CameraListCamera camera in camListResponse.data) { if (camera.group == null) { fpsMap[camera.optionValue] = camera.FPS; } } gotCamlist = true; } } catch (Exception ex) { Logger.Debug(ex, "Error reading camera list from web server."); } try { string response = wc.UploadString(CameraWebInterfaceLinker.GetJsonURL(), "{\"cmd\":\"status\",\"session\":\"" + session + "\"}"); StatusResponse statusResponse = JsonConvert.DeserializeObject <StatusResponse>(response); if (statusResponse != null && statusResponse.result == "success") { currentProfile = statusResponse.data.profile; gotStatus = true; if (currentProfile < 1 || currentProfile > 7) { currentProfile = 1; gotStatus = false; } else { record.ProfileConfirmed = true; } } } catch (Exception ex) { Logger.Debug(ex, "Error reading camera list from web server."); } } finally { wc.UploadString(CameraWebInterfaceLinker.GetJsonURL(), "{\"cmd\":\"logout\",\"session\":\"" + session + "\"}"); } } } catch (Exception ex) { Logger.Debug(ex, "Error dealing with web server."); } } record.webserverState = 0; if (gotCamlist && gotStatus) { record.webserverState = 1; if (isAdmin) // and any future admin-requiring stuff all worked { record.webserverState = 2; } } // Get camera info List <Upload_Camera> cameras = new List <Upload_Camera>(); foreach (Camera camSrc in c.cameras.Values) { if (!camSrc.enabled) { continue; } Upload_Camera cam = new Upload_Camera(); if (fpsMap.TryGetValue(camSrc.shortname, out double fps)) { cam.FPS = (byte)Math.Round(fps).Clamp(0, 255); cam.FPSConfirmed = true; } else { cam.FPS = (byte)(Math.Round(camSrc.MaxRate).Clamp(0, 255)); } cam.CapType = (byte)camSrc.CapType; cam.Hwaccel = (byte)camSrc.Hwva; cam.LimitDecode = camSrc.LimitDecode; cam.Pixels = camSrc.Pixels; if (camSrc.hasSubStream) { cam.MainPixels = camSrc.MainPixels; } cam.Type = (byte)camSrc.Type; cam.MotionDetector = camSrc.triggerSettings[currentProfile].motionDetectionEnabled; cam.RecordTriggerType = (byte)camSrc.recordSettings[currentProfile].triggerType; cam.RecordFormat = (byte)camSrc.recordSettings[currentProfile].recordingFormat; cam.DirectToDisk = camSrc.recordSettings[currentProfile].DirectToDisc; cam.VCodec = camSrc.recordSettings[currentProfile].VCodec; cameras.Add(cam); } record.AllFPSConfirmed = cameras.All(cam => cam.FPSConfirmed); // Ignored and recalculated by server. This exists here for the sake of local json output. record.cameras = cameras.ToArray(); record.gpus = c.gpus.Select(g => new Upload_Gpu() { Name = g.Name, Version = g.DriverVersion }).ToArray(); record.Total_FPS = record.Total_Megapixels = record.Total_MPPS = 0; foreach (Upload_Camera cam in cameras) { float MP = cam.Pixels / 1000000f; record.Total_Megapixels += MP; record.Total_FPS += cam.FPS; record.Total_MPPS += MP * cam.FPS; } return(record); }
public override victim getVictim(HtmlNode victimDetailContent) { if (checkIgnoreMovie(victimDetailContent)) { return(null); } var dd = getDDItems(); var currentMovieInfo = dd[0].InnerText.Trim().ToLower().Replace("bản đẹp", "HD").ToLower(); var smallImage = victimDetailContent.SelectSingleNode("//div[@class='movie-l-img'] //img").Attributes["src"].Value; if (smallImage.IndexOf(victimDomainNoExt) != -1) { smallImage = UriUtil.getUrlNoDomain(smallImage); } var movieHref = UriUtil.checkAndAddDomain(victimDetailContent.SelectSingleNode("//a[@id='btn-film-watch']").Attributes["href"].Value, victimDomain, protocol); var totalEpisode = 1; var isContinue = 0; int isMultipleEpisode = (currentMovieInfo.IndexOf("tập") != -1 || currentMovieInfo.IndexOf("/") != -1) ? 1 : 0; int currentEpisode = 0; int viewed = Int32.Parse(dd[dd.Count() - 1].InnerText.Trim().Replace(",", "").Trim()); var rating = NumberUtil.GetDouble(victimDetailContent.SelectSingleNode("//div[@id='star']").Attributes["data-score"].Value); var schedule = victimDetailContent.SelectSingleNode("//div[@class='show-time']"); var priority = Int32.Parse(smallImage.Split('/')[2]); if (isMultipleEpisode == 1) { var infoArray = currentMovieInfo.Replace("(", "").Replace(")", "").Split(' '); isContinue = 1; totalEpisode = 0; foreach (var info in infoArray) { if (info.IndexOf("/") != -1) { var episodeInfo = info.Split('/'); try { currentEpisode = Int32.Parse(episodeInfo[0].Trim()); } catch (Exception ex) { Console.Write(ex.Message); } try { totalEpisode = Int32.Parse(episodeInfo[1].Trim()); } catch (Exception ex) { Console.Write(ex.Message); } if (currentEpisode == totalEpisode) { isContinue = 0; } break; } else if (IsNumber(info)) { currentEpisode = Int32.Parse(info); break; } } } var description = victimDetailContent.SelectSingleNode("//div[@id='film-content']"); description.InnerHtml = removeTextNodes(description, "h3"); enhanceDescription(description); var caption = dd[6].InnerText.Trim().ToLower(); var playListHtml = getPlayListHtml(movieHref); if (playListHtml == null) { return(null); } victim vtm = new victim() { name = victimDomain, movieHref = movieHref, thumb = CryptoUtil.encrypt(smallImage), poster = CryptoUtil.encrypt(smallImage.Replace("/medium/", "/large/")), smallImage = CryptoUtil.encrypt(smallImage.Replace("/medium/", "/small/")), description = description.InnerHtml, currentEpisode = currentEpisode, totalEpisode = totalEpisode, duration = dd[4].InnerText.Trim().Replace(" / tập", "").Trim(), quality = dd[5].InnerText.Trim(), hasSub = (caption.IndexOf("phụ đề") != -1) ? 1 : 0, hasDubbing = (caption.IndexOf("lồng tiếng") != -1) ? 1 : 0, hasTrans = (caption.IndexOf("thuyết minh") != -1) ? 1 : 0, isContinue = isContinue, dateUpdate = DateTime.Now, updateState = 1, viewed = viewed, rating = rating, schedule = (schedule != null) ? replaceDomain(schedule.InnerHtml) : "", victimTypeNo = victimTypeNo, priority = priority, isTrailer = isTrailer(victimDetailContent) ? 1 : 0, playListHtml = playListHtml[0], playListHtmlBk = playListHtml[1] }; return(vtm); }
/// <summary> /// Creates an anonymous usage record. This method spends 10 seconds measuring CPU usage. Returns null if any BlueIris.exe processes close while CPU usage is being measured, or if no BlueIris.exe processes were open. /// </summary> /// <returns></returns> public static Upload_Record GetPerfDataRecord() { Upload_Record record = new Upload_Record(); // Begin measuring CPU usage. using (PerformanceCounter totalCpuCounter = new PerformanceCounter("Processor", "% Processor Time", "_Total")) { totalCpuCounter.NextValue(); Stopwatch sw = new Stopwatch(); sw.Start(); List <Process> biProcs = Process.GetProcesses().Where(p => p.ProcessName.ToLower() == "blueiris").ToList(); if (biProcs.Count < 1) { Logger.Info("Unable to generate anonymous performance data record because Blue Iris is not running."); return(null); } TimeSpan[] startTimes = new TimeSpan[biProcs.Count]; for (int i = 0; i < biProcs.Count; i++) { startTimes[i] = biProcs[i].TotalProcessorTime; } // Wait for CPU usage to happen. Thread.Sleep(10000); // Take CPU usage measurements. record.CpuUsage = (byte)Math.Round(totalCpuCounter.NextValue()); sw.Stop(); TimeSpan totalTime = TimeSpan.Zero; for (int i = 0; i < biProcs.Count; i++) { biProcs[i].Refresh(); if (biProcs[i].HasExited) { Logger.Info("Unable to generate anonymous performance data record because Blue Iris exited while CPU usage was being measured."); return(null); } totalTime += biProcs[i].TotalProcessorTime - startTimes[i]; } double fraction = totalTime.TotalMilliseconds / sw.Elapsed.TotalMilliseconds; record.BiCpuUsage = (byte)Math.Round((fraction / Environment.ProcessorCount) * 100); record.CpuThreads = (short)Environment.ProcessorCount; long physicalMemUsage = 0; long virtualMemUsage = 0; foreach (Process p in biProcs) { if (record.BiVersion == null) { record.BiVersion = p.MainModule.FileVersionInfo.FileVersion + " " + (MainSvc.Is64Bit(p) ? "x64" : "x86"); } physicalMemUsage += p.WorkingSet64; virtualMemUsage += p.VirtualMemorySize64; } record.BiMemUsageMB = (int)(physicalMemUsage / 1000000); record.BiPeakVirtualMemUsageMB = (int)(virtualMemUsage / 1000000); foreach (Process p in biProcs) { IntPtr handle = p.MainWindowHandle; if (handle == IntPtr.Zero) { // This is the service. } else { // This is the console. record.ConsoleOpen = true; try { WINDOWPLACEMENT placement = new WINDOWPLACEMENT(); if (GetWindowPlacement(handle, ref placement)) { if (placement.showCmd == 2) { // Minimized record.ConsoleWidth = -2; record.ConsoleHeight = -2; } else { // Not Minimized RECT Rect = new RECT(); if (GetWindowRect(handle, ref Rect)) { record.ConsoleWidth = (short)NumberUtil.Clamp(Rect.right - Rect.left, 0, short.MaxValue); record.ConsoleHeight = (short)NumberUtil.Clamp(Rect.bottom - Rect.top, 0, short.MaxValue); } } } } catch (Exception ex) { Logger.Debug(ex); } } } if (biProcs.Count > 1 && !record.ConsoleOpen) { record.ConsoleOpen = true; } } record.Secret = Program.settings.secret; record.OS = GetOsVersion(); CpuInfo cpuInfo = GetCpuInfo(); if (cpuInfo == null) { record.CpuModel = "Unknown"; record.CpuMHz = NumberUtil.ParseInt(cpuInfo.maxClockSpeed); } else { record.CpuModel = cpuInfo.GetModel(); record.CpuMHz = NumberUtil.ParseInt(cpuInfo.maxClockSpeed); } record.HelperVersion = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString(); record.HwAccel = (byte)RegistryUtil.GetHKLMValue <int>(@"SOFTWARE\Perspective Software\Blue Iris\Options", "hwaccel", 0); record.ServiceMode = RegistryUtil.GetHKLMValue <int>(@"SOFTWARE\Perspective Software\Blue Iris\Options", "Service", 0) == 1; if (RegistryUtil.GetHKLMValue <int>(@"SOFTWARE\Perspective Software\Blue Iris\Options", "limitlive", 0) == 0) { record.LivePreviewFPS = -2; } else { record.LivePreviewFPS = (short)RegistryUtil.GetHKLMValue <int>(@"SOFTWARE\Perspective Software\Blue Iris\Options", "livefps", -1); } ComputerInfo computerInfo = new ComputerInfo(); record.MemMB = (int)(computerInfo.TotalPhysicalMemory / 1000000); record.MemFreeMB = (int)(computerInfo.AvailablePhysicalMemory / 1000000); RamInfo ramInfo = GetRamInfo(); record.RamGiB = ramInfo.GiB; record.RamChannels = ramInfo.Channels; record.DimmLocations = ramInfo.DimmLocations; record.RamMHz = ramInfo.MHz; // Get camera info. // Get frame rates (only accessible via BI's web server). Dictionary <string, double> fpsMap = new Dictionary <string, double>(); BiServerInfo.Reload(); if (BiServerInfo.enabled) { try { using (WebClient wc = new WebClient()) { string session = CameraWebInterfaceLinker.GetSecureAuthenticatedSession(wc); string response = wc.UploadString(CameraWebInterfaceLinker.GetJsonURL(), "{\"cmd\":\"camlist\",\"session\":\"" + session + "\"}"); wc.UploadString(CameraWebInterfaceLinker.GetJsonURL(), "{\"cmd\":\"logout\",\"session\":\"" + session + "\"}"); CamListResponse camListResponse = JsonConvert.DeserializeObject <CamListResponse>(response); if (camListResponse != null && camListResponse.result == "success") { foreach (CameraListCamera camera in camListResponse.data) { if (camera.group == null) { fpsMap[camera.optionValue] = camera.FPS; } } } } } catch (Exception ex) { Logger.Debug(ex, "Error reading camera list from web server."); } } // Get camera info from registry List <Upload_Camera> cameras = new List <Upload_Camera>(); RegistryKey camerasKey = RegistryUtil.GetHKLMKey(@"SOFTWARE\Perspective Software\Blue Iris\Cameras"); foreach (string camName in camerasKey.GetSubKeyNames()) { RegistryKey camKey = camerasKey.OpenSubKey(camName); if (RegistryUtil.GetIntValue(camKey, "enabled", 0) != 1) { continue; } string shortName = RegistryUtil.GetStringValue(camKey, "shortname"); Upload_Camera cam = new Upload_Camera(); if (fpsMap.TryGetValue(shortName, out double fps)) { cam.FPS = (byte)NumberUtil.Clamp(Math.Round(fps), 0, 255); } else { int interval = RegistryUtil.GetIntValue(camKey, "interval", 1000000); if (interval <= 0) { cam.FPS = 0; } else { cam.FPS = (byte)NumberUtil.Clamp(Math.Round(10000000.0 / interval), 0, 255); } } cam.CapType = (byte)RegistryUtil.GetIntValue(camKey, "screencap", 0); cam.Hwaccel = (byte)RegistryUtil.GetIntValue(camKey, "ip_hwaccel", 0); cam.LimitDecode = RegistryUtil.GetIntValue(camKey, "smartdecode", 0) == 1; cam.Pixels = RegistryUtil.GetIntValue(camKey, "fullxres", 0) * RegistryUtil.GetIntValue(camKey, "fullyres", 0); cam.Type = (byte)RegistryUtil.GetIntValue(camKey, "type", 0); RegistryKey motionKey = camKey.OpenSubKey("Motion"); cam.MotionDetector = RegistryUtil.GetIntValue(motionKey, "enabled", 0) == 1; cam.RecordTriggerType = (byte)RegistryUtil.GetIntValue(motionKey, "continuous", 0); RegistryKey clipsKey = camKey.OpenSubKey("Clips"); cam.RecordFormat = (byte)RegistryUtil.GetIntValue(clipsKey, "movieformat", 0); cam.DirectToDisk = RegistryUtil.GetIntValue(clipsKey, "transcode", 0) == 0; cam.VCodec = RegistryUtil.GetStringValue(clipsKey, "vcodec"); cameras.Add(cam); } record.cameras = cameras.ToArray(); record.gpus = GetGpuInfo().Select(g => new Upload_Gpu() { Name = g.Name, Version = g.DriverVersion }).ToArray(); return(record); }
public static BlittableJsonReaderObject[] ReadAllEntriesFromIndex(IndexReader reader, JsonOperationContext context, IState state) { if (reader.MaxDoc > 512 * 1024) { throw new InvalidOperationException("Refusing to extract all index entries from an index with " + reader.MaxDoc + " entries, because of the probable time / memory costs associated with that." + Environment.NewLine + "Viewing index entries are a debug tool, and should not be used on indexes of this size."); } var results = new Dictionary <string, object> [reader.MaxDoc]; using (var termDocs = reader.TermDocs(state)) using (var termEnum = reader.Terms(state)) { while (termEnum.Next(state)) { var term = termEnum.Term; if (term == null) { break; } string text; if (term.Field.EndsWith("__maxX") || term.Field.EndsWith("__maxY") || term.Field.EndsWith("__minY") || term.Field.EndsWith("__minX")) { // This is a Spatial Index field term // Lucene keeps the index-entries-values for 'Spatial Index Fields' with 'BoundingBox' encoded as 'prefixCoded bytes' // Need to convert to numbers var num = NumericUtils.PrefixCodedToDouble(term.Text); text = NumberUtil.NumberToString(num); } else { text = term.Text; } termDocs.Seek(termEnum, state); for (var i = 0; i < termEnum.DocFreq() && termDocs.Next(state); i++) { var result = results[termDocs.Doc]; if (result == null) { results[termDocs.Doc] = result = new Dictionary <string, object>(); } var propertyName = term.Field; if (propertyName.EndsWith("_ConvertToJson") || propertyName.EndsWith("_IsArray") || propertyName.EndsWith(Constants.Documents.Indexing.Fields.RangeFieldSuffix)) { continue; } if (result.TryGetValue(propertyName, out var oldValue)) { if (oldValue is DynamicJsonArray oldValueAsArray) { oldValueAsArray.Add(text); continue; } if (oldValue is string oldValueAsString) { result[propertyName] = oldValueAsArray = new DynamicJsonArray(); oldValueAsArray.Add(oldValueAsString); oldValueAsArray.Add(text); continue; } throw new ArgumentException("No idea how to handle " + oldValue.GetType()); } result[propertyName] = text; } } } var final = new BlittableJsonReaderObject[results.Length]; for (int i = 0; i < results.Length; i++) { var doc = new DynamicJsonValue(); var dictionary = results[i]; if (dictionary == null) { continue; } foreach (var kvp in dictionary) { doc[kvp.Key] = kvp.Value; } final[i] = context.ReadObject(doc, "index/entries"); } return(final); }
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) { long ms = NumberUtil.ParseLong(reader.ReadAsString()); return(TimeUtil.DateTimeFromEpochMS(ms)); }
/// <summary> /// 转换新值 /// </summary> /// <param name="value">值</param> /// <returns>新值</returns> protected override object ToNew(object value) => NumberUtil.FenToYuan((long)value);
VPackSlice SearchObjectKeyBinary( string attribute, long ieBase, int offsetsize, long n) { bool useTranslator = attributeTranslator != null; VPackSlice result; long l = 0; long r = n - 1; for (;;) { // midpoint long index = l + ((r - l) / 2); long offset = ieBase + index * offsetsize; long keyIndex = NumberUtil.ToLong(vpack, (int)(start + offset), offsetsize); VPackSlice key = new VPackSlice(vpack, (int)(start + keyIndex)); int res = 0; if (key.IsType(SliceType.String)) { res = key.CompareString(attribute); } else if (key.IsInteger()) { // translate key if (!useTranslator) { // no attribute translator throw new VPackNeedAttributeTranslatorException(); } res = key.TranslateUnchecked().CompareString(attribute); } else { // invalid key result = new VPackSlice(); break; } if (res == 0) { // found result = new VPackSlice(vpack, key.start + key.GetByteSize()); break; } if (res > 0) { if (index == 0) { result = new VPackSlice(); break; } r = index - 1; } else { l = index + 1; } if (r < l) { result = new VPackSlice(); break; } } return(result); }
/// <summary> /// Return object by attribute name /// </summary> /// <param name="attribute"></param> /// <returns></returns> public VPackSlice this[string attribute] { get { if (!IsType(SliceType.Object)) { throw new VPackValueTypeException(SliceType.Object); } byte head = TypeCode; VPackSlice result = new VPackSlice(); if (head == 0x0a) { // special case, empty object result = new VPackSlice(); } else if (head == 0x14) { // compact Object result = GetFromCompactObject(attribute); } else { int offsetsize = ObjectArrayUtil.GetOffsetSize(head); long end = NumberUtil.ToLong(vpack, start + 1, offsetsize); long n; if (offsetsize < 8) { n = NumberUtil.ToLong(vpack, start + 1 + offsetsize, offsetsize); } else { n = NumberUtil.ToLong(vpack, (int)(start + end - offsetsize), offsetsize); } if (n == 1) { // Just one attribute, there is no index table! VPackSlice key = new VPackSlice(vpack, start + FindDataOffset()); if (key.IsType(SliceType.String)) { if (key.IsEqualString(attribute)) { result = new VPackSlice(vpack, key.start + key.GetByteSize()); } else { // no match result = new VPackSlice(); } } else if (key.IsInteger()) { // translate key if (attributeTranslator == null) { throw new VPackNeedAttributeTranslatorException(); } if (key.TranslateUnchecked().IsEqualString(attribute)) { result = new VPackSlice(vpack, key.start + key.GetByteSize()); } else { // no match result = new VPackSlice(); } } else { // no match result = new VPackSlice(); } } else { long ieBase = end - n * offsetsize - (offsetsize == 8 ? 8 : 0); // only use binary search for attributes if we have at least // this many entries // otherwise we'll always use the linear search long sortedSearchEntriesThreshold = 4; bool sorted = head >= 0x0b && head <= 0x0e; if (sorted && n >= sortedSearchEntriesThreshold) { // This means, we have to handle the special case n == 1 // only in the linear search! result = SearchObjectKeyBinary(attribute, ieBase, offsetsize, n); } else { result = SearchObjectKeyLinear(attribute, ieBase, offsetsize, n); } } } return(result); } }
public override Result VisitMacro([NotNull] MacroContext context) { var macroName = context.GetToken(SYNTAX, 0).GetText(); _il.Emit(OpCodes.Ldarg_0); // ctx _il.Emit(OpCodes.Ldstr, macroName); // ctx name _il.Emit(OpCodes.Ldstr, _context.CurrentNs); // ctx name ns _il.Emit(OpCodes.Ldarg_0); // ctx name ns ctx _il.Emit(OpCodes.Call, OneCallContext.GetObj); // ctx name ns self var contexts = context.GetRuleContexts <MacroParameterContext>(); _il.Emit(OpCodes.Ldc_I4, contexts.Length); // ctx name ns self _il.Emit(OpCodes.Newarr, typeof(object)); // ctx name ns self args for (var i = 0; i < contexts.Length; ++i) { var arg = contexts[i]; _il.Emit(OpCodes.Dup); // .. -> args _il.Emit(OpCodes.Ldc_I4, i); // .. -> args idx if (arg.nsSyntax() != null) { _il.Emit(OpCodes.Ldstr, arg.nsSyntax().GetText()); // .. -> args idx ele } else if (arg.STRING() != null) { var result = StringUtil.Parse(arg.STRING().GetText()); // .. -> args idx ele if (result.IsSuccess) { _il.Emit(OpCodes.Ldstr, result.Value); // .. -> args idx ele } else { return(result); } } else if (arg.NUMBER() != null) { var result = NumberUtil.Parse(arg.NUMBER().GetText()); if (result.IsSuccess) { _il.Emit(OpCodes.Ldc_R8, result.Value); // .. -> args idx vele _il.Emit(OpCodes.Box, typeof(double)); // .. -> args idx rele } else { return(result); } } else if (arg.DATE() != null) { var result = DateUtil.Parse(arg.DATE().GetText()); if (result.IsSuccess) { _il.Emit(OpCodes.Ldc_I8, result.Value.ToBinary()); // .. -> args idx int64 var ctor = typeof(DateTime).GetConstructor(new[] { typeof(long) }); _il.Emit(OpCodes.Newobj, ctor); // .. -> args idx date _il.Emit(OpCodes.Box, typeof(DateTime)); // .. -> args idx rele } else { return(result); } } else if (arg.Bool() != null) { _il.Emit(bool.Parse(arg.Bool().GetText()) ? OpCodes.Ldc_I4_1 : OpCodes.Ldc_I4_0); // .. -> args idx bool _il.Emit(OpCodes.Box, typeof(bool)); // .. -> args idx rele } else if (arg.unnamedSql() != null) { var parseTree = arg.unnamedSql(); var id = NameUtil.GetFunctionName(parseTree); var result = _context.TryGetEmiter(id, _context.CurrentNs); SqlEmiter emiter; if (result.IsSuccess) { emiter = result.Value; } else { emiter = SqlEmiterUtil.CreateUnnamed(parseTree, _context.CurrentNs); var ok = _context.TryAdd(id, emiter); if (ok.IsFailure) { return(ok); } } var compileResult = emiter.EnsureCompiled(_context); if (compileResult.IsFailure) { return(compileResult); } _il.Emit(OpCodes.Ldarg_0); // .. -> args idx ctx _il.Emit(OpCodes.Call, OneCallContext.GetCompiler); // .. -> args ids compiler _il.Emit(OpCodes.Ldstr, id); // .. -> args idx compiler id _il.Emit(OpCodes.Ldstr, _context.CurrentNs); // .. -> args idx compiler id ns _il.Emit(OpCodes.Call, typeof(SqlEmiterUtil) .GetMethod(nameof(SqlEmiterUtil.EmiterFromId))); // .. -> args idx emiter } else { throw new InvalidOperationException(); } _il.Emit(OpCodes.Stelem_Ref); // -> ctx name ns self args } _il.Emit(OpCodes.Call, typeof(MacroManager) .GetMethod(nameof(MacroManager.Execute))); // result<str> _il.Emit(OpCodes.Dup); // result<str> x 2 _il.Emit(OpCodes.Call, typeof(Result) .GetMethod("get_" + nameof(Result.IsSuccess))); // result<str> bool _il.Emit(OpCodes.Ldc_I4_1); // result<str> bool true var ifIsSuccess = _il.DefineLabel(); _il.Emit(OpCodes.Beq, ifIsSuccess); // result<str> (jmp if equal) _il.Emit(OpCodes.Ret); // [exit-returned] _il.MarkLabel(ifIsSuccess); // ifIsSuccess: _il.Emit(OpCodes.Call, typeof(Result <string>) .GetMethod("get_" + nameof(Result <string> .Value))); // str var strValue = _il.DeclareLocal(typeof(string)); _il.Emit(OpCodes.Stloc, strValue); // [empty] _il.Emit(OpCodes.Ldloc_0); // sb _il.Emit(OpCodes.Ldloc, strValue); // sb str _il.Emit(OpCodes.Call, _appendCall); // [empty] return(Result.Ok()); }
private void OnDeleteControlsOsdokument() { this.rowOSDOKUMENT.OSDK = NumberUtil.ToString((long)this.rowOSDOKUMENT.IDOSDOKUMENT, "") + " | " + this.rowOSDOKUMENT.NAZIVOSDOKUMENT; }
private void ParseHelpVerb(string request) { if (parameterTypes.FindIndex(x => x.Equals(request, System.StringComparison.OrdinalIgnoreCase)) != -1) { switch (request.ToLower()) { case "verb": PrintResponse(HelpType(typeof(Verb))); break; case "item": PrintResponse(HelpType(typeof(Item))); break; case "resource": PrintResponse(HelpType(typeof(Resource))); break; case "direction": PrintResponse(HelpType(typeof(Direction))); break; case "number": PrintResponse("Any positive integer value\n\nDefault: " + NumberUtil.GetDefault()); break; default: PrintResponse("Help for '" + request + "' not defined"); break; } } else { System.Type type = GetValueType(request); if (type == typeof(Verb)) { Verb verbRequest = GetEnumValue <Verb>(request); PrintResponse(SingletonFactory.GetInstance <VerbUtil>().Help(verbRequest)); } else if (type == typeof(Item)) { Item itemRequest = GetEnumValue <Item>(request); PrintResponse(SingletonFactory.GetInstance <ItemUtil>().Help(itemRequest)); } else if (type == typeof(Resource)) { Resource resourceRequest = GetEnumValue <Resource>(request); PrintResponse(SingletonFactory.GetInstance <ResourceUtil>().Help(resourceRequest)); } else if (type == typeof(Direction)) { Direction directionRequest = GetEnumValue <Direction>(request); PrintResponse(SingletonFactory.GetInstance <DirectionUtil>().Help(directionRequest)); } else if (type == typeof(Number)) { uint numberRequest = SingletonFactory.GetInstance <NumberUtil>().GetNumber(request); PrintResponse(SingletonFactory.GetInstance <NumberUtil>().Help(numberRequest)); } else { PrintResponse(request + " is " + GetValueType(request).ToString()); } } }
private void OnLoadActionsOsdokument() { this.rowOSDOKUMENT.OSDK = NumberUtil.ToString((long)this.rowOSDOKUMENT.IDOSDOKUMENT, "") + " | " + this.rowOSDOKUMENT.NAZIVOSDOKUMENT; }
private static bool Prefix(TrainCar __instance, ref Vector3 ___prevAbsoluteWorldPosition, ref int ___stationaryFramesCounter, Action <bool> ___MovementStateChanged) { if (NetworkManager.IsClient()) { if (AppUtil.IsPaused) { return(true); } if (NumberUtil.AnyInfinityMinMaxNaN(__instance.transform.position) || __instance.transform.position.y < -500f) { Debug.LogWarning(string.Format("Car '{0}' fell through the ground (y: {1}) and will be deleted!", __instance.name, __instance.transform.position.y)); Job jobOfCar = JobChainController.GetJobOfCar(__instance); if (jobOfCar != null) { JobState state = jobOfCar.State; if (state != JobState.Available) { if (state != JobState.InProgress) { Debug.LogError(string.Format("Unexpected state {0}, ignoring force abandon/expire!", jobOfCar.State)); } else { PlayerJobs.Instance.AbandonJob(jobOfCar); } } else { jobOfCar.ExpireJob(); } } CarSpawner.DeleteCar(__instance); SingletonBehaviour <UnusedTrainCarDeleter> .Instance.ClearInvalidCarReferencesAfterManualDelete(); } Vector3 a = __instance.transform.position - WorldMover.currentMove; if ((a - ___prevAbsoluteWorldPosition).sqrMagnitude > 0.0001f) { ___prevAbsoluteWorldPosition = a; ___stationaryFramesCounter = 0; if (__instance.isStationary) { ___MovementStateChanged?.Invoke(true); } __instance.isStationary = (__instance.isEligibleForSleep = false); return(false); } if (!__instance.isEligibleForSleep || !__instance.isStationary) { if (___stationaryFramesCounter < 100) { ___stationaryFramesCounter++; return(false); } if (___stationaryFramesCounter >= 100) { ___stationaryFramesCounter = 0; if (!__instance.isStationary) { ___MovementStateChanged?.Invoke(false); } __instance.isEligibleForSleep = (__instance.isStationary = true); } } } return(true); }
private void CheckExtendedTableOsdokument() { this.rowOSDOKUMENT.OSDK = NumberUtil.ToString((long)this.rowOSDOKUMENT.IDOSDOKUMENT, "") + " | " + this.rowOSDOKUMENT.NAZIVOSDOKUMENT; }
// Token: 0x060000DB RID: 219 RVA: 0x0000AD70 File Offset: 0x00008F70 public bool HasChanged(ACCMaterial mate) { return(this.editColors.Where((EditColor t, int i) => t.val != mate.editColors[i].val).Any <EditColor>() || this.editVals.Where((EditValue t, int i) => !NumberUtil.Equals(t.val, mate.editVals[i].val, 0.001f)).Any <EditValue>()); }
protected void EVT0G2( ) { if (StringUtil.StrCmp(context.GetRequestMethod( ), "POST") == 0) { if (String.IsNullOrEmpty(StringUtil.RTrim(context.wjLoc)) && (context.nUserReturn != 1) && !wbErr) { /* Read Web Panel buttons. */ sEvt = cgiGet("_EventName"); EvtGridId = cgiGet("_EventGridId"); EvtRowId = cgiGet("_EventRowId"); if (StringUtil.Len(sEvt) > 0) { sEvtType = StringUtil.Left(sEvt, 1); sEvt = StringUtil.Right(sEvt, (short)(StringUtil.Len(sEvt) - 1)); if (StringUtil.StrCmp(sEvtType, "M") != 0) { if (StringUtil.StrCmp(sEvtType, "E") == 0) { sEvtType = StringUtil.Right(sEvt, 1); if (StringUtil.StrCmp(sEvtType, ".") == 0) { sEvt = StringUtil.Left(sEvt, (short)(StringUtil.Len(sEvt) - 1)); if (StringUtil.StrCmp(sEvt, "RFR") == 0) { context.wbHandled = 1; dynload_actions( ); } else if (StringUtil.StrCmp(sEvt, "START") == 0) { context.wbHandled = 1; dynload_actions( ); /* Execute user event: E110G2 */ E110G2(); } else if (StringUtil.StrCmp(sEvt, "LOAD") == 0) { context.wbHandled = 1; dynload_actions( ); /* Execute user event: E120G2 */ E120G2(); } else if (StringUtil.StrCmp(sEvt, "ENTER") == 0) { context.wbHandled = 1; if (!wbErr) { Rfr0gs = false; if (!Rfr0gs) { } dynload_actions( ); } /* No code required for Cancel button. It is implemented as the Reset button. */ } else if (StringUtil.StrCmp(sEvt, "LSCR") == 0) { context.wbHandled = 1; dynload_actions( ); dynload_actions( ); } } else { } } else if (StringUtil.StrCmp(sEvtType, "W") == 0) { sEvtType = StringUtil.Left(sEvt, 4); sEvt = StringUtil.Right(sEvt, (short)(StringUtil.Len(sEvt) - 4)); nCmpId = (short)(NumberUtil.Val(sEvtType, ".")); if (nCmpId == 2) { OldHeaderbc = cgiGet("W0002"); if ((StringUtil.Len(OldHeaderbc) == 0) || (StringUtil.StrCmp(OldHeaderbc, WebComp_Headerbc_Component) != 0)) { WebComp_Headerbc = getWebComponent(GetType(), "GeneXus.Programs", OldHeaderbc, new Object[] { context }); WebComp_Headerbc.ComponentInit(); WebComp_Headerbc.Name = "OldHeaderbc"; WebComp_Headerbc_Component = OldHeaderbc; } WebComp_Headerbc.componentprocess("W0002", "", sEvt); WebComp_Headerbc_Component = OldHeaderbc; } else if (nCmpId == 3) { OldRecentlinks = cgiGet("W0003"); if ((StringUtil.Len(OldRecentlinks) == 0) || (StringUtil.StrCmp(OldRecentlinks, WebComp_Recentlinks_Component) != 0)) { WebComp_Recentlinks = getWebComponent(GetType(), "GeneXus.Programs", OldRecentlinks, new Object[] { context }); WebComp_Recentlinks.ComponentInit(); WebComp_Recentlinks.Name = "OldRecentlinks"; WebComp_Recentlinks_Component = OldRecentlinks; } if (StringUtil.Len(WebComp_Recentlinks_Component) != 0) { WebComp_Recentlinks.componentprocess("W0003", "", sEvt); } WebComp_Recentlinks_Component = OldRecentlinks; } } context.wbHandled = 1; } } } } }
public void ExportWelcomeBoard(ExcelPackage excelPackage, BusByDate busByDate) { var listBookingBusByDate = TransferRequestByDateBLL.BookingBusByDateGetAllByCriterion(busByDate).Future().ToList(); var listBooking = listBookingBusByDate.Select(x => x.Booking).ToList(); var shortRouteName = StringUtil.GetFirstLetter(busByDate.Route.Name); var sheet = excelPackage.Workbook.Worksheets.Copy("Welcome Board", "WB" + "-" + shortRouteName.Replace(" ", "").Replace("-", "_") + "-" + busByDate.BusType.Name + "-G" + busByDate.Group); var totalRow = 6; var totalCol = 11; for (int i = 0; i < listBooking.Count; i++) { var booking = listBooking[i]; var listCustomer = booking.Customers; sheet.Cells[1, 1, totalRow, totalCol].Copy(sheet.Cells[(i + 1) * totalRow + 1, 1]); var currentRow = (i + 2) * totalRow; //chỉnh lại chiều cao của các row vừa mới copy sheet.Row(currentRow - 5).Height = 119.25; sheet.Row(currentRow - 4).Height = 42; sheet.Row(currentRow - 3).Height = 300.75; sheet.Row(currentRow - 2).Height = 30.75; sheet.Row(currentRow - 1).Height = 45.75; sheet.Row(currentRow - 0).Height = 42; var name = booking.CustomerNameFull.Replace("<br/>", "\r\n").ToUpper(); sheet.Cells[currentRow - 3, 1].Value = name; sheet.Cells[currentRow - 1, 2].Value = busByDate.Driver_Name + " - " + NumberUtil.FormatPhoneNumber(busByDate.Driver_Phone); foreach (var busByDateGuide in busByDate.BusByDatesGuides) { sheet.Cells[currentRow - 0, 2].Value += (busByDateGuide.Guide != null ? busByDateGuide.Guide.Name : "") + " - " + (busByDateGuide.Guide != null ? NumberUtil.FormatPhoneNumber(busByDateGuide.Guide.Phone) : "") + "\r\n"; } sheet.Cells[currentRow - 1, 5].Value = booking.PickupAddress; sheet.Cells[currentRow - 1, 10].Value = CurrentUser.FullName; } sheet.DeleteRow(1, totalRow); }
bool CheckMatrixValues(Matrix matrix, float a, float b, float c, float d, float tx, float ty) { return(NumberUtil.Equals(a, matrix.A) && NumberUtil.Equals(b, matrix.B) && NumberUtil.Equals(b, matrix.B) && NumberUtil.Equals(c, matrix.C) && NumberUtil.Equals(tx, matrix.Tx) && NumberUtil.Equals(ty, matrix.Ty)); }
protected void INITWEB( ) { initialize_properties( ) ; if ( nGotPars == 0 ) { entryPointCalled = false; gxfirstwebparm = GetNextPar( ); gxfirstwebparm_bkp = gxfirstwebparm; gxfirstwebparm = DecryptAjaxCall( gxfirstwebparm); if ( context.isSpaRequest( ) ) { disableJsOutput(); } if ( StringUtil.StrCmp(gxfirstwebparm, "dyncall") == 0 ) { setAjaxCallMode(); if ( ! IsValidAjaxCall( true) ) { GxWebError = 1; return ; } dyncall( GetNextPar( )) ; return ; } else if ( StringUtil.StrCmp(gxfirstwebparm, "gxajaxEvt") == 0 ) { setAjaxEventMode(); if ( ! IsValidAjaxCall( true) ) { GxWebError = 1; return ; } gxfirstwebparm = GetNextPar( ); } else if ( StringUtil.StrCmp(gxfirstwebparm, "gxfullajaxEvt") == 0 ) { if ( ! IsValidAjaxCall( true) ) { GxWebError = 1; return ; } gxfirstwebparm = GetNextPar( ); } else { if ( ! IsValidAjaxCall( false) ) { GxWebError = 1; return ; } gxfirstwebparm = gxfirstwebparm_bkp; } if ( ! entryPointCalled && ! ( isAjaxCallMode( ) || isFullAjaxMode( ) ) ) { AV10BR_Demographics_ID = (long)(NumberUtil.Val( gxfirstwebparm, ".")); context.httpAjaxContext.ajax_rsp_assign_attri("", false, "AV10BR_Demographics_ID", StringUtil.LTrim( StringUtil.Str( (decimal)(AV10BR_Demographics_ID), 18, 0))); context.httpAjaxContext.ajax_rsp_assign_attri("", false, "gxhash_vBR_DEMOGRAPHICS_ID", GetSecureSignedToken( "", context.localUtil.Format( (decimal)(AV10BR_Demographics_ID), "ZZZZZZZZZZZZZZZZZZ"), context)); if ( StringUtil.StrCmp(gxfirstwebparm, "viewer") != 0 ) { AV8TabCode = GetNextPar( ); context.httpAjaxContext.ajax_rsp_assign_attri("", false, "AV8TabCode", AV8TabCode); context.httpAjaxContext.ajax_rsp_assign_attri("", false, "gxhash_vTABCODE", GetSecureSignedToken( "", StringUtil.RTrim( context.localUtil.Format( AV8TabCode, "")), context)); } } if ( context.isSpaRequest( ) ) { enableJsOutput(); } } if ( ! context.IsLocalStorageSupported( ) ) { context.PushCurrentUrl(); } }
private static bool IsFixedPosition(IRenderer renderer) { int?positioning = NumberUtil.AsInteger(renderer.GetProperty <Object>(Property.POSITION)); return(Convert.ToInt32(LayoutPosition.FIXED).Equals(positioning)); }
public string GetTotalOfBookingsInMonth(int month, int year) { var totalRevenue = DashBoardBLL.BookingGetTotalRevenueInMonth(month, year, CurrentUser); return(NumberUtil.FormatMoney(totalRevenue)); }
protected void EVT012( ) { if (StringUtil.StrCmp(context.GetRequestMethod( ), "POST") == 0) { if (String.IsNullOrEmpty(StringUtil.RTrim(context.wjLoc)) && (context.nUserReturn != 1) && !wbErr) { /* Read Web Panel buttons. */ sEvt = cgiGet("_EventName"); EvtGridId = cgiGet("_EventGridId"); EvtRowId = cgiGet("_EventRowId"); if (StringUtil.Len(sEvt) > 0) { sEvtType = StringUtil.Left(sEvt, 1); sEvt = StringUtil.Right(sEvt, (short)(StringUtil.Len(sEvt) - 1)); if (StringUtil.StrCmp(sEvtType, "E") == 0) { sEvtType = StringUtil.Right(sEvt, 1); if (StringUtil.StrCmp(sEvtType, ".") == 0) { sEvt = StringUtil.Left(sEvt, (short)(StringUtil.Len(sEvt) - 1)); if (StringUtil.StrCmp(sEvt, "RFR_MPAGE") == 0) { context.wbHandled = 1; dynload_actions( ); } else if (StringUtil.StrCmp(sEvt, "START_MPAGE") == 0) { context.wbHandled = 1; dynload_actions( ); /* Execute user event: E11012 */ E11012(); } else if (StringUtil.StrCmp(sEvt, "REFRESH_MPAGE") == 0) { context.wbHandled = 1; dynload_actions( ); /* Execute user event: E12012 */ E12012(); } else if (StringUtil.StrCmp(sEvt, "LOAD_MPAGE") == 0) { context.wbHandled = 1; dynload_actions( ); /* Execute user event: E13012 */ E13012(); } else if (StringUtil.StrCmp(sEvt, "ENTER_MPAGE") == 0) { context.wbHandled = 1; if (!wbErr) { Rfr0gs = false; if (!Rfr0gs) { } dynload_actions( ); } /* No code required for Cancel button. It is implemented as the Reset button. */ } else if (StringUtil.StrCmp(sEvt, "LSCR") == 0) { context.wbHandled = 1; dynload_actions( ); dynload_actions( ); } } else { } } else if (StringUtil.StrCmp(sEvtType, "M") == 0) { sEvtType = StringUtil.Right(sEvt, (short)(StringUtil.Len(sEvt) - 2)); sEvt = StringUtil.Right(sEvt, (short)(StringUtil.Len(sEvt) - 6)); nCmpId = (short)(NumberUtil.Val(sEvtType, ".")); if (nCmpId == 34) { OldWcrecentlinks = cgiGet("MPW0034"); if ((StringUtil.Len(OldWcrecentlinks) == 0) || (StringUtil.StrCmp(OldWcrecentlinks, WebComp_Wcrecentlinks_Component) != 0)) { WebComp_Wcrecentlinks = getWebComponent(GetType(), "GeneXus.Programs", OldWcrecentlinks, new Object[] { context }); WebComp_Wcrecentlinks.ComponentInit(); WebComp_Wcrecentlinks.Name = "OldWcrecentlinks"; WebComp_Wcrecentlinks_Component = OldWcrecentlinks; } if (StringUtil.Len(WebComp_Wcrecentlinks_Component) != 0) { WebComp_Wcrecentlinks.componentprocess("MPW0034", "", sEvt); } WebComp_Wcrecentlinks_Component = OldWcrecentlinks; } } if (context.wbHandled == 0) { getDataAreaObject().DispatchEvents(); } context.wbHandled = 1; } } } }
public void 引数が2の時はtrue() { Assert.IsTrue(NumberUtil.IsEven(2)); }
int GetBinaryLengthUnchecked() { return((int)NumberUtil.ToLong(vpack, start + 1, TypeCode - 0xbf)); }