private void AddList(IEnumerable <string> fileList) { foreach ( var myClass in fileList.Where( myClass => _installList.Any(c => c.Location.EqualsIgnoreCase(myClass)) || _installList.Any(c => c.Name.EqualsIgnoreCase(Path.GetFileNameWithoutExtension(myClass))))) { fileList = fileList.Where(u => u.EqualsIgnoreCase(myClass)).ToList(); } var incompatible = 0; Parallel.ForEach(fileList, new ParallelOptions { MaxDegreeOfParallelism = Options.MaxThreads }, currentFile => { _Update newItem = null; if (currentFile.EndsWithIgnoreCase(".MSU")) { newItem = new MsuUpdate(currentFile); } else if (currentFile.EndsWithIgnoreCase(".CAB")) { newItem = new CabUpdate(currentFile); } if (newItem == null || newItem.AppliesTo != OS.Version.ToString()) { incompatible++; //return; } lock (_installList) { _installList.Add(newItem); } }); if (incompatible > 0) { MessageBox.Show(string.Format("{0} item(s) are not compatible with your OS.", incompatible), "Invalid Updates"); } _installList = _installList.GroupBy(x => x.Name.ToLowerInvariant()).Select(x => x.First()).ToList(); //Updates status dgUpdates.ItemsSource = _installList; lblStatus.Text = _installList.Count + " " + Localization.GetString("Global", 54); dgUpdates.Update(); }
public Data_Render(string _i, RectangleF [] _r, int _p,Animacion _a, _Update up) { i = _i; rExt = _r[0]; rInt = _r[1]; Prof = _p; a = _a; update = up; }
internal static _Update Update() { if (_UpdateFunc == null) { _UpdateFunc = (_Update)Marshal.GetDelegateForFunctionPointer( Torque3D.DllLoadUtils.GetProcAddress( Torque3D.Torque3DLibHandle, "fnGuiVariableInspector_update"), typeof(_Update)); } return(_UpdateFunc); }
internal static _Update Update() { if (_UpdateFunc == null) { _UpdateFunc = (_Update)Marshal.GetDelegateForFunctionPointer( NativeLibrary.GetExport( Torque3D.Torque3DLibHandle, "fnGuiVariableInspector_update"), typeof(_Update)); } return(_UpdateFunc); }
public static void Add(_Update update) { var searchUpdate = _updateCache.FirstOrDefault(u => u.MD5.EqualsIgnoreCase(update.MD5)); if (searchUpdate == null) { var newCache = new UpdateCacheItem(); newCache.FileName = Path.GetFileName(update.Location); newCache.Size = update.Size; newCache.PackageName = update.PackageName; newCache.PackageVersion = update.PackageVersion; newCache.Type = update.UpdateType; if (update.MD5.EqualsIgnoreCase("N/A")) { newCache.MD5 = FileHandling.GetMD5(update.Location); } else { newCache.MD5 = update.MD5; } newCache.Architecture = update.Architecture; newCache.PackageDescription = update.Description; newCache.Language = update.Language; newCache.AppliesTo = update.AppliesTo.TryParse <decimal>(); newCache.Support = update.Support; newCache.CreatedDate = update.Date; newCache.AllowedOffline = update.AllowedOffline; lock (_updateCache) { if (update.PackageName.EqualsIgnoreCase("default") || update.PackageName.EqualsIgnoreCase("1.0") || update.PackageName.Equals("000000") || update.AppliesTo.ToString() == "1.0") { newCache.Type = UpdateType.Unknown; xError.Add(newCache.XML); } else { xUpdates.Add(newCache.XML); } _updateCache.Add(newCache); Save(); } } }
private async void addUpdate(IEnumerable <string> files) { dgUpdates.Disable(); pbProgress.Value = 0; lblProgress.Content = "0%"; var source = files.ToArray(); pbProgress.Maximum = source.Count(); _tim = new ElapsedTimer(ref txtTime); _tim.Start(); await Task.Factory.StartNew(delegate { Parallel.ForEach(source, new ParallelOptions { MaxDegreeOfParallelism = Options.MaxThreads }, currentFile => { _Update newUpdate = null; if (currentFile.EndsWithIgnoreCase(".cab")) { newUpdate = new CabUpdate(currentFile); } else if (currentFile.EndsWithIgnoreCase(".msu")) { newUpdate = new MsuUpdate(currentFile); } pbProgress.Increment(lblProgress); if (newUpdate == null) { return; } _updates.Add(newUpdate); }); }); _tim.Stop(); dgUpdates.ItemsSource = _updates; dgUpdates.Update(); }
public void AddData(string i, RectangleF [] r, Animacion a, int p, _Update up) { Render_List.Add(new Data_Render(i, r, p, a, up)); }
public Data_Render(string _i, RectangleF [] _r, int _p,_Update up) : this(_i, _r, _p, null,up) { }
public virtual void Draw(RenderHandler R_H) { _Update up = new _Update(this.Update); R_H(im, rec, null, profundidad,up); }
// start point, called by invoke public void Bind() { try { //WriteLine( "CSAICInterface.Bind >>>" ); initai = new _InitAI( InitAI ); InitAIInstancePointer = Marshal.GetFunctionPointerForDelegate( initai ); SetInitAICallback( InitAIInstancePointer ); update = new _Update( Update ); UpdateInstancePointer = Marshal.GetFunctionPointerForDelegate( update ); SetUpdateCallback( UpdateInstancePointer ); gotchatmsg = new _GotChatMsg( GotChatMsg ); GotChatMsgInstancePointer = Marshal.GetFunctionPointerForDelegate( gotchatmsg ); SetGotChatMsgCallback( GotChatMsgInstancePointer ); unitcreated = new _UnitCreated( UnitCreated ); UnitCreatedInstancePointer = Marshal.GetFunctionPointerForDelegate( unitcreated ); SetUnitCreatedCallback( UnitCreatedInstancePointer ); unitfinished = new _UnitFinished( UnitFinished ); UnitFinishedInstancePointer = Marshal.GetFunctionPointerForDelegate( unitfinished ); SetUnitFinishedCallback( UnitFinishedInstancePointer ); unitidle = new _UnitIdle( UnitIdle ); UnitIdleInstancePointer = Marshal.GetFunctionPointerForDelegate( unitidle ); SetUnitIdleCallback( UnitIdleInstancePointer ); unitmovefailed = new _UnitMoveFailed( UnitMoveFailed ); UnitMoveFailedInstancePointer = Marshal.GetFunctionPointerForDelegate( unitmovefailed ); SetUnitMoveFailedCallback( UnitMoveFailedInstancePointer ); unitdamaged = new _UnitDamaged( UnitDamaged ); UnitDamagedInstancePointer = Marshal.GetFunctionPointerForDelegate( unitdamaged ); SetUnitDamagedCallback( UnitDamagedInstancePointer ); unitdestroyed = new _UnitDestroyed( UnitDestroyed ); UnitDestroyedInstancePointer = Marshal.GetFunctionPointerForDelegate( unitdestroyed ); SetUnitDestroyedCallback( UnitDestroyedInstancePointer ); enemyenterlos = new _EnemyEnterLOS( EnemyEnterLOS ); EnemyEnterLOSInstancePointer = Marshal.GetFunctionPointerForDelegate( enemyenterlos ); SetEnemyEnterLOSCallback( EnemyEnterLOSInstancePointer ); enemyleavelos = new _EnemyLeaveLOS( EnemyLeaveLOS ); EnemyLeaveLOSInstancePointer = Marshal.GetFunctionPointerForDelegate( enemyleavelos ); SetEnemyLeaveLOSCallback( EnemyLeaveLOSInstancePointer ); enemyenterradar = new _EnemyEnterRadar( EnemyEnterRadar ); EnemyEnterRadarInstancePointer = Marshal.GetFunctionPointerForDelegate( enemyenterradar ); SetEnemyEnterRadarCallback( EnemyEnterRadarInstancePointer ); enemyleaveradar = new _EnemyLeaveRadar( EnemyLeaveRadar ); EnemyLeaveRadarInstancePointer = Marshal.GetFunctionPointerForDelegate( enemyleaveradar ); SetEnemyLeaveRadarCallback( EnemyLeaveRadarInstancePointer ); enemydamaged = new _EnemyDamaged( EnemyDamaged ); EnemyDamagedInstancePointer = Marshal.GetFunctionPointerForDelegate( enemydamaged ); SetEnemyDamagedCallback( EnemyDamagedInstancePointer ); enemydestroyed = new _EnemyDestroyed( EnemyDestroyed ); EnemyDestroyedInstancePointer = Marshal.GetFunctionPointerForDelegate( enemydestroyed ); SetEnemyDestroyedCallback( EnemyDestroyedInstancePointer ); // WriteLine( "CSAICInterface.Bind <<<" ); } catch(Exception e ) { sw = new StreamWriter("outbind.log", false ); WriteLine( e.ToString() ); sw.Flush(); sw.Close(); } }
// start point, called by invoke public void Bind() { try { //WriteLine( "CSAICInterface.Bind >>>" ); initai = new _InitAI(InitAI); InitAIInstancePointer = Marshal.GetFunctionPointerForDelegate(initai); SetInitAICallback(InitAIInstancePointer); update = new _Update(Update); UpdateInstancePointer = Marshal.GetFunctionPointerForDelegate(update); SetUpdateCallback(UpdateInstancePointer); gotchatmsg = new _GotChatMsg(GotChatMsg); GotChatMsgInstancePointer = Marshal.GetFunctionPointerForDelegate(gotchatmsg); SetGotChatMsgCallback(GotChatMsgInstancePointer); unitcreated = new _UnitCreated(UnitCreated); UnitCreatedInstancePointer = Marshal.GetFunctionPointerForDelegate(unitcreated); SetUnitCreatedCallback(UnitCreatedInstancePointer); unitfinished = new _UnitFinished(UnitFinished); UnitFinishedInstancePointer = Marshal.GetFunctionPointerForDelegate(unitfinished); SetUnitFinishedCallback(UnitFinishedInstancePointer); unitidle = new _UnitIdle(UnitIdle); UnitIdleInstancePointer = Marshal.GetFunctionPointerForDelegate(unitidle); SetUnitIdleCallback(UnitIdleInstancePointer); unitmovefailed = new _UnitMoveFailed(UnitMoveFailed); UnitMoveFailedInstancePointer = Marshal.GetFunctionPointerForDelegate(unitmovefailed); SetUnitMoveFailedCallback(UnitMoveFailedInstancePointer); unitdamaged = new _UnitDamaged(UnitDamaged); UnitDamagedInstancePointer = Marshal.GetFunctionPointerForDelegate(unitdamaged); SetUnitDamagedCallback(UnitDamagedInstancePointer); unitdestroyed = new _UnitDestroyed(UnitDestroyed); UnitDestroyedInstancePointer = Marshal.GetFunctionPointerForDelegate(unitdestroyed); SetUnitDestroyedCallback(UnitDestroyedInstancePointer); enemyenterlos = new _EnemyEnterLOS(EnemyEnterLOS); EnemyEnterLOSInstancePointer = Marshal.GetFunctionPointerForDelegate(enemyenterlos); SetEnemyEnterLOSCallback(EnemyEnterLOSInstancePointer); enemyleavelos = new _EnemyLeaveLOS(EnemyLeaveLOS); EnemyLeaveLOSInstancePointer = Marshal.GetFunctionPointerForDelegate(enemyleavelos); SetEnemyLeaveLOSCallback(EnemyLeaveLOSInstancePointer); enemyenterradar = new _EnemyEnterRadar(EnemyEnterRadar); EnemyEnterRadarInstancePointer = Marshal.GetFunctionPointerForDelegate(enemyenterradar); SetEnemyEnterRadarCallback(EnemyEnterRadarInstancePointer); enemyleaveradar = new _EnemyLeaveRadar(EnemyLeaveRadar); EnemyLeaveRadarInstancePointer = Marshal.GetFunctionPointerForDelegate(enemyleaveradar); SetEnemyLeaveRadarCallback(EnemyLeaveRadarInstancePointer); enemydamaged = new _EnemyDamaged(EnemyDamaged); EnemyDamagedInstancePointer = Marshal.GetFunctionPointerForDelegate(enemydamaged); SetEnemyDamagedCallback(EnemyDamagedInstancePointer); enemydestroyed = new _EnemyDestroyed(EnemyDestroyed); EnemyDestroyedInstancePointer = Marshal.GetFunctionPointerForDelegate(enemydestroyed); SetEnemyDestroyedCallback(EnemyDestroyedInstancePointer); // WriteLine( "CSAICInterface.Bind <<<" ); } catch (Exception e) { sw = new StreamWriter("outbind.log", false); WriteLine(e.ToString()); sw.Flush(); sw.Close(); } }
public override void Draw(RenderHandler R_H) { _Update up = new _Update(this.Update); R_H(im, rec, ani, profundidad, up); }