public Present Evaluate(Present[] paramList) { D.Assert(paramList.Length == 3); for (int i = 0; i < paramList.Length; i++) { Present present = paramList[i]; if (present is PresentFailureCode) { return present; } } if (!(paramList[0] is ImageRef)) { return paramList[0]; } ImageRef imageRef = (ImageRef)paramList[0]; TileAddress tileAddress = (TileAddress)paramList[1]; BoundsPresent boundsPresent = (BoundsPresent)paramList[2]; MapRectangle mapWindow = CoordinateSystemUtilities.TileAddressToMapRectangle(this.coordinateSystem, tileAddress); Region clipRegion = boundsPresent.GetRenderRegion().GetClipRegion(mapWindow, tileAddress.ZoomLevel, this.coordinateSystem); GDIBigLockedImage gDIBigLockedImage = new GDIBigLockedImage(imageRef.image.Size, "UserClipperVerb"); gDIBigLockedImage.SetClip(clipRegion); gDIBigLockedImage.DrawImageOntoThis(imageRef.image, new RectangleF(0f, 0f, (float)gDIBigLockedImage.Size.Width, (float)gDIBigLockedImage.Size.Height), new RectangleF(0f, 0f, (float)imageRef.image.Size.Width, (float)imageRef.image.Size.Height)); ImageRef result = new ImageRef(new ImageRefCounted(gDIBigLockedImage)); boundsPresent.Dispose(); imageRef.Dispose(); return result; }
public Present Evaluate(Present[] paramList) { if (!(paramList[0] is IntParameter)) { return PresentFailureCode.FailedCast(paramList[0], "FoxitOpenDocument.Evaluate"); } switch (((IntParameter)paramList[0]).value) { case 0: { D.Assert(paramList.Length == 5); MapRectangleParameter mapRectangleParameter = (MapRectangleParameter)paramList[1]; SizeParameter sizeParameter = (SizeParameter)paramList[2]; BoolParameter boolParameter = (BoolParameter)paramList[3]; BoolParameter boolParameter2 = (BoolParameter)paramList[4]; return this.Render(mapRectangleParameter.value, sizeParameter.value, boolParameter.value, boolParameter2.value); } case 1: D.Assert(paramList.Length == 1); return this.FetchBounds(); case 2: D.Assert(paramList.Length == 2); return new IntParameter(5); case 3: D.Assert(paramList.Length == 1); if (BuildConfig.theConfig.suppressFoxitMessages) { return new StringParameter(null); } return new StringParameter("MapCruncher PDF rendering powered by Foxit Software Company"); default: return new PresentFailureCode("Invalid AccessVerb"); } }
public Present Evaluate(Present[] paramList) { MapRectangle mapRectangle = null; int i = 0; while (i < paramList.Length) { Present present = paramList[i]; Present result; if (present is PresentFailureCode) { result = new PresentFailureCode((PresentFailureCode)present, "CompositeBoundsVerb"); } else { if (present is BoundsPresent) { ((BoundsPresent)present).GetRenderRegion().AccumulateBoundingBox(ref mapRectangle); i++; continue; } result = new PresentFailureCode(new Exception("Unexpected result of child computation in CompositeBoundsVerb")); } return result; } if (mapRectangle == null) { return new PresentFailureCode("No valid sourcemaps in input."); } RenderRegion renderRegion = new RenderRegion(mapRectangle, new DirtyEvent()); return new BoundsPresent(renderRegion); }
public Present Evaluate(Present[] paramList) { D.Assert(paramList.Length == 2); MapRectangle value = ((MapRectangleParameter)paramList[0]).value; Size value2 = ((SizeParameter)paramList[1]).value; MapRectangle mapRectangle = value.Transform(this.imageTransformer.getDestLatLonToSourceTransformer()).GrowFraction(0.05); Present present = this.warpedBoundsFuture.Realize("WarpImageVerb.Evaluate-bounds"); if (present is BoundsPresent) { MapRectangle boundingBox = ((BoundsPresent)present).GetRenderRegion().GetBoundingBox(); if (!boundingBox.intersects(value)) { return new BeyondImageBounds(); } } Present present2 = this.sourceMapSupplier.Curry(new ParamDict(new object[] { TermName.ImageBounds, new MapRectangleParameter(mapRectangle) })).Realize("WarpImageVerb.Evaluate"); if (present2 is PresentFailureCode) { return present2; } ImageRef imageRef = (ImageRef)present2; GDIBigLockedImage gDIBigLockedImage = new GDIBigLockedImage(value2, "WarpImageVerb"); this.imageTransformer.doTransformImage(imageRef.image, mapRectangle, gDIBigLockedImage, value); imageRef.Dispose(); return new ImageRef(new ImageRefCounted(gDIBigLockedImage)); }
public Present Evaluate(Present[] paramList) { StringParameter stringParameter = (StringParameter)paramList[0]; IntParameter intParameter = (IntParameter)paramList[1]; D.Assert(paramList.Length == 2); Present result; try { result = new WPFOpenDocument(stringParameter.value, intParameter.value); } catch (DllNotFoundException ex) { MessageBox.Show("It appears that .Net 3.0 is not installed on this machine. Please install .Net 3.0 and restart the application.", "Missing Dependency"); result = new PresentFailureCode(ex); } catch (FileNotFoundException ex2) { if (ex2.Source == "PresentationCore") { MessageBox.Show("It appears that .Net 3.0 is not installed on this machine. Please install .Net 3.0 and restart the application.", "Missing Dependency"); } result = new PresentFailureCode(ex2); } catch (Exception ex3) { result = new PresentFailureCode(ex3); } return result; }
public static PresentFailureCode FailedCast(Present result, string provenance) { if (result is PresentFailureCode) { return new PresentFailureCode((PresentFailureCode)result, provenance); } return new PresentFailureCode(string.Format("Unexpected type {0} at {1}", result.GetType(), provenance)); }
public Present Evaluate(Present[] paramList) { Size value = ((SizeParameter)paramList[0]).value; GDIBigLockedImage gDIBigLockedImage = new GDIBigLockedImage(value, "CompositeImageVerb"); Present result; try { GDIBigLockedImage obj; Monitor.Enter(obj = gDIBigLockedImage); try { Graphics graphics = gDIBigLockedImage.IPromiseIAmHoldingGDISLockSoPleaseGiveMeTheGraphics(); using (graphics) { for (int i = 1; i < paramList.Length; i++) { Present present = paramList[i]; if (present is PresentFailureCode) { result = new PresentFailureCode((PresentFailureCode)present, "CompositeImageVerb"); return result; } if (!(present is ImageRef)) { result = new PresentFailureCode(new Exception("Unexpected result of child computation in CompositeImageVerb")); return result; } ImageRef imageRef = (ImageRef)present; GDIBigLockedImage image; Monitor.Enter(image = imageRef.image); try { graphics.DrawImage(imageRef.image.IPromiseIAmHoldingGDISLockSoPleaseGiveMeTheImage(), new Rectangle(0, 0, value.Width, value.Height)); } finally { Monitor.Exit(image); } } } } finally { Monitor.Exit(obj); } ImageRef imageRef2 = new ImageRef(new ImageRefCounted(gDIBigLockedImage)); gDIBigLockedImage = null; result = imageRef2; } finally { if (gDIBigLockedImage != null) { gDIBigLockedImage.Dispose(); } } return result; }
private void StoreRenderRegion(Present present) { if (this.renderRegion == null && present is BoundsPresent) { BoundsPresent boundsPresent = (BoundsPresent)present; this.renderRegion = boundsPresent.GetRenderRegion().Copy(this.dirtyEvent); this.boundsChangedEvent.SetDirty(); } }
public AsyncRecord(AsyncScheduler scheduler, IFuture cacheKeyToEvict, IFuture future) { this._cacheKeyToEvict = cacheKeyToEvict; this._future = future; this.scheduler = scheduler; this._present = null; this.asyncState = AsyncState.Prequeued; this.queuePriority = 0; this.qtpRef = new AsyncRef(this, "qRef"); }
public static string DescribeResult(Present result) { if (result == null) { return "Processing"; } if (result is PresentFailureCode) { return ((PresentFailureCode)result).ToString(); } return "Complete"; }
public Present Evaluate(Present[] paramList) { if (paramList[0] is PresentFailureCode) { return new PresentFailureCode((PresentFailureCode)paramList[0], "ApplyVerbPresent"); } if (!(paramList[0] is VerbPresent)) { return PresentFailureCode.FailedCast(paramList[0], "ApplyVerbPresent"); } Present[] array = new Present[paramList.Length - 1]; Array.Copy(paramList, 1, array, 0, paramList.Length - 1); return ((VerbPresent)paramList[0]).Evaluate(array); }
public Present Evaluate(Present[] paramList) { Present result; try { TileAddress ta = (TileAddress)paramList[0]; if (BuildConfig.theConfig.injectTemporaryTileFailures && new Random().Next() % 2 == 0) { result = new InjectedTileFailure(); } else { HttpWebRequest httpWebRequest = (HttpWebRequest)WebRequest.Create(this.GetTileURL(ta)); httpWebRequest.Timeout = 9000; HttpWebResponse httpWebResponse; try { httpWebResponse = (HttpWebResponse)httpWebRequest.GetResponse(); } catch (WebException ex) { if (ex.Response is HttpWebResponse) { HttpWebResponse httpWebResponse2 = (HttpWebResponse)ex.Response; if (httpWebResponse2.StatusCode == HttpStatusCode.BadRequest || httpWebResponse2.StatusCode == HttpStatusCode.NotFound) { result = new UnretryableFailure(ex); return result; } } result = new RetryableFailure(ex, "Timeout waiting for tile in WebTileFetch"); return result; } if (httpWebResponse.StatusCode != HttpStatusCode.OK) { throw new Exception(string.Format("HTTP {0} from web source", httpWebResponse.StatusCode.ToString())); } Stream responseStream = httpWebResponse.GetResponseStream(); GDIBigLockedImage image = GDIBigLockedImage.FromStream(responseStream); httpWebResponse.Close(); result = new ImageRef(new ImageRefCounted(image)); } } catch (Exception ex2) { result = new PresentFailureCode(ex2); } return result; }
public override Present Realize(string refCredit) { Present present = this.documentFuture.Realize(refCredit); if (!(present is SourceDocument)) { return PresentFailureCode.FailedCast(present, "FetchDocumentFuture"); } SourceDocument sourceDocument = (SourceDocument)present; string filesystemAbsolutePath = sourceDocument.localDocument.GetFilesystemAbsolutePath(); Present[] paramList = new Present[] { new StringParameter(filesystemAbsolutePath), new IntParameter(sourceDocument.localDocument.GetPageNumber()) }; string text = Path.GetExtension(filesystemAbsolutePath).ToLower(); if (text[0] == '.') { text = text.Substring(1); } Verb verb = null; string a = null; if (FetchDocumentFuture.knownExtensions.ContainsKey(text)) { a = FetchDocumentFuture.knownExtensions[text]; } if (a == "FoxIt") { verb = new FoxitOpenVerb(); } else { if (a == "WPF") { verb = new WPFOpenVerb(); } else { if (a == "GDI") { verb = new GDIOpenVerb(); } } } if (verb == null) { return new PresentFailureCode(new UnknownImageTypeException("Unknown file type " + text)); } return verb.Evaluate(paramList); }
/// <summary> /// Returns the length of ribbon required to wrap the specified present. /// </summary> /// <param name="present">The present to calculate the required length of ribbon for.</param> /// <returns>The length of ribbon, in feet, required to wrap the present.</returns> private static int GetRibbonLength(Present present) { var perimetersOfSides = new[] { (present.Length + present.Width) * 2, (present.Width + present.Height) * 2, (present.Height + present.Length) * 2, }; int smallestPerimeter = perimetersOfSides.Min(); int lengthForBow = present.Height * present.Length * present.Width; return smallestPerimeter + lengthForBow; }
/// <summary> /// Presents the contents of the next buffer in the sequence of back buffers to the screen. /// </summary> /// <param name="presentFlags">The present flags.</param> /// <param name="sourceRectangle">The area of the back buffer that should be presented.</param> /// <param name="destinationRectangle">The area of the front buffer that should receive the result of the presentation.</param> /// <param name="windowOverride">The destination window whose client area is taken as the target for this presentation.</param> /// <unmanaged>HRESULT IDirect3DSwapChain9::Present([In, Optional] const void* pSourceRect,[InOut, Optional] const void* pDestRect,[In] HWND hDestWindowOverride,[In] const RGNDATA* pDirtyRegion,[In] unsigned int dwFlags)</unmanaged> public void Present(Present presentFlags, Rectangle sourceRectangle, Rectangle destinationRectangle, IntPtr windowOverride) { unsafe { var srcPtr = IntPtr.Zero; if (sourceRectangle != Rectangle.Empty) srcPtr = new IntPtr(&sourceRectangle); var destPtr = IntPtr.Zero; if (destinationRectangle != Rectangle.Empty) destPtr = new IntPtr(&destinationRectangle); Present(srcPtr, destPtr, windowOverride, IntPtr.Zero, (int)presentFlags); } }
public Present Evaluate(Present[] paramList) { StringParameter stringParameter = (StringParameter)paramList[0]; IntParameter intParameter = (IntParameter)paramList[1]; D.Assert(paramList.Length == 2); Present result; try { result = new FoxitOpenDocument(stringParameter.value, intParameter.value); } catch (Exception ex) { result = new PresentFailureCode(ex); } return result; }
void Awake() { pathfinder = GetComponent<NavMeshAgent> (); // компонент NavMeshAgent present = GetComponent<Present> (); if (GameObject.FindGameObjectWithTag ("Player") != null) { hasTarget = true; target = GameObject.FindGameObjectWithTag ("Player").transform; // находим по тегу трансформ Игрока targetEntity = target.GetComponent<LivingEntity>(); myCollisionRadius = GetComponent<CapsuleCollider> ().radius; //берем врага коллайдер.radius targetCollisionRadius = target.GetComponent<CapsuleCollider>().radius; // берем свой коллайдер.radius } }
public static Present ToPresent(this EditPresentModel model) { var present = new Present { Id = model.Id, Title = model.Title, Description = model.Description, ShortDescription = model.ShortDescription, Address = model.Address, Latitude = model.Latitude, Longitude = model.Longitude, FakeRequestsCount = model.FakeRequestsCount, Rating = model.Rating, VideoLink = model.VideoLink }; return present; }
public Present Evaluate(Present[] paramList) { D.Assert(paramList.Length == 0); if (this.userRegion != null) { return new BoundsPresent(this.userRegion); } Present present = this.delayedStaticBoundsFuture.Realize("UserBoundsRefVerb.Evaluate"); if (present is BoundsPresent) { return present; } if (present is PresentFailureCode) { return new PresentFailureCode((PresentFailureCode)present, "BoundsPresent.Evaluate"); } return new PresentFailureCode(string.Format("Unrecognized Present type {0} in BoundsPresent.Evaluate", present.GetType())); }
public Present Evaluate(Present[] paramList) { D.Assert(paramList.Length == 1); TileAddress tileAddress = (TileAddress)paramList[0]; if (tileAddress.ZoomLevel < 1) { return new PresentFailureCode(new Exception("zoomlevel 0")); } ITileAddressLayout tileAddressLayout = this.coordinateSystem.GetTileAddressLayout(); TileAddress tileAddress2 = new TileAddress(tileAddressLayout.XValueOneTileEast(tileAddress), tileAddressLayout.YValueOneTileSouth(tileAddress), tileAddress.ZoomLevel); LatLon latLonOfTileNW = this.coordinateSystem.GetLatLonOfTileNW(tileAddress); LatLon latLonOfTileNW2 = this.coordinateSystem.GetLatLonOfTileNW(tileAddress2); if (latLonOfTileNW2.lon <= latLonOfTileNW.lon) { latLonOfTileNW2 = new LatLon(latLonOfTileNW2.lat, latLonOfTileNW2.lon + 360.0); } D.Assert(latLonOfTileNW2.lon > latLonOfTileNW.lon); return new MapRectangleParameter(new MapRectangle(latLonOfTileNW, latLonOfTileNW2)); }
public Present Evaluate(Present[] paramList) { D.Assert(paramList.Length == 2); if (!(paramList[0] is ImageRef)) { return paramList[0]; } if (!(paramList[1] is TileAddress)) { return paramList[1]; } ImageRef imageRef = (ImageRef)paramList[0]; TileAddress tileAddress = (TileAddress)paramList[1]; double fadeForZoomLevel = this.fadeOptions.GetFadeForZoomLevel(tileAddress.ZoomLevel); if (fadeForZoomLevel == 1.0) { return imageRef; } return this.FadeTile(imageRef, fadeForZoomLevel); }
public void WriteObject(Present present, string path, out long length) { if (!(present is ImageRef)) { if (!this.complainedSet.ContainsKey(present.GetType())) { this.complainedSet[present.GetType()] = true; D.Sayf(0, "No support for disk streams for type {0}", new object[] { present.GetType() }); } length = 0L; return; } GDIBigLockedImage image = ((ImageRef)present).image; string text = path + "." + PresentDiskDispatcher.outputExtension(image.RawFormat); if (File.Exists(text)) { throw new WriteObjectFailedException(text, "file exists", null); } try { image.Save(text); } catch (Exception innerEx) { throw new WriteObjectFailedException(text, "exception", innerEx); } Stream stream = new FileStream(path, FileMode.Create, FileAccess.Write); stream.Write(new byte[] { 0 }, 0, 1); StreamWriter streamWriter = new StreamWriter(stream); streamWriter.Write(text); streamWriter.Flush(); length = PresentDiskDispatcher.FileLength(text) + stream.Length; stream.Close(); }
public void Dispose() { if (this.present != null) { this.present.Dispose(); this.present = null; } Monitor.Enter(this); try { if (this.wait != null) { this.wait.Close(); this.wait = null; } } finally { Monitor.Exit(this); } CacheRecord.cacheRecordsExtant.crement(-1); }
public Present Evaluate(Present[] paramList) { D.Assert(paramList.Length == 1); IBoundsProvider boundsProvider = (IBoundsProvider)paramList[0]; RenderRegion renderRegion = boundsProvider.GetRenderRegion(); IPointTransformer robustPointTransform = this.imageTransformer.getSourceToDestLatLonTransformer(); double num = 0.05; List<LatLon> asLatLonList = renderRegion.GetAsLatLonList(); List<LatLon> list = new List<LatLon>(); for (int i = 0; i < asLatLonList.Count; i++) { int index = (i + 1) % asLatLonList.Count; LatLon source = asLatLonList[i]; LatLon dest = asLatLonList[index]; ParametricLine parametricLine = new ParametricLine(source, dest); int numSteps = (int)Math.Max(1.0, parametricLine.Length() / num); List<LatLon> list2 = parametricLine.Interpolate(numSteps); list.AddRange(list2.ConvertAll<LatLon>((LatLon inp) => robustPointTransform.getTransformedPoint(inp))); } RenderRegion renderRegion2 = new RenderRegion(list, new DirtyEvent()); return new BoundsPresent(renderRegion2); }
public void Process() { try { this.present = this.future.Realize("CacheRecord.Process"); } catch (Exception ex) { this.present = new PresentFailureCode(ex); } D.Assert(this.present != null); Monitor.Enter(this); try { this.wait.Set(); this.wait.Close(); this.wait = null; } finally { Monitor.Exit(this); } }
public Present Evaluate(Present[] paramList) { Present result; try { TileAddress ta = (TileAddress)paramList[0]; string renderPath = this.namingScheme.GetRenderPath(ta); if (File.Exists(renderPath)) { GDIBigLockedImage gDIBigLockedImage = GDIBigLockedImage.FromFile(renderPath); gDIBigLockedImage.CopyPixels(); result = new ImageRef(new ImageRefCounted(gDIBigLockedImage)); } else { result = new BeyondImageBounds(); } } catch (Exception ex) { result = new PresentFailureCode(ex); } return result; }
public void selectPresent(Present present) { if (gameManager.CurrentState == GameManager.GameState.PLAYER_SELECTION) { // for selection group if (present.IsSelected) { increaseSelectCount(-1); switch (present.SelectionGroup) { case Present.PresentGroup.GROUP0: present.SelectionGroup = Present.PresentGroup.UNSELECTED; break; case Present.PresentGroup.GROUP1: setPresentGroupByGroup(Present.PresentGroup.UNSELECTED_GROUP1); break; case Present.PresentGroup.GROUP2: setPresentGroupByGroup(Present.PresentGroup.UNSELECTED_GROUP2); break; default: present.SelectionGroup = Present.PresentGroup.UNSELECTED; break; } } else { if (isSelectable(present)) { increaseSelectCount(1); switch (present.SelectionGroup) { case Present.PresentGroup.UNSELECTED: present.SelectionGroup = Present.PresentGroup.GROUP0; break; case Present.PresentGroup.UNSELECTED_GROUP1: setPresentGroupByGroup(Present.PresentGroup.GROUP1); break; case Present.PresentGroup.UNSELECTED_GROUP2: setPresentGroupByGroup(Present.PresentGroup.GROUP2); break; default: present.SelectionGroup = Present.PresentGroup.GROUP0; break; } } } } else { if (present.IsSelected) { increaseSelectCount(-1); present.SelectionGroup = Present.PresentGroup.UNSELECTED; removeFromPresentGroupStore(present); } else { if (isSelectable(present)) { increaseSelectCount(1); present.SelectionGroup = getTypeOfEmptyPresentGroupStore(); PresentGroupStore = present; } } } }
/// <summary> /// Operates All Options, not just 1 /// </summary> // Does this work things that operate on Commands??? override protected async Task SelectAction_Inner <T>(string prompt, IExecuteOn <T>[] options, Present present, T ctx) { foreach (var opt in options) { await opt.Execute(ctx); } }
// Used in the overlay unsafe int PresentExHook(IntPtr devicePtr, SharpDX.Rectangle *pSourceRect, SharpDX.Rectangle *pDestRect, IntPtr hDestWindowOverride, IntPtr pDirtyRegion, Present dwFlags) { try { _isUsingPresent = true; DeviceEx device = (DeviceEx)devicePtr; DoCaptureRenderTarget(device, "PresentEx"); // Region region = new Region(pDirtyRegion); if (pSourceRect == null || *pSourceRect == SharpDX.Rectangle.Empty) { device.PresentEx(dwFlags); } else { if (hDestWindowOverride != IntPtr.Zero) { device.PresentEx(dwFlags, *pSourceRect, *pDestRect, hDestWindowOverride); } else { device.PresentEx(dwFlags, *pSourceRect, *pDestRect); } } return(SharpDX.Result.Ok.Code); } catch (Exception ex) { DebugMessage(ex.ToString()); return(SharpDX.Result.Ok.Code); } }
public void Setup() { this.present = new Present("Test", 20.00); this.bag = new Bag(); }
public DeferredWriteRecord(Present result, string freshPath, string debugOriginInfo) { this.result = result.Duplicate("DiskCache.DeferredWriteRecord"); this.freshPath = freshPath; this.debugOriginInfo = debugOriginInfo; }
public static TokenFrom1Space TokenToMove(SpiritIsland.Space srcSpace, int count, Token[] options, Present present) => new TokenFrom1Space(present != Present.Done ? $"Move ({count})" : $"Move up to ({count})", srcSpace, options, present);
public virtual async Task <PowerCard> ForgetPowerCard_UserChoice(IEnumerable <PowerCard> options, Present present = Present.Always) { PowerCard cardToForget = await this.SelectPowerCard("Select power card to forget", options, CardUse.Forget, present); if (cardToForget != null) { Forget(cardToForget); } return(cardToForget); }
/// <summary> /// Presents the contents of the next buffer in the sequence of back buffers to the screen. /// </summary> /// <param name="presentFlags">The present flags.</param> /// <unmanaged>HRESULT IDirect3DSwapChain9::Present([In, Optional] const void* pSourceRect,[InOut, Optional] const void* pDestRect,[In] HWND hDestWindowOverride,[In] const RGNDATA* pDirtyRegion,[In] unsigned int dwFlags)</unmanaged> public void Present(Present presentFlags) { Present(IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, (int)presentFlags); }
public ConstantVerb(Present constantPresent) { this.constantPresent = constantPresent; }
//public bool UseDefaultDetailContent //{ // get { return _UseDefaultContent; } // set // { // _UseDefaultContent = value; // foreach ( var item in _DetialContents ) // { // item.Visible = value; // } // } //} protected override void FillFilter() { //畫面沒有設定完成就什麼都不做 if (!_Initilized || !Loaded) { return; } List <string> primaryKeys = new List <string>(); List <string> filters = new List <string>(); foreach (string each in AllStatus) { //if (FilterMenu[each].Checked) // filters.Add(each); if (FilterMenu[each].Checked) { //#region 待刪除畢業及離校 //if (each != "畢業或離校") filters.Add(each); //#endregion } } foreach (var item in Items.GetStatusStudents(filters.ToArray())) { if (!primaryKeys.Contains(item.ID)) { primaryKeys.Add(item.ID); } } //#region 待刪除畢業及離校 ////// 加這判斷主要當 click button 會進來2次 //bool clickChkeck1 = false; //string GraduatePath1 = "畢業或離校"; //// string NotInGraduateName = "離校(非畢修業)"; //FilterMenu[GraduatePath1].Click += delegate //{ // if (clickChkeck1 == false) // { // if (FilterMenu[GraduatePath1].Checked == false) // { // foreach (string GraduatePath2 in GraduateList) // FilterMenu[GraduatePath1][GraduatePath2].Checked = true; // // 加入所有畢業或離校學生 // foreach (string id in GraduateLeaveInfoAll.Keys) // if (!primaryKeys.Contains(id)) // primaryKeys.Add(id); // FilterMenu[GraduatePath1].Checked = true; // } // else // { // foreach (string GraduatePath2 in GraduateList) // FilterMenu[GraduatePath1][GraduatePath2].Checked = false; // FilterMenu[GraduatePath1].Checked = false; // } // Present.SetFilteredSource(primaryKeys); // clickChkeck1 = true; // } //}; //bool chkGrad = true; //foreach (string str in GraduateList) // if (FilterMenu[GraduatePath1][str].Checked == false) // chkGrad = false; //if (chkGrad == true) // FilterMenu[GraduatePath1].Checked = true; //else // FilterMenu[GraduatePath1].Checked = false; //string NotInGraduateName = "離校(非畢修業)"; //// 新加入畢業,修業分開 //foreach (string GraduatePath2 in GraduateList) //{ // // 當有選起 // if (FilterMenu[GraduatePath1][GraduatePath2].Checked) // { // // 加入畢業 // if (GraduateLeaveInfoU.ContainsKey(GraduatePath2)) // foreach (string id in GraduateLeaveInfoU[GraduatePath2]) // if (!primaryKeys.Contains(id)) // primaryKeys.Add(id); // // 加入修業 // if (GraduateLeaveInfoD.ContainsKey(GraduatePath2)) // foreach (string id in GraduateLeaveInfoD[GraduatePath2]) // if (!primaryKeys.Contains(id)) // primaryKeys.Add(id); // } //} //// 非畢業 //if (FilterMenu[GraduatePath1][NotInGraduateName].Checked) //{ // List<string> checkIDs = new List<string>(); // foreach (List<string> IDs in GraduateLeaveInfoU.Values) // foreach (string id in IDs) // checkIDs.Add(id); // foreach (List<string> IDs in GraduateLeaveInfoD.Values) // foreach (string id in IDs) // checkIDs.Add(id); // foreach (string id in GraduateLeaveInfoAll.Keys) // if (!checkIDs.Contains(id)) // if (!primaryKeys.Contains(id)) // primaryKeys.Add(id); //} //#endregion Present.SetFilteredSource(primaryKeys); }
public Present Evaluate(Present[] paramList) { D.Assert(paramList.Length == 4); MapRectangleParameter parameter = (MapRectangleParameter)paramList[0]; SizeParameter parameter2 = (SizeParameter)paramList[1]; Present present = paramList[2]; Present present2 = paramList[3]; double num = Math.Min(parameter.value.LonExtent, parameter.value.LatExtent); int num2 = Math.Max(parameter2.value.Width, parameter2.value.Height); if ((num > 1.0) && (num2 <= 0x400)) { IFuture future = this.prototype.Curry(new ParamDict(new object[] { TermName.ImageBounds, new MapRectangleParameter(this.unitRectangle), TermName.OutputSize, new SizeParameter(this.memoizedSize), TermName.UseDocumentTransparency, present, TermName.ExactColors, present2 })); StrongHash hash = new StrongHash(); future.AccumulateRobustHash(hash); D.Sayf(0, "Future {0} hashes to {1}", new object[] { RobustHashTools.DebugString(future), hash.ToString() }); Present present3 = future.Realize("sourceImageDownsampler-memo"); if (present3 is ImageRef) { try { ImageRef ref2 = (ImageRef)present3; GDIBigLockedImage image = new GDIBigLockedImage(parameter2.value, "sourceImageDownsampler-downsample"); lock (ref2.image) { lock (image) { Graphics graphics = image.IPromiseIAmHoldingGDISLockSoPleaseGiveMeTheGraphics(); MapRectangle region = parameter.value.Intersect(this.unitRectangle); if (!region.IsEmpty()) { RectangleF srcRect = this.SelectSubRectangle(this.unitRectangle, region, this.memoizedSize); RectangleF destRect = this.SelectSubRectangle(parameter.value, region, parameter2.value); Image image2 = ref2.image.IPromiseIAmHoldingGDISLockSoPleaseGiveMeTheImage(); graphics.InterpolationMode = InterpolationMode.HighQualityBilinear; graphics.DrawImage(image2, destRect, srcRect, GraphicsUnit.Pixel); } graphics.Dispose(); return(new ImageRef(new ImageRefCounted(image))); } } } catch (ArgumentException) { return(new PresentFailureCode("Image processing overflow")); } catch (OverflowException) { return(new PresentFailureCode("Image processing overflow")); } catch (Exception exception) { return(new PresentFailureCode(exception)); } finally { present3.Dispose(); } } return(present3); } return(this.prototype.Curry(new ParamDict(new object[] { TermName.ImageBounds, parameter, TermName.OutputSize, parameter2, TermName.UseDocumentTransparency, present, TermName.ExactColors, present2 })).Realize("sourceImageDownsampler-passthru")); }
public void SetUp() { this.bag = new Bag(); this.present = new Present(name, magic); }
public void SetUp() { this.present = new Present(presentName, presentMagic); this.bag = new Bag(); }
public Present Evaluate(Present[] paramList) { Size value = ((SizeParameter)paramList[0]).value; GDIBigLockedImage gDIBigLockedImage = new GDIBigLockedImage(value, "CompositeImageVerb"); Present result; try { GDIBigLockedImage obj; Monitor.Enter(obj = gDIBigLockedImage); try { Graphics graphics = gDIBigLockedImage.IPromiseIAmHoldingGDISLockSoPleaseGiveMeTheGraphics(); using (graphics) { for (int i = 1; i < paramList.Length; i++) { Present present = paramList[i]; if (present is PresentFailureCode) { result = new PresentFailureCode((PresentFailureCode)present, "CompositeImageVerb"); return(result); } if (!(present is ImageRef)) { result = new PresentFailureCode( new Exception("Unexpected result of child computation in CompositeImageVerb")); return(result); } ImageRef imageRef = (ImageRef)present; GDIBigLockedImage image; Monitor.Enter(image = imageRef.image); try { graphics.DrawImage(imageRef.image.IPromiseIAmHoldingGDISLockSoPleaseGiveMeTheImage(), new Rectangle(0, 0, value.Width, value.Height)); } finally { Monitor.Exit(image); } } } } finally { Monitor.Exit(obj); } ImageRef imageRef2 = new ImageRef(new ImageRefCounted(gDIBigLockedImage)); gDIBigLockedImage = null; result = imageRef2; } finally { if (gDIBigLockedImage != null) { gDIBigLockedImage.Dispose(); } } return(result); }
public PresentInfo(Present present) { Name = present.Name; BuyBySanta = present.BuyBySanta; }
// Used in the overlay private unsafe int PresentExHook(IntPtr devicePtr, Rectangle *pSourceRect, Rectangle *pDestRect, IntPtr hDestWindowOverride, IntPtr pDirtyRegion, Present dwFlags) { _isUsingPresent = true; var device = (DeviceEx)devicePtr; DoCaptureRenderTarget(device, "PresentEx"); return(Direct3DDeviceEx_PresentExHook.Original(devicePtr, pSourceRect, pDestRect, hDestWindowOverride, pDirtyRegion, dwFlags)); }
/// <summary> /// Swap the swapchain's next buffer with the front buffer. /// </summary> /// <param name="flags">The flags.</param> /// <returns> /// A <see cref="SharpDX.Result"/> object describing the result of the operation. /// </returns> /// <unmanaged>HRESULT IDirect3DDevice9Ex::PresentEx([In] const void* pSourceRect,[In] const void* pDestRect,[In] HWND hDestWindowOverride,[In] const RGNDATA* pDirtyRegion,[In] unsigned int dwFlags)</unmanaged> public void PresentEx(Present flags) { PresentEx(IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, (int)flags); }
public void CreateShouldThrowExceptionWithNullPresent() { Present present = null; Assert.Throws <ArgumentNullException>(() => bag.Create(present)); }
/// <summary> /// Swap the swapchain's next buffer with the front buffer. /// </summary> /// <param name="flags">The flags.</param> /// <param name="sourceRectangle">The source rectangle.</param> /// <param name="destinationRectangle">The destination rectangle.</param> /// <returns> /// A <see cref="SharpDX.Result"/> object describing the result of the operation. /// </returns> /// <unmanaged>HRESULT IDirect3DDevice9Ex::PresentEx([In] const void* pSourceRect,[In] const void* pDestRect,[In] HWND hDestWindowOverride,[In] const RGNDATA* pDirtyRegion,[In] unsigned int dwFlags)</unmanaged> public void PresentEx(Present flags, RawRectangle sourceRectangle, RawRectangle destinationRectangle) { PresentEx(flags, sourceRectangle, destinationRectangle, IntPtr.Zero); }
public Task AddService(Present present) { throw new System.NotImplementedException(); }
public Spirit(string powerName, IEnumerable <SpiritIsland.Spirit> spirits, Present present = Present.Always) : base(powerName + ": Target Spirit", spirits, present) { }
static void Main(string[] args) { Tank[] t34 = new Tank[5]; t34[0] = new Tank("Джейк"); t34[1] = new Tank("Биби"); t34[2] = new Tank("Пупырка"); t34[3] = new Tank("Фин"); t34[4] = new Tank("БиМо"); Tank[] Pantera = new Tank[5]; Pantera[0] = new Tank("Sponge"); Pantera[1] = new Tank("Patrick"); Pantera[2] = new Tank("Krabs"); Pantera[3] = new Tank("Perl"); Pantera[4] = new Tank("Garry"); Console.WriteLine("\t\t\tУчастники!"); Tank[] Vinner = new Tank[5]; Console.ForegroundColor = ConsoleColor.DarkRed; Console.WriteLine("Танки Т-34 : \t"); Console.ForegroundColor = ConsoleColor.White; foreach (var i in t34) { Console.WriteLine(i.Show()); } Console.WriteLine(); Console.ForegroundColor = ConsoleColor.DarkRed; Console.WriteLine("Танки Pantera : \t"); Console.ForegroundColor = ConsoleColor.White; foreach (var i in Pantera) { Console.WriteLine(i.Show()); } Console.WriteLine(); Console.WriteLine(""); for (int i = 0; i < Vinner.Length; i++) { Console.ForegroundColor = ConsoleColor.DarkRed; Console.WriteLine((i + 1) + " РАУНД! \n" + " танк Т34 против Pantera "); Console.ForegroundColor = ConsoleColor.White; Console.WriteLine(" _____"); Console.WriteLine("| " + (i + 1) + " ||__ ........"); Console.WriteLine("|_____|| ********"); Console.WriteLine(" ooooo"); Vinner[i] = t34[i] * Pantera[i]; Console.WriteLine("Победитель: \t" + Vinner[i].Show()); } Console.WriteLine(); Console.WriteLine(); /*Разработать программу, моделирующую танковый бой. * В танковом бою участвуют 5 танков «Т-34» и * 5 танков «Pantera». Каждый танк («Т-34» и «Pantera») * описываются параметрами: «Боекомплект», «Уровень брони», * «Уровень маневренности». * Значение данных параметров задаются случайными * числами от 0 до 100. * Каждый танк участвует в парной битве, * т.е. первый танк «Т-34» сражается с первым танком * «Pantera» и т. д. * Победа присуждается тому танку, который превышает * противника по двум и более параметрам из трех * (пример: см. программу). * Основное требование: сражение (проверку на победу в бою) * реализовать путем перегрузки оператора «*» (произведение). */ #region Console.WriteLine("-------------------------"); Present[] Candys = new Present[3]; Candys[0] = new Present("Рахат", "Рахат", 250, 25); Candys[1] = new Present("Kinders", "Ferrero", 110, 45); Candys[2] = new Present("Mars", "Mars", 110, 45); for (int i = 0; i < Candys.Length; i++) { Console.Write("№" + (i + 1)); Candys[i].Show(); } Console.WriteLine(); Console.Write("Выберите номер товара "); int k = Int32.Parse(Console.ReadLine()) - 1; Console.Write("И номер второго товара "); int l = Int32.Parse(Console.ReadLine()) - 1; Console.WriteLine(); if (Candys[k] == Candys[l]) { Console.WriteLine("Подарок " + Candys[k].name + " + Подарок " + Candys[l].name + " Одинаковы по весу и цене "); } else { Console.WriteLine("Не равноценные продукт "); } Console.WriteLine(); #endregion #region Console.WriteLine("------------------------------"); Arrays massiv1 = new Arrays(10); Arrays massiv2 = new Arrays(10); massiv1.Show(); massiv2.Show(); Console.WriteLine(); if (massiv1 > massiv2) { Console.WriteLine("Сумма элементов первого массива больше второго "); } else { Console.WriteLine("Сумма элементов второго массива больше первого "); } #endregion #region Console.WriteLine("------------------------------------------"); Console.ForegroundColor = ConsoleColor.Red; Console.Write("Введите сумму в тенге: "); Console.ForegroundColor = ConsoleColor.White; int sum = Int32.Parse(Console.ReadLine()); Console.ForegroundColor = ConsoleColor.Red; Console.Write("Введите вторую сумму :"); Console.ForegroundColor = ConsoleColor.White; int sum2 = Int32.Parse(Console.ReadLine()); Console.ForegroundColor = ConsoleColor.Red; Console.Write("и валюту (dollars, euro, rub, tenge) : "); Console.ForegroundColor = ConsoleColor.White; string cur = Console.ReadLine(); Money tenge = new Money(sum, "tenge"); Money dol = new Money(sum2, cur); Console.ForegroundColor = ConsoleColor.Red; if (tenge == dol) { Console.WriteLine(tenge.money + dol.money); } else { double res; Console.Write("Выберите валюту для конвертации итога : \n1-dollars; 2- euro; 3- rub; 4-tenge "); Console.ForegroundColor = ConsoleColor.White; int i = Int32.Parse(Console.ReadLine()); if (i == 4) { res = dol.Convert(i); Console.WriteLine("Итого " + (tenge.money + res) + " tenge"); } else { res = tenge.Convert(i); Console.WriteLine("Итого " + (dol.money + res) + " " + cur); } } #endregion }
public void SetUp() { string name = "TV"; double magic = 10.00; Present present = new Present(name, magic); }
public void Set() { this.bag = new Bag(); this.present = new Present("toy", 6.5); }
public void SetUp() { bag = new Bag(); present = new Present("Laptop", 10.10); }
public void GetPresentShouldReturnNullPresent() { Present actPresent = this.bag.GetPresent("SomeName"); Assert.IsNull(actPresent); }
public ConstantVerb() { this.constantPresent = new PresentFailureCode(new Exception("Null ConstantVerb")); }
/// <summary> /// Presents the contents of the next buffer in the sequence of back buffers to the screen. /// </summary> /// <param name="flags">The flags.</param> /// <param name="sourceRectangle">The area of the back buffer that should be presented.</param> /// <param name="destinationRectangle">The area of the front buffer that should receive the result of the presentation.</param> /// <param name="windowOverride">The destination window whose client area is taken as the target for this presentation.</param> /// <param name="region">Specifies a region on the back buffer that contains the minimal amount of pixels that need to be updated.</param> /// <unmanaged>HRESULT IDirect3DSwapChain9::Present([In, Optional] const void* pSourceRect,[InOut, Optional] const void* pDestRect,[In] HWND hDestWindowOverride,[In] const RGNDATA* pDirtyRegion,[In] unsigned int dwFlags)</unmanaged> public void Present(Present flags, Rectangle sourceRectangle, Rectangle destinationRectangle, IntPtr windowOverride, System.Drawing.Region region) { unsafe { var graphics = System.Drawing.Graphics.FromHwnd(windowOverride); var regionPtr = region.GetHrgn(graphics); graphics.Dispose(); var srcPtr = IntPtr.Zero; if (sourceRectangle != Rectangle.Empty) srcPtr = new IntPtr(&sourceRectangle); var destPtr = IntPtr.Zero; if (destinationRectangle != Rectangle.Empty) destPtr = new IntPtr(&destinationRectangle); Present(srcPtr, destPtr, windowOverride, regionPtr, (int)flags); } }
protected virtual void OnPresent(PresentRaceLapEventArgs e) { Present?.Invoke(this, e); }
/// <summary> /// Presents the contents of the next buffer in the sequence of back buffers to the screen. /// </summary> /// <param name="presentFlags">The present flags.</param> /// <param name="sourceRectangle">The area of the back buffer that should be presented.</param> /// <param name="destinationRectangle">The area of the front buffer that should receive the result of the presentation.</param> /// <unmanaged>HRESULT IDirect3DSwapChain9::Present([In, Optional] const void* pSourceRect,[InOut, Optional] const void* pDestRect,[In] HWND hDestWindowOverride,[In] const RGNDATA* pDirtyRegion,[In] unsigned int dwFlags)</unmanaged> public void Present(Present presentFlags, Rectangle sourceRectangle, Rectangle destinationRectangle) { Present(presentFlags, sourceRectangle, destinationRectangle, IntPtr.Zero); }
private static void SampleWithGenericList() { List <Selection> selectionList = new List <Selection>(); //Selection[] selectionList = new Selection[20]; Student studentOne = new Student("Shahab", "Noori Goodarzi"); Console.WriteLine(studentOne.Identity); Console.WriteLine("---------------------------------------------------------------"); Teacher teacherOne = new Teacher("Hamid", "Molai"); Console.WriteLine(teacherOne.Identity); Console.WriteLine("---------------------------------------------------------------"); Course courseOne = new Course("C# Programming", 3); Console.WriteLine(courseOne.Identity); Console.WriteLine("---------------------------------------------------------------"); Course courseTwo = new Course("Java Programming", 4); Console.WriteLine(courseTwo.Identity); Console.WriteLine("---------------------------------------------------------------"); Course courseThree = new Course("Php Programming", 5); Console.WriteLine(courseThree.Identity); Console.WriteLine("---------------------------------------------------------------"); Course courseFour = new Course("Python Programming", 2); Console.WriteLine(courseFour.Identity); Console.WriteLine("---------------------------------------------------------------"); Course courseFive = new Course("Java script Programming", 1); Console.WriteLine(courseFive.Identity); Console.WriteLine("---------------------------------------------------------------"); ClassRoom classRoomOne = new ClassRoom("Ferdoosi", 5, 16); Console.WriteLine(classRoomOne.Identity); Console.WriteLine("---------------------------------------------------------------"); Present presentOne = new Present(courseOne, classRoomOne, teacherOne); Console.WriteLine(presentOne.Identiy); Console.WriteLine("---------------------------------------------------------------"); Present presentTwo = new Present(courseTwo, classRoomOne, teacherOne); Console.WriteLine(presentTwo.Identiy); Console.WriteLine("---------------------------------------------------------------"); Present presetnThree = new Present(courseThree, classRoomOne, teacherOne); Console.WriteLine(presetnThree.Identiy); Console.WriteLine("---------------------------------------------------------------"); Present presentFour = new Present(courseFour, classRoomOne, teacherOne); Console.WriteLine(presentFour.Identiy); Console.WriteLine("---------------------------------------------------------------"); Present presentFive = new Present(courseFive, classRoomOne, teacherOne); Console.WriteLine(presentFive.Identiy); Console.WriteLine("---------------------------------------------------------------"); int count = 0; EntekhabVahed(selectionList, studentOne, presentOne, count++); EntekhabVahed(selectionList, studentOne, presentTwo, count++); EntekhabVahed(selectionList, studentOne, presetnThree, count++); EntekhabVahed(selectionList, studentOne, presentFive, count++); EntekhabVahed(selectionList, studentOne, presentFour, count); }
// Used in the overlay unsafe int PresentExHook(IntPtr devicePtr, SharpDX.Rectangle* pSourceRect, SharpDX.Rectangle* pDestRect, IntPtr hDestWindowOverride, IntPtr pDirtyRegion, Present dwFlags) { _isUsingPresent = true; DeviceEx device = (DeviceEx)devicePtr; DoCaptureRenderTarget(device, "PresentEx"); return Direct3DDeviceEx_PresentExHook.Original(devicePtr, pSourceRect, pDestRect, hDestWindowOverride, pDirtyRegion, dwFlags); }
public static TokenFrom1Space TokenToPush(SpiritIsland.Space space, int count, Token[] options, Present present) => new TokenFrom1Space(present != Present.Done ? $"Push ({count})" : $"Push up to ({count})", space, options, present);