Skip to content

Commit f08f52d

Browse files
committed
Fixing StyleCop warnings. No functional changes.
1 parent 43d4f8e commit f08f52d

6 files changed

+711
-168
lines changed

Knuckleball/Atom.cs

+14
Original file line numberDiff line numberDiff line change
@@ -33,20 +33,30 @@ internal Atom()
3333
{
3434
}
3535

36+
/// <summary>
37+
/// Gets the data type of the data stored in the atom.
38+
/// </summary>
3639
internal virtual NativeMethods.MP4ItmfBasicType DataType
3740
{
3841
get { return NativeMethods.MP4ItmfBasicType.Utf8; }
3942
}
4043

44+
/// <summary>
45+
/// Gets the meaning of the atom.
46+
/// </summary>
4147
internal abstract string Meaning { get; }
4248

49+
/// <summary>
50+
/// Gets the name of the atom.
51+
/// </summary>
4352
internal abstract string Name { get; }
4453

4554
/// <summary>
4655
/// Initializes the <see cref="Atom"/> instance from the specified <see cref="IntPtr"/>
4756
/// value.
4857
/// </summary>
4958
/// <param name="fileHandle">The <see cref="IntPtr"/> file handle of the file from which to read this <see cref="Atom"/>.</param>
59+
/// <returns><see langword="true"/> if this <see cref="Atom"/> was successfully initialized; otherwise, <see langword="false"/>.</returns>
5060
internal bool Initialize(IntPtr fileHandle)
5161
{
5262
bool isInitialized = false;
@@ -85,6 +95,10 @@ internal bool Initialize(IntPtr fileHandle)
8595
/// used to populate this <see cref="Atom"/>.</param>
8696
internal abstract void Populate(byte[] dataBuffer);
8797

98+
/// <summary>
99+
/// Returns the data to be stored in this <see cref="Atom"/> as a byte array.
100+
/// </summary>
101+
/// <returns>The byte array containing the data to be stored in the atom.</returns>
88102
internal abstract byte[] ToByteArray();
89103
}
90104
}

Knuckleball/MP4File.cs

+12-9
Original file line numberDiff line numberDiff line change
@@ -679,8 +679,8 @@ public void WriteTags()
679679
NativeMethods.MP4TagsSetXID(tagsPtr, this.Xid);
680680
}
681681

682-
WriteTrackInfo(tagsPtr, tags.track);
683-
WriteDiscInfo(tagsPtr, tags.disk);
682+
this.WriteTrackInfo(tagsPtr, tags.track);
683+
this.WriteDiscInfo(tagsPtr, tags.disk);
684684

685685
// If the artwork has been edited, there are two possibilities:
686686
// First we are replacing an existing piece of artwork with another; or
@@ -689,7 +689,7 @@ public void WriteTags()
689689
{
690690
if (this.artwork != null)
691691
{
692-
WriteArtwork(tagsPtr);
692+
this.WriteArtwork(tagsPtr);
693693
}
694694
else if (this.ArtworkCount != 0)
695695
{
@@ -706,11 +706,14 @@ public void WriteTags()
706706
WriteRawAtom<RatingInfo>(fileHandle, this.RatingInfo);
707707
}
708708

709-
//MovieInfo movieInfo = ReadRawAtom<MovieInfo>(fileHandle);
710-
//if (this.MovieInfo != movieInfo)
711-
//{
712-
WriteRawAtom<MovieInfo>(fileHandle, this.MovieInfo);
713-
//}
709+
// TODO: Implement an equality comparison for MovieInfo, so
710+
// as to only write the atom to the file if it's been modified.
711+
// MovieInfo movieInfo = ReadRawAtom<MovieInfo>(fileHandle);
712+
// if (this.MovieInfo != movieInfo)
713+
// {
714+
// WriteRawAtom<MovieInfo>(fileHandle, this.MovieInfo);
715+
// }
716+
WriteRawAtom<MovieInfo>(fileHandle, this.MovieInfo);
714717

715718
NativeMethods.MP4Close(fileHandle);
716719
}
@@ -821,7 +824,7 @@ private void ReadArtwork(IntPtr artworkStructurePointer)
821824
byte[] artworkBuffer = new byte[artwork.size];
822825
Marshal.Copy(artwork.data, artworkBuffer, 0, artwork.size);
823826
this.artworkStream = new MemoryStream(artworkBuffer);
824-
this.artwork = Image.FromStream(artworkStream);
827+
this.artwork = Image.FromStream(this.artworkStream);
825828

826829
switch (artwork.type)
827830
{

Knuckleball/MP4TagsStructureExtensions.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
using System;
1717
using System.Collections.Generic;
1818
using System.Linq;
19-
using System.Text;
2019
using System.Runtime.InteropServices;
20+
using System.Text;
2121

2222
namespace Knuckleball
2323
{

Knuckleball/MovieInfo.cs

+44-6
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ public IList<string> Directors
104104
}
105105

106106
/// <summary>
107-
/// Gets or sets a list of producers for this movie.
107+
/// Gets a list of producers for this movie.
108108
/// </summary>
109109
/// <remarks>
110110
/// The <see cref="Producers"/> property is read-only, but can be
@@ -132,7 +132,7 @@ public IList<string> Producers
132132
}
133133

