private void FilteredWriteObject(PSObject obj, List <PSNoteProperty> addedNoteProperties)
        {
            Diagnostics.Assert(obj != null, "This command should never write null");

            if (!_unique)
            {
                if (obj != AutomationNull.Value)
                {
                    SetPSCustomObject(obj);
                    WriteObject(obj);
                }

                return;
            }
            //if only unique is mentioned
            else if ((_unique))
            {
                bool isObjUnique = true;
                foreach (UniquePSObjectHelper uniqueObj in _uniques)
                {
                    ObjectCommandComparer comparer = new ObjectCommandComparer(true, CultureInfo.CurrentCulture, true);
                    if ((comparer.Compare(obj.BaseObject, uniqueObj.WrittenObject.BaseObject) == 0) &&
                        (uniqueObj.NotePropertyCount == addedNoteProperties.Count))
                    {
                        bool found = true;
                        foreach (PSNoteProperty note in addedNoteProperties)
                        {
                            PSMemberInfo prop = uniqueObj.WrittenObject.Properties[note.Name];
                            if (prop == null || comparer.Compare(prop.Value, note.Value) != 0)
                            {
                                found = false;
                                break;
                            }
                        }

                        if (found)
                        {
                            isObjUnique = false;
                            break;
                        }
                    }
                    else
                    {
                        continue;
                    }
                }

                if (isObjUnique)
                {
                    SetPSCustomObject(obj);
                    _uniques.Add(new UniquePSObjectHelper(obj, addedNoteProperties.Count));
                }
            }
        }
 private void FilteredWriteObject(PSObject obj, List <PSNoteProperty> addedNoteProperties)
 {
     if (!this.unique)
     {
         if (obj != AutomationNull.Value)
         {
             this.SetPSCustomObject(obj);
             base.WriteObject(obj);
         }
     }
     else if (this.unique)
     {
         bool flag = true;
         foreach (UniquePSObjectHelper helper in this.uniques)
         {
             ObjectCommandComparer comparer = new ObjectCommandComparer(true, Thread.CurrentThread.CurrentCulture, true);
             if ((comparer.Compare(obj.BaseObject, helper.WrittenObject.BaseObject) == 0) && (helper.NotePropertyCount == addedNoteProperties.Count))
             {
                 bool flag2 = true;
                 foreach (PSNoteProperty property in addedNoteProperties)
                 {
                     PSMemberInfo info = helper.WrittenObject.Properties[property.Name];
                     if ((info == null) || (comparer.Compare(info.Value, property.Value) != 0))
                     {
                         flag2 = false;
                         break;
                     }
                 }
                 if (flag2)
                 {
                     flag = false;
                     break;
                 }
             }
         }
         if (flag)
         {
             this.SetPSCustomObject(obj);
             this.uniques.Add(new UniquePSObjectHelper(obj, addedNoteProperties.Count));
         }
     }
 }