Пример #1
0
 public void AddStandardEntry()
 {
     using (PropList l = new PropList()) {
         l[Properties.ApplicationPID] = "1234";
         Assert.AreEqual("1234", l[Properties.ApplicationPID]);
     }
 }
Пример #2
0
        public void AddMultipleEntriesAndCheckForMemoryCorruption()
        {
            using (PropList l = new PropList()) {
                System.Text.UTF8Encoding encoder = new System.Text.UTF8Encoding();
                string first  = "mydata";
                byte[] second =
                {
                    0,
                    5,
                    10,
                    25
                };
                byte[] third =
                {
                    255,
                    125,
                    5
                };
                l["first"]  = encoder.GetBytes(first);
                l["second"] = second;
                l["third"]  = third;

                Assert.AreEqual(third, l["third"]);
                Assert.AreEqual(second, l["second"]);
                Assert.AreEqual(first, encoder.GetString(l["first"]));
            }
        }
Пример #3
0
 public void AddingEntryIncreasesCount()
 {
     using (PropList l = new PropList()) {
         l[Properties.ApplicationIconName] = "value";
         Assert.AreEqual(1, l.Count);
     }
 }
Пример #4
0
        public PropList Copy()
        {
            PropList clone = new PropList(pa_proplist_copy(handle));

            clone.needDispose = true;
            GC.ReRegisterForFinalize(clone);
            return(clone);
        }
Пример #5
0
 public void AddedEntryAppearsInKeysEnumeration()
 {
     using (PropList l = new PropList()) {
         l["foo"] = new byte[] {
             1,
             2,
             3
         };
         Assert.Contains("foo", l.Keys.ToArray());
     }
 }
Пример #6
0
        internal SinkInput(NativeSinkInputInfo info, Context c)
        {
            ctx            = c;
            this.info      = info;
            Name           = Marshal.PtrToStringAnsi(info.name);
            ResampleMethod = Marshal.PtrToStringAnsi(info.resample_method);
            Driver         = Marshal.PtrToStringAnsi(info.driver);
            PropList temp = new PropList(info.prop_handle);

            Properties          = temp.Copy();
            ctx.SinkInputEvent += HandleSinkInputEvent;
        }
Пример #7
0
 public void AddedNonStandardEntryHasCorrectValue()
 {
     using (PropList l = new PropList()) {
         byte[] data =
         {
             0,
             1,
             2,
             3,
             4
         };
         l["key"] = data;
         Assert.AreEqual(data, l["key"]);
     }
 }
Пример #8
0
 public void EachAddedEntryAppearsInKeysEnumeration()
 {
     using (PropList l = new PropList()) {
         string[] keys = new string[] {
             "one",
             "two",
             "three",
             "four"
         };
         foreach (string key in keys)
         {
             l[key] = new byte[] { 1 };
         }
         foreach (string key in keys)
         {
             Assert.Contains(key, l.Keys.ToArray());
         }
     }
 }
Пример #9
0
        private void UpdateInfo(NativeSinkInputInfo info)
        {
            EventHandler <PropertyChangedEventArgs> propHandler;

            propHandler = PropertiesChanged;
            if (propHandler != null)
            {
                propHandler(this, new PropertyChangedEventArgs());
            }
            if (this.info.volume != info.volume)
            {
                EventHandler <VolumeChangedEventArgs> handler;
                handler = VolumeChanged;
                if (handler != null)
                {
                    handler(this, new VolumeChangedEventArgs(info.volume));
                }
            }
            this.info      = info;
            ResampleMethod = Marshal.PtrToStringAnsi(info.resample_method);
            PropList temp = new PropList(info.prop_handle);

            Properties = temp.Copy();
        }
Пример #10
0
 public void NewlyCreatedPropListHasZeroEntries()
 {
     using (PropList l = new PropList()) {
         Assert.AreEqual(0, l.Count);
     }
 }
Пример #11
0
 public void NewlyCreatedPropListIsEmpty()
 {
     using (PropList l = new PropList()) {
         Assert.IsTrue(l.Empty);
     }
 }