EKG_Project.IO.FileLoader.Validate C# (CSharp) Method

Validate() public method

public Validate ( string path ) : void
path string
return void
        public void Validate(string path)
        {
            try
            {
                Directory.Exists(Path.GetDirectoryName(path));

                    if (File.Exists(path))
                    {
                        extension = Path.GetExtension(path);
                    }
                    /*
                    else
                    {
                        throw new FileNotFoundException(); // < - robić coś takiego?
                    }
                     */
            }
            catch (Exception e)
            {
                throw e;
            }
        }

Usage Example

Example #1
0
 static void Main()
 {
     FileLoader fl = new FileLoader();
     fl.Validate(@"C:\temp\234.txt");
     Console.WriteLine("Rozszerzenie: " + fl.extension);
     fl.Load(@"C:\temp\234.txt");
     Console.WriteLine("Konwerter: " + fl.converter.GetType().Name);
     Console.Read();
 }