SecureDelete.WipeContext.GetFailedObjects C# (CSharp) Method

GetFailedObjects() public method

Get all failed objects
public GetFailedObjects ( ) : SecureDelete.NativeMethods.WSmallObject[]
return SecureDelete.NativeMethods.WSmallObject[]
        public NativeMethods.WSmallObject[] GetFailedObjects()
        {
            CheckContextInitialized();
            int number;

            // object can be inserted only when the context is stopped
            if(_status != ContextStatus.Stopped) {
                throw new Exception("Object can be inserted only when the context is stopped");
            }

            if(GetFailedObjectNumber(out number) == false) {
                return null;
            }

            // get the errors
            NativeMethods.WError dummyError = new NativeMethods.WError();
            List<NativeMethods.WSmallObject> objects = new List<NativeMethods.WSmallObject>();

            for(int i = 0; i < number; i++) {
                NativeMethods.WSmallObject item = new NativeMethods.WSmallObject();

                if(GetFailedObject(i, out item, false, out dummyError) == false) {
                    // return what we could get so far
                    return objects.ToArray();
                }
                else {
                    objects.Add(item);
                }
            }

            // all errors could be retrieved
            return objects.ToArray();
        }