public EmoUploaderController() { _serverFolderPath = ConfigurationManager.AppSettings["UPLOAD_DIR"]; var key = ConfigurationManager.AppSettings["EMOTION_KEY"]; _emoHelper = new EmotionHelper(key); }
/// <summary> /// 防注入 /// </summary> protected string SqlFilter(string inputString, bool nohtml = true, bool xss = true) { string SqlStr = @"script|and|or|exec|execute|insert|select|delete|update|alter|create|drop|count|\*|chr|char|asc|mid|substring|master|truncate|declare|xp_cmdshell|restore|backup|net +user|net +localgroup +administrators"; try { if (!string.IsNullOrEmpty(inputString)) { inputString = UrlDecode(inputString); if (nohtml) { inputString = Tools.NoHTML(inputString); } inputString = Regex.Replace(inputString, @"\b(" + SqlStr + @")\b", string.Empty, RegexOptions.IgnoreCase); if (nohtml) { inputString = inputString.Replace(" ", ""); } } } catch (Exception ex) { LogHelper.ErrorLoger.Error("SQL注入", ex); } if (xss) { return(AntiXssChineseString.ChineseStringSanitize(EmotionHelper.EmotionFilter(inputString))); } else { return(EmotionHelper.EmotionFilter(inputString)); } }
public EmoUploaderController() { serverFolderPath = ConfigurationManager.AppSettings["UPLOAD_DIR"]; key = ConfigurationManager.AppSettings["EMOTION_KEY"]; emotionRoot = ConfigurationManager.AppSettings["EMOTION_ROOT"]; emoHelper = new EmotionHelper(key, emotionRoot); }
public async Task <IHttpActionResult> PostEmoUploaderAsync(string fileName, Stream file) { string key = ConfigurationManager.AppSettings["KEY_EMOTION"]; string serverFolderPath = ConfigurationManager.AppSettings["UPLOAD_DIR"]; EmotionHelper emoHelper = new EmotionHelper(key); var pictureName = Guid.NewGuid().ToString(); pictureName += Path.GetExtension(fileName); var route = System.Web.HttpContext.Current.Server.MapPath(serverFolderPath); route += $"/{pictureName}"; FileStream fileStream = File.Create(route, (int)file.Length); byte[] bytesInStream = new byte[file.Length]; file.Read(bytesInStream, 0, bytesInStream.Length); fileStream.Write(bytesInStream, 0, bytesInStream.Length); var emoPicture = await emoHelper.DetectAndExtracFacesAsync(file); emoPicture.Name = Path.GetFileName(fileName); emoPicture.Path = $"{serverFolderPath}/{pictureName}"; db.EmoPictures.Add(emoPicture); await db.SaveChangesAsync(); return(CreatedAtRoute("DefaultApi", new { id = emoPicture.Id }, emoPicture)); }
public void StartConversation(Conversation conversation) { mainCamera.GetComponent <CinemachineBrain>().enabled = false; playerMovement.DisablePlayerMovement(); animator.SetBool("IsOpen", true); speaker.sprite = EmotionHelper.GetSpriteOfEmotion(conversation.emotion, conversation.actor); speakerName.text = conversation.actor.FirstName; UpdateInventoryButtons(); canvasOpen = true; for (int i = 0; i < talkItems.Length; i++) { if (conversation.textboxes[i] != null) { talkItems[i].gameObject.SetActive(true); talkItems[i].GetComponentInChildren <TextMeshProUGUI>().text = conversation.textboxes[i].text; if (conversation.textboxes[i].visited) { talkItems[i].GetComponent <Image>().color = Color.grey; } } else { talkItems[i].gameObject.SetActive(false); } } lastConversation = conversation; //Cursor.lockState = CursorLockMode.None; }
public EmoUploaderController() { // configuracion de variables de entorno, file Web.config -> appSettings key = ConfigurationManager.AppSettings["EMOTION_KEY"]; serverFolderPath = ConfigurationManager.AppSettings["UPLOAD_DIR"]; emotionHelper = new EmotionHelper(key); }
public EmoUploaderController() { //almacena el Path donde se descargarán los archivos //ConfigurationManager.AppSettings["UPLOAD_DIR"] buscará en el archivo Web.config //en appSetting la ruta con key="UPLOAD_DIR" serverFolderPath = ConfigurationManager.AppSettings["UPLOAD_DIR"]; key = ConfigurationManager.AppSettings["EMOTION_KEY"]; emoHelper = new EmotionHelper(key); }
// TODO: 7. 얼굴의 대표 감정을 얻어와 얼굴 사각형 표시하는 메서드 DisplayEmotion() private void DisplayEmotion(BitmapImage softwareBitmap, DetectedFace emotion) { if (emotion != null) { var emotionName = EmotionHelper.GetTopEmotionName(emotion); DrawFaceBox(softwareBitmap, emotion.FaceRectangle, emotionName); } }
// TODO: 6. 이미지 위에 얼굴 상자를 그리고 감정 설명을 붙이는 메서드 DrawFaceBox() private void DrawFaceBox(BitmapImage softwareBitmap, FaceRectangle faceRectangle, string emotionName) { // 얼굴 사각형 표시를 위해 스케일링 계수 업데이트 GetScalingFactors(softwareBitmap); // 감정에 맞게 색 조정 var emotionColor = EmotionHelper.GetEmotionColor(emotionName); // 얼굴 상자 준비 var faceBox = EmotionHelper.PrepareFaceBox(faceRectangle, emotionColor, xScalingFactor, yScalingFactor); // 감정 설명 준비 var emotionTextBlock = EmotionHelper.PrepareEmotionTextBlock(faceBox, emotionColor, emotionName); // 경계 상자와 감정 설명 표시 CanvasFaceDisplay.Children.Add(faceBox); CanvasFaceDisplay.Children.Add(emotionTextBlock); }
public UploaderController() { _helper = new EmotionHelper(key); }
public DialogueUI(Actor actor, string sentence, Emotion emotion) { name = actor.FirstName; this.sentence = sentence; image = EmotionHelper.GetSpriteOfEmotion(emotion, actor); }
public EmoUploaderController() { key = ConfigurationManager.AppSettings["Emotion_Key"]; emoHelper = new EmotionHelper(key); ServerFolderPath = ConfigurationManager.AppSettings["UPLOAD_DIR"]; }
public EmoUploaderController() { key = ConfigurationManager.AppSettings["UPLOAD_KEY"]; serverFolderPath = ConfigurationManager.AppSettings["UPLOAD_DIR"]; vHelper = new EmotionHelper(key); }
public EmoUploaderController() { serverfolderpath = ConfigurationManager.AppSettings["UPLOAD_DIR"]; key = ConfigurationManager.AppSettings["Emotion_Key"]; EmoHelper = new EmotionHelper(key); }