الفريق العربي للبرمجةأرشيف المنتديات · 2000 – 2023
نسخة أرشيفية للقراءة فقط — التسجيل والمشاركة مغلقان، والمحتوى محفوظ كما كان.

موجز خصائص الملفات - *summary*

بدأه Bashar Rabat في 10 سبتمبر 2009 · 7 رد · 1,801 مشاهدة · في قسم الدروس والمواضيع المتميزة
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

مرحباً أخواني الكرام،

لقد قمت بكتابة ( Code ) قصير يساعدكم باستخراج معلومات من الممكن أن تفيدكم في معالجة الأنواع التالي :

EXE = Executable Files

JPG, PNG, BMP, GIF, TIFF, EXIF, EMF, Etc.. = Image Files

MP3, WAV, WMA, Etc... = Audio Files

ليس هناك الكثير ليشرح لأن عمليات المعالجة تتم عبر الـ( Shell32 Library ) أي ليس هناك اي شيفرة أو خوارزمية ليتم شرحها .

 

Imports Shell32

[color= #000000; font-weight: bold;]Public [color= #000000; font-weight: bold;]Class Form1

[color= #666666; font-style: italic;]#Region "ExecutableFiles"

 

    [color= #000000; font-weight: bold;]Private Structure ExecutableFileSummary

        [color= #000000; font-weight: bold;]Public FilePath [color= #b1b100;]As String

        [color= #000000; font-weight: bold;]Public FileName [color= #b1b100;]As String

        [color= #000000; font-weight: bold;]Public Directory [color= #b1b100;]As String

        [color= #000000; font-weight: bold;]Public Format [color= #b1b100;]As String

        [color= #000000; font-weight: bold;]Public CompanyName [color= #b1b100;]As String

        [color= #000000; font-weight: bold;]Public Description [color= #b1b100;]As String

        [color= #000000; font-weight: bold;]Public Version [color= #b1b100;]As String

        [color= #000000; font-weight: bold;]Public ProductName [color= #b1b100;]As String

    [color= #990000;]End Structure

 

    [color= #000000; font-weight: bold;]Private [color= #000000; font-weight: bold;]Function GetExecutableFileSummary[color= #009900;](ByVal FilePath [color= #b1b100;]As String[color= #009900;]) [color= #b1b100;]As ExecutableFileSummar
y

        Dim NEFSummary [color= #b1b100;]As [color= #000000; font-weight: bold;]New ExecutableFileSummary

        With NEFSummary

            [color= #339933;].FilePath [color= #339933;]= FilePath

            [color= #339933;].FileName [color= #339933;]= IO[color= #339933;].Path[color= #339933;].GetFileName[color= #009900;](FilePath[color= #009900;])

            [color= #339933;].Directory [color= #339933;]= FilePath[color= #339933;].Substring[color= #009900;]([color= #cc66cc;]0[color= #339933;], FilePath[color= #339933;].LastIndexOf[color= #009900;]([color= #0000ff;]"[color= #000099; font-weight: bold;]"))

[color= #0000ff;]            Dim ShellClass As New Shell

[color= #0000ff;]            Dim ShellF As Folder = ShellClass.NameSpace(.Directory)

[color= #0000ff;]            Dim FItem As FolderItem = ShellF.ParseName(.FileName)

[color= #0000ff;]            .Format = ShellF.GetDetailsOf(FItem, 2)

[color= #0000ff;]            .CompanyName = ShellF.GetDetailsOf(FItem, 35)

[color= #0000ff;]            .Description = ShellF.GetDetailsOf(FItem, 36)

[color= #0000ff;]            .Version = ShellF.GetDetailsOf(FItem, 37)

[color= #0000ff;]            .ProductName = ShellF.GetDetailsOf(FItem, 38)

[color= #0000ff;]        End With

[color= #0000ff;]        Return NEFSummary

[color= #0000ff;]    End Function

 

[color= #0000ff;]#End Region

 

[color= #0000ff;]#Region "ImageFiles[color= #0000ff;]"

 

[color= #0000ff;]    Private Structure ImageFileSummary

[color= #0000ff;]        Public FilePath As String

[color= #0000ff;]        Public FileName As String

[color= #0000ff;]        Public Directory As String

[color= #0000ff;]        Public Format As String

[color= #0000ff;]        Public ImageDimensions As String

[color= #0000ff;]        Public ImageWidthInPixel As String

[color= #0000ff;]        Public ImageHeightInPixel As String

[color= #0000ff;]    End Structure

 

[color= #0000ff;]    Private Function GetImageFileSummary(ByVal FilePath As String) As ImageFileSummary

[color= #0000ff;]        Dim NIFSummary As New ImageFileSummary

[color= #0000ff;]        With NIFSummary

[color= #0000ff;]            .FilePath = FilePath

[color= #0000ff;]            .FileName = IO.Path.GetFileName(FilePath)

[color= #0000ff;]            .Directory = FilePath.Substring(0, FilePath.LastIndexOf("[color= #0000ff;]"))

[color= #0000ff;]            Dim ShellClass As New Shell

[color= #0000ff;]            Dim ShellF As Folder = ShellClass.NameSpace(.Directory)

[color= #0000ff;]            Dim FItem As FolderItem = ShellF.ParseName(.FileName)

[color= #0000ff;]            .Format = ShellF.GetDetailsOf(FItem, 2)

[color= #0000ff;]            .ImageDimensions = ShellF.GetDetailsOf(FItem, 26)

[color= #0000ff;]            .ImageWidthInPixel = ShellF.GetDetailsOf(FItem, 27)

[color= #0000ff;]            .ImageHeightInPixel = ShellF.GetDetailsOf(FItem, 28)

[color= #0000ff;]        End With

[color= #0000ff;]        Return NIFSummary

[color= #0000ff;]    End Function

 

[color= #0000ff;]#End Region

 

[color= #0000ff;]#Region "AudioFiles[color= #0000ff;]"

 

[color= #0000ff;]    Private Structure AudioFileSummary

[color= #0000ff;]        Public FilePath As String

[color= #0000ff;]        Public FileName As String

[color= #0000ff;]        Public Directory As String

[color= #0000ff;]        Public Format As String

[color= #0000ff;]        Public ArtistName As String

[color= #0000ff;]        Public TrackTitle As String

[color= #0000ff;]        Public FramesCount As Int32

[color= #0000ff;]        Public Comments As String

[color= #0000ff;]        Public AlbumTitle As String

[color= #0000ff;]        Public AlbumCreationDate As String

[color= #0000ff;]        Public TrackNumber As Int32

[color= #0000ff;]        Public Genre As String

[color= #0000ff;]        Public Duration As String

[color= #0000ff;]        Public BitRate As String

[color= #0000ff;]        Public [Protected] As String

[color= #0000ff;]        Public Quality As String

[color= #0000ff;]        Public Channel As String

[color= #0000ff;]    End Structure

 

[color= #0000ff;]    Private Function GetAudioFileSummary(ByVal FilePath As String) As AudioFileSummary

[color= #0000ff;]        Dim NAFSummary As New AudioFileSummary

[color= #0000ff;]        With NAFSummary

[color= #0000ff;]            .FilePath = FilePath

[color= #0000ff;]            .FileName = IO.Path.GetFileName(FilePath)

[color= #0000ff;]            .Directory = FilePath.Substring(0, FilePath.LastIndexOf("[color= #0000ff;]"))

[color= #0000ff;]            Dim ShellClass As New Shell

[color= #0000ff;]            Dim ShellF As Folder = ShellClass.NameSpace(.Directory)

[color= #0000ff;]            Dim FItem As FolderItem = ShellF.ParseName(.FileName)

[color= #0000ff;]            .Format = ShellF.GetDetailsOf(FItem, 2)

[color= #0000ff;]            .ArtistName = ShellF.GetDetailsOf(FItem, 9)

[color= #0000ff;]            .TrackTitle = ShellF.GetDetailsOf(FItem, 10)

[color= #0000ff;]            .Genre = ShellF.GetDetailsOf(FItem, 12)

[color= #0000ff;]            .FramesCount = ShellF.GetDetailsOf(FItem, 13)

[color= #0000ff;]            .Comments = ShellF.GetDetailsOf(FItem, 14)

[color= #0000ff;]            .AlbumTitle = ShellF.GetDetailsOf(FItem, 17)

[color= #0000ff;]            .AlbumCreationDate = ShellF.GetDetailsOf(FItem, 18)

[color= #0000ff;]            .TrackNumber = ShellF.GetDetailsOf(FItem, 19)

[color= #0000ff;]            .Duration = ShellF.GetDetailsOf(FItem, 21)

[color= #0000ff;]            .BitRate = ShellF.GetDetailsOf(FItem, 22)

[color= #0000ff;]            .Protected = ShellF.GetDetailsOf(FItem, 23)

[color= #0000ff;]            .Quality = ShellF.GetDetailsOf(FItem, 33)

[color= #0000ff;]            .Channel = ShellF.GetDetailsOf(FItem, 34)

[color= #0000ff;]        End With

[color= #0000ff;]        Return NAFSummary

[color= #0000ff;]    End Function

 

[color= #0000ff;]#End Region

 

[color= #0000ff;]End Class

أسئلتكم مُرحب بها :)

بالتوفيق .

The important thing is not so much

that every child should be taught,

as that every child should be given the wish to learn.

#2

Imports Shell32 ؟؟؟؟؟

مقالاتي في VB.NET وبرامجي على موقعي الجديد :

#3
Fikou-sama كتب:
Imports Shell32 ؟؟؟؟؟

:wacko: :blink:

Explain Please :)

The important thing is not so much

that every child should be taught,

as that every child should be given the wish to learn.

#4

100 % :clapping:

كود جميل و يمكنك عمل Encapsulate له ليصبح اجمل :resentful:

و الله ولى التوفيق

تم تعديل هذه المشاركة بواسطة Muhammad alaa في 11 سبتمبر 2009 في 04:37

مدونتي: C++ Tips and Tricks

#5

جميل جداً :wink:

إن قلت قال الله قال رسولـه همزوك همز المنكر المتعالي
أو قلت قد قال الصحابة والألـى تبعاً لهم بالقول والأعمال
أو قلت قـال الشافعي وأحمد و أبو حنيفة والإمام الغالي
صدوا عن وحي الإله ودينـه واحتالوا على حرام الله بالإحلال
يا أمةً لعبت بدين نبيها كتلاعب الصبيان في الأوحال
حاشا رسول الله يحكم بالهوى تلك إذاً حكومة الضلال

feed.1.gif

#6

got it

تم تعديل هذه المشاركة بواسطة Fikou-sama في 11 سبتمبر 2009 في 05:27

مقالاتي في VB.NET وبرامجي على موقعي الجديد :

#7

شكراً لكم أخ ( محمد علاء ) وأخ ( Ghost2010 )

Fikou-sama كتب:
got it

Ok ;), Thought there's an API call that returns a class from a dynamic link library :P :lol:

The important thing is not so much

that every child should be taught,

as that every child should be given the wish to learn.

#8

شكرااااااااااااا الله يعطيك العافيه وسلامه

مواضيع مشابهة