Exemplo n.º 1
0
 public void DiscardExportObject(SnooperExportedObjectBase snooperExportedObject)
 {
     //if(snooperExportedObject != this._currentObjectBase) { throw new UnknownSnooperExportedObject(); }
     if (!this._currentObjectBase.Contains(snooperExportedObject))
     {
         throw new UnknownSnooperExportedObject();
     }
     this._currentObjectBase.Remove(snooperExportedObject);
 }
Exemplo n.º 2
0
        public void AddExportObject(SnooperExportedObjectBase snooperExportedObject)
        {
            //Console.WriteLine("AddExportObject()");
            if (this.ExportObjects == null)
            {
                this.ExportObjects = new List <SnooperExportedObjectBase>();
            }
            if (!snooperExportedObject.ExportSources.Any())
            {
                throw new EmptySourceInSnooperExportedObject();
            }
            if (this.ExportContext == ExportContext.Unknown)
            {
                throw new UnknownExportContext();
            }
            // adding to list of exported objects
            this.ExportObjects.Add(snooperExportedObject);
            // getting rid of the reference to it
            //this._currentObjectBase = null;
            this._currentObjectBase.Remove(snooperExportedObject);

            switch (snooperExportedObject.ExportValidity)
            {
            case ExportValidity.ValidWhole:
                break;

            case ExportValidity.ValidFragment:
                if (this.ExportValidity != ExportValidity.Malformed)
                {
                    this.ExportValidity = ExportValidity.ValidFragment;
                }
                break;

            case ExportValidity.Malformed:
                this.ExportValidity = ExportValidity.Malformed;
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }