示例#1
0
        //add an Item to the List that contains all Items
        private static void AddItemToListWithAllItems(string messageId,
                                                      string MessageId_Without,
                                                      string MessageId_Without_Upper,
                                                      string messageSource)
        {
            /*if(MessageId_Without.Equals("Help"))
             * {
             *  string test = "";
             *  //for debugger
             * }*/

            OriginalItem MyOriginalItem = new OriginalItem();

            MyOriginalItem.OriginalString = messageId;
            MyOriginalItem.SourceLocation = messageSource;

            //check if item alreay exists in lists
            //if yes then add a new derivate to the existing item
            //if not then add a new Item


            bool Found = false;

            for (int i = 0; i < ListWithAllItems.Count; i++) // Loop through List with for
            {
                //check if item is already in list
                if (ListWithAllItems[i].StringWithoutAdditionalCharacters.Equals(MessageId_Without_Upper))
                {
                    //item without additional characters found
                    //check if the actual derivate is already in ItemWithDerivates and if not then add it as a new derivate
                    Found = true;
                    ListWithAllItems[i].AddNewDerivate(MyOriginalItem);
                }

//            if(ListWithAllItems[i].StringWithoutAdditionalCharacters.Equals("Help"))
                {
                }
            }

            if (!Found)
            {
                ItemWithDerivates MyItemWithDerivates = new ItemWithDerivates();
                MyItemWithDerivates.StringWithoutAdditionalCharacters = MessageId_Without_Upper;
                MyItemWithDerivates.AddNewDerivate(MyOriginalItem);
                ListWithAllItems.Add(MyItemWithDerivates);
            }
        }
示例#2
0
        /// <summary>
        /// Adds a new Derivate to an already existing item
        /// </summary>
        public void AddNewDerivate(OriginalItem MyOriginalItem)
        {
            String OriginalString = MyOriginalItem.OriginalString;

            // if(AllDerivates.Count != 0)
            bool Found = false;

            foreach (OriginalItem AllOriginalItems in AllDerivates)
            {
                if (AllOriginalItems.OriginalString.Equals(MyOriginalItem))
                {
                    Found = true;
                }
            }

            if (!Found)
            {
                AllDerivates.Add(MyOriginalItem);
            }
        }
示例#3
0
        /// <summary>
        /// Adds a new Derivate to an already existing item
        /// </summary>
        public void AddNewDerivate(OriginalItem MyOriginalItem)
        {
            String OriginalString = MyOriginalItem.OriginalString;

            // if(AllDerivates.Count != 0)
            bool Found = false;

            foreach (OriginalItem AllOriginalItems in AllDerivates)
            {
                if (AllOriginalItems.OriginalString.Equals(MyOriginalItem))
                {
                    Found = true;
                }
            }

            if (!Found)
            {
                AllDerivates.Add(MyOriginalItem);
            }
        }
示例#4
0
        //add an Item to the List that contains all Items
        private static void AddItemToListWithAllItems(string messageId,
            string MessageId_Without,
            string MessageId_Without_Upper,
            string messageSource)
        {
            /*if(MessageId_Without.Equals("Help"))
             * {
             *  string test = "";
             *  //for debugger
             * }*/

            OriginalItem MyOriginalItem = new OriginalItem();

            MyOriginalItem.OriginalString = messageId;
            MyOriginalItem.SourceLocation = messageSource;

            //check if item alreay exists in lists
            //if yes then add a new derivate to the existing item
            //if not then add a new Item


            bool Found = false;

            for (int i = 0; i < ListWithAllItems.Count; i++) // Loop through List with for
            {
                //check if item is already in list
                if (ListWithAllItems[i].StringWithoutAdditionalCharacters.Equals(MessageId_Without_Upper))
                {
                    //item without additional characters found
                    //check if the actual derivate is already in ItemWithDerivates and if not then add it as a new derivate
                    Found = true;
                    ListWithAllItems[i].AddNewDerivate(MyOriginalItem);
                }

//            if(ListWithAllItems[i].StringWithoutAdditionalCharacters.Equals("Help"))
                {
                }
            }

            if (!Found)
            {
                ItemWithDerivates MyItemWithDerivates = new ItemWithDerivates();
                MyItemWithDerivates.StringWithoutAdditionalCharacters = MessageId_Without_Upper;
                MyItemWithDerivates.AddNewDerivate(MyOriginalItem);
                ListWithAllItems.Add(MyItemWithDerivates);
            }
        }