Example #1
0
        /// <summary>
        /// Get valid length file name
        /// </summary>
        /// <param name="filepath"></param>
        /// <param name="filenameWithoutExtension"></param>
        /// <returns></returns>
        public static string GetValidLengthFileName(string filepath, string filenameWithoutExtension, Presentation.PresentationType presentationType)
        {
            string RetVal = string.Empty;
            try
            {
                if (filepath.Length + filenameWithoutExtension.Length > 205)
                {
                    string FileName = filenameWithoutExtension.Replace(presentationType.ToString(), "");

                    RetVal = FileName.Substring(0, 205 - (FileName.Length + presentationType.ToString().Length));

                    RetVal = RetVal + " - " + presentationType.ToString();
                }
                else
                {
                    RetVal = filenameWithoutExtension;
                }
            }
            catch (Exception)
            {
            }
            return RetVal;
        }