Example #1
0
            /// <summary>
            /// No Path, No Extension
            /// </summary>
            /// <param name="NameFull"></param>
            /// <param name="Name"></param>
            /// <param name="Error"></param>
            /// <returns></returns>
            public static bool GetNameShort(String NameFull, out String Name, out String Error)
            {
                int    iIndex;
                String strMsg, strName, strNameFull;

                Name = "";

                if (!CFile.GetName(NameFull, out strName, out Error))
                {
                    return(false);
                }

                //System.IO.Path.GetFileNameWithoutExtension()
                strNameFull = NameFull;
                iIndex      = strName.LastIndexOf(".");
                if (iIndex == -1)
                {
                    strMsg = String.Format("The name of file doesn't contain the extension.({0})", strNameFull);
                    Error  = strMsg;

                    return(false);
                }

                Name = strName.Substring(0, iIndex);
                return(true);
            }