Exemple #1
0
        /// <summary>
        /// Removes a publishing house from the publishing houses list, as well as
        /// from the respective books list.
        /// </summary>
        /// <param name="publishingHouseToRemove">The publishing house to remove</param>
        public void RemovePublishingHouse(PublishingHouse publishingHouseToRemove)
        {
            IUpdateAction removeBooksWithPublishingHouseAction = new DummyAction();

            publishingHouses.Remove(publishingHouseToRemove);

            if (booksWithPublishingHouse.ContainsKey(publishingHouseToRemove) == true)
            {
                removeBooksWithPublishingHouseAction = new DeleteAction(
                    booksWithPublishingHouse[publishingHouseToRemove]);

                foreach (Book currentBook in booksWithPublishingHouse[publishingHouseToRemove])
                {
                    currentBook.PublishingHouse = null;
                }

                booksWithPublishingHouse.Remove(publishingHouseToRemove);
            }

            try
            {
                IUpdateAction removePublishingHouseAction = new DeleteAction(publishingHouseToRemove);
                DatabaseManager.Instance.PerformDataUpdate(removeBooksWithPublishingHouseAction,
                                                           removePublishingHouseAction);
            }

            catch (DatabaseException ex)
            {
                throw new BookEntitiesException(ex.Message, ex);
            }
        }
Exemple #2
0
        /// <summary>
        /// Removes a year of publishing from the years of publishing list, as well as
        /// from the respective books list.
        /// </summary>
        /// <param name="yearOfPublishingToRemove">The year of publishing to remove</param>
        public void RemoveYearOfPublishing(YearOfPublishing yearOfPublishingToRemove)
        {
            IUpdateAction removeBooksWithYearOfPublishingAction = new DummyAction();

            yearsOfPublishing.Remove(yearOfPublishingToRemove);

            if (booksWithYearOfPublishing.ContainsKey(yearOfPublishingToRemove) == true)
            {
                removeBooksWithYearOfPublishingAction = new DeleteAction(
                    booksWithYearOfPublishing[yearOfPublishingToRemove]);

                foreach (Book currentBook in booksWithYearOfPublishing[yearOfPublishingToRemove])
                {
                    currentBook.YearOfPublishing = null;
                }

                booksWithYearOfPublishing.Remove(yearOfPublishingToRemove);
            }

            try
            {
                IUpdateAction removeYearOfPublishingAction = new DeleteAction(yearOfPublishingToRemove);
                DatabaseManager.Instance.PerformDataUpdate(removeBooksWithYearOfPublishingAction,
                                                           removeYearOfPublishingAction);
            }

            catch (DatabaseException ex)
            {
                throw new BookEntitiesException(ex.Message, ex);
            }
        }
Exemple #3
0
        /// <summary>
        /// Removes an author from the authors list, as well as from the respective books list.
        /// </summary>
        /// <param name="authorToRemove">The author to remove</param>
        public void RemoveAuthor(Author authorToRemove)
        {
            IUpdateAction removeBooksWithAuthorAction = new DummyAction();

            authors.Remove(authorToRemove);

            if (booksWithAuthor.ContainsKey(authorToRemove) == true)
            {
                removeBooksWithAuthorAction = new DeleteAction(booksWithAuthor[authorToRemove]);

                foreach (Book currentBook in booksWithAuthor[authorToRemove])
                {
                    currentBook.Authors.Remove(authorToRemove);
                }

                booksWithAuthor.Remove(authorToRemove);
            }

            try
            {
                IUpdateAction removeAuthorAction = new DeleteAction(authorToRemove);
                DatabaseManager.Instance.PerformDataUpdate(removeBooksWithAuthorAction, removeAuthorAction);
            }

            catch (DatabaseException ex)
            {
                throw new BookEntitiesException(ex.Message, ex);
            }
        }
