예제 #1
0
        /// <summary>
        /// プレイブックデザイン画像の保存ファイル名を作成する。
        /// </summary>
        /// <param name="playName"></param>
        /// <param name="fileExtension"></param>
        /// <returns></returns>
        private string CreateFileName(PlayName playName, string fileExtension)
        {
            var cantUseChars = Path.GetInvalidFileNameChars();

            Array.Resize(ref cantUseChars, cantUseChars.Length + 1);
            cantUseChars[cantUseChars.Length - 1] = ' ';
            var playNameforFileName = string.Concat(playName.ShortName.Select(c => cantUseChars.Contains(c) ? '_' : c));
            var sysDate             = DateTime.Now.ToString("yyyyMMddHHmmss");

            return(sysDate + "_" + playNameforFileName + fileExtension);
        }
예제 #2
0
 //TODO : Updateメソッドをどこにセットしようか悩み中。最終更新日・ユーザーを取得したいがchangeメソッドの中に毎回書くのは嫌だから。
 public Playbook(int id, Category category, PlayName playName, string installStatus, IFormFile file, Context context, User createUser)
 {
     ChangePlaybookId(id);
     ChangeCategory(category);
     ChangePlayName(playName);
     ChangeContext(context);
     ChangeInstallStatus(installStatus);
     ChangePlayDesign(new PlayDesign(file, PlayName));
     CreateUser     = createUser;
     CreateDate     = DateTime.Now;
     LastUpdateUser = createUser;
     LastUpdateDate = DateTime.Now;
 }
예제 #3
0
        public void ChangeFile(IFormFile file, PlayName playName)
        {
            if (file == null)
            {
                return;
            }

            var fileExtension = Path.GetExtension(file.FileName).ToLower();


            if (CanUseFileExtension(fileExtension) == false)
            {
                File = null;
                return;
            }
            if (file.Length / 1000 >= 500)
            {
            }

            FileName = CreateFileName(playName, fileExtension);
            File     = file;
        }
예제 #4
0
 public void ChangePlayName(PlayName playName)
 {
     PlayName = playName;
 }
예제 #5
0
 public PlayDesign(IFormFile file, PlayName playName)
 {
     ChangeFile(file, playName);
 }