Ejemplo n.º 1
0
        /// <summary>
        /// Konstruktor, der durch Übergabe eines Dateinamens die ReadOnly Properties der Klasse füllt.
        /// </summary>
        /// <param name="Path">Name der Datei zu der die Dateiinformationen gelesen werden sollen</param>
        public FileInformation(string Path)
        {
            FileInfo soFI = new System.IO.FileInfo(Path);

            msName        = soFI.Name;
            moFI          = soFI;
            mlLength      = soFI.Length;
            mdLastChanged = soFI.LastWriteTime;
            msFiletype    = GetFileInformation.GetFileType(Path);
            moSmallIcon   = GetFileInformation.GetSmallIcon(Path);
            moLargeIcon   = GetFileInformation.GetLargeIcon(Path);
        }
Ejemplo n.º 2
0
        private int GetIconImageIndex(string FilePath)
        {
            System.Diagnostics.Trace.WriteLine(">>> de.coe.controls.filecontrols.ExplorerListView.GetIconImageIndex");
            string ssKey = "";

            if (moView != View.LargeIcon)
            {
                ssKey = System.IO.Path.GetExtension(FilePath);
            }
            else
            {
                ssKey = System.IO.Path.GetFileName(FilePath);
            }
            if (moSystemIcons.ContainsKey(ssKey) == false)
            {
                Icon soIcon;
                soIcon = GetFileInformation.GetSmallIcon(FilePath);
                moImgListSmall.Images.Add(soIcon);
                if (moView != View.LargeIcon)
                {
                    soIcon = GetFileInformation.GetLargeIcon(FilePath);
                    moImgListLarge.Images.Add(soIcon);
                }
                else
                {
                    try
                    { moImgListLarge.Images.Add(ResizeImage(Image.FromFile(FilePath), 120)); }
                    catch
                    {
                        soIcon = GetFileInformation.GetLargeIcon(FilePath);
                        moImgListLarge.Images.Add(soIcon);
                    }
                }
                moSystemIcons.Add(ssKey, moImgListSmall.Images.Count - 1);
            }
            System.Diagnostics.Trace.WriteLine("<<< de.coe.controls.filecontrols.ExplorerListView.GetIconImageIndex");
            return((int)moSystemIcons[ssKey]);
        }