Źle porównuję stringi, nie wiem jak to lepiej opisać

0

Hej wszystkim forumowiczom :)
Mam klasę:

public class File
    {
        public static string Name(string path)
        {
            return System.IO.Path.GetFileNameWithoutExtension(path);
        }
        public static string Extension(string path)
        {
            return (HasExtension(path)) ? path.Substring(path.LastIndexOf('.')) : null;
        }
        public static bool Exist(string path)
        {
            return System.IO.File.Exists(path);
        }
        public static bool HasExtension(string path)
        {
            return System.IO.Path.HasExtension(path);
        }
        public static List<string> GetFiles(DragEventArgs e)
        {
            List<string> OutputList = new List<string>();
            e.Effects = DragDropEffects.All;
            string[] DroppedFiles = (string[])e.Data.GetData(DataFormats.FileDrop);
            GetFiles(DroppedFiles, OutputList);
            return OutputList;
        }
        public static void GetFiles(string[] files, List<string> List)
        {
            if (files == null)
                return;
            foreach (string Path in files)
            {
                if (!HasExtension(Path))
                    GetFiles(GetAllFilesFromDirectory(Path), List);
                else
                {
                    MessageBox.Show(Extension(Path));
                    if (Extension(Path).Contains(".Ink"))
                    {
                        MessageBox.Show("...");
                        GetFiles(GetAllFilesFromShortcut(Path), List);
                    }
                    else
                    {
                        List.Add(Path);
                    }
                }
            }

            return;
        }
        public static string[] GetAllFilesFromDirectory(string directory)
        {
            IEnumerable<string> output = Directory.EnumerateFileSystemEntries(directory, "*", SearchOption.AllDirectories);
            return (output != null) ? output.ToArray() : null;
        }
        public static string[] GetAllFilesFromShortcut(string Path)
        {
            if (Path == null)
                return null;
            WshShell shell = new WshShell();
            IWshShortcut link = (IWshShortcut)shell.CreateShortcut(Path);
            MessageBox.Show(link.TargetPath);
            Path = link.TargetPath;
            if (!HasExtension(Path))
                return GetAllFilesFromDirectory(Path);
            else
            {
                if (Extension(Path).Contains(".Ink"))
                {
                    return GetAllFilesFromShortcut(Path);
                }
                else
                {
                    return new List<string> { Path }.ToArray();
                }
            }
        }

Nie potrafi mi poprawnie porównać, czy rozszerzenie jest równe .Ink
MessageBox zaraz przedtem pokazuje wynik ".Ink", jednak jak porównuje i to zwraca false. Proszę o pomoc w tej części:

if (!HasExtension(Path))
                    GetFiles(GetAllFilesFromDirectory(Path), List);
                else
                {
                    MessageBox.Show(Extension(Path));
                    if (Extension(Path).Contains(".Ink"))
                    {
                        MessageBox.Show("...");
                        GetFiles(GetAllFilesFromShortcut(Path), List);
                    }
4

wez pod uwage ze duze i oraz male L to nie to samo :) chodzi ci pewnie o lnk a nie Ink

0

Nie żartuj... Byłem pewien, że to I xD

Edit:
Dzięki @katelx. Chyba jednak będę musiał kupić te okulary...

1 użytkowników online, w tym zalogowanych: 0, gości: 1