Exemple #4
0
        /// <summary>
        /// Removes a tag from the tags list, as well as from the respective books list.
        /// </summary>
        /// <param name="tagToRemove">The tag to remove</param>
        public void RemoveTag(Tag tagToRemove)
        {
            IUpdateAction removeBooksWithTagAction = new DummyAction();

            tags.Remove(tagToRemove);

            if (booksWithTag.ContainsKey(tagToRemove) == true)
            {
                removeBooksWithTagAction = new DeleteAction(booksWithTag[tagToRemove]);

                foreach (Book currentBook in booksWithTag[tagToRemove])
                {
                    currentBook.Tags.Remove(tagToRemove);
                }

                booksWithTag.Remove(tagToRemove);
            }

            try
            {
                IUpdateAction removeTagAction = new DeleteAction(tagToRemove);
                DatabaseManager.Instance.PerformDataUpdate(removeBooksWithTagAction, removeTagAction);
            }

            catch (DatabaseException ex)
            {
                throw new BookEntitiesException(ex.Message, ex);
            }
        }
        /// <summary> Go off and fill our DefineFunction records with function names.</summary>
        /// <seealso cref="Flash.Swf.MovieMetaData.walkActions(ActionList, int, String[], String, System.Collections.IList)"> for a discussion on how this is done.
        /// </seealso>
        internal virtual void buildFunctionNames(ActionList list, int version)
        {
            int size = list.size();

            for (int i = 0; i < size; i++)
            {
                DummyAction a = (DummyAction)list.getAction(i);
                MovieMetaData.walkActions(a.ActionList, version, null, a.ClassName, null);
            }
        }
        /// <summary> -----------------------------------------------
        /// The following APIs override TagHandler.
        /// -----------------------------------------------
        /// </summary>
        public override void  doInitAction(DoInitAction tag)
        {
            DummyAction a = recordActions(tag.actionList);

            // now fill in the class name if we can
            if (m_header.version > 6 && tag.sprite != null)
            {
                String __Packages = MovieMetaData.idRef(tag.sprite, m_dictionary);
                String className  = (__Packages != null && __Packages.StartsWith("__Packages"))?__Packages.Substring(11):null;                //$NON-NLS-1$
                a.ClassName = className;
            }
        }
            public bool TryParseButtonName(string value, out IAction action)
            {
                if (!IsConnected)
                {
                    // this may not be the best solution
                    // but it prevents crashing and things from being overridden, if a gamepad is not connected
                    action = new DummyAction(value);
                    return(true);
                }

                return(Buttons.TryParseLowerTrimmedString(value, out action) ||
                       Axes.TryParseLowerTrimmedString(value, out action));
            }
        /// <summary> Store away the ActionLists for later retrieval</summary>
        internal virtual DummyAction recordActions(ActionList list)
        {
            DummyAction da = null;

            if (list != null && list.size() > 0)
            {
                // use the first offset as our reference point
                int offset = list.getOffset(0);

                // now create a pseudo action for this action list in our master
                da = new DummyAction(list);
                m_master.setActionOffset(offset, da);
            }
            return(da);
        }
Exemple #9
0
        private List <IAction> CreateActions(List <ActionJsonModel> actionsInJson)
        {
            if (actionsInJson != null)
            {
                var actions = new List <IAction>();

                foreach (var item in actionsInJson)
                {
                    var action = new DummyAction();

                    actions.Add(action);
                }

                return(actions);
            }
            else
            {
                return(new List <IAction>());
            }
        }
		/// <summary>
		/// Initializes a new instance of the FailableScheduledAction class.
		/// </summary>
		public FailableScheduledAction()
		{
			mAction = DummyAction.Run;
			mLastRun = DateTimeOffset.MinValue;
		}
		/// <summary>
		/// Test implementation of IXmlSerializable
		/// </summary>
		/// <param name="reader"></param>
		public override void ReadXml(XmlReader reader)
		{
			mAction = (DummyAction)Enum.Parse(typeof(DummyAction), reader.GetAttribute("behavior"));
		}
Exemple #12
0
 /// <summary>
 /// Initializes a new instance of the FailableScheduledAction class.
 /// </summary>
 public FailableScheduledAction()
 {
     mAction  = DummyAction.Run;
     mLastRun = DateTimeOffset.MinValue;
 }
Exemple #13
0
 /// <summary>
 /// Test implementation of IXmlSerializable
 /// </summary>
 /// <param name="reader"></param>
 public override void ReadXml(XmlReader reader)
 {
     mAction = (DummyAction)Enum.Parse(typeof(DummyAction), reader.GetAttribute("behavior"));
 }
		/// <summary> Store away the ActionLists for later retrieval</summary>
		internal virtual DummyAction recordActions(ActionList list)
		{
			DummyAction da = null;
			if (list != null && list.size() > 0)
			{
				// use the first offset as our reference point
				int offset = list.getOffset(0);
				
				// now create a pseudo action for this action list in our master
				da = new DummyAction(list);
				m_master.setActionOffset(offset, da);
			}
			return da;
		}
Exemple #15
0
 public ActionBaseTests()
 {
     action          = new DummyAction(false);
     action2         = new DummyAction(true);
     resourceManager = new ResourceManager();
 }