fix PackagePart.GetRelationships for readonly files

Fixes this bug: https://bugzilla.novell.com/show_bug.cgi?id=675379

'PackagePart.GetRelationships throws an "Operation not valid when package is read-only" exception when package is open with only read presmissions'
Whoops. Fixed.


On 04/09/14 14:16, Alexander Köplinger wrote:
>
> In mcs/class/WindowsBase/Test/System.IO.Packaging/PackagePartTest.cs:
>
> > @@ -367,5 +367,19 @@ public void CheckContentTypes ()
> >          {
> >  	        Assert.IsFalse (package.PartExists(new Uri ("[Content_Types].xml", UriKind.Relative)));
> >          }
> > +
> > +        [Test]
> > +        public void CheckCanGetRelationshipsIfReadOnly ()
> > +        {
> > +            using (var stream = new MemoryStream ()) {
> > +                var package = Package.Open (stream, FileMode.OpenOrCreate);
> > +                var part = package.CreatePart (uris [0], contentType);
> > +                part.CreateRelationship (part.Uri, TargetMode.Internal, "self");
> > +                package.Close ();
> > +                package = Package.Open (new MemoryStream (stream.ToArray ()), FileMode.Open, FileAccess.Read);
> > +                part  = package.GetPart(uris[0]);
>
> Please add a space after |GetPart| (before the opening parenthesis) 
> like in the rest of the code. There's also an unnecessary space after 
> |part|.
>
> —
> Reply to this email directly or view it on GitHub 
> <https://github.com/mono/mono/pull/1255/files#r17111995>.
>