Exemple #1
0
        public static void CheckMainFile()
        {
            if (File.Exists(txtFileName.Text))
            {
                lnkFileName.Text = Path.GetFileName(txtFileName.Text);

                if (IoTools.FileOpened(txtFileName.Text))
                {
                    InvalidFile    = true;
                    lFileSize.Text = "File Size: Access Denied.";
                    return;
                }

                lFileSize.Text      = "File Size: " + IoTools.ParseFileSize(txtFileName.Text);
                lnkFileName.Enabled = true;
                InvalidFile         = false;
            }
            else
            {
                InvalidFile = true;
                if (txtFileName.Text.Length > 0)
                {
                    lnkFileName.Text = "File does not exists.";
                }
                else
                {
                    lnkFileName.Text = "No files selected.";
                }

                lnkFileName.Enabled = false;
                lFileSize.Text      = "File Size: N/A";
            }

            UpdatePartsInfo();
        }
Exemple #2
0
        public static void CheckMainFile()
        {
            if (File.Exists(txtFileName.Text))
            {
                int pNumber = 0;

                lFileName.Text = "Part Name: " + IoTools.GetFileShortName(Path.GetFileName(txtFileName.Text), 50);

                lFileSize.Text = "Part Size: " + IoTools.ParseFileSize(txtFileName.Text);

                pNumber = GetPartsNumber();

                if (pNumber > 0)
                {
                    lPartsNumber.Text = "Parts Number: " + pNumber.ToString();
                }
                else
                {
                    lPartsNumber.Text = "Parts Number: Some parts are missing";
                }

                InvalidFile = false;
            }
            else
            {
                InvalidFile = true;
                if (txtFileName.Text.Length > 0)
                {
                    lFileName.Text = "Part Name: File does not exists.";
                }
                else
                {
                    lFileName.Text = "Part Name: No files selected.";
                }

                lFileSize.Text    = "Part Size: N/A";
                lPartsNumber.Text = "Parts Number: N/A";
            }

            string fileName = GetFirstPart();

            if (fileName == null)
            {
                SetCrcChk(false);
                return;
            }

            string pDir  = Directory.GetParent(txtFileName.Text).FullName;
            string fPath = Path.Combine(pDir, fileName);

            //Check if sfv file exists
            if (File.Exists(fPath + ".sfv"))
            {
                sfvFile = fPath + ".sfv";
                SetCrcChk(true);
            }
            else
            {
                SetCrcChk(false);
            }
        }