Пример #1
0
        public void Switch(JryVideoDataSourceProviderManagerMode mode)
        {
            switch (mode)
            {
                case JryVideoDataSourceProviderManagerMode.Public:
                    this.CurrentDataCenter = this.NormalDataCenter;
                    break;

                case JryVideoDataSourceProviderManagerMode.Private:
                    this.CurrentDataCenter = this.SecureDataCenter;
                    break;

                default:
                    throw new ArgumentOutOfRangeException(nameof(mode), mode, null);
            }
        }
        public async Task<bool> Initialize(JryVideoDataSourceProviderManagerMode mode)
        {
            var builder = new MongoUrlBuilder();

            builder.Server = MongoServerAddress.Parse("127.0.0.1:50710");
            builder.DatabaseName = "admin";

            builder.Username = "******";
            builder.Password = "******";

            this.Client = new MongoClient(builder.ToMongoUrl());

            this.Database = this.Client.GetDatabase("JryVideo_" + mode.ToString());

            return true;
        }
        public async Task <bool> Initialize(JryVideoDataSourceProviderManagerMode mode)
        {
            var builder = new MongoUrlBuilder();

            builder.Server       = MongoServerAddress.Parse("127.0.0.1:50710");
            builder.DatabaseName = "admin";

            builder.Username = "******";
            builder.Password = "******";

            this.Client = new MongoClient(builder.ToMongoUrl());

            this.Database = this.Client.GetDatabase("JryVideo_" + mode.ToString());

            return(true);
        }
Пример #4
0
        public void Switch(JryVideoDataSourceProviderManagerMode mode)
        {
            switch (mode)
            {
            case JryVideoDataSourceProviderManagerMode.Public:
                this.CurrentDataCenter = this.NormalDataCenter;
                break;

            case JryVideoDataSourceProviderManagerMode.Private:
                this.CurrentDataCenter = this.SecureDataCenter;
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(mode), mode, null);
            }
        }
        public Task<bool> Initialize(JryVideoDataSourceProviderManagerMode mode)
        {
            if (!Enum.IsDefined(typeof(JryVideoDataSourceProviderManagerMode), mode))
                throw new ArgumentOutOfRangeException(nameof(mode));

            this.Mode = mode;

            var builder = new MongoUrlBuilder();

            builder.Server = MongoServerAddress.Parse("127.0.0.1:50710");
            builder.DatabaseName = "admin";

            builder.Username = "******";
            builder.Password = "******";

            this.Client = new MongoClient(builder.ToMongoUrl());

            this.Database = this.Client.GetDatabase("JryVideo_" + mode.ToString());

            return Task.FromResult(true);
        }
        public Task <bool> Initialize(JryVideoDataSourceProviderManagerMode mode)
        {
            if (!Enum.IsDefined(typeof(JryVideoDataSourceProviderManagerMode), mode))
            {
                throw new ArgumentOutOfRangeException(nameof(mode));
            }

            this.Mode = mode;

            var builder = new MongoUrlBuilder();

            builder.Server       = MongoServerAddress.Parse("127.0.0.1:50710");
            builder.DatabaseName = "admin";

            builder.Username = "******";
            builder.Password = "******";

            this.Client = new MongoClient(builder.ToMongoUrl());

            this.Database = this.Client.GetDatabase("JryVideo_" + mode.ToString());

            return(Task.FromResult(true));
        }
Пример #7
0
        public void Switch(JryVideoDataSourceProviderManagerMode mode)
        {
            if (this.threadId != Thread.CurrentThread.ManagedThreadId)
            {
                throw new InvalidOperationException();
            }

            var old = this.CurrentDataCenter;

            switch (mode)
            {
                case JryVideoDataSourceProviderManagerMode.Public:
                    this.CurrentDataCenter = this.NormalDataCenter;
                    break;

                case JryVideoDataSourceProviderManagerMode.Private:
                    this.CurrentDataCenter = this.SecureDataCenter;
                    break;

                default:
                    throw new ArgumentOutOfRangeException(nameof(mode), mode, null);
            }

            var @new = this.CurrentDataCenter;

            if (old != @new)
            {
                if (old != null)
                {
                    old.FlagManager.FlagChanged -= this.FlagManager_FlagChanged;
                }

                Debug.Assert(@new != null);
                @new.FlagManager.FlagChanged += this.FlagManager_FlagChanged;
            }
        }
Пример #8
0
        public void Switch(JryVideoDataSourceProviderManagerMode mode)
        {
            if (this.threadId != Thread.CurrentThread.ManagedThreadId)
            {
                throw new InvalidOperationException();
            }

            var old = this.CurrentDataCenter;

            switch (mode)
            {
            case JryVideoDataSourceProviderManagerMode.Public:
                this.CurrentDataCenter = this.NormalDataCenter;
                break;

            case JryVideoDataSourceProviderManagerMode.Private:
                this.CurrentDataCenter = this.SecureDataCenter;
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(mode), mode, null);
            }

            var @new = this.CurrentDataCenter;

            if (old != @new)
            {
                if (old != null)
                {
                    old.FlagManager.FlagChanged -= this.FlagManager_FlagChanged;
                }

                Debug.Assert(@new != null);
                @new.FlagManager.FlagChanged += this.FlagManager_FlagChanged;
            }
        }