Ejemplo n.º 1
0
        private FileVO.FileType GetTypeFromPath(string filePath)
        {
            string[] temp = filePath.Split('.');

            if (temp.Length == 1)
            {
                return(FileVO.FileType.UNKNOWN);
            }

            try
            {
                FileVO.FileType result = (FileVO.FileType)Enum.Parse(typeof(FileVO.FileType), temp[temp.Length - 1], true);
                return(result);
            }
            catch
            {
                return(FileVO.FileType.UNKNOWN);
            }
        }
Ejemplo n.º 2
0
        private void importFileB_Click(object sender, EventArgs e)
        {
            filePath = AcquireNewFile();

            if (filePath == "")
            {
                return;
            }

            type = GetTypeFromPath(filePath);

            if (type == FileVO.FileType.UNKNOWN)
            {
                Error("الملف المحدد من نوع بيانات غير معروف");
                return;
            }

            fileName = GenerateNewFileName();
            SetEnabled(false);
            toolStripProgressBar1.Style = ProgressBarStyle.Marquee;
            SetStatus("جاري تشفير الملف");
            encryptorBGW.RunWorkerAsync();
        }
Ejemplo n.º 3
0
        public FileVO GenerateNewFile(string filePath, string newFileName, DocumentVO parentDocument, FileVO.FileType type)
        {
            FileVO result = new FileVO();

            result.Name     = newFileName;
            result.Document = parentDocument;
            FillData(result, filePath);
            result.Type = type;

            return(result);
        }