Example #1
0
        byte[] LoadData(string file, bool raw)
        {
            if (file == null || !File.Exists(file))
            {
                return(null);
            }
            file_reference = file;
            Cls();
            int length = Marshal.SizeOf(typeof(BITMAPINFOHEADER));

            if (File.Exists(file_reference))
            {
                using (fru = new FileReaderUtil(file_reference))
                {
                    fru.fs.Seek(raw?0:14, SeekOrigin.Begin);
                    sel = fru.br.ReadBytes(length);
                }
            }
            return(sel);
        }
Example #2
0
        public void CalculateWordOccurencesTest()
        {
            try
            {
                string filePath = @"D:\VSProjects\ANBSysPro\ANBSysPro\bin\Debug\Sample.txt";

                long     topNNumberofWords = 5;
                string[] wordsToSkip       = new string[] { "is", "was", "the" };

                Assert.IsFalse(string.IsNullOrEmpty(filePath), "Please enter the filepath");
                Assert.IsFalse(topNNumberofWords < 1, "Please enter the top n words more than 1");
                Assert.IsFalse(!File.Exists(filePath), "Please enter the valida filepath");

                FileReaderUtil.CalculateWordOccurences(filePath, topNNumberofWords, wordsToSkip);
            }
            catch (FileNotFoundException ex)
            {
                Assert.Fail(ex.Message);
            }
            catch (Exception ex)
            {
                Assert.Fail(ex.Message);
            }
        }