예제 #1
0
        public unsafe void EnumStorage()
        {
            using (var cleaner = new TestFileCleaner())
            {
                string   path       = cleaner.GetTestPath();
                IStorage storage    = (IStorage)Com.CreateStorage(path, InterfaceIds.IID_IStorage);
                IStream  stream     = storage.CreateStream("mystream", StorageMode.Create | StorageMode.ReadWrite | StorageMode.ShareExclusive);
                IStorage subStorage = storage.CreateStorage("substorage", StorageMode.Create | StorageMode.ReadWrite | StorageMode.ShareExclusive);
                storage.Commit();

                IEnumSTATSTG         e    = storage.EnumElements();
                WInterop.Com.STATSTG stat = default;
                int count = 0;
                while (e.Next(1, ref stat) > 0)
                {
                    count++;
                    switch (stat.type)
                    {
                    case StorageType.Storage:
                        stat.GetAndFreeString().Should().Be("substorage");
                        break;

                    case StorageType.Stream:
                        stat.GetAndFreeString().Should().Be("mystream");
                        break;

                    default:
                        false.Should().BeTrue($"unexpected type {stat.type}");
                        break;
                    }
                }

                count.Should().Be(2);
            }
        }
예제 #2
0
 void IStream.Stat(out STATSTG pstatstg, StatFlag grfStatFlag)
 {
     throw new NotImplementedException();
 }