Example #1
0
 public UpdateReadyDialog(Updatable u, UpdateService us)
 {
     InitializeComponent();
     this.u = u;
     this.us = us;
     this.label2.Text = "An update for " + u.getName() + " is ready!";
 }
Example #2
0
 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";
                }
            }
        }
Example #4
0
        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;
        }
Example #5
0
 /// <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();
 }
Example #6
0
 public UpdateRegister(Updatable updatedObject, String tag)
 {
     this.tag = tag;
     this.updatedObject = updatedObject;
     updatesPassed = 0;
     frequency = UpdateFrequency.One;
     timeElapsedSinceLastUpdate = 0;
 }
Example #7
0
 public UpdateRegister(Updatable updatedObject, String tag)
 {
     this.tag                   = tag;
     this.updatedObject         = updatedObject;
     updatesPassed              = 0;
     frequency                  = UpdateFrequency.One;
     timeElapsedSinceLastUpdate = 0;
 }
Example #8
0
        private void OnUpdatableItemDownloadProgress(Updatable updatable, int percentage)
        {
            UpdatableItemDownloadProgress handler = UpdatableItemDownloadProgress;

            if (handler != null)
            {
                handler(updatable, percentage);
            }
        }
Example #9
0
        private void OnUpdatableItemStarted(Updatable updatable)
        {
            var handler = UpdatableItemStarted;

            if (handler != null)
            {
                handler(updatable);
            }
        }
Example #10
0
        public void OnUpdatableItemFailed(Updatable updatable, Exception e)
        {
            UpdatableItemFailed handler = UpdatableItemFailed;

            if (handler != null)
            {
                handler(updatable, e);
            }
        }
Example #11
0
        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);
        }
Example #12
0
 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>();
        }
Example #14
0
    private void onEndTurn(Updatable up)
    {
        StateController st = up.GetComponent <StateController>();

        if (st != null)
        {
            CheckTransitions(st);
        }
        else
        {
            Debug.LogError("Wtf no state controller");
        }
    }
Example #15
0
        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();
                    }
                }
            }
        }
Example #16
0
        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();
                }
            }
        }
Example #17
0
        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);
        }
Example #18
0
 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);
 }
Example #19
0
        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");
     }
 }
Example #21
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");
            }
        }
Example #22
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++;
        }
Example #23
0
        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);
        }
Example #24
0
        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);
 }
Example #28
0
 public int InsertOrUpdate(T instance)
 {
     return(Updatable.InsertOrUpdate(this, instance));
 }
Example #29
0
 public int Update(T instance)
 {
     return(Updatable.Update(this, instance));
 }
Example #30
0
 public int Delete(T instance)
 {
     return(Updatable.Delete(this, instance));
 }
Example #31
0
 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);
        }
Example #34
0
 private void UpdaterOnUpdatableItemCompleted(Updatable name)
 {
     _view.ProgressBarValue += 1;
 }
Example #35
0
 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);
 }
Example #37
0
 private void FileActionFailed(Updatable updatable, string filename, Exception e)
 {
     OnUpdatableItemFailed(updatable, e);
 }