Exemple #1
0
        private static IRandomStrategy _irandomstrategy = null;//随机性策略

        static Randoms()
        {
            _irandomstrategy = BMARandom.Instance;
            if (!string.IsNullOrWhiteSpace(BMAConfig.MallConfig.RandomLibrary))
            {
                _irandomstrategy.RandomLibrary = BMAConfig.MallConfig.RandomLibrary.ToCharArray();
            }
        }
Exemple #2
0
        private static IRandomStrategy _irandomstrategy = null; //随机性策略

        static Randoms()
        {
            _irandomstrategy = HaRandom.Instance;
            if (!string.IsNullOrWhiteSpace(HaConfig.MallConfig.RandomLibrary))
            {
                _irandomstrategy.RandomLibrary = HaConfig.MallConfig.RandomLibrary.ToCharArray();
            }
        }
Exemple #3
0
        private static IRandomStrategy _irandomstrategy = null; //随机性策略

        static Randoms()
        {
            _irandomstrategy = BSPRandom.Instance;
            if (!string.IsNullOrWhiteSpace(BSPConfig.ShopConfig.RandomLibrary))
            {
                _irandomstrategy.RandomLibrary = BSPConfig.ShopConfig.RandomLibrary.ToCharArray();
            }
        }
Exemple #4
0
        private static IRandomStrategy _irandomstrategy = null;//随机性策略

        static BSPRandom()
        {
            try
            {
                string[] fileNameList = Directory.GetFiles(System.Web.HttpRuntime.BinDirectory, "OWZX.RandomStrategy.*.dll", SearchOption.TopDirectoryOnly);
                _irandomstrategy = (IRandomStrategy)Activator.CreateInstance(Type.GetType(string.Format("OWZX.RandomStrategy.{0}.RandomStrategy, OWZX.RandomStrategy.{0}", fileNameList[0].Substring(fileNameList[0].IndexOf("RandomStrategy.") + 15).Replace(".dll", "")),
                                                                                          false,
                                                                                          true));
            }
            catch
            {
                throw new BSPException("创建'随机性策略对象'失败,可能存在的原因:未将'随机性策略程序集'添加到bin目录中;'随机性策略程序集'文件名不符合'OWZX.RandomStrategy.{策略名称}.dll'格式");
            }
        }
Exemple #5
0
        private static IRandomStrategy _irandomstrategy = null; //随机性策略

        #endregion Fields

        #region Constructors

        static BSPRandom()
        {
            try
            {
                string[] fileNameList = Directory.GetFiles(System.Web.HttpRuntime.BinDirectory, "BrnShop.RandomStrategy.*.dll", SearchOption.TopDirectoryOnly);
                _irandomstrategy = (IRandomStrategy)Activator.CreateInstance(Type.GetType(string.Format("BrnShop.RandomStrategy.{0}.RandomStrategy, BrnShop.RandomStrategy.{0}", fileNameList[0].Substring(fileNameList[0].IndexOf("RandomStrategy.") + 15).Replace(".dll", "")),
                                                                                         false,
                                                                                         true));
            }
            catch
            {
                throw new BSPException("创建'随机性策略对象'失败,可能存在的原因:未将'随机性策略程序集'添加到bin目录中;'随机性策略程序集'文件名不符合'BrnShop.RandomStrategy.{策略名称}.dll'格式");
            }
        }
Exemple #6
0
 /// <summary>
 /// 加载随机性策略
 /// </summary>
 private static void Load()
 {
     try
     {
         string[] fileNameList = Directory.GetFiles(System.Web.HttpRuntime.BinDirectory, "BonSite.RandomStrategy.*.dll", SearchOption.TopDirectoryOnly);
         _randomstrategy = (IRandomStrategy)Activator.CreateInstance(Type.GetType(string.Format("BonSite.RandomStrategy.{0}.RandomStrategy, BonSite.RandomStrategy.{0}", fileNameList[0].Substring(fileNameList[0].IndexOf("RandomStrategy.") + 15).Replace(".dll", "")),
                                                                                  false,
                                                                                  true));
     }
     catch
     {
         throw new BSException("创建\"随机性策略对象\"失败,可能存在的原因:未将\"随机性策略程序集\"添加到bin目录中;将多个\"随机性策略程序集\"添加到bin目录中;\"随机性策略程序集\"文件名不符合\"BonSite.RandomStrategy.{策略名称}.dll\"格式");
     }
 }
Exemple #7
0
        private static IRandomStrategy _irandomstrategy = null;//随机性策略

        static HaRandom()
        {
            //try
            //{
            //    string[] fileNameList = Directory.GetFiles(System.Web.HttpRuntime.BinDirectory, "Halfox.RandomStrategy.*.dll", SearchOption.TopDirectoryOnly);
            //    _irandomstrategy = (IRandomStrategy)Activator.CreateInstance(Type.GetType(string.Format("Halfox.RandomStrategy.{0}.RandomStrategy, Halfox.RandomStrategy.{0}", fileNameList[0].Substring(fileNameList[0].IndexOf("RandomStrategy.") + 15).Replace(".dll", "")),
            //                                                                             false,
            //                                                                             true));
            //}
            //catch
            //{
            //    throw new HaException("创建'随机性策略对象'失败,可能存在的原因:未将'随机性策略程序集'添加到bin目录中;'随机性策略程序集'文件名不符合'Halfox.RandomStrategy.{策略名称}.dll'格式");
            //}
            _irandomstrategy = new RandomStrategy();
        }