Beispiel #1
0
        /// <summary>
        /// 得到文件名
        /// </summary>
        /// <param name="FileLabel">文件编号</param>
        /// <returns>文件名</returns>
        public string GetFileName(int FileLabel)
        {
            FileState state = FileLabelToState(FileLabel);

            if (state == null)
            {
                throw new Exception("这文件已不存在");
            }
            string haveStr = EngineTool.StringRight(state.FileName, "\\");

            return(haveStr);
        }
Beispiel #2
0
        /// <summary>
        /// 发送方对一个文件包头进行加密得到一个byte[]
        /// </summary>
        /// <param name="fileSend"></param>
        /// <returns></returns>
        internal static byte[] FileHeadEncryption(FileState fileSend)
        {
            string fileName = EngineTool.StringRight(fileSend.FileName, "\\");

            byte[] fileNameByte = Encoding.UTF8.GetBytes(fileName);
            byte[] haveDate     = new byte[15 + fileNameByte.Length];
            haveDate[0] = PasswordCode._fileCode;
            haveDate[1] = PasswordCode._sendUser;
            haveDate[2] = PasswordCode._fileHeadCode;
            ByteToDate.IntToByte(fileSend.FileLabel, 3, haveDate);
            ByteToDate.IntToByte(fileSend.FileLenth, 7, haveDate);
            fileNameByte.CopyTo(haveDate, 15);
            return(haveDate);
        }