public async Task PostBanner(SetImage request) { UserInfo user = await GetUserInfoAsync(); HttpStatusCode result = await UserOperations.SetBannerImage( DbContext, user, request); result.ThrowHttpResponseExceptionIfNotSuccessful(); }
//블럭 배열 생성---------------------------------------------- void CreateBlock() { shuffleB = new EventBlock[blockLine, blockLine]; //초기 번호 배열 targetArray = gameObject.AddComponent <NumArray>(); targetArray.MakeLine(blockLine); for (int y = 0; y < blockLine; y++) { for (int x = 0; x < blockLine; x++) { int myNum = x + (blockLine * y) + 1; targetArray.MakeArray(x, y, myNum); } } numArray = gameObject.AddComponent <NumArray>(); numArray.MakeLine(blockLine); //분할 이미지 Texture2D[,] Image = SetImage.ImageBlock(myImage, blockLine); for (int y = 0; y < blockLine; y++) { for (int x = 0; x < blockLine; x++) { //Quad로 블럭 생성 GameObject myBlock = GameObject.CreatePrimitive(PrimitiveType.Quad); myBlock.transform.localPosition = new Vector2(-0.5f * (blockLine - 1), -0.5f * (blockLine - 1) - 1) + new Vector2(x, y); //이벤트 설정 eventBlock = myBlock.AddComponent <EventBlock>(); //좌표, 이미지 설정 eventBlock.Init(new Vector2(x, y), Image[x, y]); //셔플 배열에 블럭 넣기 shuffleB[x, y] = eventBlock; //번호 배열 정보 int myNum = x + (blockLine * y) + 1; //변화하는 번호 배열 numArray.MakeArray(x, y, myNum); //초기 비어있는 블럭 if (x == blockLine - 1 && y == 0) { myBlock.SetActive(false); emptyBlock = eventBlock; } //마우스 입력이 일어나면 eventBlock.BlockPressed += MoveBlock; } } }
public void split(SetImage setImageDelegate) { dirtySlices.Add(new Region(0, 0, image.Width, image.Height)); List <Region> tempSlices; int halfWidth; int halfHeight; while (dirtySlices.Count != 0) { tempSlices = new List <Region>(); foreach (Region region in dirtySlices) { if (isRegionUniform(region)) { byte meanValue = (byte)meanValueForRegion(region); readySlices.Add(new SolidSlice <byte>(region, meanValue)); } else { halfWidth = (region.EndX - region.StartX) / 2 + region.StartX; halfHeight = (region.EndY - region.StartY) / 2 + region.StartY; if (halfHeight < 2 && halfWidth < 2) { readySlices.Add(new SolidSlice <byte>(region, (byte)meanValueForRegion(region))); } else { tempSlices.Add(new Region(region.StartX, region.StartY, halfWidth, halfHeight)); tempSlices.Add(new Region(halfWidth, region.StartY, region.EndX, halfHeight)); tempSlices.Add(new Region(region.StartX, halfHeight, halfWidth, region.EndY)); tempSlices.Add(new Region(halfWidth, halfHeight, region.EndX, region.EndY)); } } } dirtySlices = tempSlices; } Console.Out.Write("Complete"); foreach (SolidSlice <byte> solidSlice in readySlices) { for (int x = solidSlice.StartX; x < solidSlice.EndX; x++) { for (int y = solidSlice.StartY; y < solidSlice.EndY; y++) { image.SetPixel(x, y, Color.FromArgb(solidSlice.Value, solidSlice.Value, solidSlice.Value)); } } } setImageDelegate(image); }
public void BrowseForImage(SetImage pass) { OpenFileDialog browse = new OpenFileDialog(); browse.FilterIndex = 2; browse.Filter = "BMP Image (*.bmp)|*.bmp|PNG Image (*.png)|*.png|JPEG Image (*.jpg, *.jpeg)|*.jpg; *.jpeg|GIF Image (*.gif)|*.gif"; browse.CheckFileExists = true; browse.CheckPathExists = true; browse.ValidateNames = true; DialogResult result = browse.ShowDialog(); if (result == DialogResult.OK) { pass(LoadImage(browse.FileName)); } }
public void CaptureWindow(SetImage pass) { Profile profile = (Profile)profileComboBox.SelectedItem; if (profile == null) { MessageBox.Show("Please select a Profile", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } Process[] players = Process.GetProcessesByName(Path.GetFileNameWithoutExtension(profile.ApplicationPath)); if (players.Length == 0) { MessageBox.Show("No game window detected", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } IntPtr player = players[0].MainWindowHandle; Rectangle pic = new Rectangle(); GetClientRect(player, ref pic); ScreenShot.ScreenCapture screenshot = new ScreenShot.ScreenCapture(); Bitmap image = (Bitmap)screenshot.CaptureWindow(player); int border = (image.Width - pic.Width) / 2; int top = image.Height - pic.Height - border; Rectangle crop = new Rectangle(border, top, pic.Width, pic.Height); if (IsIconic(player) | crop.IsEmpty | crop.Width == 0 | crop.Height == 0) { MessageBox.Show("Please make sure the game is not minimized", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); SetForegroundWindow((int)player); SendKeys.SendWait("~"); return; } else { Bitmap cropped = image.Clone(crop, image.PixelFormat); pass(cropped); } }
public FormLogin( ) { InitializeComponent( ); this.StartPosition = FormStartPosition.CenterScreen; _bll = new LineProductMesBll.Bll.EmployeeBll( ); labUserName.Visible = labPassW.Visible = labTip.Visible = false; SetImage.setImage(pictureBox1, "SetConn.png"); UserInfoMation.userName = config.AppSettings.Settings ["UserName"].Value; UserInfoMation.userNum = config.AppSettings.Settings ["UserNum"].Value; UserInfoMation.sign = config.AppSettings.Settings ["Sign"].Value; if (UserInfoMation.sign.Equals("1")) { txtUserName.Text = UserInfoMation.userName; txtUserName.Tag = UserInfoMation.userNum; } }
public static async Task <HttpStatusCode> SetAvatarImage( ApplicationDbContext dbContext, UserInfo user, SetImage request) { UserMedia media = await dbContext.UserMedias .SingleOrDefaultAsync(um => um.UserMediaId == request.MediaId); if (media == null) { return(HttpStatusCode.BadRequest); } if (!media.MediaAlbumId.HasValue) { if (user.AvatarsMediaAlbumId.HasValue) { media.MediaAlbumId = user.AvatarsMediaAlbumId; } else { var avatarsAlbum = new MediaAlbum { User = user, Title = "Avatar Images", Description = "Images used as my avatar" }; user.AvatarsAlbum = avatarsAlbum; media.MediaAlbum = avatarsAlbum; } } user.Avatar = media; await dbContext.SaveChangesAsync(); return(HttpStatusCode.OK); }
/// <param name='request'> /// Required. /// </param> /// <param name='cancellationToken'> /// Cancellation token. /// </param> public async Task <HttpOperationResponse <object> > PostBannerByRequestWithOperationResponseAsync(SetImage request, CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { // Validate if (request == null) { throw new ArgumentNullException("request"); } // Tracing bool shouldTrace = ServiceClientTracing.IsEnabled; string invocationId = null; if (shouldTrace) { invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary <string, object> tracingParameters = new Dictionary <string, object>(); tracingParameters.Add("request", request); ServiceClientTracing.Enter(invocationId, this, "PostBannerByRequestAsync", tracingParameters); } // Construct URL string url = ""; url = url + "/api/Profile/SetBannerImage"; string baseUrl = this.Client.BaseUri.AbsoluteUri; // Trim '/' character from the end of baseUrl and beginning of url. if (baseUrl[baseUrl.Length - 1] == '/') { baseUrl = baseUrl.Substring(0, baseUrl.Length - 1); } if (url[0] == '/') { url = url.Substring(1); } url = baseUrl + "/" + url; url = url.Replace(" ", "%20"); // Create HTTP transport objects HttpRequestMessage httpRequest = new HttpRequestMessage(); httpRequest.Method = HttpMethod.Post; httpRequest.RequestUri = new Uri(url); // Set Headers // Set Credentials if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await this.Client.Credentials.ProcessHttpRequestAsync(httpRequest, cancellationToken).ConfigureAwait(false); } // Serialize Request string requestContent = null; JToken requestDoc = request.SerializeJson(null); requestContent = requestDoc.ToString(Newtonsoft.Json.Formatting.Indented); httpRequest.Content = new StringContent(requestContent, Encoding.UTF8); httpRequest.Content.Headers.ContentType = MediaTypeHeaderValue.Parse("application/json"); // Send Request if (shouldTrace) { ServiceClientTracing.SendRequest(invocationId, httpRequest); } cancellationToken.ThrowIfCancellationRequested(); HttpResponseMessage httpResponse = await this.Client.HttpClient.SendAsync(httpRequest, cancellationToken).ConfigureAwait(false); if (shouldTrace) { ServiceClientTracing.ReceiveResponse(invocationId, httpResponse); } HttpStatusCode statusCode = httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string responseContent = await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); if (statusCode != HttpStatusCode.NoContent) { HttpOperationException <object> ex = new HttpOperationException <object>(); ex.Request = httpRequest; ex.Response = httpResponse; ex.Body = null; if (shouldTrace) { ServiceClientTracing.Error(invocationId, ex); } throw ex; } // Create Result HttpOperationResponse <object> result = new HttpOperationResponse <object>(); result.Request = httpRequest; result.Response = httpResponse; // Deserialize Response object resultModel = default(object); result.Body = resultModel; if (shouldTrace) { ServiceClientTracing.Exit(invocationId, result); } return(result); }
public void DataSet(Command order) { ActionShell AS; foreach (DataShell Shell in order.Data) { switch (Shell.key) { case "TextBox.Open": case "TextBox.Close": AS = new OpenAction(TextBoxPivot); ActionPlan.Add(AS); break; case "FaceBox.Open": case "FaceBox.Close": AS = new OpenAction(FaceBoxPivot); ActionPlan.Add(AS); break; case "ImageBox.Open": case "ImageBox.Close": AS = new OpenAction(ImageBoxPivot); ActionPlan.Add(AS); break; case "SelectBox.Open": case "SelectBox.Close": AS = new OpenAction(SelectBoxPivot); ActionPlan.Add(AS); break; case "TextBox.AddText": AS = new TalkAction(Shell.Data, this); ActionPlan.Add(AS); break; case "FaceBox.SetImage": AS = new SetImage(NPCFace, Shell.Data); ActionPlan.Add(AS); break; case "ImageBox.SetImage": AS = new SetImage(ImageBox, Shell.Data); ActionPlan.Add(AS); break; case "SelectBox.AddChoice": break; case "SelectBox.AddText": break; case "SelectBox.SetImage": AS = new SetImage(PlayerFace, Shell.Data); ActionPlan.Add(AS); break; default: Debug.Log("Lost order : " + Shell.key); break; } } StartCoroutine(DataAction()); }
// Use this for initialization void Start() { iclickable = new SetImage(activeImage, imagePath); Initialize(); }
/// <param name='operations'> /// Reference to the Rg.ClientApp.IProfile. /// </param> /// <param name='request'> /// Required. /// </param> /// <param name='cancellationToken'> /// Cancellation token. /// </param> public static async Task <object> PostBannerByRequestAsync(this IProfile operations, SetImage request, CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { Microsoft.Rest.HttpOperationResponse <object> result = await operations.PostBannerByRequestWithOperationResponseAsync(request, cancellationToken).ConfigureAwait(false); return(result.Body); }
public CurationForm() { flashpointPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); InitializeComponent(); treeView.AllowDrop = true; treeView.DragEnter += TreeView_DragEnter; treeView.DragDrop += TreeView_DragDrop; logoPictureBox.Paint += LogoPictureBox_Paint; logoPictureBox.DragEnter += LogoPictureBox_DragEnter; logoPictureBox.AllowDrop = true; logoPictureBox.DragDrop += LogoPictureBox_DragDrop; screenshotPictureBox.Paint += ScreenshotPictureBox_Paint; screenshotPictureBox.DragEnter += ScreenshotPictureBox_DragEnter; screenshotPictureBox.AllowDrop = true; screenshotPictureBox.DragDrop += ScreenshotPictureBox_DragDrop; profileComboBox.Items.AddRange(ProfileEditorForm.LoadProfiles()); genreComboBox.Items.AddRange(Curation.Genres); playModeComboBox.Items.AddRange(Curation.Modes); statusComboBox.Items.AddRange(Curation.Statuses); treeView.MouseDown += TreeView_MouseDown; treeView.AfterExpand += TreeView_AfterExpand; treeView.AfterCollapse += TreeView_AfterCollapse; Icon = Icon.ExtractAssociatedIcon(Application.ExecutablePath); SetImage SetL = SetLogo; SetImage SetSS = SetScreenshot; //Create instructions and Browse/Capture/Remove/Crop buttons for logo PictureBox Label logoinstructions = new Label(); logoinstructions.TextAlign = ContentAlignment.MiddleCenter; logoinstructions.AutoSize = true; logoinstructions.Text = "Drag and drop an image here, or..."; logoPictureBox.Controls.Add(logoinstructions); logoinstructions.Location = new Point((logoPictureBox.Width / 2) - (logoinstructions.Width / 2), (logoPictureBox.Height / 2) - (logoinstructions.Height / 2) - 15); Button logocapturebutton = new Button(); logocapturebutton.Text = "Capture"; logoPictureBox.Controls.Add(logocapturebutton); logocapturebutton.Click += (sender, e) => { CaptureWindow(SetL); }; logocapturebutton.Location = new Point((logoPictureBox.Width / 2) - logocapturebutton.Width - 5, (logoPictureBox.Height / 2) - (logocapturebutton.Height / 2) + 10); Button logobrowsebutton = new Button(); logobrowsebutton.Text = "Browse..."; logoPictureBox.Controls.Add(logobrowsebutton); logobrowsebutton.Click += (sender, e) => { BrowseForImage(SetL); }; logobrowsebutton.Location = new Point((logoPictureBox.Width / 2) + 5, (logoPictureBox.Height / 2) - (logobrowsebutton.Height / 2) + 10); Button logoremovebutton = new Button(); logoremovebutton.Text = "X"; logoremovebutton.Name = "logoremovebutton"; logoremovebutton.Visible = false; logoremovebutton.Width = 26; logoremovebutton.BackColor = Color.PaleVioletRed; logoremovebutton.ForeColor = Color.White; logoremovebutton.Font = new Font(logoremovebutton.Font, FontStyle.Bold); logoPictureBox.Controls.Add(logoremovebutton); logoremovebutton.Click += (sender, e) => { SetLogo(null); }; logoremovebutton.Location = new Point(logoPictureBox.Width - logoremovebutton.Width - 5, 5); //Button logocropbutton = new Button(); //logocropbutton.Text = "Crop"; //logocropbutton.Name = "logocropbutton"; //logocropbutton.Visible = false; //logoPictureBox.Controls.Add(logocropbutton); //logocropbutton.Location = new Point((logoPictureBox.Width / 2) - (logocropbutton.Width / 2), logoPictureBox.Height - logocropbutton.Height - 8); //Create instructions and Browse/Capture/Remove buttons for screenshot PictureBox Label screenshotinstructions = new Label(); screenshotinstructions.TextAlign = ContentAlignment.MiddleCenter; screenshotinstructions.AutoSize = true; screenshotinstructions.Text = "Drag and drop an image here, or..."; screenshotPictureBox.Controls.Add(screenshotinstructions); screenshotinstructions.Location = new Point((screenshotPictureBox.Width / 2) - (screenshotinstructions.Width / 2), (screenshotPictureBox.Height / 2) - (screenshotinstructions.Height / 2) - 15); Button screenshotcapturebutton = new Button(); screenshotcapturebutton.Text = "Capture"; screenshotPictureBox.Controls.Add(screenshotcapturebutton); screenshotcapturebutton.Click += (sender, e) => { CaptureWindow(SetSS); }; screenshotcapturebutton.Location = new Point((screenshotPictureBox.Width / 2) - screenshotcapturebutton.Width - 5, (screenshotPictureBox.Height / 2) - (screenshotcapturebutton.Height / 2) + 10); Button screenshotbrowsebutton = new Button(); screenshotbrowsebutton.Text = "Browse..."; screenshotPictureBox.Controls.Add(screenshotbrowsebutton); screenshotbrowsebutton.Click += (sender, e) => { BrowseForImage(SetSS); }; screenshotbrowsebutton.Location = new Point((screenshotPictureBox.Width / 2) + 5, (screenshotPictureBox.Height / 2) - (screenshotbrowsebutton.Height / 2) + 10); Button screenshotremovebutton = new Button(); screenshotremovebutton.Text = "X"; screenshotremovebutton.Name = "screenshotremovebutton"; screenshotremovebutton.Visible = false; screenshotremovebutton.Width = 26; screenshotremovebutton.BackColor = Color.PaleVioletRed; screenshotremovebutton.ForeColor = Color.White; screenshotremovebutton.Font = new Font(screenshotremovebutton.Font, FontStyle.Bold); screenshotPictureBox.Controls.Add(screenshotremovebutton); screenshotremovebutton.Click += (sender, e) => { SetScreenshot(null); }; screenshotremovebutton.Location = new Point(screenshotPictureBox.Width - screenshotremovebutton.Width - 5, 5); //Create swap button Button swapbutton = new Button(); swapbutton.Text = "<- Swap ->"; swapbutton.Visible = false; swapbutton.Name = "swapbutton"; this.Controls.Add(swapbutton); swapbutton.Click += (sender, e) => { SwapPictures(); }; swapbutton.Location = new Point(tableLayoutPanel2.Location.X + (tableLayoutPanel2.Width / 2) - (swapbutton.Width / 2), tableLayoutPanel2.Location.Y + tableLayoutPanel2.Height - 10); swapbutton.BringToFront(); }