public TimeChangeMonitor(DateTime disposeTime) { this._createTime = DateTime.Now; this._activityTime = this._createTime; this._disposeTime = disposeTime; this._timeType = TimeType.Absolute_Time; }
public TimeChangeMonitor(TimeSpan spanTime) { this._createTime = DateTime.Now; this._activityTime = this._createTime; this._spanTime = spanTime; this._timeType = TimeType.Relative_Time; }
/// <summary> /// Creates Scada from file /// </summary> /// <param name="fileName">File name</param> /// <param name="dataConsumer">Data consumer</param> /// <param name="timeType">Time type</param> /// <param name="isAbsoluteTime">The "is absolute time" sign</param> /// <param name="realtimeStep">Realtime Step</param> /// <returns>Scada</returns> public static IScadaInterface ScadaFromFile(this string fileName, string dataConsumer, TimeType timeType, bool isAbsoluteTime, IAsynchronousCalculation realtimeStep) { IDesktop desktop = fileName.DesktopFromFile(); return(desktop.ScadaFromDesktop(dataConsumer, timeType, isAbsoluteTime, realtimeStep)); }
/// <summary> /// Creates Scada from stream /// </summary> /// <param name="stream">Stream</param> /// <param name="dataConsumer">Data consumer</param> /// <param name="timeType">Time type</param> /// <param name="isAbsoluteTime">The "is absolute time" sign</param> /// <param name="realtimeStep">Realtime Step</param> /// <returns>Scada</returns> public static IScadaInterface ScadaFromBytes(this System.IO.Stream stream, string dataConsumer, TimeType timeType, bool isAbsoluteTime, IAsynchronousCalculation realtimeStep) { IDesktop desktop = stream.DesktopFromStream(); return(desktop.ScadaFromDesktop(dataConsumer, timeType, isAbsoluteTime, realtimeStep)); }
/// <summary> /// Creates Scada from bytes /// </summary> /// <param name="buffer">Buffer</param> /// <param name="dataConsumer">Data consumer</param> /// <param name="timeType">Time type</param> /// <param name="isAbsoluteTime">The "is absolute time" sign</param> /// <param name="realtimeStep">Realtime Step</param> /// <returns>Scada</returns> public static IScadaInterface ScadaFromBytes(this byte[] buffer, string dataConsumer, TimeType timeType, bool isAbsoluteTime, IAsynchronousCalculation realtimeStep) { IDesktop desktop = buffer.DesktopFromBytes(); return(desktop.ScadaFromDesktop(dataConsumer, timeType, isAbsoluteTime, realtimeStep)); }
public DateTime DateAdd(TimeType Identificador, DateTime Fecha, double Valor) { try { switch (Identificador) { case TimeType.Segundos: return(Fecha.AddSeconds(Valor)); case TimeType.Minutos: return(Fecha.AddMinutes(Valor)); case TimeType.Horas: return(Fecha.AddHours(Valor)); case TimeType.Dias: return(Fecha.AddDays(Valor)); case TimeType.Meses: return(Fecha.AddMonths(Convert.ToInt16(Valor))); case TimeType.Años: return(Fecha.AddYears(Convert.ToInt16(Valor))); default: return(Fecha.AddMilliseconds(Valor)); } } catch (Exception) { return(Fecha); } }
public static string ConvertTimeFormat(int InTime, TimeType InType = TimeType.hhmmss) { switch (InType) { case TimeType.hhmmss: { int hour = InTime / 3600; int minute = InTime % 3600 / 60; int second = InTime % 60; return((hour > 9 ? "" : "0") + hour + (minute > 9 ? ":" : ":0") + minute + (second > 9 ? ":" : ":0") + second); } case TimeType.mmss: { int minute = InTime % 3600 / 60; int second = InTime % 60; return((minute > 9 ? "" : "0") + minute + (second > 9 ? ":" : ":0") + second); } case TimeType.ss: return(InTime > 9 ? InTime.ToString() : "0" + InTime); default: return(string.Empty); } }
private static Tuple <long, long> GetDiff(TimeType type, int value, DateTime time) { Func <TimeType, long> func1 = p => { switch (p) { //case TimeType.Millisecond: return 1000; case TimeType.Second: return(1000 * 60); case TimeType.Minute: return(1000 * 60 * 60); case TimeType.Hours: return(1000 * 60 * 60 * 24); default: throw new Exception("error type,not supported"); } }; Func <int, int, long> func2 = (p, q) => p > value ? (value + q - p) : (value - p); switch (type) { //case TimeType.Millisecond: return Tuple.Create(func2(time.Millisecond, 1000), func1(type)); case TimeType.Second: return(Tuple.Create(1000 * func2(time.Second, 60), func1(type))); case TimeType.Minute: return(Tuple.Create(1000 * 60 * func2(time.Minute, 60), func1(type))); case TimeType.Hours: return(Tuple.Create(1000 * 60 * 60 * func2(time.Hour, 24), func1(type))); default: throw new Exception("error type,not supported"); } }
/// <summary> /// Initialises a new instance of the <see cref="LabelGenerationViewModel"/> class. /// </summary> /// <param name="model">junior handicap model</param> /// <param name="normalisationConfigManager">normalisation configuration manager</param> /// <param name="seriesConfigManager">series configuration manager</param> /// <param name="logger">application logger</param> /// <param name="saveFolder">folder to save the output to</param> public LabelGenerationViewModel( IModel model, INormalisationConfigMngr normalisationConfigManager, ISeriesConfigMngr seriesConfigManager, IJHcLogger logger, string saveFolder) { this.model = model; this.seriesConfigManager = seriesConfigManager; this.logger = logger; SaveFolder = saveFolder; NormalisationConfigType hcConfiguration = normalisationConfigManager.ReadNormalisationConfiguration(); // TODO, this is repeated code, see HandicapWriter.cs foreach (AthleteDetails athlete in model.Athletes.AthleteDetails) { TimeType newHandicap = model.CurrentSeason.GetAthleteHandicap(athlete.Key, hcConfiguration); // Only look at active athletes. if (athlete.Active) { List <string> runningNumbers = model.Athletes.GetAthleteRunningNumbers(athlete.Key); // Use default handicap, if the athlete is not registered for the current season. // TODO, I suspect this should never happen??? if (newHandicap == null) { newHandicap = athlete.RoundedHandicap; } // Ensure that the athlete is registered for the season. if (runningNumbers.Count > 0) { AthleteLabel modelAthlete = new AthleteLabel( athlete.Name, athlete.Club, runningNumbers[0], newHandicap, athlete.Appearances == 0); modelAthlete.AthleteLabelWidth = A4Details.GetLabelWidth96DPI(NoColumns); modelAthlete.AthleteLabelHeight = A4Details.GetLabelHeight96DPI(NoRows); this.AthleteDetails.Add(modelAthlete); } } } // Order the athletes alphabetically. this.AthleteDetails = this.AthleteDetails.OrderBy(athlete => athlete.Forename).ToList(); this.AthleteDetails = this.AthleteDetails.OrderBy(athlete => athlete.Surname).ToList(); this.saveDirectory = saveFolder; this.CreateRaceLabelsCommand = new CreateAndSaveRaceLabelsCmd(this); this.CreateSpareLabelsCommand = new CreateAndSaveSpareLabelsCmd(this); this.CreateAllLabelsCommand = new CreateAndSaveAllLabelsCmd(this); }
public HltbRule(string name, float minHours, float maxHours, TimeType timeType) { Name = name; MinHours = minHours; MaxHours = maxHours; TimeType = timeType; }
public ConductorOrder_GameObject_MoveToPlanarRotation(GameObject t, float e, float s, TimeType tt) : base(t) { end = e; speed = s; time_type = tt; }
public ConductorOrder_GameObject_MoveToLocalPlanarPosition(GameObject t, Vector2 e, float s, TimeType tt) : base(t) { end = e; speed = s; time_type = tt; }
protected override void OnDeserialiseComplete() { TimeType type; LapTime = DeserialiseLapTimeInfo(out type); LapTimeType = type; }
private void btnStart_Click(object sender, EventArgs e) { if (!IsValidInput(txtEventTime.Text)) { lblTimeRemaining.Text = "'" + txtEventTime.Text + "'" + Constants.InvalidInput; return; } // TODO validate input var inputTime = txtEventTime.Text; TimeType timeType = (TimeType)cmbTimeType.SelectedItem; _remainingTime = TimeTypeHelper.GetTimeSpan(inputTime, timeType); _timerEvent.Start(); txtEventTime.Enabled = false; cmbEventType.Enabled = false; cmbTimeType.Enabled = false; btnStart.Enabled = false; btnCancel.Enabled = true; this.btnCancel.Focus(); RefreshUI(); }
/// <summary> /// Realtime analysis enumerable /// </summary> /// <param name="dataConsumer">Data consumer</param> /// <param name="readers">Input</param> /// <param name="stop">Stop function</param> /// <param name="reason">Reason</param> /// <param name="timeType">Time type</param> /// <param name="isAbsoluteTime">The absolute time "sign"</param> /// <returns>The enumerable</returns> public static IEnumerable <object> RealtimeAnalysisEnumerableDirectory(this IDataConsumer dataConsumer, ILogReaderCollection readers, Func <object, bool> stop, string reason, TimeType timeType, bool isAbsoluteTime) { IComponentCollection cc = dataConsumer.CreateCollection(reason); cc.ForEach((ICalculationReason re) => { re.CalculationReason = reason; }); cc.ForEach((IRealTimeStartStop ss) => { ss.Start(); }); IEnumerable <ILogReader> r = readers.Readers; foreach (ILogReader reader in r) { cc.ForEach((IRealTimeStartStop ss) => { ss.Start(); }); IEnumerable <object> en = dataConsumer.RealtimeAnalysisEnumerable(reader, stop, reason, timeType, isAbsoluteTime); object ob = null; foreach (object o in en) { ob = o; } yield return(ob); cc.ForEach((IRealTimeStartStop ss) => { ss.Stop(); }); } cc.ForEach((IRealTimeStartStop ss) => { ss.Stop(); }); }
public CooldownComponent(TimeType type, int value = 0) { ComponentType = AbilityComponentType.Cooldown; Type = type; Value = value; Setup(); }
private long EllapsedMicroseconds(TimeType type) { BoardException.ValidateResult( Utilities.GpioTime(type, out var seconds, out var microseconds)); return((seconds * SecondsToMicrosFactor) + microseconds); }
public EventTime(TimeType timeType, DurationType?durationType = null, DateTime?start = null, DateTime?end = null, int?duration = null) { TimeType = timeType; switch (timeType) { case TimeType.Date: { Guard.Against.Null(start, nameof(start)); Guard.Against.Null(end, nameof(end)); Start = start; End = end; DurationType = null; Duration = null; break; } case TimeType.Duration: { Guard.Against.Null(durationType, nameof(durationType)); Guard.Against.Null(duration, nameof(duration)); Guard.Against.OutOfRange(duration.Value, nameof(duration), 1, int.MaxValue); DurationType = durationType; Duration = duration; Start = null; End = null; break; } } }
/// <summary> /// Creates a new instance of the AthleteDetails class /// </summary> /// <param name="key">unique key</param> /// <param name="name">athlete's name</param> /// <param name="club">athlete's club</param> /// <param name="roundedHandicap">rounded handicap</param> /// <param name="sex">athlete's sex</param> /// <param name="birthYear">birth year, no longer recorded</param> /// <param name="birthMonth">birth month, no longer recorded</param> /// <param name="birthDay">birth day, no longer recorded</param> /// <param name="signedConsent"> /// indicates whether the parental consent form has been signed /// </param> /// <param name="active">active</param> /// <param name="normalisationConfigManager">normalisation config manager</param> public AthleteDetails( int key, string name, string club, TimeType roundedHandicap, SexType sex, string birthYear, string birthMonth, string birthDay, bool signedConsent, bool active, INormalisationConfigMngr normalisationConfigManager) { this.Key = key; this.Name = name; this.Club = club; this.PredeclaredHandicap = roundedHandicap; this.Sex = sex; this.SignedConsent = signedConsent; this.Active = active; this.RunningNumbers = new List <string>(); this.Times = new List <Appearances>(); this.BirthDate = new DateOfBirth( birthYear, birthMonth, birthDay); this.normalisationConfigMngr = normalisationConfigManager; }
public static TimeSpan GetTimeSpan(string time, TimeType type) { TimeSpan timeSpan; int timeInteger = Convert.ToInt32(time); switch (type) { case TimeType.Seconds: timeSpan = new TimeSpan(0, 0, timeInteger); break; case TimeType.Minutes: timeSpan = new TimeSpan(0, timeInteger, 0); break; case TimeType.Hours: timeSpan = new TimeSpan(timeInteger, 0, 0); break; case TimeType.Days: timeSpan = new TimeSpan(timeInteger, 0, 0, 0, 0); break; default: timeSpan = new TimeSpan(); break; } return(timeSpan); }
private OriginalBdtCasMessage GetGenerateObject() { this.timeStamp = new TimeType(); this.timeStamp.c_seconds = 1; this.timeStamp.seconds = 1; this.timeStamp.minutes = 1; this.timeStamp.hours = 1; this.timeStamp.day = 1; this.timeStamp.month = 1; this.timeStamp.year = 1; this.systemTracks = new List <TrackData>(); var trackData = new TrackData(); trackData.trackID = 1; trackData.trackState = State.NewTrack; trackData.creationTime = new TimeType(); trackData.creationTime.c_seconds = 1; trackData.creationTime.seconds = 1; trackData.creationTime.minutes = 1; trackData.creationTime.hours = 1; trackData.creationTime.day = 1; trackData.creationTime.month = 1; trackData.creationTime.year = 1; trackData.relativeBearing = 1; trackData.relativeBearingRate = 1; this.systemTracks.Add(trackData); return(new OriginalBdtCasMessage(this.timeStamp, this.systemTracks)); }
public OriginalBdtCasMessage(TimeType timeStamp, List <TrackData> systemTracks) { this.timeStamp = new TimeType(); this.timeStamp.c_seconds = timeStamp.c_seconds; this.timeStamp.seconds = timeStamp.seconds; this.timeStamp.minutes = timeStamp.minutes; this.timeStamp.hours = timeStamp.hours; this.timeStamp.day = timeStamp.day; this.timeStamp.month = timeStamp.month; this.timeStamp.year = timeStamp.year; this.systemTracks = new List <TrackData>(); for (int i = 0; i < systemTracks.Count; i++) { TrackData trackData = new TrackData(); trackData.trackID = systemTracks[i].trackID; trackData.trackState = systemTracks[i].trackState; trackData.creationTime = new TimeType(); trackData.creationTime.c_seconds = timeStamp.c_seconds; trackData.creationTime.seconds = timeStamp.seconds; trackData.creationTime.minutes = timeStamp.minutes; trackData.creationTime.hours = timeStamp.hours; trackData.creationTime.day = timeStamp.day; trackData.creationTime.month = timeStamp.month; trackData.creationTime.year = timeStamp.year; trackData.relativeBearing = systemTracks[i].relativeBearing; trackData.relativeBearingRate = systemTracks[i].relativeBearingRate; this.systemTracks.Add(trackData); } }
public CooldownComponent() { ComponentType = AbilityComponentType.Cooldown; Type = TimeType.None; Value = 0; Setup(); }
/// <summary> /// Sort with insertion algorithm on float values. /// </summary> public static long Time(float[] array, TimeType type) { //copy whole array var copiedArray = new float[array.Length]; for (int i = 0; i < copiedArray.Length; i++) { copiedArray[i] = array[i]; } var stopwatch = new Stopwatch(); //creates stopwatch stopwatch.Start(); //start stopwatch Insertion(copiedArray); //sort array stopwatch.Stop(); //stop stopwatch switch (type) { case TimeType.Miliseconds: return(stopwatch.ElapsedMilliseconds); //return number of miliseconds counted while sorting array case TimeType.Ticks: return(stopwatch.ElapsedTicks); //return number of ticks counted while sorting array default: return(0); } }
//работа с просрочкой private void GetOverdueInDB(DateTime curDateTime) { OverdueTaskIDs.Clear(); foreach (DataRow dr in cConfig.dsConfig.Tables["Tasks"].Rows) { string sNext = (string)dr["NextDateTime"]; DateTime dtNext = cTask.InternalStringToDT(sNext); curDateTime = new DateTime(curDateTime.Year, curDateTime.Month, curDateTime.Day, curDateTime.Hour, curDateTime.Minute, 0); string LastRun = (string)dr["LastRun"]; int ID = (int)dr["ID"]; TimeType TaskTimeType = (TimeType)dr["TimeType"]; bool Active = (bool)dr["Active"]; if (!Active) { continue; } if (LastRun == string.Empty) //задача не разу не выполнялась { //сравниваем дату следующего выполнения с заданной //заданная больше - задание просрочено if (curDateTime > dtNext) { OverdueTaskIDs.Add(ID); dr["Overdue"] = true; } } else //задание выполнялось { //задание одноразовое и выполнялось //не просрочено if (TaskTimeType == TimeType.One) { continue; } //сравниваем дату следующего выполнения с заданной //заданная больше - задание просрочено if (curDateTime > dtNext) { OverdueTaskIDs.Add(ID); dr["Overdue"] = true; } } } if (OverdueTaskIDs.Count > 0) { if (OnOverdueTaskDetected != null) { OnOverdueTaskDetected(this); } } }
/// <summary> /// Get the type of time based on an enum. /// </summary> internal static float GetTime(this TimeType timeType) { switch (timeType) { case TimeType.Time: return(Time.time); case TimeType.Delta: return(Time.deltaTime); case TimeType.Fixed: return(Time.fixedDeltaTime); case TimeType.UnscaledDelta: return(Time.unscaledDeltaTime); case TimeType.UnscaledFixed: return(Time.fixedUnscaledDeltaTime); case TimeType.UnscaledTime: return(Time.unscaledTime); case TimeType.UnscaledFixedTime: return(Time.fixedUnscaledTime); default: return(Time.deltaTime); } }
public HltbRule(HltbRule other) { Name = other.Name; MinHours = other.MinHours; MaxHours = other.MaxHours; TimeType = other.TimeType; }
/// <summary> /// Start /// </summary> /// <param name="collection">Components</param> /// <param name="timeUnit">Time unit</param> /// <param name="isAbsoluteTime">Components</param> /// <param name="realtimeStep">Realtime step</param> /// <param name="dataConsumer">Data consumer</param> public static IRealtime StartRealtime(this IComponentCollection collection, TimeType timeUnit, bool isAbsoluteTime, IAsynchronousCalculation realtimeStep, IDataConsumer dataConsumer, IEventLog log, string reason) { if (reason.Equals(StaticExtensionEventInterfaces.Realtime)) { if (currentRuntime != null) { throw new Exception(); } start(reason); currentRuntime = Runtime.Start(collection, timeUnit, isAbsoluteTime, realtimeStep, dataConsumer, log, reason); if (currentRuntime == null) { stop(); } } else { start(reason); return(Runtime.Start(collection, timeUnit, isAbsoluteTime, realtimeStep, dataConsumer, log, reason)); } return(currentRuntime); }
/// <summary> /// 開始時間計算式 /// </summary> /// <param name="startTime">時間計算式</param> /// <param name="gap">填空項目</param> /// <param name="index">控件索引ID</param> /// <returns>HTML模板信息</returns> private string GetStartTimeHtml(TimeType startTime, GapFilling gap, int index) { var html = string.Empty; html += string.Format(SPAN_TIME_NUM_HTML_FORMAT, "现在是"); // 如果是填空項目 if (gap == GapFilling.Left) { // 小時 html += string.Format(INPUT_HTML_ON_SCRIPT_FORMAT, index.ToString().PadLeft(2, '0'), "0", Consts.HR_UNIT); html += SPAN_COLON_HTML; // 分鐘 html += string.Format(INPUT_HTML_ON_SCRIPT_FORMAT, index.ToString().PadLeft(2, '0'), "1", Consts.MIN_UNIT); html += SPAN_COLON_HTML; // 秒 html += string.Format(INPUT_HTML_ON_SCRIPT_FORMAT, index.ToString().PadLeft(2, '0'), "2", Consts.SEC_UNIT); // 題型答案 html += string.Format(INPUT_ANSWER_HTML_FORMAT, index.ToString().PadLeft(2, '0'), Base64.EncodeBase64(startTime.HMSValue)); } else { // 時間顯示(eg: 09:23:03) html += string.Format(SPAN_TIME_NUM_HTML_FORMAT, startTime.HMSValue); } return(html); }
public Time GetTime(TimeType type) { #region Require if (IsDisposed) { throw new ObjectDisposedException("OutputStream"); } #endregion Time t = new Time(); t.type = (int)type; lock (lockObject) { int result = midiStreamPosition(Handle, ref t, Marshal.SizeOf(typeof(Time))); if (result != MidiDeviceException.MMSYSERR_NOERROR) { throw new OutputDeviceException(result); } } return(t); }
public static void SetTimeScale(TimeType type, double scale) { if (type == TimeType.Normal) { throw new UnityException("Cannot modify Normal time scale! Use other existing TimeTypes or create a new TimeType instead."); } timeScale[(int)type] = scale; }
public static float GetTime(TimeType type) { if(Time.timeScale != 0.0f) { return Time.deltaTime * m_ActualTimeDilatations[(int)type]; } else { return Time.fixedDeltaTime * m_ActualTimeDilatations[(int)type]; } }
public ActionResult Create(TimeType timetype) { if (ModelState.IsValid) { db.TimeTypes.Add(timetype); db.SaveChanges(); return RedirectToAction("Index"); } return View(timetype); }
private static int remaining(TimeType T, int myTime, int movesToGo, int ply, int slowMover) { var TMaxRatio = (T == TimeType.OptimumTime ? 1 : MaxRatio); var TStealRatio = (T == TimeType.OptimumTime ? 0 : StealRatio); var moveImportance = (move_importance(ply)*slowMover)/100; double otherMovesImportance = 0; for (var i = 1; i < movesToGo; ++i) { otherMovesImportance += move_importance(ply + 2*i); } var ratio1 = (TMaxRatio*moveImportance)/(TMaxRatio*moveImportance + otherMovesImportance); var ratio2 = (moveImportance + TStealRatio*otherMovesImportance)/(moveImportance + otherMovesImportance); return (int) (myTime*Math.Min(ratio1, ratio2)); // Intel C++ asks an explicit cast }
protected override void OnDeserialiseComplete() { TimeType type; BestLap = DeserialiseLapTimeInfo(out type); BestLapType = type; }
protected override void OnDeserialiseComplete() { TimeType type; PeriodTime = DeserialiseLapTimeInfo(out type); PeriodTimeType = type; }
private void RemoveAllTimeBase(TimeType type) { for (int i = 0, count = timeList.Count; i < count; i++) { if (type == TimeType.None || timeList[i].type == type) { timeList[i].isRemove = true; } } }
public static double GetTimeScale(TimeType type) { return timeScale[(int)type]; }
public static double GetDeltaTime(TimeType type) { return Time.deltaTime * timeScale[(int)type]; }
public void HydrateFromBinary(BTVersion version, byte[] btBuf, int offset, int len) { var index = offset; if (len != 52) throw new Exception("BTRecipe.HydrateFromBinary: Buffer Size Error."); // recipe slot Slot = btBuf[index++]; // recipe units Units = (BTUnits)btBuf[index++]; // name byte[] nameArray = new byte[BTConfig.RecipeNameSize]; int i; for (i = 0; i < BTConfig.RecipeNameSize; i++) { nameArray[i] = btBuf[index++]; if (nameArray[i] < 0x20) nameArray[i] = (byte)' '; } Debug.Assert(btBuf[index] == 0, "btBuf[index] == 0"); index++; ASCIIEncoding encoder = new ASCIIEncoding(); Name = encoder.GetString(nameArray).Trim(); // mash steps DoughIn, Acid Rest, Protein Rest, Sacch1 Rest, Sacch2 Rest, Mash Out // PreHeat is handled separately foreach (var mashStep in MashSteps.Where(mashStep => mashStep.Key != MashStepID.PreHeat)) { mashStep.Value.step_temperature = new TemperatureType { Value = btBuf[index++], degrees = Units == BTUnits.US ? TemperatureUnitType.F : TemperatureUnitType.C }; mashStep.Value.step_time = new TimeType { Value = btBuf[index++], duration = TimeUnitType.min }; } // mash heat source MashHeatSource = (BTVesselID)btBuf[index++]; // sparge temp SpargeTemp = new TemperatureType { Value = btBuf[index++], degrees = Units == BTUnits.US ? TemperatureUnitType.F : TemperatureUnitType.C }; // pitch temp PitchTemp = new TemperatureType { Value = btBuf[index++], degrees = Units == BTUnits.US ? TemperatureUnitType.F : TemperatureUnitType.C }; // HLT Setpoint HLTSetpoint = new TemperatureType { Value = btBuf[index++], degrees = Units == BTUnits.US ? TemperatureUnitType.F : TemperatureUnitType.C }; // batch volume decimal dVal = (btBuf[index++] << 24) | (btBuf[index++] << 16) | (btBuf[index++] << 8) | (btBuf[index++] << 0); BatchVolume = new VolumeType { Value = dVal / 1000, volume = Units == BTUnits.US ? VolumeUnitType.gal : VolumeUnitType.l }; // grain weight dVal = (btBuf[index++] << 24) | (btBuf[index++] << 16) | (btBuf[index++] << 8) | (btBuf[index++] << 0); GrainWeight = new MassType { Value = dVal / 1000, mass = (Units == BTUnits.US) ? MassUnitType.lb : MassUnitType.kg }; // boil time BoilTime = new TimeType { Value = (btBuf[index++] << 8) | (btBuf[index++] << 0), duration = TimeUnitType.min }; // mash ratio dVal = (btBuf[index++] << 8) | (btBuf[index++] << 0); MashRatio = dVal / 100; // boil additions Additions = (UInt16)((btBuf[index++] << 8) + (btBuf[index++] << 0)); Debug.Assert(index == offset + len, "index == offset + len"); }
public ActionResult Edit(TimeType timetype) { if (ModelState.IsValid) { db.Entry(timetype).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } return View(timetype); }
private void RemoveTimeBase(object func, TimeType type) { for (int i = 0, count = timeList.Count; i < count; i++) { if (timeList[i].type == type && timeList[i].func.Equals(func)) { timeList[i].isRemove = true; return; } } }
public TimeBase(TimeType t) { type = t; }
public static float GetTimeDilatation(TimeType type) { return m_DesiredTimeDilatations[(int)type]; }
public static void SetTimeDilatation(TimeType type, float dilatation) { m_DesiredTimeDilatations[(int)type] = dilatation; UpdateDilatations(); }
public bool SetTime(TimeType type, int time=0, bool delay=false) { switch (type) { case TimeType.INCREASE: gameClock += 2; break; case TimeType.END_DAY: gameClock = END_DAY_HOUR; break; default: if (time >= 6 && time <= 24) { gameClock = time; } break; } bool midnight = Midnight(); SetTime(gameClock, delay); return midnight; }