private void setGenre(bool update) { txtBoxGenreSource.Text = _fileItem.Genre; string text = Previewer.GetGenre(_fileItem); if (!update || !isCustomized(comBoxGenreTag)) { comBoxGenreTag.Text = text; } var settings = Previewer.Settings; string[] genres = settings.Genres.SplitTrim(';'); comBoxGenreTag.Items.Clear(); comBoxGenreTag.Items.AddRange(genres); comBoxGenreTag.Tag = text; if (_fileItem.CustomNames is null) { return; } if (!string.IsNullOrWhiteSpace(_fileItem.CustomNames.GenreTag)) { comBoxGenreTag.Text = _fileItem.CustomNames.GenreTag; } }
private void setTitle(bool update) { txtBoxTitleSource.Text = _fileItem.BookTitle; var(tag, file) = Previewer.TitlePreview(_fileItem); if (!update || !isCustomized(txtBoxTitleTag)) { txtBoxTitleTag.Text = tag; } txtBoxTitleTag.Tag = tag; if (!update || !isCustomized(txtBoxTitleFile)) // && !isCustomized(txtBoxTitleTag))) { txtBoxTitleFile.Text = file; } txtBoxTitleFile.Tag = file; if (_fileItem.CustomNames is null) { return; } if (!string.IsNullOrWhiteSpace(_fileItem.CustomNames.TitleTag)) { txtBoxTitleTag.Text = _fileItem.CustomNames.TitleTag; } if (!string.IsNullOrWhiteSpace(_fileItem.CustomNames.TitleFile)) { txtBoxTitleFile.Text = _fileItem.CustomNames.TitleFile; } }
private void UpdatePlayerPreview(Previewer previewer, bool human, bool roamer) { Team selectorTeam = Team.humanTeam; if (!human) { selectorTeam = Team.robotTeam; } if (selectorTeam == null) { previewer.Show(false); return; } previewer.Show(true); bool ready; if (roamer) { ready = selectorTeam.isRoamerReady; } else { ready = selectorTeam.isSnooperReady; } previewer.SetReady(ready); }
public string Process(FileUpload input) { if (input?.Urls?.Count > 0) { try { string picPath = _environment.WebRootPath + "\\Upload\\"; string previewPath = _environment.WebRootPath + "\\Preview\\"; if (!Directory.Exists(picPath)) { Directory.CreateDirectory(picPath); } if (!Directory.Exists(previewPath)) { Directory.CreateDirectory(previewPath); } string result = ""; int successCounter = 0; int curCounter = 0; foreach (var url in input.Urls) { string nameNExt = ""; if (url.Split('/').Length > 0) { nameNExt = url.Split('/')[url.Split('/').Length - 1]; } else { return("URL is empty"); } using (WebClient client = new WebClient()) { nameNExt = Helpers.GetUniqueName(nameNExt, picPath); client.DownloadFile(new Uri(url), picPath + nameNExt); successCounter++; curCounter++; result += $"Picture {curCounter} successfully downloaded.\n"; } Previewer.uploadPreview(picPath, previewPath, nameNExt); } return(result + $"Total pictures uploaded: {successCounter} from {curCounter}"); } catch (Exception ex) { //TODO: log error: ex.Message.ToString() return("Error. Please, try again."); } } else { return("Unsucsessful uploading. Please, try again."); } }
private void Start() { player = Player.instance; gameManager = GameManager.instance; towerManager = TowerManager.instance; previewer = Previewer.instance; ToggleButtons(false); }
private void Start() { player = Player.instance; gameManager = GameManager.instance; towerManager = TowerManager.instance; previewer = Previewer.instance; cancelPurchaseButton.SetActive(false); comfirmPurchaseButton.SetActive(false); }
public string Process(FileUpload input) { if (input?.Pictures?.Count > 0) { try { string picPath = _environment.WebRootPath + "\\Upload\\"; string previewPath = _environment.WebRootPath + "\\Preview\\"; if (!Directory.Exists(picPath)) { Directory.CreateDirectory(picPath); } if (!Directory.Exists(previewPath)) { Directory.CreateDirectory(previewPath); } string result = ""; int successCounter = 0; int curCounter = 0; foreach (var pic in input.Pictures) { string fileName = pic.FileName; fileName = Helpers.GetUniqueName(fileName, picPath); using (FileStream fileStream = System.IO.File.Create(picPath + fileName)) { pic.CopyTo(fileStream); fileStream.Flush(); successCounter++; curCounter++; result += $"Picture {curCounter} successfully downloaded.\n"; } Previewer.uploadPreview(picPath, previewPath, fileName); } return(result + $"Total pictures uploaded: {successCounter} from {curCounter}"); } catch (Exception ex) { //TODO: log error: ex.Message.ToString() //return "Error. Please, try again."; return(ex.Message.ToString()); } } else { return("Unsucsessful uploading. Please, try again."); } }
public void uploadPreviewTest() { //arrange string pathFrom = @"W:\CV\"; string pathTo = @"W:\CV\"; string fileName = @"pic1.png"; //act Previewer.uploadPreview(pathFrom, pathTo, fileName); //assert Assert.IsTrue(System.IO.File.Exists(@"W:\CV\preview_pic1.png")); //after test System.IO.File.Delete(@"W:\CV\preview_pic1.png"); }
// Use this for initialization void Start() { if (!cameraParent) { throw new System.NullReferenceException("No main parent for camera adjuster to manipulate camera"); } if (!cameraFocusPoint) { throw new System.NullReferenceException("No camera focus point"); } c = cameraParent.GetComponentInChildren <Camera>(); c.transform.LookAt(cameraFocusPoint); previewer = Previewer.instance; }
private void adjustFile(TextBox txtBoxTag, TextBox txtBoxFile) { if (isCustomized(txtBoxFile)) { return; } string text = txtBoxTag.Text; if (txtBoxFile == txtBoxTitleFile) { text = Previewer.PruneTitle(text); } else { text = text.Prune(); } txtBoxFile.Text = text; //txtBoxFile.Tag = text; // better not }
// Use this for initialization void Awake() { instance = this; myPlane = new Plane(Vector3.up, new Vector3(0, 0.2f, 0)); }
// Use this for initialization private void Start() { buildManager = BuildManager.instance; snapToGrid = SnapToGrid.instance; previewer = Previewer.instance; }
private void Start() { previewer = Previewer.instance; }
public string Process(JsonElement input) { var json = input.ToString(); if (String.IsNullOrWhiteSpace(json)) { return("JSON is empty."); } List <Base64EncodedJSON> images; try { images = JsonConvert.DeserializeObject <List <Base64EncodedJSON> >(json); } catch (Exception ex) { return("Error in convetsation: " + ex.Message); } string result = ""; int successCounter = 0; int curCounter = 0; if (images?.Count > 0) { try { string picPath = _environment.WebRootPath + "\\Upload\\"; string previewPath = _environment.WebRootPath + "\\Preview\\"; if (!Directory.Exists(picPath)) { Directory.CreateDirectory(picPath); } if (!Directory.Exists(previewPath)) { Directory.CreateDirectory(previewPath); } foreach (var pic in images) { string type = pic.GetType(); if (string.IsNullOrWhiteSpace(type)) { result += $"Picture {curCounter} can not be loaded - because it have invalid image type.\r\n"; curCounter++; continue; } string name = pic.GetName(); var base64 = pic.GetBase64(); string fileName = name + "." + type; fileName = Helpers.GetUniqueName(fileName, picPath); using (FileStream fileStream = System.IO.File.Create(picPath + fileName)) { fileStream.Write(Convert.FromBase64String(base64)); fileStream.Flush(); successCounter++; curCounter++; result += $"Picture {curCounter} successfully downloaded.\n"; } Previewer.uploadPreview(picPath, previewPath, fileName); } return(result + $"Total pictures uploaded: {successCounter} from {curCounter}"); } catch (Exception ex) { //TODO: log error: ex.Message.ToString() return("Error. Please, try again."); } } else { return("Unsucsessful uploading. Please, try again."); } }
public SampleReportPreviewer() { Previewer = new Previewer(ReportSelector.SelectedReport); }
private void RefreshPreview() { var html = SelectedSubNode?.Preview ?? $"<html>{SelectedObject??"nil"}</html>"; Previewer.NavigateToString(html); }