示例#1
0
        public BankCollection GetBankDetail(string extractedText)
        {
            var res = new BankCollection();

            try
            {
                var banks = GetAll();
                var found = false;
                foreach (var bank in banks)
                {
                    if (Regex.IsMatch(extractedText, bank.Expression,
                                      RegexOptions.IgnoreCase))
                    {
                        res   = bank;
                        found = true;
                    }
                    if (found)
                    {
                        break;
                    }
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
            return(res);
        }
示例#2
0
        /// <summary>
        /// /// Changes wave sequence references; only used from programs not from a master file.
        /// </summary>
        /// <param name="changes"></param>

        public void ChangeWaveSequenceReferences(Dictionary <IWaveSequence, IWaveSequence> changes)
        {
            foreach (var program in BankCollection.Where(bank => bank.IsFilled && !((IProgramBank)bank).IsModeled)
                     .SelectMany(bank => bank.Patches)
                     .Where(program => program.IsLoaded))
            {
                ((IProgram)program).ReplaceWaveSequence(changes);
            }
        }
示例#3
0
        /// <summary>
        /// /// Changes drum kit references; only used from programs not from a master file.
        /// </summary>
        /// <param name="changes"></param>

        public void ChangeDrumKitReferences(Dictionary <IDrumKit, IDrumKit> changes)
        {
            foreach (var program in BankCollection.Where(bank => bank.IsFilled)
                     .SelectMany(bank => bank.Patches)
                     .Where(program => program.IsLoaded))
            {
                ((IProgram)program).ReplaceDrumKit(changes);
            }
        }
        public static void Execute()
        {
            IEnumerable bank        = new BankCollection();
            var         bankManager = new BankManager();

            bankManager.IntruderDetected += Detector.Warning;

            bankManager.PrintAllCustomersBalance(bank);
        }
示例#5
0
 /// <summary>
 /// Changes program references; only used from set lists not from a master file.
 /// </summary>
 /// <param name="changes"></param>
 public void ChangeProgramReferences(Dictionary <IProgram, IProgram> changes)
 {
     foreach (var setListSlot in BankCollection.Where(
                  bank => bank.IsFilled).SelectMany(bank => bank.Patches).Where(
                  setListSlot => (setListSlot.IsLoaded) &&
                  (((ISetListSlot)setListSlot).SelectedPatchType == SetListSlot.PatchType.Program) &&
                  changes.ContainsKey((IProgram)((ISetListSlot)(setListSlot)).UsedPatch)))
     {
         ((ISetListSlot)setListSlot).UsedPatch =
             changes[(IProgram)(((ISetListSlot)setListSlot).UsedPatch)];
     }
 }
示例#6
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="pcgId"></param>
        /// <returns></returns>
        public override IBank GetBankWithPcgId(int pcgId)
        {
            var bank = base.GetBankWithPcgId(pcgId);

            // GM variation bank selected, select GM bank (last).
            if (bank == null)
            {
                bank = BankCollection.Last();
            }

            return(bank);
        }
示例#7
0
        public ActionResult Index()
        {
            var news       = newsRepository.GetNews();
            var collection = new BankCollection <News>
            {
                Collection = news.ToList(),
                TotalItems = newsRepository.GetCount(),
                PageIndex  = 1,
                PageSize   = 3
            };

            return(View(collection));
        }
示例#8
0
 public ActionResult Create(BankCollection collection)
 {
     try
     {
         collection.DocumentType = "Bank";
         _bankContext.Create(collection);
         return(RedirectToAction("Index"));
     }
     catch
     {
         return(View());
     }
 }
示例#9
0
        public PartialViewResult News(int pageIndex, int pageSize)
        {
            var news = newsRepository.GetNews(pageIndex, pageSize);

            var collection = new BankCollection <News>
            {
                Collection = news.ToList(),
                PageIndex  = pageIndex,
                PageSize   = pageSize,
                TotalItems = newsRepository.GetCount()
            };

            return(PartialView("_News", collection));
        }
示例#10
0
 /// <summary>
 /// /// Changes combi references; only used from set lists not from a master file.
 /// </summary>
 /// <param name="changes"></param>
 public void ChangeCombiReferences(Dictionary <ICombi, ICombi> changes)
 {
     foreach (
         IPatch setListSlot in
         BankCollection.Where(bank => bank.IsFilled)
         .SelectMany(bank => bank.Patches)
         .Where(setListSlot => (setListSlot.IsLoaded) &&
                (((ISetListSlot)setListSlot).SelectedPatchType ==
                 SetListSlot.PatchType.Combi) &&
                changes.ContainsKey((ICombi)((ISetListSlot)(setListSlot)).UsedPatch)))
     {
         ((ISetListSlot)setListSlot).UsedPatch =
             changes[(ICombi)(((ISetListSlot)setListSlot).UsedPatch)];
     }
 }
示例#11
0
        public bool Create(BankCollection identifier)
        {
            var returnRes = false;

            try
            {
                var bankDocument   = identifier.ToBsonDocument();
                var bankCollection = _database.GetCollection <BsonDocument>("BankCollection");
                bankCollection.InsertOne(bankDocument);
                returnRes = true;
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
            return(returnRes);
        }
示例#12
0
        // Index:              0       1       2       3       4        4
        // Name:               A       B       C       D       S        M


        /// <summary>
        /// In the Trinity, when program S or M is referenced, use that bank.
        /// </summary>
        /// <param name="pcgId"></param>
        /// <returns></returns>
        public override IBank GetBankWithPcgId(int pcgId)
        {
            IBank bank = null;

            if ((pcgId == 4) || (pcgId == 5))
            {
                IBank programBank = BankCollection[4];
                if (programBank.IsLoaded)
                {
                    // S bank exists; return this bank;
                    bank = programBank;
                }

                programBank = BankCollection[5];
                if (programBank.IsLoaded)
                {
                    // S bank exists; return this bank;
                    bank = programBank;
                }
            }

            if (bank == null)
            {
                foreach (IBank currentBank in BankCollection.Where(bankLambda => bankLambda.PcgId == pcgId))
                {
                    bank = currentBank;
                    break;
                }
            }

            if (bank == null)
            {
                throw new NotSupportedException("No GM Bank present in Trinity");
            }

            return(bank as IProgramBank);
        }
示例#13
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="pcgId"></param>
 /// <returns></returns>
 public virtual IBank GetBankWithPcgId(int pcgId)
 {
     return(BankCollection.FirstOrDefault(bank => bank.PcgId == pcgId));
 }
示例#14
0
 /// <summary>
 /// Used in unit tests.
 /// </summary>
 /// <param name="name"></param>
 /// <returns></returns>
 public IBank this[string name]
 {
     get { return(BankCollection.First(n => n.Id == name)); }
 }