private void Setup_PreviewPane()
        {
            Dispatcher.BeginInvoke(DispatcherPriority.Background, (ThreadStart)(() =>
            {
                if (SelectedItem != null)
                {
                    if (!Browser.SelectedItems.Any())
                    {
                        return;
                    }
                    if (this.SelectedItem.IsFolder)
                    {
                        return;
                    }

                    //http://www.codeproject.com/Articles/7987/Retrieve-detailed-information-of-a-File
                    var sh = new Shell32.ShellClass();
                    Shell32.Folder dir = sh.NameSpace(System.IO.Path.GetDirectoryName(SelectedItem.ParsingName));
                    Shell32.FolderItem item = dir.ParseName(System.IO.Path.GetFileName(SelectedItem.ParsingName));

                    // loop through the Folder Items
                    for (int i = 0; i < 30; i++)
                    {
                        // read the current detail Info from the FolderItem Object
                        //(Retrieves details about an item in a folder. For example, its size, type, or the time of its last modification.)
                        // some examples:
                        // 0 Retrieves the name of the item.
                        // 1 Retrieves the size of the item.
                        // 2 Retrieves the type of the item.
                        // 3 Retrieves the date and time that the item was last modified.
                        // 4 Retrieves the attributes of the item.
                        // -1 Retrieves the info tip information for the item.
                        string colName = dir.GetDetailsOf(String.Empty, i);
                        string value = dir.GetDetailsOf(item, i);
                        // Create a helper Object for holding the current Information
                        // an put it into a ArrayList
                    }


                    //this.SelectedItem.Thumbnail.CurrentSize = new System.Windows.Size(this.ActualHeight - 20, this.ActualHeight - 20);
                    //this.SelectedItem.Thumbnail.FormatOption = BExplorer.Shell.Interop.ShellThumbnailFormatOption.Default;
                    //this.SelectedItem.Thumbnail.RetrievalOption = BExplorer.Shell.Interop.ShellThumbnailRetrievalOption.Default;
                    //icon.Source = this.SelectedItem.Thumbnail.BitmapSource;

                    //txtDisplayName.Text = SelectedItem.DisplayName;
                    //txtFileType.Text = "Extension: " + SelectedItem.Extension;
                    //txtPath.Text = "Location : " + SelectedItem.FileSystemPath;

                    //var OpenWirgList = SelectedItem.GetAssocList();
                    //if (OpenWirgList.Any()) {
                    //	txtOpenWith.Text = "Opens With: " + OpenWirgList.First().DisplayName;
                    //}

                    var File = new System.IO.FileInfo(Browser.SelectedItems[0].ParsingName);
                    txtFileSize.Text = "Size: " + File.Length.ToString();
                    txtFileCreated.Text = "Created: " + File.CreationTime.ToLongDateString();
                    txtFileModified.Text = "Modified: " + File.LastWriteTime.ToLongDateString();
                }
            }));
        }
        public void DataReaderSetup(string foldername)
        {
            _foldername = foldername;

             //_objFolder = _shell.NameSpace(@_foldername);
            _objFolder = _shell.NameSpace(@"C:\Users\Jakob\Music\");

            for (int i = 0; i < short.MaxValue; i++)
            {
                string header = _objFolder.GetDetailsOf(null, i);
                if (String.IsNullOrEmpty(header))
                    break;
                _arrHeaders.Add(header);
            }

            foreach (Shell32.FolderItem2 item in _objFolder.Items())
            {
                for (int i = 0; i < _arrHeaders.Count; i++)
                //for (int i = 0; i < 50; i++) //this prints the metadata <--
                {
                    Console.WriteLine("{0}\t{1}: {2}", i, _arrHeaders[i], _objFolder.GetDetailsOf(item, i));
                }

            }
        }
Exemplo n.º 3
0
        public void                     onStartup()
        {
            Shell32.Shell  shell     = new Shell32.Shell();
            Shell32.Folder objFolder = shell.NameSpace(@"C:\Windows");

            this.files.Clear();
            foreach (string name in ColumnListPerName)
            {
                this.files.Columns.Add(name);
            }
            foreach (int id in ColumnListPerID)
            {
                string header = objFolder.GetDetailsOf(null, id);
                if (String.IsNullOrEmpty(header))
                {
                    break;
                }
                while (this.files.Columns.Contains(header))
                {
                    header += "_";
                }
                header = header.Replace("'", "_").Replace("’", "_");
                Debug.WriteLine("creating column named " + header);
                this.files.Columns.Add(header);
            }

            this.files.Columns["ID"].DataType = Type.GetType("System.Int32");
            this.files.Columns[objFolder.GetDetailsOf(null, 26).Replace("'", "_").Replace("’", "_")].DataType = Type.GetType("System.Int32");
            //this.files.Columns["Longueur"].DataType = Type.GetType("System.TimeSpan");
            this.files.Columns["URI"].DataType = typeof(System.Uri);
            ProcessLibraries();
            this.files.AcceptChanges();
        }
Exemplo n.º 4
0
        private string GetFileInfo()
        {
            string dirname;
            string filename;
            string header;
            string data;
            string info = "";

            Shell32.Shell shell = new Shell32.Shell();
            dirname  = Path.GetDirectoryName(trackPath);
            filename = Path.GetFileName(trackPath);
            Shell32.Folder     folder     = shell.NameSpace(dirname);
            Shell32.FolderItem folderitem = folder.ParseName(filename);
            info = filename + "\n";
            for (int i = 1; i <= 350; i++)
            {
                header = folder.GetDetailsOf(null, i);
                data   = folder.GetDetailsOf(folderitem, i);
                if (!(String.IsNullOrEmpty(header)) && !(String.IsNullOrEmpty(data)))
                {
                    if (header == "Wolne miejsce" || header == "Całkowity rozmiar")
                    {
                        i++;
                    }
                    else
                    {
                        info += $"{header}: {data}\r";
                    }
                }
            }
            return(info);
        }
Exemplo n.º 5
0
        private string GetFileInfo()
        {
            // TODO: Add exception-handling. What if file can't be found or is invalid?
            string dirname;
            string filename;
            string header;
            string data;
            string info = "";

            Shell32.Shell shell = new Shell32.ShellClass();
            dirname  = Path.GetDirectoryName(trackPath);
            filename = Path.GetFileName(trackPath);
            Shell32.Folder     folder     = shell.NameSpace(dirname);
            Shell32.FolderItem folderitem = folder.ParseName(filename);
            info = filename;
            for (int i = 0; i <= 315; i++)
            {
                header = folder.GetDetailsOf(null, i);
                data   = folder.GetDetailsOf(folderitem, i);
                if (!(String.IsNullOrEmpty(header)) && !(String.IsNullOrEmpty(data)))
                {
                    info += $"{header}: {data}\r";
                }
            }
            return(info);
        }
Exemplo n.º 6
0
        /// <summary>
        /// 长度秒(支持mp4?)
        /// </summary>
        /// <param name="path"></param>
        /// <returns></returns>
        public static int GetMediaTimeLenSecond(string path)
        {
            try
            {
                Shell32.Shell shell = new Shell32.Shell();
                //文件路径
                Shell32.Folder folder = shell.NameSpace(path.Substring(0, path.LastIndexOf("\\")));
                //文件名称
                Shell32.FolderItem folderitem = folder.ParseName(path.Substring(path.LastIndexOf("\\") + 1));
                string             len;
                if (Environment.OSVersion.Version.Major >= 6)
                {
                    len = folder.GetDetailsOf(folderitem, 27);
                }
                else
                {
                    len = folder.GetDetailsOf(folderitem, 21);
                }

                string[] str = len.Split(new char[] { ':' });
                int      sum = 0;
                sum = int.Parse(str[0]) * 60 * 60 + int.Parse(str[1]) * 60 + int.Parse(str[2]);

                return(sum);
            }
            catch (Exception ex) { return(0); }
        }
        /// <summary>
        /// 获取MD5和播放时长
        /// </summary>
        /// <param name="FilePathName"></param>
        /// <returns></returns>
        public ViewModelVideoItem GetItem(string FilePathName)
        {
            ViewModelVideoItem newItem = new ViewModelVideoItem();

            newItem.Name          = FilePathName.Substring(FilePathName.LastIndexOf("\\") + 1);
            newItem.ReRelativeUrl = FilePathName;
            int sum = 0;

            if (newItem.Name.Substring(newItem.Name.LastIndexOf(".")) == ".wmv" || newItem.Name.Substring(newItem.Name.LastIndexOf(".")) == ".WMV")
            {
                Shell32.Shell      shell      = new Shell32.Shell();
                Shell32.Folder     folder     = shell.NameSpace(FilePathName.Substring(0, FilePathName.LastIndexOf("\\")));
                Shell32.FolderItem folderitem = folder.ParseName(newItem.Name);
                string             len;
                if (Environment.OSVersion.Version.Major >= 6)
                {
                    len = folder.GetDetailsOf(folderitem, 27);
                }
                else
                {
                    len = folder.GetDetailsOf(folderitem, 21);
                }

                string[] str = len.Split(new char[] { ':' });

                sum = int.Parse(str[0]) * 3600 + int.Parse(str[1]) * 60 + int.Parse(str[2]) + 1;
            }
            newItem.SunTime  = sum;
            newItem.MD5Value = SeatManage.SeatManageComm.SeatComm.GetMD5HashFromFile(newItem.ReRelativeUrl);
            return(newItem);
        }
Exemplo n.º 8
0
        /// <summary>
        /// Get duration(ms) of audio or vedio by Shell32.dll
        /// </summary>
        /// <param name="filePath">audio/vedio's path</param>
        /// <returns>Duration in original format, duration in milliseconds</returns>
        /// <remarks>return value from Shell32.dll is in format of: "00:10:16"</remarks>
        public override Tuple <string, long> GetDuration(string filePath)
        {
            try
            {
                string dir = Path.GetDirectoryName(filePath);

                // From Add Reference --> COM
                Shell32.Shell      shell      = new Shell32.Shell();
                Shell32.Folder     folder     = shell.NameSpace(dir);
                Shell32.FolderItem folderitem = folder.ParseName(Path.GetFileName(filePath));

                string duration = null;

                // Deal with different versions of OS
                if (Environment.OSVersion.Version.Major >= 6)
                {
                    duration = folder.GetDetailsOf(folderitem, 27);
                }
                else
                {
                    duration = folder.GetDetailsOf(folderitem, 21);
                }

                duration = string.IsNullOrEmpty(duration) ? "00:00:00" : duration;
                return(Tuple.Create(duration, GetTimeInMillisecond(duration)));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 9
0
        // ファイルのプロパティからイメージの高さを取得
        private int GetFileHeightProperty(string filePath)
        {
            Shell32.Shell shell  = new Shell32.Shell();
            string        res    = "";
            int           height = 0;

            try
            {
                Shell32.Folder     objFolder  = shell.NameSpace(System.IO.Path.GetDirectoryName(filePath));
                Shell32.FolderItem folderItem = objFolder.ParseName(System.IO.Path.GetFileName(filePath));

                for (int i = 0; i < 300; i++)
                {
                    if (objFolder.GetDetailsOf("", i) == "高さ")
                    {
                        res = objFolder.GetDetailsOf(folderItem, i);
                        break;
                    }
                }

                Regex regex = new Regex("[0-9]+");
                Match match = regex.Match(res);
                if (match.Success)
                {
                    height = int.Parse(match.Value);
                }
            }
            catch
            {
                height = 0;
            }

            return(height);
        }
Exemplo n.º 10
0
        private void OnClick_LoadFiles(object sender, RoutedEventArgs e)
        {
            string p = ZS_TXT_FolderPath.Text;

            if (!Directory.Exists(p))
            {
                System.Windows.MessageBox.Show("目录不存在!");
                return;
            }

            Shell32.ShellClass sh  = new Shell32.ShellClass();
            Shell32.Folder     dir = sh.NameSpace(p);
            foreach (Shell32.FolderItem item in dir.Items())
            {
                txtTest.Text += "\r\n" + dir.GetDetailsOf(item, 0);
                txtTest.Text += "\r\n" + dir.GetDetailsOf(item, 1);
                txtTest.Text += "\r\n" + dir.GetDetailsOf(item, 21);
                txtTest.Text += "\r\n" + dir.GetDetailsOf(item, 27);
            }

            //string[] files = Directory.GetFiles(ZS_TXT_FolderPath.Text);
            //foreach (string f in files)
            //{
            //    Shell32.FolderItem item = dir.ParseName(f);
            //}

            sh = null;
        }
Exemplo n.º 11
0
        public void GetData(string location)
        {
            try
            {
                ShellObject song = ShellObject.FromParsingName(location);
                nameTextBox.Text    = Index.GetValue(song.Properties.GetProperty(SystemProperties.System.FileName));
                aArtistTextBox.Text = Index.GetValue(song.Properties.GetProperty(SystemProperties.System.Music.AlbumArtist));
                titleTextBox.Text   = Index.GetValue(song.Properties.GetProperty(SystemProperties.System.Title));
                albumTextBox.Text   = Index.GetValue(song.Properties.GetProperty(SystemProperties.System.Music.AlbumTitle));
                yearTextBox.Text    = Index.GetValue(song.Properties.GetProperty(SystemProperties.System.Media.Year));
                lyricsTextBox.Text  = Index.GetValue(song.Properties.GetProperty(SystemProperties.System.Music.Lyrics));

                Shell32.Shell      shell      = new Shell32.Shell();
                Shell32.Folder     objFolder  = shell.NameSpace(System.IO.Path.GetDirectoryName(location));
                Shell32.FolderItem folderItem = objFolder.ParseName(System.IO.Path.GetFileName(location));
                contributingTextBox.Text = objFolder.GetDetailsOf(folderItem, 13);
                genreBox.Text            = objFolder.GetDetailsOf(folderItem, 16);
            }
            catch (ShellException)
            {
                MessageBox.Show("File not found exception!", "Error");
                Close();
            }
            catch (Exception e)
            {
                MessageBox.Show(e.ToString(), "Error");
                Close();
            }
        }
Exemplo n.º 12
0
        // File processing
        private void ShowInfo()
        {
            string dirname;
            string filename;
            string header;
            string data;

            Shell32.Shell shell = new Shell32.ShellClass();
            dirname  = Path.GetDirectoryName(trackPath);
            filename = Path.GetFileName(trackPath);
            Shell32.Folder     folder     = shell.NameSpace(dirname);
            Shell32.FolderItem folderitem = folder.ParseName(filename);
            infoBox.Text = dirname + "\n" + filename;
            for (int i = 0; i <= 315; i++)
            {
                header = folder.GetDetailsOf(null, i);
                data   = folder.GetDetailsOf(folderitem, i);
                if (String.IsNullOrEmpty(header))
                {
                    header = "[Unknown header]";
                }
                if (String.IsNullOrEmpty(data))
                {
                    data = "[No data]";
                }
                infoBox.AppendText($"\n{i} {header} {data}");
            }
        }
Exemplo n.º 13
0
        static void runRenamer(string p)
        {
            string songTitle = "bartFart";
            //File songFile = Directory.get
            string songArtist = "ShortLife";

            string path       = p;
            string targetPath = @"C:\NewSongs\";

            //get the file(s)
            string[] songfiles = Directory.GetFiles(path);

            foreach (string song in songfiles)
            {
                List <string> arrHeaders = new List <string>();

                Shell32.Shell      shell      = new Shell32.Shell();
                Shell32.Folder     objFolder  = shell.NameSpace(System.IO.Path.GetDirectoryName(song));
                Shell32.FolderItem folderItem = objFolder.ParseName(System.IO.Path.GetFileName(song));

                for (int i = 0; i < short.MaxValue; i++)
                {
                    string header = objFolder.GetDetailsOf(null, i);
                    if (String.IsNullOrEmpty(header))
                    {
                        break;
                    }
                    arrHeaders.Add(header);
                }

                for (int i = 0; i < arrHeaders.Count; i++)
                {
                    Console.WriteLine("{0}\t{1}: {2}", i, arrHeaders[i], objFolder.GetDetailsOf(folderItem, i));
                }
                songTitle  = objFolder.GetDetailsOf(folderItem, 21);
                songArtist = objFolder.GetDetailsOf(folderItem, 13);
                FileAttributes attributes = File.GetAttributes(song);

                FileInfo fi = new FileInfo("bart.txt");
                //fi.a

                ////get the file property

                ////check if the dir exists
                if (!System.IO.Directory.Exists(targetPath + songArtist))
                {
                    Directory.CreateDirectory(targetPath + songArtist);
                }
                ////copy the file to target dir


                System.IO.File.Move(song, targetPath + songArtist + @"\" + songTitle + ".m4a");
                //rename the file to the Title of the Song
            }
            Console.ReadLine();
        }
Exemplo n.º 14
0
 private int video_handle(string path)
 {
     try
     {
         log("{0} 视频信息读取 ing..", path);
         Shell32.Shell shell = new Shell32.Shell();
         //文件路径
         Shell32.Folder folder = shell.NameSpace(path.Substring(0, path.LastIndexOf("\\")));
         //文件名称
         Shell32.FolderItem folderitem = folder.ParseName(path.Substring(path.LastIndexOf("\\") + 1));
         string             len;
         //string kbps = folder.GetDetailsOf(folderitem, 308);
         //int i = 0;
         //while (true)
         //{
         //    //获取属性名称
         //    string key = folder.GetDetailsOf(null, i);
         //    if (string.IsNullOrEmpty(key))
         //    {
         //        //当无属性可取时,退出循环
         //        break;
         //    }
         //    //获取属性值
         //    string value = folder.GetDetailsOf(folderitem, i);
         //    Console.WriteLine("{0}:{1}", key, value);
         //    i++;
         //}
         //多系统兼容
         if (Environment.OSVersion.Version.Major >= 6)
         {
             len = folder.GetDetailsOf(folderitem, 27);
         }
         else
         {
             len = folder.GetDetailsOf(folderitem, 21);
         }
         string[] str = len.Split(new char[] { ':' });
         int      sum = 0;
         if (str.Length == 3)
         {
             sum = int.Parse(str[0]) * 60 * 60 + int.Parse(str[1]) * 60 + int.Parse(str[2]);
             log("视频信息{0}s", sum);
         }
         else
         {
             error("视频信息读取失败,也行是系统功能被限制!");
         }
         return(sum);
     }
     catch (Exception ex)
     {
         error("读取视频信息发生错误{0}", ex.Message);
         return(0);
     }
 }
        /// <summary>
        /// 添加媒体文件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnAdditem_Click(object sender, RoutedEventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog();

            ofd.Multiselect = false;
            ofd.Filter      = "媒体文件|*.jpg;*.bmp;*.jpeg;*.png;*.wmv;";
            ofd.ShowDialog();
            if (!string.IsNullOrEmpty(ofd.FileName))
            {
                PlaylistItemViewModel itemVM = new PlaylistItemViewModel();
                itemVM.Name     = ofd.SafeFileName;
                itemVM.FilePath = ofd.FileName;
                int sum = 0;
                if (itemVM.Name.Substring(itemVM.Name.LastIndexOf(".")) == ".wmv" || itemVM.Name.Substring(itemVM.Name.LastIndexOf(".")) == ".WMV")
                {
                    Shell32.Shell      shell      = new Shell32.Shell();
                    Shell32.Folder     folder     = shell.NameSpace(ofd.FileName.Substring(0, ofd.FileName.LastIndexOf("\\")));
                    Shell32.FolderItem folderitem = folder.ParseName(ofd.SafeFileName);
                    string             len;
                    if (Environment.OSVersion.Version.Major >= 6)
                    {
                        len = folder.GetDetailsOf(folderitem, 27);
                    }
                    else
                    {
                        len = folder.GetDetailsOf(folderitem, 21);
                    }
                    string[] str = len.Split(new char[] { ':' });

                    sum = int.Parse(str[0]) * 3600 + int.Parse(str[1]) * 60 + int.Parse(str[2]) + 1;
                }
                else
                {
                    if (Playlist.ItemList.Count > 0)
                    {
                        for (int i = Playlist.ItemList.Count - 1; i >= 0; i--)
                        {
                            if (Playlist.ItemList[i].Name.Substring(Playlist.ItemList[i].Name.LastIndexOf(".")) != ".WMV" && Playlist.ItemList[i].Name.Substring(Playlist.ItemList[i].Name.LastIndexOf(".")) != ".wmv")
                            {
                                sum = Playlist.ItemList[i].SunTime;
                                break;
                            }
                        }
                    }
                }
                if (sum == 0)
                {
                    sum = 10;
                }
                itemVM.SunTime  = sum;
                itemVM.Md5Value = SeatManage.SeatManageComm.SeatComm.GetMD5HashFromFile(itemVM.FilePath);
                Playlist.ItemList.Add(itemVM);
            }
        }
Exemplo n.º 16
0
        private void ChangeTitleToolStripMenuItem_Click(object sender, EventArgs e)
        {
            try
            {
                string[] files = Directory.GetFiles(path, "*.mp3", SearchOption.AllDirectories);

                for (int i = 0; i < files.Length; i++)
                {
                    FileInfo file = new FileInfo(files[i]);
                    if (NameCheck(file.Name) == "")
                    {
                        var fileshell = ShellFile.FromFilePath(file.DirectoryName + "\\" + file.Name);

                        Shell32.Shell      shell       = new Shell32.Shell();
                        var                strFileName = file.DirectoryName + "\\" + file.Name;
                        Shell32.Folder     objFolder   = shell.NameSpace(System.IO.Path.GetDirectoryName(strFileName));
                        Shell32.FolderItem folderItem  = objFolder.ParseName(System.IO.Path.GetFileName(strFileName));
                        var                title       = objFolder.GetDetailsOf(folderItem, 21);

                        if (title == "" || title.Contains("ntitled") || title.Contains("nknown") || title.Contains("nknown") || title.Contains("http") || title.Contains("www.") || title.Contains(".com") || title.Contains("Track"))
                        {
                            string   name    = objFolder.GetDetailsOf(folderItem, 0);
                            string[] newName = Regex.Split(name, "-");

                            if (newName.Length >= 2 && newName[1] != null)
                            {
                                string[] newest = Regex.Split(newName[1], "\\.");

                                ShellPropertyWriter propertyWriter = fileshell.Properties.GetPropertyWriter();
                                try
                                {
                                    propertyWriter.WriteProperty(SystemProperties.System.Title, new string[] { newest[0] });
                                }
                                finally
                                {
                                    propertyWriter.Close();
                                }
                            }
                        }
                    }
                    progressBar1.Value = Convert.ToInt32(100 * (i + 1) / files.Length);

                    if (i == files.Length - 1)
                    {
                        progressBar1.Value = 100;
                    }
                }
            }
            catch (FileNotFoundException)
            {
                MessageBox.Show("Files not found exception!", "Error!");
            }
        }
Exemplo n.º 17
0
        private void GetHeadersToolStripMenuItem_Click(object sender, EventArgs e)
        {
            DisableButtons();
            DataTable table = new DataTable();

            table.Columns.Add("No");
            table.Columns.Add("Header Name");

            List <string> arrHeaders = new List <string>();
            List <Tuple <int, string, string> > attributes = new List <Tuple <int, string, string> >();

            Shell32.Shell shell       = new Shell32.Shell();
            var           strFileName = "C:\\Music";

            Shell32.Folder     objFolder  = shell.NameSpace(System.IO.Path.GetDirectoryName(strFileName));
            Shell32.FolderItem folderItem = objFolder.ParseName(System.IO.Path.GetFileName(strFileName));


            for (int i = 0; i < short.MaxValue; i++)
            {
                string header = objFolder.GetDetailsOf(null, i);
                if (String.IsNullOrEmpty(header))
                {
                    break;
                }
                arrHeaders.Add(header);
            }

            // The attributes list below will contain a tuple with attribute index, name and value
            // Once you know the index of the attribute you want to get,
            // you can get it directly without looping, like this:
            var Authors = objFolder.GetDetailsOf(folderItem, 20);

            for (int i = 0; i < arrHeaders.Count; i++)
            {
                var attrName  = arrHeaders[i];
                var attrValue = objFolder.GetDetailsOf(folderItem, i);
                var attrIdx   = i;

                attributes.Add(new Tuple <int, string, string>(attrIdx, attrName, attrValue));

                //Debug.WriteLine("{0}\t{1}: {2}", i, attrName, attrValue);

                DataRow row = table.NewRow();
                row["No"]          = i + 1;
                row["Header Name"] = attrName;
                table.Rows.Add(row);
            }

            dataGridView1.DataSource = table;
        }
Exemplo n.º 18
0
        private void FindFieldContent()
        {
            textBoxTitle.Text = FindTaskParts(out string[] titles, out string[][] subtasks);

            Shell32.Shell       shell  = new Shell32.Shell();
            Shell32.Folder      folder = shell.NameSpace(FIELD_PIC_PATH);
            Shell32.FolderItems items  = folder.Items();

            for (int i = 0; i < items.Count; i++)
            {
                var fileName = folder.GetDetailsOf(items.Item(i), 0);
                DecompilePicName(Path.GetFileNameWithoutExtension(fileName), out var position, out var taskNumber);

                fields[position - 1].TaskNumbers.Add(taskNumber);
                fields[position - 1].Title = titles[position - 1];

                if (subtasks[position - 1].Length < taskNumber)
                {
                    MessageBox.Show("Nem tartozik feladat a képhez:" + fileName);
                    fields[position - 1].Tasks.Add("");
                }
                else
                {
                    fields[position - 1].Tasks.Add(subtasks[position - 1][taskNumber - 1]);
                }

                fields[position - 1].Paths.Add(FIELD_PIC_PATH + fileName);
            }
        }
Exemplo n.º 19
0
        private bool tryGetMediaCreated(FileInfo file, out DateTime mediaCreated)
        {
            try
            {
                Shell32.Folder     folder     = GetShell32NameSpaceFolder(file.DirectoryName);
                Shell32.FolderItem folderItem = folder.ParseName(file.Name);

                string created   = folder.GetDetailsOf(folderItem, 209);
                string sanitized = "";
                foreach (char c in created.ToCharArray())
                {
                    if ((int)c < 128)
                    {
                        sanitized += c;
                    }
                }
                mediaCreated = DateTime.Parse(sanitized);
                return(true);
            }
            catch (Exception e)
            {
                Console.WriteLine("Non-video file type found");
                Console.WriteLine(e.ToString());
            }
            mediaCreated = DateTime.MinValue;
            return(false);
        }
Exemplo n.º 20
0
        /// <summary>
        /// Get bit depth.
        /// </summary>
        private static ExifInfo GetBitDepth(Shell32.Folder objFolder, Shell32.FolderItem folderItem)
        {
            var propertyValue = objFolder.GetDetailsOf(folderItem, 174);
            var propertyText  = "ビット深度";

            return(new ExifInfo(propertyText, propertyValue));
        }
Exemplo n.º 21
0
        /// <summary>
        /// Get ISO data.
        /// </summary>
        private static ExifInfo GetISO(Shell32.Folder objFolder, Shell32.FolderItem folderItem)
        {
            var propertyValue = objFolder.GetDetailsOf(folderItem, 264);
            var propertyText  = "ISO";

            return(new ExifInfo(propertyText, propertyValue));
        }
Exemplo n.º 22
0
        /// <summary>
        /// Get metering mode.
        /// </summary>
        private static ExifInfo GetMeteringMode(Shell32.Folder objFolder, Shell32.FolderItem folderItem)
        {
            var propertyValue = objFolder.GetDetailsOf(folderItem, 269);
            var propertyText  = "測光モード";

            return(new ExifInfo(propertyText, propertyValue));
        }
Exemplo n.º 23
0
        /// <summary>
        /// Get focal length.
        /// </summary>
        private static ExifInfo GetFocusLength(Shell32.Folder objFolder, Shell32.FolderItem folderItem)
        {
            var propertyValue = objFolder.GetDetailsOf(folderItem, 262);
            var propertyText  = "焦点距離";

            return(new ExifInfo(propertyText, propertyValue));
        }
Exemplo n.º 24
0
        /// <summary>
        /// Get shooting date and time.
        /// </summary>
        private static ExifInfo GetMediaDate(Shell32.Folder objFolder, Shell32.FolderItem folderItem)
        {
            var propertyValue = objFolder.GetDetailsOf(folderItem, 3);
            var propertyText  = "撮影日時";

            return(new ExifInfo(propertyText, propertyValue));
        }
Exemplo n.º 25
0
        /// <summary>
        /// Get camera model information.
        /// </summary>
        private static ExifInfo GetCameraModel(Shell32.Folder objFolder, Shell32.FolderItem folderItem)
        {
            var propertyValue = objFolder.GetDetailsOf(folderItem, 30);
            var propertyText  = "カメラモデル";

            return(new ExifInfo(propertyText, propertyValue));
        }
Exemplo n.º 26
0
        /// <summary>
        /// Get camera manufacturer information.
        /// </summary>
        private static ExifInfo GetCameraManufacturer(Shell32.Folder objFolder, Shell32.FolderItem folderItem)
        {
            var propertyValue = objFolder.GetDetailsOf(folderItem, 32);
            var propertyText  = "カメラ製造元";

            return(new ExifInfo(propertyText, propertyValue));
        }
Exemplo n.º 27
0
        /// <summary>
        /// Get image width and height.
        /// </summary>
        private static List <ExifInfo> GetImageWidthAndHeight(Shell32.Folder objFolder, Shell32.FolderItem folderItem)
        {
            var imageWidthAndHeightInfo = new List <ExifInfo>();

            // 幅
            var propertyValue = objFolder.GetDetailsOf(folderItem, 176);
            var propertyText  = "幅";

            imageWidthAndHeightInfo.Add(new ExifInfo(propertyText, propertyValue));

            // 高さ
            propertyValue = objFolder.GetDetailsOf(folderItem, 178);
            propertyText  = "高さ";
            imageWidthAndHeightInfo.Add(new ExifInfo(propertyText, propertyValue));

            return(imageWidthAndHeightInfo);
        }
Exemplo n.º 28
0
        /// <summary>
        /// Get image resolution.
        /// </summary>
        private static List <ExifInfo> GetImageResolutionWidthAndHeight(Shell32.Folder objFolder, Shell32.FolderItem folderItem)
        {
            var imageResolutionInfo = new List <ExifInfo>();

            // 水平解像度
            var propertyValue = objFolder.GetDetailsOf(folderItem, 175);
            var propertyText  = "水平解像度";

            imageResolutionInfo.Add(new ExifInfo(propertyText, propertyValue));

            // 垂直解像度
            propertyValue = objFolder.GetDetailsOf(folderItem, 177);
            propertyText  = "垂直解像度";
            imageResolutionInfo.Add(new ExifInfo(propertyText, propertyValue));

            return(imageResolutionInfo);
        }
Exemplo n.º 29
0
        /// <summary>
        /// Get shutter speed and aperture value.
        /// </summary>
        private static List <ExifInfo> GetFnumberAndShutterSpeed(Shell32.Folder objFolder, Shell32.FolderItem folderItem)
        {
            var shutterSpeedAndApertureInfo = new List <ExifInfo>();

            // シャッター速度
            var propertyValue = objFolder.GetDetailsOf(folderItem, 259);
            var propertyText  = "シャッター速度";

            shutterSpeedAndApertureInfo.Add(new ExifInfo(propertyText, propertyValue));

            // 絞り値
            propertyValue = objFolder.GetDetailsOf(folderItem, 260);
            propertyText  = "絞り値";
            shutterSpeedAndApertureInfo.Add(new ExifInfo(propertyText, propertyValue));

            return(shutterSpeedAndApertureInfo);
        }
Exemplo n.º 30
0
        /// <summary>
        /// Get exposure program and white balance.
        /// </summary>
        private static List <ExifInfo> GetExposeModeAndWhiteBlance(Shell32.Folder objFolder, Shell32.FolderItem folderItem)
        {
            var exposeModeAndWhiteBlanceInfo = new List <ExifInfo>();

            // 露出プログラム
            var propertyValue = objFolder.GetDetailsOf(folderItem, 258);
            var propertyText  = "露出プログラム";

            exposeModeAndWhiteBlanceInfo.Add(new ExifInfo(propertyText, propertyValue));

            // ホワイトバランス
            propertyValue = objFolder.GetDetailsOf(folderItem, 275);
            propertyText  = "ホワイトバランス";
            exposeModeAndWhiteBlanceInfo.Add(new ExifInfo(propertyText, propertyValue));

            return(exposeModeAndWhiteBlanceInfo);
        }
Exemplo n.º 31
0
        public void LeerMetadatos(String pathFichero)
        {
            Shell32.Shell      shell      = new Shell32.Shell();
            Shell32.Folder     folder     = shell.NameSpace(Path.GetDirectoryName(pathFichero));
            Shell32.FolderItem folderItem = folder.ParseName(Path.GetFileName(pathFichero));

            if (folderItem != null)
            {
                NombreFichero = Path.GetFileName(pathFichero);
                NombreAlbum   = folder.GetDetailsOf(folderItem, (int)InfoFichero.Album);
                NombreArtista = folder.GetDetailsOf(folderItem, (int)InfoFichero.Artista);
                Titulo        = folder.GetDetailsOf(folderItem, (int)InfoFichero.Titulo);
            }
            folderItem = null;
            folder     = null;
            shell      = null;
        }