public UpdateReadyDialog(Updatable u, UpdateService us) { InitializeComponent(); this.u = u; this.us = us; this.label2.Text = "An update for " + u.getName() + " is ready!"; }
private void FileActionComplete(Updatable updatable, string filename) { ExecutingThreads--; updatable.InProgress = false; updatable.CurrentVersion = updatable.LatestVersion; OnUpdatableItemCompleted(updatable); }
public UpdateInfo(Updatable[] applicationInfos, UpdateXml[] updateInfos) { InitializeComponent(); if (applicationInfos[0].ApplicationIcon != null) this.Icon = applicationInfos[0].ApplicationIcon; int firstUpdatable = 0; for (int i = 0; i < updateInfos.Length; ++i) { if (updateInfos[i].ShouldUpdate) { firstUpdatable = i; break; } } this.Text = applicationInfos[firstUpdatable].ApplicationName + " - Update Info"; this.lblVersions.Text = String.Format(Strings.currUpdVersion, applicationInfos[firstUpdatable].ApplicationVersion.ToString(), updateInfos[firstUpdatable].Version.ToString()); this.txtDescription.Text = ""; for (int i = 0; i < updateInfos.Length; ++i){ UpdateXml updateInfo = updateInfos[i]; if (updateInfo.ShouldUpdate) { this.txtDescription.Text += applicationInfos[i].ApplicationName + "\n"; this.txtDescription.Text += updateInfo.Description + "\n\n"; } } }
private void bgWorker_DoWork(object sender, DoWorkEventArgs e) { Updatable[] applications = (Updatable[])e.Argument; UpdateXml[] result = new UpdateXml[applications.Length]; bool oneSucceeded = false; for (int i = 0; i < applications.Length; ++i) { Updatable application = applications[i]; if (!UpdateXml.existsOnServer(application.UpdateXmlLocation)) { result[i] = null; } else { result[i] = UpdateXml.parse(application.UpdateXmlLocation, application.ApplicationID); } if (!oneSucceeded && result[i] != null) { oneSucceeded = true; } } if (!oneSucceeded) { e.Cancel = true; } e.Result = result; }
/// <summary> /// Instantiate a Job /// </summary> /// <param name="arrivalTime">Next time event will fire for this Job in system</param> /// <param name="creator">UserGroup that spawned this Job</param> /// <param name="entryTime">Entry time into system</param> public Job(double arrivalTime, Updatable creator, double entryTime) { this.systemEntryTime = entryTime; this.arrivalTime = arrivalTime; this.locationInSystem = creator; this.creator = creator; uniqueID = GenerateId(); }
public UpdateRegister(Updatable updatedObject, String tag) { this.tag = tag; this.updatedObject = updatedObject; updatesPassed = 0; frequency = UpdateFrequency.One; timeElapsedSinceLastUpdate = 0; }
private void OnUpdatableItemDownloadProgress(Updatable updatable, int percentage) { UpdatableItemDownloadProgress handler = UpdatableItemDownloadProgress; if (handler != null) { handler(updatable, percentage); } }
private void OnUpdatableItemStarted(Updatable updatable) { var handler = UpdatableItemStarted; if (handler != null) { handler(updatable); } }
public void OnUpdatableItemFailed(Updatable updatable, Exception e) { UpdatableItemFailed handler = UpdatableItemFailed; if (handler != null) { handler(updatable, e); } }
public Update(Updatable[] applicationInfos) { this.applicationInfos = applicationInfos; this.isInstaller = false; this.bgWorker = new BackgroundWorker(); bgWorker.DoWork += new DoWorkEventHandler(bgWorker_DoWork); bgWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bgWorker_RunWorkerCompleted); }
public void EntityTypeDoesNotExistInDatastore() { Assert.Throws <NotSupportedException>( () => { var dumy = new Updatable <Author>(DataStore); } ); }
public void SetUp() { _startable = new Startable(); _updatable = new Updatable(); _destroyable = new Destroyable(); _fixedUpdatable = new FixedUpdatable(); _lateUpdatable = new LateUpdatable(); _container = CreateContainerWith <DependencyContainer>(); }
private void onEndTurn(Updatable up) { StateController st = up.GetComponent <StateController>(); if (st != null) { CheckTransitions(st); } else { Debug.LogError("Wtf no state controller"); } }
private static void ObjectsCollided(object sender, EventArgs e) { Updatable collidingObject1 = (Updatable)(e as CollisionEventArgs).object1; Updatable collidingObject2 = (Updatable)(e as CollisionEventArgs).object2; if (collidingObject1 is Missile) { if (collidingObject2 is Player) { if ((collidingObject1 as Missile).ParentType == typeof(Enemy)) { collidingObject2.Die(); collidingObject1.Die(); } } if (collidingObject2 is Enemy) { if ((collidingObject1 as Missile).ParentType == typeof(Player)) { collidingObject2.Die(); collidingObject1.Die(); } } } if (collidingObject1 is Player) { if (collidingObject2 is Missile) { if ((collidingObject2 as Missile).ParentType == typeof(Enemy)) { collidingObject1.Die(); collidingObject2.Die(); } } } if (collidingObject1 is Enemy) { if (collidingObject2 is Missile) { if ((collidingObject2 as Missile).ParentType == typeof(Player)) { collidingObject1.Die(); collidingObject2.Die(); } } } }
void SubSystemUpdate() { bool online = State != HubState.Idle; for (int i = 0, cnt = _update.Count; i < cnt; ++i) { Updatable system = _update[i]; if (system.UpdateOffline || online) { system.Update(); } } }
private void Update(Updatable updatable) { var latestUpdate = updatable.LatestUpdate; if (latestUpdate == null) { return; } var filename = string.Format("patch-{0}.zip", updatable.Name); _tempFiles.Add(filename); SpawnDownloadFileThread(updatable, filename, latestUpdate); }
public override void Render(StringBuilder sb) { AddProperty("rotate", Vector3.ToString(Rotate)); AddProperty("center", Vector3.ToString(Center)); AddProperty("clingtocamera", ClingToCamera); AddProperty("activetransform", ActiveTransform); AddProperty("presentation", Presentation); AddProperty("presentationangle", PresentationAngle); AddProperty("presentationspeed", PresentationSpeed); AddProperty("kinetic", Kinetic); AddProperty("bounciness", Bounciness); AddProperty("applytoparent", ApplyToParent.ToSlamString()); AddProperty("handdraggable", HandDraggable.ToSlamString()); AddProperty("updatable", Updatable.ToSlamString()); base.Render(sb); }
public bool AreColliding(Object object1, Object object2) { if (!(object1 is Updatable) || !(object2 is Updatable)) { return(false); } Updatable updatable1 = (object1 as Updatable); Updatable updatable2 = (object2 as Updatable); if (updatable1.Position.X + updatable1.Size.X > updatable2.Position.X && updatable1.Position.Y + updatable1.Size.Y > updatable2.Position.Y && updatable1.Position.X + updatable1.Size.X < updatable2.Position.X + updatable2.Size.X && updatable1.Position.Y + updatable1.Size.Y < updatable2.Position.Y + updatable2.Size.Y || updatable2.Position.X + updatable2.Size.X > updatable1.Position.X && updatable2.Position.Y + updatable2.Size.Y > updatable1.Position.Y && updatable2.Position.X + updatable2.Size.X < updatable1.Position.X + updatable1.Size.X && updatable2.Position.Y + updatable2.Size.Y < updatable1.Position.Y + updatable1.Size.Y) { return(true); } return(false); }
internal UpdatableFile(Updatable parent, string name, string path) { if (!Path.IsPathRooted(path)) //make relative paths relative to the main executable path = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), path); this.parent = parent; this.name = name; this.path = path; string verfile = Path.Combine(Path.GetDirectoryName(path), Path.GetFileNameWithoutExtension(path)) + ".ver"; try { version = new Version(File.ReadAllText(verfile)); } catch { version = new Version("0.0.0.0"); } }
internal UpdatableFile(Updatable parent, string name, string path) { if (!Path.IsPathRooted(path)) //make relative paths relative to the main executable { path = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), path); } this.parent = parent; this.name = name; this.path = path; string verfile = Path.Combine(Path.GetDirectoryName(path), Path.GetFileNameWithoutExtension(path)) + ".ver"; try { version = new Version(File.ReadAllText(verfile)); } catch { version = new Version("0.0.0.0"); } }
public void Register(IUpdatable obj) { int index = obj.Index; if (index <= 0) { index = _index++; obj.Index = index; } if (index >= _objects.Length) { Array.Resize(ref _objects, 2 * _objects.Length); } Updatable updatable = _objects[index]; if (updatable == null) { updatable = new Updatable(); updatable.MaxPerFrame = obj.MaxRefFrame; updatable.SkipFrames = obj.SkipFrames; _objects[index] = updatable; int hash = obj.TypeHash; if (hash == 0) { hash = obj.GetType().GetHashCode(); } if (!_updateLimits.ContainsKey(hash)) { _updateLimits[hash] = new SharedValue <uint>(); } updatable.UpdatesCount = _updateLimits[hash]; } updatable.Item = obj; _count++; }
public void Init() { var fieldPropertyFactory = new Mock <IFieldPropertyFactory>(); var sqlCommand = new Mock <IDbCommand>(); var sqlFactory = new Mock <ISqlFactory>(); sqlFactory.Setup(_ => _.CreateFieldPropertyFactory()).Returns(fieldPropertyFactory.Object); sqlFactory.Setup(_ => _.AddParam(It.IsAny <object>(), It.IsAny <ICollection <IDataParameter> >())).Returns("X"); sqlFactory.Setup(_ => _.CreateCommand()).Returns(sqlCommand.Object); var connection = new Mock <IDbConnection>(); var engine = new Mock <IDbEngine>(); engine.Setup(_ => _.GetNewConnection()).Returns(connection.Object); DataStore = new SqlDataStore(engine.Object, sqlFactory.Object); DataStore.AddType <Book>(); UpdateQuery = new Updatable <Book>(DataStore); }
private void SpawnDownloadFileThread(Updatable updatable, string fileName, UpdateVersion latestUpdate) { ExecutingThreads++; updatable.InProgress = true; OnUpdatableItemStarted(updatable); var downloadThread = new Thread(() => { try { using (var webClient = new WebClient()) { webClient.DownloadProgressChanged += (sender, args) => _dispatcher.Invoke(new Action <Updatable, int>(OnUpdatableItemDownloadProgress), updatable, args.ProgressPercentage); webClient.DownloadFileCompleted += (sender, args) => _dispatcher.Invoke(new Action <Updatable, int>(OnUpdatableItemDownloadProgress), updatable, 100); webClient.DownloadFile(latestUpdate.Url, fileName); } using (var zipFile = new ZipFile(fileName)) { zipFile.ExtractAll(updatable.ExtractLocation, ExtractExistingFileAction.OverwriteSilently); } } catch (Exception e) { var ex = new Exception(string.Format("Failed to process update `{0}` to version {3}\nURL:{1}\n{2}", updatable.Name, updatable.LatestUpdate.Url, e.Message, updatable.LatestUpdate.Version), e.InnerException); _dispatcher.Invoke(new Action <Updatable, string, Exception>(FileActionFailed), updatable, fileName, ex); } _dispatcher.Invoke(new Action <Updatable, string>(FileActionComplete), updatable, fileName); }); downloadThread.Start(); }
internal UpdateAccept(Updatable[] applicationInfos, UpdateXml[] updateInfos) { InitializeComponent(); int firstUpdatable = 0; for (int i = 0; i < updateInfos.Length; ++i) { if (updateInfos[i].ShouldUpdate) { firstUpdatable = i; break; } } this.applicationInfos = applicationInfos; this.updateInfos = updateInfos; this.Text = applicationInfos[firstUpdatable].ApplicationName+ Strings.updateAvail; if (applicationInfos[0].ApplicationIcon != null) this.Icon = applicationInfos[0].ApplicationIcon; lblNewVersion.Text = string.Format(Strings.newVersion, updateInfos[firstUpdatable].Version.ToString()); }
public void AddUpdatable(Updatable m) { updatableEntities.Add(m); }
public void RemoveUpdatable(Updatable m) { if (updatableEntities.Contains(m)) updatableEntities.Remove(m); }
public int InsertOrUpdate(T instance) { return(Updatable.InsertOrUpdate(this, instance)); }
public int Update(T instance) { return(Updatable.Update(this, instance)); }
public int Delete(T instance) { return(Updatable.Delete(this, instance)); }
private void UpdaterOnUpdatableItemFailed(Updatable updatable, Exception exception) { MessageBox.Show(exception.Message, "Update Failed", MessageBoxButtons.OK, MessageBoxIcon.Error); Application.Exit(); }
internal UpdatableExecutable(Updatable parent, System.Reflection.Assembly assembly, string name, string path) { }
public Updater Update(string Table) { update = new Updater(Table, Pair); return((Updater)update); }
private void UpdaterOnUpdatableItemCompleted(Updatable name) { _view.ProgressBarValue += 1; }
private void UpdaterOnUpdatableItemDownloadProgress(Updatable updatable, int percentage) { _view.ProgressText2 = string.Format("Downloaded {0}%", percentage); }
public Updater2 Update(string Table, object obj) { update = new Updater2(Maker, db, Where, WhereCondition, (k, v) => pairs.Add(new SimplePair(k, v)), Table, obj); return((Updater2)update); }
private void FileActionFailed(Updatable updatable, string filename, Exception e) { OnUpdatableItemFailed(updatable, e); }