public void AddEventToFolder(EventUC eventUC) { Cursor = Cursors.Wait; if (!DoImport(eventUC, false)) { Cursor = Cursors.Arrow; return; } double _h = eventUC.ActualHeight / 10; for (int i = 10; i > 0; i--) { eventUC.Height = i * _h; DoEvents(); Thread.Sleep(50); } VideosCount -= eventUC.VideosCount; PhotosCount -= eventUC.PhotosCount; Rt.RemoveFileChanges(eventUC.Event); m_eventUCs.Remove(eventUC); ShowInfor(); m_currentDevice.Refresh(); Cursor = Cursors.Arrow; }
/// <summary> /// 基準日、変化点、傾きの推計 /// (dt: 基準日の指定, days: 0 でなければ変化日までの日数) /// </summary> /// <param name="localDuration"></param> /// <param name="dt_"></param> /// <returns></returns> private MinParams CalcDecaySubParams1(DateTime dt, int days) { logger.Trace(() => $"\nENTER ---- {Title}, dt={dt._toDateString()}"); // ブレークポイントを仕掛ける場所 if (dt._notValid()) { return(new MinParams()); } double[] rts = Rt; int startIdx = (dt - Dates._first()).Days; double rt0 = Rt._nth(startIdx); // 1st stage var minParam = find_rt1(dt, Rt, startIdx, days); logger.Trace(() => $"{Title}_1: find_rt1: {minParam}"); // rt1 と days の調整: days は STAGE1_MIN_DURATION 以上とする if (minParam.errRt < Constants.MAX_ERROR) { if (minParam.dayIdx < Constants.STAGE1_MIN_DURATION) { int dura = minParam.dayIdx * 2; if (dura > Constants.STAGE1_MIN_DURATION) { dura = Constants.STAGE1_MIN_DURATION; } minParam.extendDaysAndCalcRt1(rt0, dura); } var rt1 = minParam.rt1; // rt2 の調整: rt1 の80%にする //var rt2 = (rt1 > 1) ? 1 + (rt1 - 1) * 0.8 : rt1 * 1.2 - rt0 * 0.2; // rt2 の調整: 上昇中なら上昇分*30%、下降中なら下降分*20%、さらに下げる var rt2 = (rt1 > rt0) ? rt1 - (rt1 - rt0) * 0.3 : rt1 - (rt0 - rt1) * 0.2; minParam.rt2 = rt2._lowLimit(0.001); minParam.ftIdx2 = (minParam.ftIdx1 - Pages.MyChart._decayFactors2Start)._lowLimit(minParam.ftIdx2); minParam.errAve = calcErrByAverage(Constants.AVERAGE_ERR_DURATION, minParam); logger.Trace(() => $"{Title}_2: adjusted duration={Constants.AVERAGE_ERR_DURATION}: {minParam}"); } // both stage int duration = Rt._length() - startIdx - 1; if (duration >= Constants.STAGE2_MIN_DURATION) { var minp = find_both(dt, Rt, startIdx, days); logger.Trace(() => $"{Title}_3: find_both: {minp}"); adjustFactor1AndMakeSubParams(Constants.AVERAGE_ERR_TAIL_DURATION, minp); //if (minp.err < err) if (minp.errAve < minParam.errAve) { minParam = minp; } } //if (a > 0) a *= 0.9; logger.Trace(() => $"LEAVE ---- {Title}_4: {minParam}\n"); // ブレークポイントを仕掛ける場所 return(minParam); }
public PosixPageFileBackedMemoryMapPager(string file, long?initialFileSize = null) { var instanceId = Interlocked.Increment(ref _counter); _file = "/" + Syscall.getpid() + "-" + instanceId + "-" + file; _fd = Rt.shm_open(_file, OpenFlags.O_RDWR | OpenFlags.O_CREAT, (int)FilePermissions.ALLPERMS); if (_fd == -1) { PosixHelper.ThrowLastError(Marshal.GetLastWin32Error()); } SysPageSize = Syscall.sysconf(SysconfName._SC_PAGESIZE); if (initialFileSize.HasValue) { _totalAllocationSize = NearestSizeToPageSize(initialFileSize.Value); } _totalAllocationSize = NearestSizeToPageSize(_totalAllocationSize); var result = Syscall.ftruncate(_fd, _totalAllocationSize); if (result != 0) { PosixHelper.ThrowLastError(result); } NumberOfAllocatedPages = _totalAllocationSize / PageSize; PagerState.Release(); PagerState = CreatePagerState(); }
public async void OnJoinRequest() { if (Rt.TryGet("name", out var name)) { var world = await Database.GetWorld(name.ToUpper()); world.Enter(Player); } }
public override void Dispose() { base.Dispose(); if (_fd != -1) { Syscall.close(_fd); Rt.shm_unlink(_file); _fd = -1; } }
private void ShowLvPosition() { return; Lvdb.Visible = true; var pos = Rt.GetPositionFromCharIndex(Rt.SelectionStart); Lvdb.Left = pos.X + 5; Lvdb.Top = pos.Y + 50; }
public virtual void Send(string value = null, Rt type = Rt.Debug) { if (_report == null) { return; } lock (OutputValues) { OutputValues.Enqueue(new RtMsg() { Message = value, Type = type }); if (_ran) { return; } else { _ran = true; _task = new Task(() => { while (true) { RtMsg v; lock (OutputValues) { if (OutputValues.Count > 0) { v = OutputValues.Dequeue(); } else { _ran = false; break; } } _report(v.Message, v.Type); } }); } _task.Start(); } }
private void ShowEvents() { Cursor = Cursors.Wait; m_defaultEventNameCache = new List <string>(); PhotosCount = 0; VideosCount = 0; m_eventUCs = new ObservableCollection <EventUC>(); listBoxEvent.ItemsSource = m_eventUCs; GroupingEventInterval = m_sliderTicks.ToArray()[(int)sliderEvent.Value].Value; Rt.GroupingByEvent(GroupingEventInterval); Rt.Events.Reverse(); foreach (List <FileChange> _event in Rt.Events) { EventUC _ctl = new EventUC { Event = _event }; _ctl.SetUI(); PhotosCount += _ctl.PhotosCount; VideosCount += _ctl.VideosCount; _ctl.DescribeText = GetDefaultEventName(Rt.DateTimeCache[_event[0].taken_time]); m_eventUCs.Add(_ctl); } DoEvents(); DataTemplate _dataTemplate = FindResource("SbPreviewTemplate") as DataTemplate; listBoxEvent.SetValue(ScrollingPreviewService.VerticalScrollingPreviewTemplateProperty, _dataTemplate); ShowInfor(); GC.Collect(); SetEventIntervalTypeText(); }
public async void OnAccountLogin() { if (Rt.TryGet("tankIDName", out var name) && Rt.TryGet("tankIDPass", out var password)) { Player.Name = name; Player.Password = password; if (await Database.ValidatePlayer(Player)) { Console.WriteLine("An Account Logged In\n" + $" [-] Username = {name}\n" + $" [-] Password = {password}\n"); Player.SendLogin(); } } }
public int CompareTo(object obj) { Edge other = (Edge)obj; int c1 = Lt.CompareTo(other.Lt); int c2 = Rt.CompareTo(other.Rt); if (c1 != 0) { return(c1); } if (c2 != 0) { return(c2); } return(Wt - other.Wt); }
public InfectData ShiftStartDate(DateTime startDt) { InfectData data = Clone(); int idx = Dates._findIndex(startDt); if (idx > 0) { data.Dates = Dates.Skip(idx).ToArray(); data.Newly = Newly.Skip(idx).ToArray(); data.DistNewly = DistNewly.Skip(idx).ToArray(); data.Average = Average.Skip(idx).ToArray(); data.PosiRates = PosiRates.Skip(idx).ToArray(); data.Rt = Rt.Skip(idx).ToArray(); data.Serious = Serious.Skip(idx).ToArray(); data.SeriousEx = SeriousEx.Skip(idx).ToArray(); } return(data); }
public void OnDrop() { var pair = Rt.Get(1); if (pair.Values.Count == 2 && pair.Value == "itemID") { if (int.TryParse(pair.Values[1], out var id)) { int x = (int)(Player.Pos.X + (Player.RotatingLeft ? -32 : 32)) / 32, y = (int)(Player.Pos.Y) / 32; if (World.Blocks[x + y * World.Width].Fg.CollisionType == 1) { Player.SendTextOverlay("You can't drop that here, face somewhere with open space."); Player.SendSound("cant_place_tile"); return; } if (Player.Inventory.Find(id, out var amount)) { DialogBuilder db = new DialogBuilder(); db.SetDefaultColor() .AddLabelWithIcon($"`wDrop {Tile.Parse(id).Name}``", id, false) .AddTextBox("How many to drop?") .AddTextInput("count", "", amount.ToString(), 5) .AddEmbedData("itemID", id) .EndDialog("drop", "Cancel", "OK"); Player.SendDialog(db); } else { Player.Disconnect(); } } else { Player.Disconnect(); } } else { Player.Disconnect(); } }
private void Form1_Load(object sender, EventArgs e) { // DeleteAllDataFromAllTables(); // return; Glob.EnableNearWordsEntry = false; lblStatus.Visible = false; GetSettings(); GetSettings(); PopulateUnAllowedWords(); if (UseListBox) { lstDBItems.Visible = true; Lvdb.Visible = false; } else { lstDBItems.Visible = false; Lvdb.Visible = true; //Lvdb.Columns.Add("SC", 60, HorizontalAlignment.Left); //Lvdb.Columns.Add("Name", 240, HorizontalAlignment.Left); //Lvdb.Columns.Add("Freq", 60, HorizontalAlignment.Left); //Lvdb.Columns.Add("Id", 60, HorizontalAlignment.Left); Lvdb.Columns.Add("", 60, HorizontalAlignment.Left); Lvdb.Columns.Add("", 240, HorizontalAlignment.Left); Lvdb.Columns.Add("", 60, HorizontalAlignment.Left); Lvdb.Columns.Add("", 60, HorizontalAlignment.Left); Lvdb.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.None; Lvdb.View = View.Details; } LoadHotStrings(); Rt.SelectionStart = Rt.TextLength; Rt.Focus(); Rt.Focus(); // LoadData(string.Empty); }
public void OnGuestLogin() { if (Rt.TryGet("requestedName", out var requestedName)) { Player.RequestedName = requestedName; DialogBuilder db = new DialogBuilder(); db.SetDefaultColor() .AddBigLabel("Create account") .AddSmallSpacer() .AddTextInput("username", "Username:"******"", 15) .AddTextInput("password", "Password:"******"", 15) .AddSmallSpacer() .EndDialog("account", "", "OK"); Player.SendDialog(db); } }
public Rt Add(Rt rtf) { this.text += rtf.text; return this; }
public static Rt Block(string tag, Rt rtf) { return new Rt("{" + Tag(tag).text + rtf.text + "}"); }
public void SetFromScreenPos(Vector2 screenPos) { var localPos = LocalFromScreenPos(screenPos); Rt.SetPos(localPos); }