private Task<NugetResult> findDependenciesFor(Dependency dependency, UpdateMode mode, int depth, SearchLocation location, List<Dependency> dependencies) { var result = findLocal(dependency, location); return Task.Factory.StartNew(() => { if (result.Found) { processNuget(result.Nuget, dependency, mode, depth, location, dependencies); return result; } var search = NugetSearch.Find(_solution, dependency); search.ContinueWith(task => { if (!task.Result.Found) { return; } result.Import(task.Result); var nuget = task.Result.Nuget; processNuget(nuget, dependency, mode, depth, location, dependencies); }, TaskContinuationOptions.NotOnFaulted | TaskContinuationOptions.AttachedToParent); return result; }, TaskCreationOptions.AttachedToParent); }
public Dependency(string name, string version, UpdateMode mode) { Name = name; Version = version ?? string.Empty; Mode = mode; }
public Dependency(string name, string version, UpdateMode mode) { Name = name; Version = version ?? string.Empty; Mode = mode; Stability = NugetStability.Anything; }
/// <summary> /// /// </summary> public vp_Spring(Transform transform, UpdateMode mode, bool autoUpdate = true) { Mode = mode; Transform = transform; m_AutoUpdate = autoUpdate; }
/// <inheritdoc/> public override void UpdateShape(MapView mapView, UpdateMode mode, bool lazyUpdate) { ClipShape(mapView, mode, lazyUpdate); if (NeedsUpdate(lazyUpdate, mode)) base.UpdateShape(mapView, mode, lazyUpdate); this.StrokeThickness = mapView.CurrentScale; }
public AssemblyUpdate(string version, string fullVesion, UpdateMode mode) { _version = version; _fullVersion = fullVesion; _updateMode = mode; _excludedFiles = new List<string>(); LoadExcludedFiles(Path.Combine( Application.StartupPath, "ExcludeFromUpdate.txt")); }
public static IFeatureRepository Get(UpdateMode updateMode, string url) { switch (updateMode) { case UpdateMode.Pull: return new Pull(url); case UpdateMode.Push: return new Push(url); } throw new Exception("Invalid update mode specified"); }
// Almost entirely covered by integration tests public IEnumerable<Dependency> DependenciesFor(Dependency dependency, UpdateMode mode, SearchLocation location = SearchLocation.Remote) { var cache = mode == UpdateMode.Fixed ? _dependenciesForFixedCache : _dependenciesForFloatCache; IEnumerable<Dependency> dependencies; if (cache.TryGetValue(dependency, out dependencies) == false) { dependencies = findDependenciesFor(dependency, mode, 0, location); cache[dependency] = dependencies; } return dependencies.ToArray(); }
public static String getUpdateModeString(UpdateMode update_mode) { switch(update_mode) { case UpdateMode.UPDATEMODE_NEVER: return "never"; case UpdateMode.UPDATEMODE_MANUAL: return "manual"; case UpdateMode.UPDATEMODE_ONCHANGE: return "on change"; case UpdateMode.UPDATEMODE_PERIODIC: return "periodic"; default: return "unknown"; } }
/// <inheritdoc/> public override void Update(UpdateMode updateMode) { switch (updateMode) { case UpdateMode.Refresh: Children.Clear(); foreach (var location in Locations) { // calculate ptv location in canvas units Point canvasPoint = GeoToCanvas(new Point(location.Longitude, location.Latitude)); // Create the ellipse and insert it to our canvas Ellipse ellipse = new Ellipse { Width = SymbolSize, Height = SymbolSize, Fill = new SolidColorBrush(SymbolColor), Stroke = new SolidColorBrush(Colors.Black), }; // set position and add to map Canvas.SetLeft(ellipse, canvasPoint.X - SymbolSize / 2); Canvas.SetTop(ellipse, canvasPoint.Y - SymbolSize / 2); ellipse.RenderTransform = adjustTransform; ellipse.RenderTransformOrigin = new Point(0, 0); // higlight ellipse (only for main map) if (MapView.Name == "Map") { ellipse.MouseEnter += new System.Windows.Input.MouseEventHandler(ellipse_MouseEnter); ellipse.MouseLeave += new System.Windows.Input.MouseEventHandler(ellipse_MouseLeave); } // add ellipse to canvas this.Children.Add(ellipse); } goto case UpdateMode.WhileTransition; case UpdateMode.WhileTransition: adjustTransform.ScaleX = this.MapView.CurrentScale; adjustTransform.ScaleY = this.MapView.CurrentScale; break; } }
private IEnumerable<Dependency> findDependenciesFor(Dependency dependency, UpdateMode mode, SearchLocation location) { var dependencies = new List<Dependency>(); var task = findDependenciesFor(dependency, mode, 0, location, dependencies); try { task.Wait(); if (!task.Result.Found) { RippleAssert.Fail("Could not find " + dependency.Name); } } catch (AggregateException ex) { var flat = ex.Flatten(); if (flat.InnerException != null) { RippleLog.Debug(flat.InnerException.Message); } } return dependencies.OrderBy(x => x.Name); }
/// <summary> Vector-based rendering for deeper zoom levels. </summary> /// <param name="updateMode"></param> public override void Update(UpdateMode updateMode) { if (updateMode != UpdateMode.Refresh && updateMode != UpdateMode.BeginTransition) return; //var rect = Map.GetFinalEnvelopeLatLon(); //Children.Clear(); //var ellipseSize = SymbolSize * Map.FinalScale; //foreach (var location in Locations) //{ // var wgsPoint = new Point(location.Longitude, location.Latitude); // if (!rect.Contains(wgsPoint)) // continue; // // calculate ptv location in ptv mercator units // Point canvasPoint = GeoToCanvas(wgsPoint); // // Create the ellipse and insert it to our canvas // Ellipse ellipse = new Ellipse // { // Width = ellipseSize, // Height = ellipseSize, // Fill = new SolidColorBrush(SymbolColor), // }; // ellipse.ToolTip = "I'm a WPF element"; // // set position and add to map // Canvas.SetLeft(ellipse, canvasPoint.X - ellipseSize / 2); // Canvas.SetTop(ellipse, canvasPoint.Y - ellipseSize / 2); // // add ellipse to canvas // this.Children.Add(ellipse); //} }
private IEnumerable<Dependency> findDependenciesFor(Dependency dependency, UpdateMode mode, int depth, SearchLocation location) { IRemoteNuget nuget = null; if (location == SearchLocation.Local && _solution.HasLocalCopy(dependency.Name)) { try { // Try to hit the local zip and read it. Mostly for testing but it'll detect a corrupted local package as well nuget = _solution.LocalNuget(dependency.Name); nuget.Dependencies().ToList(); RippleLog.Debug(dependency.Name + " already installed"); } catch { nuget = null; } } if(nuget == null) { nuget = NugetFor(dependency); } var dependencies = new List<Dependency>(); if (depth != 0) { var dep = dependency; var markAsFixed = mode == UpdateMode.Fixed || !isFloated(dependency); if (dep.IsFloat() && markAsFixed) { dep = new Dependency(nuget.Name, nuget.Version, UpdateMode.Fixed); } dependencies.Add(dep); } nuget .Dependencies() .Each(x => dependencies.AddRange(findDependenciesFor(x, mode, depth + 1, location))); return dependencies.OrderBy(x => x.Name); }
public static void SetUpdateMode(BindableObject element, UpdateMode value) { element.SetValue(UpdateModeProperty, value); }
public override void Draw(RenderContext renderContext, UpdateMode updateMode) { }
// Instead of advancing the tween from the previous position each time, // uses the given position to calculate running time since startup, and places the tween there like a Goto. // Executes regardless of whether the tween is playing. // Returns TRUE if the tween needs to be killed internal static bool DoGoto(Tween t, float toPosition, int toCompletedLoops, UpdateMode updateMode) { // Startup if (!t.startupDone) { if (!t.Startup()) { return(true); } } // OnStart and first OnPlay callbacks if (!t.playedOnce && updateMode == UpdateMode.Update) { t.playedOnce = true; if (t.onStart != null) { OnTweenCallback(t.onStart); if (!t.active) { return(true); // Tween might have been killed by onStart callback } } if (t.onPlay != null) { OnTweenCallback(t.onPlay); if (!t.active) { return(true); // Tween might have been killed by onPlay callback } } } float prevPosition = t.position; int prevCompletedLoops = t.completedLoops; t.completedLoops = toCompletedLoops; bool wasRewinded = t.position <= 0 && prevCompletedLoops <= 0; bool wasComplete = t.isComplete; // Determine if it will be complete after update if (t.loops != -1) { t.isComplete = t.completedLoops == t.loops; } // Calculate newCompletedSteps (always useful with Sequences) int newCompletedSteps = 0; if (updateMode == UpdateMode.Update) { if (t.isBackwards) { newCompletedSteps = t.completedLoops < prevCompletedLoops ? prevCompletedLoops - t.completedLoops : (toPosition <= 0 && !wasRewinded ? 1 : 0); if (wasComplete) { newCompletedSteps--; } } else { newCompletedSteps = t.completedLoops > prevCompletedLoops ? t.completedLoops - prevCompletedLoops : 0; } } else if (t.tweenType == TweenType.Sequence) { newCompletedSteps = prevCompletedLoops - toCompletedLoops; if (newCompletedSteps < 0) { newCompletedSteps = -newCompletedSteps; } } // Set position (makes position 0 equal to position "end" when looping) t.position = toPosition; if (t.position > t.duration) { t.position = t.duration; } else if (t.position <= 0) { if (t.completedLoops > 0 || t.isComplete) { t.position = t.duration; } else { t.position = 0; } } // Set playing state after update bool wasPlaying = t.isPlaying; if (t.isPlaying) { if (!t.isBackwards) { t.isPlaying = !t.isComplete; // Reached the end } else { t.isPlaying = !(t.completedLoops == 0 && t.position <= 0); // Rewinded } } // updatePosition is different in case of Yoyo loop under certain circumstances bool useInversePosition = t.loopType == LoopType.Yoyo && (t.position < t.duration ? t.completedLoops % 2 != 0 : t.completedLoops % 2 == 0); // Get values from plugin and set them UpdateNotice updateNotice = !wasRewinded && (t.loopType == LoopType.Restart && t.completedLoops != prevCompletedLoops || t.position <= 0 && t.completedLoops <= 0) ? UpdateNotice.RewindStep : UpdateNotice.None; if (t.ApplyTween(prevPosition, prevCompletedLoops, newCompletedSteps, useInversePosition, updateMode, updateNotice)) { return(true); } // Additional callbacks if (t.onUpdate != null && updateMode != UpdateMode.IgnoreOnUpdate) { OnTweenCallback(t.onUpdate); } if (t.position <= 0 && t.completedLoops <= 0 && !wasRewinded && t.onRewind != null) { OnTweenCallback(t.onRewind); } if (newCompletedSteps > 0 && updateMode == UpdateMode.Update && t.onStepComplete != null) { for (int i = 0; i < newCompletedSteps; ++i) { OnTweenCallback(t.onStepComplete); } } if (t.isComplete && !wasComplete && t.onComplete != null) { OnTweenCallback(t.onComplete); } if (!t.isPlaying && wasPlaying && (!t.isComplete || !t.autoKill) && t.onPause != null) { OnTweenCallback(t.onPause); } // Return return(t.autoKill && t.isComplete); }
/// <summary> /// /// </summary> /// <param name="response"></param> /// <returns></returns> public virtual IActionResult ResponseOk(UpdateMode <T> .Response response) { return(Ok(response.Rows)); }
protected new bool NeedsUpdate(bool lazyUpdate, UpdateMode updateMode) { return(lazyUpdate && updateMode == UpdateMode.EndTransition || !lazyUpdate && updateMode == UpdateMode.WhileTransition || updateMode == UpdateMode.Refresh); }
public DependencyError(Dependency dependency, Exception exception, UpdateMode mode) { Dependency = dependency; Exception = exception; Mode = mode; }
internal static bool DoGoto(Tween t, float toPosition, int toCompletedLoops, UpdateMode updateMode) => default; // 0x004CC570-0x004CC870
/// <summary> /// Constructs a 'per timespan' update scheme. /// </summary> public UpdateScheme(TimeSpan timespan) { _updateMode = UpdateMode.Timespan; _timespan = timespan; }
// =================================================================================== // METHODS --------------------------------------------------------------------------- // Returns TRUE if the tween needs to be killed static bool ApplyInternalCycle(Sequence s, float fromPos, float toPos, UpdateMode updateMode, bool useInverse, bool prevPosIsInverse, bool multiCycleStep = false) { bool isBackwardsUpdate = toPos < fromPos; // Debug.Log(Time.frameCount + " " + s.id + " " + (multiCycleStep ? "<color=#FFEC03>Multicycle</color> > " : "Cycle > ") + s.position + "/" + s.duration + " - s.isBackwards: " + s.isBackwards + ", useInverse/prevInverse: " + useInverse + "/" + prevPosIsInverse + " - " + fromPos + " > " + toPos + " - UpdateMode: " + updateMode + ", isPlaying: " + s.isPlaying + ", completedLoops: " + s.completedLoops); if (isBackwardsUpdate) { int len = s._sequencedObjs.Count - 1; for (int i = len; i > -1; --i) { if (!s.active) { return(true); // Killed by some public callback } ABSSequentiable sequentiable = s._sequencedObjs[i]; if (sequentiable.sequencedEndPosition < toPos || sequentiable.sequencedPosition > fromPos) { continue; } if (sequentiable.tweenType == TweenType.Callback) { if (updateMode == UpdateMode.Update && prevPosIsInverse) { // Debug.Log("<color=#FFEC03>BACKWARDS Callback > " + s.id + " - s.isBackwards: " + s.isBackwards + ", useInverse/prevInverse: " + useInverse + "/" + prevPosIsInverse + " - " + fromPos + " > " + toPos + "</color>"); OnTweenCallback(sequentiable.onStart); } } else { // Nested Tweener/Sequence float gotoPos = toPos - sequentiable.sequencedPosition; // float gotoPos = (float)((decimal)toPos - (decimal)sequentiable.sequencedPosition); if (gotoPos < 0) { gotoPos = 0; } Tween t = (Tween)sequentiable; if (!t.startupDone) { continue; // since we're going backwards and this tween never started just ignore it } t.isBackwards = true; if (TweenManager.Goto(t, gotoPos, false, updateMode)) { return(true); } // Fixes nested callbacks not being called correctly if main sequence has loops and nested ones don't if (multiCycleStep && t.tweenType == TweenType.Sequence) { if (s.position <= 0 && s.completedLoops == 0) { t.position = 0; } else { bool toZero = s.completedLoops == 0 || s.isBackwards && (s.completedLoops < s.loops || s.loops == -1); if (t.isBackwards) { toZero = !toZero; } if (useInverse) { toZero = !toZero; } if (s.isBackwards && !useInverse && !prevPosIsInverse) { toZero = !toZero; } t.position = toZero ? 0 : t.duration; } } } } } else { int len = s._sequencedObjs.Count; for (int i = 0; i < len; ++i) { if (!s.active) { return(true); // Killed by some public callback } ABSSequentiable sequentiable = s._sequencedObjs[i]; if (sequentiable.sequencedPosition > toPos || sequentiable.sequencedEndPosition < fromPos) { continue; } if (sequentiable.tweenType == TweenType.Callback) { if (updateMode == UpdateMode.Update) { // Debug.Log("<color=#FFEC03>FORWARD Callback > " + s.id + " - s.isBackwards: " + s.isBackwards + ", useInverse/prevInverse: " + useInverse + "/" + prevPosIsInverse + " - " + fromPos + " > " + toPos + "</color>"); bool fire = !s.isBackwards && !useInverse && !prevPosIsInverse || s.isBackwards && useInverse && !prevPosIsInverse; if (fire) { OnTweenCallback(sequentiable.onStart); } } } else { // Nested Tweener/Sequence float gotoPos = toPos - sequentiable.sequencedPosition; // float gotoPos = (float)((decimal)toPos - (decimal)sequentiable.sequencedPosition); if (gotoPos < 0) { gotoPos = 0; } Tween t = (Tween)sequentiable; // Fix for final nested tween not calling OnComplete in some cases if (toPos >= sequentiable.sequencedEndPosition) { if (!t.startupDone) { TweenManager.ForceInit(t, true); } if (gotoPos < t.fullDuration) { gotoPos = t.fullDuration; } } // t.isBackwards = false; if (TweenManager.Goto(t, gotoPos, false, updateMode)) { return(true); } // Fixes nested callbacks not being called correctly if main sequence has loops and nested ones don't if (multiCycleStep && t.tweenType == TweenType.Sequence) { if (s.position <= 0 && s.completedLoops == 0) { t.position = 0; } else { bool toZero = s.completedLoops == 0 || !s.isBackwards && (s.completedLoops < s.loops || s.loops == -1); if (t.isBackwards) { toZero = !toZero; } if (useInverse) { toZero = !toZero; } if (s.isBackwards && !useInverse && !prevPosIsInverse) { toZero = !toZero; } t.position = toZero ? 0 : t.duration; } } } } } return(false); }
// Applies the tween set by DoGoto. // Returns TRUE if the tween needs to be killed public static bool DoApplyTween(Sequence s, float prevPosition, int prevCompletedLoops, int newCompletedSteps, bool useInversePosition, UpdateMode updateMode) { // Adapt to eventual ease position float prevPos = prevPosition; float newPos = s.position; if (s.easeType != Ease.Linear) { prevPos = s.duration * EaseManager.Evaluate(s.easeType, s.customEase, prevPos, s.duration, s.easeOvershootOrAmplitude, s.easePeriod); newPos = s.duration * EaseManager.Evaluate(s.easeType, s.customEase, newPos, s.duration, s.easeOvershootOrAmplitude, s.easePeriod); } float from, to = 0; // Determine if prevPos was inverse. // Used to calculate correct "from" value when applying public cycle // and also in case of multiple loops within a single update bool prevPosIsInverse = s.loopType == LoopType.Yoyo && (prevPos < s.duration ? prevCompletedLoops % 2 != 0 : prevCompletedLoops % 2 == 0); if (s.isBackwards) { prevPosIsInverse = !prevPosIsInverse; } // Update multiple loop cycles within the same update if (newCompletedSteps > 0) { // Debug.Log(Time.frameCount + " <color=#FFEC03>newCompletedSteps = " + newCompletedSteps + "</color> - completedLoops: " + s.completedLoops + " - updateMode: " + updateMode); // Store expected completedLoops and position, in order to check them after the update cycles. int expectedCompletedLoops = s.completedLoops; float expectedPosition = s.position; // int cycles = newCompletedSteps; int cyclesDone = 0; from = prevPos; if (updateMode == UpdateMode.Update) { // Run all cycles elapsed since last update while (cyclesDone < cycles) { if (cyclesDone > 0) { from = to; } else if (prevPosIsInverse && !s.isBackwards) { from = s.duration - from; } to = prevPosIsInverse ? 0 : s.duration; if (ApplyInternalCycle(s, from, to, updateMode, useInversePosition, prevPosIsInverse, true)) { return(true); } cyclesDone++; if (s.loopType == LoopType.Yoyo) { prevPosIsInverse = !prevPosIsInverse; } } // If completedLoops or position were changed by some callback, exit here // Debug.Log(" Internal Cycle Ended > expecteCompletedLoops/completedLoops: " + expectedCompletedLoops + "/" + s.completedLoops + " - expectedPosition/position: " + expectedPosition + "/" + s.position); if (expectedCompletedLoops != s.completedLoops || Math.Abs(expectedPosition - s.position) > Single.Epsilon) { return(!s.active); } } else { // Simply determine correct prevPosition after steps if (s.loopType == LoopType.Yoyo && newCompletedSteps % 2 != 0) { prevPosIsInverse = !prevPosIsInverse; prevPos = s.duration - prevPos; } newCompletedSteps = 0; } } // Run current cycle if (newCompletedSteps == 1 && s.isComplete) { return(false); // Skip update if complete because multicycle took care of it } if (newCompletedSteps > 0 && !s.isComplete) { from = useInversePosition ? s.duration : 0; // In case of Restart loop rewind all tweens (keep "to > 0" or remove it?) if (s.loopType == LoopType.Restart && to > 0) { ApplyInternalCycle(s, s.duration, 0, UpdateMode.Goto, false, false, false); } } else { from = useInversePosition ? s.duration - prevPos : prevPos; } return(ApplyInternalCycle(s, from, useInversePosition ? s.duration - newPos : newPos, updateMode, useInversePosition, prevPosIsInverse)); }
public override bool ApplyTween(float prevPosition, int prevCompletedLoops, int newCompletedSteps, bool useInversePosition, UpdateMode updateMode, UpdateNotice updateNotice) { return(DoApplyTween(this, prevPosition, prevCompletedLoops, newCompletedSteps, useInversePosition, updateMode)); }
public static IPlatformElementConfiguration <iOS, FormsElement> SetUpdateMode(this IPlatformElementConfiguration <iOS, FormsElement> config, UpdateMode value) { SetUpdateMode(config.Element, value); return(config); }
public static void UpdateLogMessage(Guid OrgID, int departmentId, int logEntryId, string logEntryText, UpdateMode updateMode) { if (logEntryId > 0 && !string.IsNullOrEmpty(logEntryText)) UpdateData("sp_UpdateTicketLogEntry", new SqlParameter[] { new SqlParameter("@DepartmentId", departmentId), new SqlParameter("@LogEntryId", logEntryId), new SqlParameter("@LogEntryText", logEntryText), new SqlParameter("@UpdateMode", (int)updateMode) }, OrgID); }
public StubFeed ThrowWhenSearchingFor(Dependency dependency, Exception exception, UpdateMode mode = UpdateMode.Fixed) { _explicitErrors.Add(new DependencyError(dependency, exception, mode)); return this; }
public abstract TranslationContext PushContext(IIteratorStackModel query, RoslynEcsTranslator roslynEcsTranslator, UpdateMode mode);
public void Load() { if (!File.Exists(filename)) return; using (XmlReader reader = XmlReader.Create(new StreamReader(filename))) { for (; ; ) { reader.Read(); if (reader.EOF) break; if (reader.NodeType == XmlNodeType.Whitespace) continue; if (reader.Name == "Options" && reader.IsStartElement()) { for (; ; ) { if (!reader.Read() || reader.EOF) break; if (reader.NodeType == XmlNodeType.Whitespace) continue; else if (reader.NodeType == XmlNodeType.EndElement) break; if (reader.Name == "TempDir") { reader.Read(); TempDir = reader.Value; reader.Read(); } else if (reader.Name == "MaxTempRAM") { reader.Read(); MaxTempRAM = Convert.ToUInt32(reader.Value); reader.Read(); } else if (reader.Name == "IgnoreHidden") { reader.Read(); IgnoreHidden = (reader.Value == "true") ? true : false; reader.Read(); } else if (reader.Name == "MonitorDrives") { reader.Read(); MonitorDrives = (reader.Value == "true") ? true : false; reader.Read(); } else if (reader.Name == "UpdateDelay") { reader.Read(); UpdateDelay = Convert.ToUInt32(reader.Value); reader.Read(); } else if (reader.Name == "UpdateMode") { reader.Read(); int mode = Convert.ToInt32(reader.Value); reader.Read(); if (mode == 1) UpdateMode = UpdateMode.NoAction; else if (mode == 2) UpdateMode = UpdateMode.ScanOnly; else if (mode == 3) UpdateMode = UpdateMode.ScanAndUpdate; } else if (reader.Name == "Ignores") { for (; ; ) { if (!reader.Read() || reader.EOF) break; if (reader.NodeType == XmlNodeType.Whitespace) continue; else if (reader.NodeType == XmlNodeType.EndElement) break; if (reader.Name == "Ignore" && reader.IsStartElement()) { reader.Read(); Ignores.Add(reader.Value); reader.Read(); // skip end element } } } } } else if (reader.Name == "Parity") ParityDir = reader.GetAttribute("Path"); else if (reader.Name == "Layout" && reader.IsStartElement()) { for (; ; ) { if (!reader.Read() || reader.EOF) break; if (reader.NodeType == XmlNodeType.Whitespace) continue; else if (reader.NodeType == XmlNodeType.EndElement) break; else if (reader.Name == "MainWindowX") { reader.Read(); MainWindowX = Convert.ToInt32(reader.Value); reader.Read(); } else if (reader.Name == "MainWindowY") { reader.Read(); MainWindowY = Convert.ToInt32(reader.Value); reader.Read(); } else if (reader.Name == "MainWindowWidth") { reader.Read(); MainWindowWidth = Convert.ToInt32(reader.Value); reader.Read(); } else if (reader.Name == "MainWindowHeight") { reader.Read(); MainWindowHeight = Convert.ToInt32(reader.Value); reader.Read(); } } } else if (reader.Name == "Drives" && reader.IsStartElement()) { for (; ; ) { if (!reader.Read() || reader.EOF) break; if (reader.NodeType == XmlNodeType.Whitespace) continue; else if (reader.NodeType == XmlNodeType.EndElement) break; if (reader.Name == "Drive") Drives.Add(new Drive(reader.GetAttribute("Path"), reader.GetAttribute("Meta"))); } } } } UpdateIgnoresRegex(); }
/** * Set the UAVObject metadata GCS telemetry update mode member * \param[in] metadata The metadata object * \param[in] val The GCS telemetry update mode */ public void SetGcsTelemetryUpdateMode(UpdateMode val) { SET_BITS(UAVOBJ_GCS_TELEMETRY_UPDATE_MODE_SHIFT, UpdateModeNum(val), UAVOBJ_UPDATE_MODE_MASK); }
public void OnBecameInvisible() { updateMode = updateWhenInvisible; }
public abstract UpdateResult Update(T entity, UpdateMode updateMode);
/// <summary> /// Constructs a 'per generations' update scheme. /// </summary> public UpdateScheme(uint generations) { _updateMode = UpdateMode.Generational; _generations = generations; }
public VersionConstraint ConstraintFor(UpdateMode mode) { return(mode == UpdateMode.Fixed ? Fixed : Float); }
internal static void UpdateThings(UpdateMode mode) { if (mode != UpdateMode) return; GInput.Update(); if (!Main.gameMenu) MctUI.Update(); }
/// <summary> /// 开始版本控制逻辑 /// </summary> /// <param name="serverUrl">服务器配置根目录</param> /// <param name="localSaveAssetsPath">本地根目录</param> /// <param name="onDownloadProccess">任务进度通知(下载完不等于任务完成!)</param> /// <param name="onTaskEndCallback">任务成功\失败通知!</param> /// 返回码: -1:error 0:success async private Task StartVersionControl(UpdateMode updateMode, string serverUrl, string localSaveAssetsPath, string subPackageName, Action <AssetItem, List <AssetItem> > onDownloadProccess, Action <RetStatus, string> onTaskEndCallback) { var platform = BApplication.RuntimePlatform; //目录准备 var platformStr = BApplication.GetRuntimePlatformPath(); var localSavePlatformPath = IPath.Combine(localSaveAssetsPath, platformStr); if (!Directory.Exists(localSavePlatformPath)) { Directory.CreateDirectory(localSavePlatformPath); } //子包模式判断 bool isDownloadSubPackageMode = !string.IsNullOrEmpty(subPackageName); //1.下载服务器version config var serverVersionInfo = new AssetsVersionInfo(); var localVersionInfo = new AssetsVersionInfo(); #region AssetVersion.info下载 BDebug.Log("【版本控制】1.获取版本信息~", "red"); { var ret = await DownloadAssetVersionInfo(serverUrl, localSaveAssetsPath); if (ret.Item1 != null) { await UniTask.SwitchToMainThread(); onTaskEndCallback?.Invoke(RetStatus.Error, ret.Item1); return; } serverVersionInfo = ret.Item2; localVersionInfo = ret.Item3; } #endregion //2.对比版本、获取对应数据 BDebug.Log("【版本控制】2.对比版本信息~", "red"); string err = null; string suc = null; var serverAssetsInfoList = new List <AssetItem>(); var localAssetsInfoList = new List <AssetItem>(); var serverAssetsContent = ""; // switch (updateMode) { case UpdateMode.Compare: case UpdateMode.CompareWithRepair: //CP模式对比版本与Compare一致 { if (isDownloadSubPackageMode) { //分包模式 (err, suc, serverAssetsInfoList, localAssetsInfoList, serverAssetsContent) = GetDownloadSubPackageData(serverUrl, subPackageName, platform, serverVersionInfo, localVersionInfo); } else { //全量下载 (err, suc, serverAssetsInfoList, localAssetsInfoList, serverAssetsContent) = GetDownloadAssetsData(serverUrl, platform, serverVersionInfo, localVersionInfo); } } break; case UpdateMode.Repair: { //服务器路径 var serverAssetInfosUrl = BResources.GetAssetsInfoPath(serverUrl, platform); //下载服务器Assets.info (err, serverAssetsInfoList, serverAssetsContent) = LoadServerAssetInfo(serverAssetInfosUrl); } break; } //返回返回结果,是否继续下载 if (err != null) { BDebug.LogError(err); await UniTask.SwitchToMainThread(); onTaskEndCallback?.Invoke(RetStatus.Error, err); return; } if (suc != null) { BDebug.Log(suc); await UniTask.SwitchToMainThread(); onTaskEndCallback?.Invoke(RetStatus.Success, suc); return; } //3.生成差异列表 BDebug.Log("【版本控制】3.获取差异列表~", "red"); Queue <AssetItem> diffDownloadQueue = null; #region 生成差异文件 switch (updateMode) { case UpdateMode.Compare: { diffDownloadQueue = Compare(localAssetsInfoList, serverAssetsInfoList, platform); } break; case UpdateMode.Repair: case UpdateMode.CompareWithRepair: //CP 获取差异模式与Repair一致 { diffDownloadQueue = Repair(serverAssetsInfoList, platform); } break; } BDebug.Log($"【版本控制】 配置数量:{serverAssetsInfoList.Count} ,本地存在{serverAssetsInfoList.Count - diffDownloadQueue.Count},下载文件数量{diffDownloadQueue.Count}", "yellow"); #endregion //4.开始下载 #region 根据差异文件下载 BDebug.Log("【版本控制】4.下载资源~", "red"); { var failDownloadList = await DownloadAssets(serverUrl, localSaveAssetsPath, diffDownloadQueue, onDownloadProccess); if (failDownloadList.Count > 0) { onTaskEndCallback(RetStatus.Error, "部分资源未下载完毕!"); return; } } #endregion //5.写入配置到本地 #region 存储配置到本地 BDebug.Log("【版本控制】5.写入配置~", "red"); string localAssetInfoPath = ""; if (isDownloadSubPackageMode) { localAssetInfoPath = BResources.GetAssetsSubPackageInfoPath(BApplication.persistentDataPath, platform, subPackageName); } else { localAssetInfoPath = BResources.GetAssetsInfoPath(BApplication.persistentDataPath, platform); } //写入Asset.Info File.WriteAllText(localAssetInfoPath, serverAssetsContent); BDebug.Log($"【版本控制】写入{Path.GetFileName(localAssetInfoPath)} \n {serverAssetsContent}"); //写入Version.Info if (isDownloadSubPackageMode) { localVersionInfo.Platfrom = serverVersionInfo.Platfrom; //子包版本信息 localVersionInfo.SubPckMap[subPackageName] = serverVersionInfo.SubPckMap[subPackageName]; } else { localVersionInfo.Platfrom = serverVersionInfo.Platfrom; //全量包信息 localVersionInfo.Version = serverVersionInfo.Version; } var localAssetsVersionInfoPath = BResources.GetServerAssetsVersionInfoPath(localSaveAssetsPath, platform); File.WriteAllText(localAssetsVersionInfoPath, JsonMapper.ToJson(localVersionInfo)); BDebug.Log($"【版本控制】写入{Path.GetFileName(localAssetsVersionInfoPath)}"); #endregion // 6.删除过期资源 BDebug.Log("【版本控制】6.冗余资源检查~", "red"); if (!isDownloadSubPackageMode) { var artAssetsPath = IPath.Combine(localSavePlatformPath, BResources.ART_ASSET_ROOT_PATH); var persistentArtAssets = Directory.GetFiles(artAssetsPath, "*", SearchOption.AllDirectories); var replacePath = localSavePlatformPath + "/"; foreach (var assetPath in persistentArtAssets) { var localPath = assetPath.Replace(replacePath, "").Replace("\\", "/"); var ret = serverAssetsInfoList.FirstOrDefault((info) => info.LocalPath.Equals(localPath)); if (ret == null) { BDebug.Log("【版本控制】删除过期资源:" + localPath); File.Delete(assetPath); } } } // 7.资源校验文件 BDebug.Log("【版本控制】7.整包资源校验~", "red"); err = null; foreach (var serverAssetItem in serverAssetsInfoList) { var ret = BResources.IsExsitAssetWithCheckHash(platform, serverAssetItem.LocalPath, serverAssetItem.HashName); if (!ret) { if (string.IsNullOrEmpty(err)) { err = "资源不存在:"; } err += $"\n {serverAssetItem.LocalPath}"; } } //the end. BDebug.Log("【版本控制】end.完成~", "red"); await UniTask.SwitchToMainThread(); if (err == null) { onTaskEndCallback?.Invoke(RetStatus.Success, null); } else { onTaskEndCallback?.Invoke(RetStatus.Error, err); } }
public Feed(string url, UpdateMode mode, NugetStability stability) { Url = url.TrimEnd('/'); Mode = mode; Stability = stability; }
public NetworkMode ReadPacket(MinecraftStream stream, NetworkMode mode, PacketDirection direction) { Name = stream.ReadString(); DisplayName = stream.ReadString(); Mode = (UpdateMode)stream.ReadUInt8(); return mode; }
public static void RegisterHotKey(KeyCode keyCode, UnityAction func, HotKeyMode keyMode = HotKeyMode.GetKeyDown, UpdateMode updateMode = UpdateMode.Update) { if (hotKeyMgr == null) { hotKeyMgr = Singleton.GetInstance <HotKeyMgr>(); } var pool = GetTargetPool(keyMode, updateMode); if (!pool.TryGetValue(keyCode, out var listeners)) { listeners = new UnityEvent(); pool.Add(keyCode, listeners); } listeners.AddListener(func); }
// Token: 0x06000296 RID: 662 RVA: 0x0000EF00 File Offset: 0x0000D100 internal override bool ApplyTween(float prevPosition, int prevCompletedLoops, int newCompletedSteps, bool useInversePosition, UpdateMode updateMode, UpdateNotice updateNotice) { float elapsed = useInversePosition ? (this.duration - this.position) : this.position; if (DOTween.useSafeMode) { try { this.tweenPlugin.EvaluateAndApply(this.plugOptions, this, this.isRelative, this.getter, this.setter, elapsed, this.startValue, this.changeValue, this.duration, useInversePosition, updateNotice); return(false); } catch { return(true); } } this.tweenPlugin.EvaluateAndApply(this.plugOptions, this, this.isRelative, this.getter, this.setter, elapsed, this.startValue, this.changeValue, this.duration, useInversePosition, updateNotice); return(false); }
/** * Maps from the java symbolic enumeration of update mode to the bitfield value * @param e The update mode * @return The numeric value to use on the wire */ public int UpdateModeNum(UpdateMode e) { switch (e) { case UpdateMode.UPDATEMODE_MANUAL: return 0; case UpdateMode.UPDATEMODE_PERIODIC: return 1; case UpdateMode.UPDATEMODE_ONCHANGE: return 2; case UpdateMode.UPDATEMODE_THROTTLED: return 3; } return 0; }
public static void UnregisterHotKey(KeyCode keyCode, UnityAction func, HotKeyMode keyMode = HotKeyMode.GetKeyDown, UpdateMode updateMode = UpdateMode.Update) { var pool = GetTargetPool(keyMode, updateMode); if (pool.TryGetValue(keyCode, out var listeners)) { listeners.RemoveListener(func); } }
/// <summary> </summary> /// <param name="updateMode"></param> public override void Update(UpdateMode updateMode) { UpdateScales(this); }
private static Dictionary <KeyCode, UnityEvent> GetTargetPool(HotKeyMode keymode, UpdateMode updateMode) { switch (updateMode) { case UpdateMode.Update: switch (keymode) { case HotKeyMode.GetKeyDown: return(keyDownPool); case HotKeyMode.GetKeyUp: return(keyUpPool); case HotKeyMode.GetKey: return(KeyPool); default: return(new Dictionary <KeyCode, UnityEvent>()); } case UpdateMode.FixedUpdate: switch (keymode) { case HotKeyMode.GetKeyDown: return(fixedKeyDownPool); case HotKeyMode.GetKeyUp: return(fixedKeyUpPool); case HotKeyMode.GetKey: return(fixedKeyPool); default: return(new Dictionary <KeyCode, UnityEvent>()); } default: return(new Dictionary <KeyCode, UnityEvent>()); } }
public Feed(string url, UpdateMode mode) : this(url, mode, NugetStability.ReleasedOnly) { }
public async Task Update(UpdateMode mode, bool background = false, bool fast = false) { if (_updating) { return; } _updating = true; var driversCount = -1; var resultStatus = ServerStatus.Ready; try { // If it’s a background update, don’t change anything in UI to avoid flashing if (!background) { CurrentDrivers = null; Status = ServerStatus.Loading; IsAvailable = false; } // Reset some update-state values PrepareErrorsList(); // Nothing loaded at all! var informationUpdated = false; if (!IsFullyLoaded) { UpdateProgress = new AsyncProgressEntry("Loading actual server information…", 0.1); ServerInformationComplete loaded; try { loaded = await GetInformationDirectly(); } catch (WebException e) { _updateWebException = e; resultStatus = ServerStatus.Error; return; } var update = UpdateValues(loaded, false, true); if (update != null) { resultStatus = update.Value; if (update != ServerStatus.MissingContent) { // Loaded data isn’t for this server (port by which it was loaded differs). // Won’t even set drivers count in this case, whole data is obsviously wrong. return; } } driversCount = loaded.Clients; // Set this flag to True so we won’t use GetInformationDirectly() again later informationUpdated = true; } // Extended mode for server wrapping thing var informationLoadedExtended = false; ServerCarsInformation carsInformation = null; if (PortExtended != null) { try { var extended = await GetExtendedInformationDirectly(); var update = UpdateValues(extended, false, true); if (update != null) { resultStatus = update.Value; if (update != ServerStatus.MissingContent) { UpdateValuesExtended(null); return; } } UpdateValuesExtended(extended); driversCount = extended.Clients; carsInformation = extended.Players; informationLoadedExtended = true; } catch (Exception e) { Logging.Warning(e); PortExtended = null; UpdateValuesExtended(null); return; } } else { UpdateValuesExtended(null); } // Update information if (!informationLoadedExtended && (mode != UpdateMode.Lite || !(Sessions?.Count > 0) // if there are no sessions (!), maybe information is damaged, let’s re-download )) { UpdateProgress = new AsyncProgressEntry("Loading actual server information…", 0.2); ServerInformationComplete loaded; try { // If informationUpdated is True and settings set to update-information-directly mode, this method // will return 0. loaded = await GetInformation(informationUpdated); } catch (WebException e) { _updateWebException = e; resultStatus = ServerStatus.Error; return; } if (loaded != null) { if (loaded.Ip == Ip && loaded.PortHttp == PortHttp || informationUpdated || loaded.LoadedDirectly) { // If loaded information is compatible with existing, use it immediately. Otherwise — apparently, // server changed — we’ll try to load an actual data directly from it later, but only if it wasn’t // loaded just before that and loaded information wasn’t loaded from it. var update = UpdateValues(loaded, false, true); if (update != null) { resultStatus = update.Value; if (update != ServerStatus.MissingContent) { return; } } driversCount = loaded.Clients; } else { ServerInformation directlyLoaded; try { directlyLoaded = await GetInformationDirectly(); } catch (WebException e) { _updateWebException = e; resultStatus = ServerStatus.Error; return; } var update = UpdateValues(directlyLoaded, false, true); if (update != null) { resultStatus = update.Value; if (update != ServerStatus.MissingContent) { return; } } driversCount = loaded.Clients; } } } // Ping server if (Ping == null || mode == UpdateMode.Full || !SettingsHolder.Online.PingOnlyOnce) { UpdateProgress = new AsyncProgressEntry("Pinging server…", 0.3); var pair = SettingsHolder.Online.ThreadsPing ? await Task.Run(() => KunosApiProvider.TryToPingServer(Ip, Port, SettingsHolder.Online.PingTimeout)) : await KunosApiProvider.TryToPingServerAsync(Ip, Port, SettingsHolder.Online.PingTimeout); if (pair != null) { Ping = (long)pair.Item2.TotalMilliseconds; _updatePingFailed = false; } else { Ping = null; _updatePingFailed = true; resultStatus = ServerStatus.Error; return; } } // Load players list if (carsInformation == null) { UpdateProgress = new AsyncProgressEntry("Loading players list…", 0.4); try { carsInformation = await KunosApiProvider.GetCarsInformationAsync(Ip, PortHttp); } catch (WebException e) { _updateWebException = e; resultStatus = ServerStatus.Error; return; } } if (!BookingMode) { CurrentDriversCount = carsInformation.Cars.Count(x => x.IsConnected); driversCount = -1; } var currentDrivers = (BookingMode ? carsInformation.Cars : carsInformation.Cars.Where(x => x.IsConnected)) .Select(x => { var driver = CurrentDrivers?.FirstOrDefault(y => y.Name == x.DriverName && y.Team == x.DriverTeam && y.CarId == x.CarId && y.CarSkinId == x.CarSkinId) ?? new CurrentDriver(x); return(driver); }) .ToList(); if (CurrentDrivers == null || !CurrentDrivers.SequenceEqual(currentDrivers)) { CurrentDrivers = currentDrivers; var count = 0; var booked = false; foreach (var x in currentDrivers) { if (x.IsConnected) { count++; } if (x.IsBookedForPlayer) { booked = true; SetSelectedCarEntry(Cars?.GetByIdOrDefault(x.CarId, StringComparison.OrdinalIgnoreCase)); } } ConnectedDrivers = count; IsBookedForPlayer = booked; } if (Cars == null) { Logging.Unexpected(); _updateDriversMissing = true; resultStatus = ServerStatus.Error; return; } for (int i = 0, c = Cars.Count; i < c; i++) { var entry = Cars[i]; var wrapper = entry.CarObjectWrapper; CarObject car; // Load car if not loaded if (wrapper != null) { if (wrapper.IsLoaded) { car = (CarObject)wrapper.Value; } else { UpdateProgress = new AsyncProgressEntry($"Loading cars ({wrapper.Id})…", 0.5 + 0.4 * i / c); await Task.Delay(fast? 10 : 50); car = (CarObject)await wrapper.LoadedAsync(); } } else { car = null; } // Load skin if (car?.SkinsManager.IsLoaded == false) { UpdateProgress = new AsyncProgressEntry($"Loading {car.DisplayName} skins…", 0.5 + 0.4 * (0.5 + i) / c); await Task.Delay(fast? 10 : 50); await car.SkinsManager.EnsureLoadedAsync(); } // Set next available skin if (CurrentSessionType == Game.SessionType.Booking) { entry.AvailableSkinId = car?.SelectedSkin?.Id; entry.Total = 0; entry.Available = 0; entry.IsAvailable = true; } else { var cars = carsInformation.Cars.Where(x => x.IsEntryList && string.Equals(x.CarId, entry.Id, StringComparison.OrdinalIgnoreCase)).ToList(); string availableSkinId; if (BookingMode) { availableSkinId = cars.FirstOrDefault(x => x.IsRequestedGuid)?.CarSkinId; entry.Total = 0; entry.Available = 0; entry.IsAvailable = true; } else { availableSkinId = cars.FirstOrDefault(y => !y.IsConnected)?.CarSkinId; entry.Total = cars.Count; entry.Available = cars.Count(y => !y.IsConnected); entry.IsAvailable = entry.Available > 0; } entry.AvailableSkinId = availableSkinId; } } var missingContentUpdate = UpdateMissingContentExtended(resultStatus == ServerStatus.MissingContent); if (missingContentUpdate.HasValue) { resultStatus = missingContentUpdate.Value; } if (IsBookedForPlayer) { FixedCar = true; } else { FixedCar = false; LoadSelectedCar(); } } catch (Exception e) { _updateException = e; resultStatus = ServerStatus.Error; Logging.Error(e); } finally { if (driversCount != -1) { CurrentDriversCount = driversCount; } UpdateProgress = AsyncProgressEntry.Ready; Status = !SettingsHolder.Online.LoadServersWithMissingContent && resultStatus == ServerStatus.MissingContent ? ServerStatus.Error : resultStatus; UpdateMissingContent(); UpdateErrorsList(); AvailableUpdate(); _updating = false; } }
public ScoreboardObjectivePacket(string name, string displayName, UpdateMode mode) { Name = name; DisplayName = displayName; Mode = mode; }
/// <summary> /// Wrap converting and updating DAT file from any format to any format /// </summary> /// <param name="inputPaths">List of input filenames</param> /// <param name="basePaths">List of base filenames</param> /// /* Normal DAT header info */ /// <param name="datHeader">All DatHeader info to be used</param> /// /* Merging and Diffing info */ /// <param name="updateMode">Non-zero flag for diffing mode, zero otherwise</param> /// <param name="inplace">True if the cascade-diffed files should overwrite their inputs, false otherwise</param> /// <param name="skip">True if the first cascaded diff file should be skipped on output, false otherwise</param> /// <param name="bare">True if the date should not be appended to the default name, false otherwise</param> /// /* Filtering info */ /// <param name="filter">Pre-populated filter object for DAT filtering</param> /// <param name="splitType">Type of the split that should be performed (split, merged, fully merged)</param> /// /* Output DAT info */ /// <param name="outDir">Optional param for output directory</param> /// <param name="clean">True to clean the game names to WoD standard, false otherwise (default)</param> /// <param name="remUnicode">True if we should remove non-ASCII characters from output, false otherwise (default)</param> /// <param name="descAsName">True if descriptions should be used as names, false otherwise (default)</param> /// <param name="replaceMode">ReplaceMode representing what should be updated [only for base replacement]</param> /// <param name="onlySame">True if descriptions should only be replaced if the game name is the same, false otherwise [only for base replacement]</param> private static void InitUpdate( List <string> inputPaths, List <string> basePaths, /* Normal DAT header info */ DatHeader datHeader, /* Merging and Diffing info */ UpdateMode updateMode, bool inplace, bool skip, bool bare, /* Filtering info */ Filter filter, SplitType splitType, /* Output DAT info */ string outDir, bool clean, bool remUnicode, bool descAsName, ReplaceMode replaceMode, bool onlySame) { // Normalize the extensions datHeader.AddExtension = (String.IsNullOrWhiteSpace(datHeader.AddExtension) || datHeader.AddExtension.StartsWith(".") ? datHeader.AddExtension : "." + datHeader.AddExtension); datHeader.ReplaceExtension = (String.IsNullOrWhiteSpace(datHeader.ReplaceExtension) || datHeader.ReplaceExtension.StartsWith(".") ? datHeader.ReplaceExtension : "." + datHeader.ReplaceExtension); // If we're in a special update mode and the names aren't set, set defaults if (updateMode != 0) { // Get the values that will be used if (String.IsNullOrWhiteSpace(datHeader.Date)) { datHeader.Date = DateTime.Now.ToString("yyyy-MM-dd"); } if (String.IsNullOrWhiteSpace(datHeader.Name)) { datHeader.Name = (updateMode != 0 ? "DiffDAT" : "MergeDAT") + (datHeader.Type == "SuperDAT" ? "-SuperDAT" : "") + (datHeader.DedupeRoms != DedupeType.None ? "-deduped" : ""); } if (String.IsNullOrWhiteSpace(datHeader.Description)) { datHeader.Description = (updateMode != 0 ? "DiffDAT" : "MergeDAT") + (datHeader.Type == "SuperDAT" ? "-SuperDAT" : "") + (datHeader.DedupeRoms != DedupeType.None ? " - deduped" : ""); if (!bare) { datHeader.Description += " (" + datHeader.Date + ")"; } } if (String.IsNullOrWhiteSpace(datHeader.Category) && updateMode != 0) { datHeader.Category = "DiffDAT"; } if (String.IsNullOrWhiteSpace(datHeader.Author)) { datHeader.Author = "SabreTools"; } } // If no replacement mode is set, default to Names if (replaceMode == ReplaceMode.None) { replaceMode = ReplaceMode.ItemName; } // Populate the DatData object DatFile userInputDat = new DatFile(datHeader); userInputDat.DetermineUpdateType(inputPaths, basePaths, outDir, updateMode, inplace, skip, clean, remUnicode, descAsName, filter, splitType, replaceMode, onlySame); }
public static IList<CodeToolInfo> ReadAllFromRegistry(UpdateMode mode, string vsRoot) { List<CodeToolInfo> infos = new List<CodeToolInfo>(); if (mode != UpdateMode.ForceUnInstall) { RegistryKey root = Common.GetLocalRegistryRoot(vsRoot, "CodeTools"); if (root != null) { String[] toolKeys = root.GetSubKeyNames(); foreach (string toolName in toolKeys) { RegistryKey toolKey = root.OpenSubKey(toolName, false); if (toolKey != null) { CodeToolInfo tool = CodeToolsInfoFromRegistry(vsRoot, toolName, toolKey); if (tool.IsRelevant()) infos.Add(tool); } } } } if (mode != UpdateMode.ForceInstall) { RegistryKey installedKey = GetInstalledCodeToolsKey(vsRoot, false); if (installedKey != null) { foreach (string toolName in installedKey.GetSubKeyNames()) { RegistryKey toolKey = installedKey.OpenSubKey(toolName, false); if (toolKey != null) { CodeToolInfo itool = CodeToolsInfoFromRegistry(vsRoot, toolName, toolKey); CodeToolInfo tool = infos.Find(delegate(CodeToolInfo t) { return t.toolName == itool.toolName; }); if (tool != null) { if (tool.Equals(itool)) { // installed tool == described tool tool.installMode = InstallMode.Active; } else { // described tool is updated: uninstall and reinstall itool.installMode = InstallMode.UnInstall; tool.installMode = InstallMode.Install; // is actually the default infos.Add(itool); } } else if (tool == null) { // described tool is gone: uninstall itool.installMode = InstallMode.UnInstall; infos.Add(itool); } } } } } infos.Reverse(); // reverse the list so uninstalls happen before installs return infos; }
internal abstract bool ApplyTween(float prevPosition, int prevCompletedLoops, int newCompletedSteps, bool useInversePosition, UpdateMode updateMode, UpdateNotice updateNotice);
internal static bool DoGoto(Tween t, float toPosition, int toCompletedLoops, UpdateMode updateMode) { if (!t.startupDone && !t.Startup()) { return(true); } if (!t.playedOnce && updateMode == UpdateMode.Update) { t.playedOnce = true; if (t.onStart != null) { Tween.OnTweenCallback(t.onStart); if (!t.active) { return(true); } } if (t.onPlay != null) { Tween.OnTweenCallback(t.onPlay); if (!t.active) { return(true); } } } float prevPosition = t.position; int num = t.completedLoops; t.completedLoops = toCompletedLoops; bool flag = t.position <= 0f && num <= 0; bool flag2 = t.isComplete; if (t.loops != -1) { t.isComplete = (t.completedLoops == t.loops); } int num2 = 0; if (updateMode == UpdateMode.Update) { if (t.isBackwards) { num2 = ((t.completedLoops < num) ? (num - t.completedLoops) : ((toPosition <= 0f && !flag) ? 1 : 0)); if (flag2) { num2--; } } else { num2 = ((t.completedLoops > num) ? (t.completedLoops - num) : 0); } } else if (t.tweenType == TweenType.Sequence) { num2 = num - toCompletedLoops; if (num2 < 0) { num2 = -num2; } } t.position = toPosition; if (t.position > t.duration) { t.position = t.duration; } else if (t.position <= 0f) { if (t.completedLoops > 0 || t.isComplete) { t.position = t.duration; } else { t.position = 0f; } } bool flag3 = t.isPlaying; if (t.isPlaying) { if (!t.isBackwards) { t.isPlaying = !t.isComplete; } else { t.isPlaying = (t.completedLoops != 0 || !(t.position <= 0f)); } } bool useInversePosition = t.loopType == LoopType.Yoyo && ((t.position < t.duration) ? (t.completedLoops % 2 != 0) : (t.completedLoops % 2 == 0)); if (!flag) { if (t.loopType == LoopType.Restart && t.completedLoops != num) { goto IL_0220; } if (t.position <= 0f && t.completedLoops <= 0) { goto IL_0220; } } int num3 = 0; goto IL_0221; IL_0220: num3 = 1; goto IL_0221; IL_0221: UpdateNotice updateNotice = (UpdateNotice)num3; if (t.ApplyTween(prevPosition, num, num2, useInversePosition, updateMode, updateNotice)) { return(true); } if (t.onUpdate != null && updateMode != UpdateMode.IgnoreOnUpdate) { Tween.OnTweenCallback(t.onUpdate); } if (t.position <= 0f && t.completedLoops <= 0 && !flag && t.onRewind != null) { Tween.OnTweenCallback(t.onRewind); } if (num2 > 0 && updateMode == UpdateMode.Update && t.onStepComplete != null) { for (int i = 0; i < num2; i++) { Tween.OnTweenCallback(t.onStepComplete); } } if (t.isComplete && !flag2 && t.onComplete != null) { Tween.OnTweenCallback(t.onComplete); } if ((!t.isPlaying & flag3) && (!t.isComplete || !t.autoKill) && t.onPause != null) { Tween.OnTweenCallback(t.onPause); } if (t.autoKill) { return(t.isComplete); } return(false); }
/// <summary> /// 更新实体表 /// </summary> /// <param name="taskId"></param> /// <param name="tenant"></param> /// <param name="dataContext"></param> /// <param name="dataSource"></param> /// <param name="hashcode"></param> /// <param name="updateMode"></param> /// <param name="beginDateTime"></param> /// <returns></returns> public Tuple <bool, bool> Update(Guid taskId, Tenant tenant, DataContext dataContext, DataSource dataSource, string hashcode, UpdateMode updateMode, DateTime beginDateTime) { _logger.LogInformation($"taskId={taskId}, update DataSource, DataSourceId={dataSource.DataSourceId}, Name={dataSource.Name}, UpdateStatue={dataSource.UpdateStatus},params beginDateTime={beginDateTime: yyyy-MM-dd HH:mm:ss.fffffff}"); if (string.IsNullOrWhiteSpace(dataSource.UpdateSql)) { dataSource.UpdateStatus = UpdateStatusType.Normal; _logger.LogInformation($"taskId={taskId}, datasource.UpdateSql is null, skip the update procressing, DataSourceId={dataSource.DataSourceId}, Name={dataSource.Name}"); return(new Tuple <bool, bool>(false, false)); } ////获取上游表 //Func<IEnumerable<DataSource>> GetUpstreamDs = () => { // IEnumerable<Guid> upstreamDids = dataContext.TableRelation.Where(_ => _.ParentId == dataSource.DataSourceId).Select(_ => _.Id); // return dataContext.DataSource.Where(_ => upstreamDids.Contains(_.DataSourceId)).ToArray(); //}; UtilsTools.Timewatch.Restart(); DateTime startDate = DateTime.Now; Tuple <int, int, bool> updateContext = null; try { string dataconnectionstring = dataSource.Connection; #if DEBUG dataconnectionstring = tenant.ConnectionStrings.Data; #endif //更新物理表数据(全量) using MySqlConnection connection = new MySqlConnection(dataconnectionstring); try { connection.Open(); updateContext = CreatePhysicalTable(taskId, tenant, dataSource, connection); } catch (Exception) { throw; } finally { if (connection != null && connection.State == ConnectionState.Open) { connection.Close(); } } //在合表更新逻辑开始之前,记录那个时间点的hash1值,在更新完毕后回写( //更新逻辑结束后从数据库再取hash2值,判断hash1是否等于hash2, // 如果一致,就回写hash值; // 如果不一致,说明上游表在更新这段时间内又发生了变更,这个时候直接退出,不修改当前hash值,下一轮重新生成合表;) if (hashcode != HashUtil.CreateHashcode(dataSource.DataSourceId, dataContext)) { return(new Tuple <bool, bool>(false, updateContext.Item3)); } var dateTime = DateTime.Now; dataSource.UpdateDate = dateTime; dataSource.EndDate = dateTime.ToString("yyyy-MM-dd HH:mm:ss"); dataSource.UpdateStatus = UpdateStatusType.Finish; dataSource.Hashcode = hashcode; dataContext.Entry(dataSource).State = EntityState.Modified; } catch (Exception ex) { _logger.LogError(ex, $"taskId={taskId},更新实体表发生错误,DataSourceId={dataSource.DataSourceId},Name={dataSource.Name}"); dataSource.UpdateStatus = UpdateStatusType.Fail; SaveLog(dataContext, dataSource, $"调度任务执行失败:{ex.Message}", UpdateLogCategory.Exception); throw ex; } _logger.LogInformation($"taskId={taskId}, UpdateStatus={dataSource.UpdateStatus}"); int timewatchUsed = UtilsTools.TimewatchUsed; _logger.LogInformation($"taskId={taskId}, TimewatchUsed={timewatchUsed}millisecond({Math.Round((double)timewatchUsed / 60000, 2)}min)"); UtilsTools.Timewatch.Stop(); //清理数据源缓存 try { RemoveTbbCache(taskId, tenant, dataSource); } catch (Exception ex) { _logger.LogError(ex, $"taskId={taskId},清理数据源缓存发生错误"); } //保存更新日志 try { //AddDataSourceUpdateLog(taskId, tenant, dataSource, new Tuple<int, int, DateTime>(updateContext.Item1, updateContext.Item2, startDate)); SaveLog(dataContext, dataSource, updateContext.Item3 ? "新建成功" : "更新成功", UpdateLogCategory.Information); } catch (Exception ex) { _logger.LogError(ex, $"taskId={taskId},保存更新日志发生错误"); } return(new Tuple <bool, bool>(true, updateContext.Item3)); }
public StubFeed ThrowWhenSearchingFor(string name, string version, UpdateMode mode, Exception exception) { return ThrowWhenSearchingFor(new Dependency(name, version), exception, mode); }
// Applies the tween set by DoGoto. // Returns TRUE if the tween needs to be killed internal override bool ApplyTween(float prevPosition, int prevCompletedLoops, int newCompletedSteps, bool useInversePosition, UpdateMode updateMode, UpdateNotice updateNotice) { float updatePosition = useInversePosition ? duration - position : position; if (DOTween.useSafeMode) { try { tweenPlugin.EvaluateAndApply(plugOptions, this, isRelative, getter, setter, updatePosition, startValue, changeValue, duration, useInversePosition, updateNotice); } catch { // Target/field doesn't exist anymore: kill tween return(true); } } else { tweenPlugin.EvaluateAndApply(plugOptions, this, isRelative, getter, setter, updatePosition, startValue, changeValue, duration, useInversePosition, updateNotice); } return(false); }
protected void throwIfNeeded(Dependency dependency, UpdateMode mode = UpdateMode.Fixed) { var error = _explicitErrors.FirstOrDefault(x => x.Matches(dependency)); if (error != null && error.Mode == mode) { throw error.Exception; } }
public override void Draw(RenderContext renderContext, UpdateMode updateMode) { throw new NotImplementedException(); }
/// <summary> /// Publishes the variable by storing it in the variableCache field. /// </summary> /// <param name="variable">The variable.</param> /// <param name="value">The value.</param> /// <param name="mode">The mode.</param> public void PublishVariable(string variable, object value, UpdateMode mode) { Logger.Instance.WriteMethodEntry(EventIdentifier.ExpressionEvaluatorPublishVariable, "Variable: '{0}'. Value: '{1}'. Update Mode: '{2}'.", variable, value, mode); try { // If the supplied variable doesn't match an entry in the variable cache, // do nothing if (!this.variableCache.ContainsKey(variable)) { Logger.Instance.WriteVerbose(EventIdentifier.ExpressionEvaluatorPublishVariable, "The variable '{0}' doesn't match an entry in the variable cache.", variable); return; } // For modify, simply publish the value to the variable cache if (mode == UpdateMode.Modify) { this.variableCache[variable] = value; Logger.Instance.WriteVerbose(EventIdentifier.ExpressionEvaluatorPublishVariable, "Modified variable '{0}' with value '{1}' in the variable cache.", variable, value); } else if (value != null) { // Use reflection to determine the expected List<> type based on the value // Also get the Add and Remove methods for the list Type listType = typeof(List<>).MakeGenericType(new Type[] { value.GetType() }); MethodInfo add = listType.GetMethod("Add"); MethodInfo remove = listType.GetMethod("Remove"); switch (mode) { case UpdateMode.Insert: if (this.variableCache[variable] == null) { this.variableCache[variable] = value; Logger.Instance.WriteVerbose(EventIdentifier.ExpressionEvaluatorPublishVariable, "Inserted variable '{0}' with value '{1}' into the variable cache.", variable, value); } else if (this.variableCache[variable].GetType() == value.GetType()) { // Single value, create a new instance of the appropriate List<> type // and add both values: existing and new object existingValue = this.variableCache[variable]; this.variableCache[variable] = Activator.CreateInstance(listType); add.Invoke(this.variableCache[variable], new object[] { existingValue }); add.Invoke(this.variableCache[variable], new object[] { value }); Logger.Instance.WriteVerbose(EventIdentifier.ExpressionEvaluatorPublishVariable, "Inserted variable '{0}' with second value '{1}' into the variable cache.", variable, value); } else if (this.variableCache[variable].GetType() == listType) { // The variable is a list of the expected type, add the value add.Invoke(this.variableCache[variable], new object[] { value }); Logger.Instance.WriteVerbose(EventIdentifier.ExpressionEvaluatorPublishVariable, "Inserted variable '{0}' with value '{1}' into the list in the variable cache.", variable, value); } else { // We have a problem and need to report an error throw Logger.Instance.ReportError(EventIdentifier.ExpressionEvaluatorPublishVariableInsertVariableError, new WorkflowActivityLibraryException(Messages.ExpressionEvaluator_PublishVariableInsertVariableError, value.GetType(), variable, this.variableCache[variable].GetType())); } break; case UpdateMode.Remove: if (this.variableCache[variable] == null) { // Do nothing Logger.Instance.WriteVerbose(EventIdentifier.ExpressionEvaluatorPublishVariable, "Nothing to remove since the variable cache does not contain variable '{0}'.", variable); } else if (this.variableCache[variable].Equals(value)) { // A single matching value exists, clear the variable this.variableCache[variable] = null; Logger.Instance.WriteVerbose(EventIdentifier.ExpressionEvaluatorPublishVariable, "Remove variable '{0}' with value '{1}' from the variable cache.", variable, value); } else if (this.variableCache[variable].GetType() == listType) { // The variable is a list of the expected type, attempt to remove the value remove.Invoke(this.variableCache[variable], new object[] { value }); Logger.Instance.WriteVerbose(EventIdentifier.ExpressionEvaluatorPublishVariable, "Remove variable '{0}' with value '{1}' from the list in the variable cache.", variable, value); // Check the count on the list to determine if we are down to a single value or have no value // If so, adjust the value of the variable accordingly to eliminate the list object listValue = null; int i = 0; foreach (object o in (IEnumerable)this.variableCache[variable]) { i += 1; listValue = o; } if (i <= 1) { this.variableCache[variable] = listValue; } } break; } } } finally { Logger.Instance.WriteMethodExit(EventIdentifier.ExpressionEvaluatorPublishVariable, "Variable: '{0}'. Value: '{1}'. Update Mode: '{2}'.", variable, value, mode); } }
public void OnBecameVisible() { updateMode = UpdateMode.FullUpdate; }
public void Reset() { MaxTempRAM = DEFAULT_MAX_TEMP_RAM; IgnoreHidden = DEFAULT_IGNORE_HIDDEN; MainWindowX = DEFAULT_MAIN_WINDOW_X; MainWindowY = DEFAULT_MAIN_WINDOW_Y; MainWindowWidth = DEFAULT_MAIN_WINDOW_WIDTH; MainWindowHeight = DEFAULT_MAIN_WINDOW_HEIGHT; MonitorDrives = DEFAULT_MONITOR_DRIVES; UpdateDelay = DEFAULT_UPDATE_DELAY; UpdateMode = DEFAULT_UPDATE_MODE; Ignores = new List<string>(); IgnoresRegex = new List<Regex>(); Drives = new List<Drive>(); }
public bool ImportCSV(string filename, bool headerrow, UpdateMode mode, out string error, ImportFlags flags) { error = string.Empty; DataTable importTable = Data.Clone(); //Clone table structure to help with mapping List <int> usedids = new List <int>(); int idcolumn = Data.Columns[Key].Ordinal; int maxid = int.MinValue; string pathOnly = Path.GetDirectoryName(filename); string fileName = Path.GetFileName(filename); Func <string, string> Unescape = s => { if (s.StartsWith("\"") && s.EndsWith("\"")) { s = s.Substring(1, s.Length - 2); if (s.Contains("\"\"")) { s = s.Replace("\"\"", "\""); } } return(s); }; try { using (StreamReader sr = new StreamReader(File.OpenRead(filename))) { if (headerrow) { sr.ReadLine(); } while (!sr.EndOfStream) { string line = sr.ReadLine(); string[] rows = Regex.Split(line, ",(?=(?:[^\"]*\"[^\"]*\")*(?![^\"]*\"))", RegexOptions.Compiled); DataRow dr = importTable.NewRow(); for (int i = 0; i < Data.Columns.Count; i++) { string value = Unescape(rows[i]); switch (Data.Columns[i].DataType.Name.ToLower()) { case "sbyte": dr[i] = Convert.ToSByte(value); break; case "byte": dr[i] = Convert.ToByte(value); break; case "int32": case "int": dr[i] = Convert.ToInt32(value); break; case "uint32": case "uint": dr[i] = Convert.ToUInt32(value); break; case "int64": case "long": dr[i] = Convert.ToInt64(value); break; case "uint64": case "ulong": dr[i] = Convert.ToUInt64(value); break; case "single": case "float": dr[i] = Convert.ToSingle(value); break; case "boolean": case "bool": dr[i] = Convert.ToBoolean(value); break; case "string": dr[i] = value; break; case "int16": case "short": dr[i] = Convert.ToInt16(value); break; case "uint16": case "ushort": dr[i] = Convert.ToUInt16(value); break; } //Double check our Ids if (i == idcolumn) { int id = (int)dr[i]; if (flags.HasFlag(ImportFlags.TakeNewest) && usedids.Contains(id)) { var prev = importTable.Rows.Find(id); if (prev != null) { importTable.Rows.Remove(prev); } } else if (flags.HasFlag(ImportFlags.FixIds) && usedids.Contains(id)) { dr[i] = ++maxid; id = (int)dr[i]; } usedids.Add(id); //Add to list maxid = Math.Max(maxid, id); //Update maxid } } importTable.Rows.Add(dr); } } } catch (FormatException ex) { error = $"Mismatch of data to datatype in row index {usedids.Count + 1}"; return(false); } catch (Exception ex) { error = ex.Message; return(false); } switch (Data.ShallowCompare(importTable, false)) { case CompareResult.Type: error = "Import Failed: Imported data has one or more incorrect column types."; return(false); case CompareResult.Count: error = "Import Failed: Imported data has an incorrect number of columns."; return(false); } UpdateData(importTable, mode); return(true); }