示例#1
0
 public bool IsApplicable(string documentType, string mostRecentNonReassignmentAnswer)
 =>
 (
     MostRecentNonReassignmentAnswer == null ||
     MostRecentNonReassignmentAnswer == mostRecentNonReassignmentAnswer ||
     CSV.ParseLine(MostRecentNonReassignmentAnswer).Contains(mostRecentNonReassignmentAnswer)
 ) &&
 (
     DocumentTypes == null ||
     DocumentTypes.Count == 0 ||
     DocumentTypes.Contains(documentType) ||
     DocumentTypes.Contains("*")
 );
示例#2
0
        private void btnVideo_Click(object sender, EventArgs e)
        {
            errProv.Dispose();

            try
            {
                if (txtFileSamp.Text == "")
                {
                    throw new Exception("No file chosen.");
                }
                else if (!File.Exists(txtFileSamp.Text))
                {
                    throw new Exception("That file does not exist, and thus can't be ran.");
                }

                string ext = Path.GetExtension(txtFileSamp.Text);


                if (VideoTypes.Contains(ext.ToLower()))
                {
                    Video videoFile = new Video(txtFileSamp.Text);

                    videoFile.ViewFile();
                }
                else if (GraphicTypes.Contains(ext.ToLower()))
                {
                    Graphic graphicFile = new Graphic(txtFileSamp.Text);


                    graphicFile.ViewFile();
                }
                else if (AudioTypes.Contains(ext.ToLower()))
                {
                    Audio audioFile = new Audio(txtFileSamp.Text);

                    audioFile.ViewFile();
                }
                else if (ArchiveTypes.Contains(ext.ToLower()))
                {
                    Archive archiveFile = new Archive(txtFileSamp.Text);



                    archiveFile.ViewFile();
                }
                else if (DocumentTypes.Contains(ext.ToLower()))
                {
                    Document docFile = new Document(txtFileSamp.Text);



                    docFile.ViewFile();
                }
                else
                {
                    throw new Exception("File type not found: the chosen file type is not supported.");
                    //System.IO.FileInfo newFile = new System.IO.FileInfo(txtFileSamp.Text);
                    //System.IO.FileAttributes b = newFile.Attributes;
                }
            }
            catch (Exception ex)
            {
                errProv.SetError(btnDisplay, ex.Message);
            }
        }