134134
/// <summary>
135-
/// Gets or sets a list of screenwriters for this movie.
135+
/// Gets a list of screenwriters for this movie.
136136
/// </summary>
137137
/// <remarks>
138138
/// The <see cref="Screenwriters"/> property is read-only, but can be
@@ -159,61 +159,95 @@ public IList<string> Screenwriters
159159
}
160160
}
161161

162-
162+
/// <summary>
163+
/// Gets a value indicating whether the <see cref="Cast"/> property has data, potentially including an empty list.
164+
/// Returns <see langword="false"/> if the <see cref="Cast"/> property is <see langword="null"/>.
165+
/// </summary>
163166
public bool HasCast
164167
{
165168
get { return this.cast != null; }
166169
}
167170

171+
/// <summary>
172+
/// Gets a value indicating whether the <see cref="Directors"/> property has data, potentially including an empty list.
173+
/// Returns <see langword="false"/> if the <see cref="Directors"/> property is <see langword="null"/>.
174+
/// </summary>
168175
public bool HasDirectors
169176
{
170177
get { return this.directors != null; }
171178
}
172179

180+
/// <summary>
181+
/// Gets a value indicating whether the <see cref="Producers"/> property has data, potentially including an empty list.
182+
/// Returns <see langword="false"/> if the <see cref="Producers"/> property is <see langword="null"/>.
183+
/// </summary>
173184
public bool HasProducers
174185
{
175186
get { return this.producers != null; }
176187
}
177188

189+
/// <summary>
190+
/// Gets a value indicating whether the <see cref="Screenwriters"/> property has data, potentially including an empty list.
191+
/// Returns <see langword="false"/> if the <see cref="Screenwriters"/> property is <see langword="null"/>.
192+
/// </summary>
178193
public bool HasScreenwriters
179194
{
180195
get { return this.screenwriters != null; }
181196
}
182197

198+
/// <summary>
199+
/// Gets the meaning of the atom.
200+
/// </summary>
183201
internal override string Meaning
184202
{
185203
get { return "com.apple.iTunes"; }
186204
}
187205

206+
/// <summary>
207+
/// Gets the name of the atom.
208+
/// </summary>
188209
internal override string Name
189210
{
190211
get { return "iTunMOVI"; }
191212
}
192213

214+
/// <summary>
215+
/// Removes all data from the <see cref="Cast"/> property, causing it to be <see langword="null"/>.
216+
/// </summary>
193217
public void RemoveCast()
194218
{
195219
this.cast = null;
196220
}
197221

222+
/// <summary>
223+
/// Removes all data from the <see cref="Directors"/> property, causing it to be <see langword="null"/>.
224+
/// </summary>
198225
public void RemoveDirectors()
199226
{
200227
this.directors = null;
201228
}
202229

230+
/// <summary>
231+
/// Removes all data from the <see cref="Producers"/> property, causing it to be <see langword="null"/>.
232+
/// </summary>
203233
public void RemoveProducers()
204234
{
205235
this.producers = null;
206236
}
207237

238+
/// <summary>
239+
/// Removes all data from the <see cref="Screenwriters"/> property, causing it to be <see langword="null"/>.
240+
/// </summary>
208241
public void RemoveScreenwriters()
209242
{
210243
this.screenwriters = null;
211244
}
212245

213246
/// <summary>
214-
/// Populates this <see cref="MovieInfo"/> with the specific data stored in it in the referenced file.
247+
/// Populates this <see cref="MovieInfo"/> with the specific data stored in it.
215248
/// </summary>
216-
/// <param name="data">The iTunes Metadata Format data used to populate this <see cref="MovieInfo"/>.</param>
249+
/// <param name="dataBuffer">A byte array containing the iTunes Metadata Format data
250+
/// used to populate this <see cref="MovieInfo"/>.</param>
217251
internal override void Populate(byte[] dataBuffer)
218252
{
219253
Dictionary<string, object> map = null;
@@ -252,6 +286,10 @@ internal override void Populate(byte[] dataBuffer)
252286
}
253287
}
254288

289+
/// <summary>
290+
/// Returns the data to be stored in this <see cref="MovieInfo"/> as a byte array.
291+
/// </summary>
292+
/// <returns>The byte array containing the data to be stored in the atom.</returns>
255293
internal override byte[] ToByteArray()
256294
{
257295
byte[] buffer = null;
@@ -314,7 +352,7 @@ internal override byte[] ToByteArray()
314352
return buffer;
315353
}
316354

317-
private void WriteList(XmlWriter writer, IList<string> list, string listName)
355+
private static void WriteList(XmlWriter writer, IList<string> list, string listName)
318356
{
319357
writer.WriteElementString("key", listName);
320358
writer.WriteStartElement("array");

0 commit comments

Comments
 (0)