예제 #1
0
 public CommonController()
 {
     if (_commonProfile == null)
     {
         _commonProfile = new CommonProfile();
     }
 }
예제 #2
0
        internal static void SetupIoC(this IServiceCollection serviceCollection, AppSettings appSettings, IConfiguration configuration)
        {
            InternalDependenciesProfile.Bootstrap(serviceCollection);

            CommonProfile.Register(serviceCollection, appSettings, configuration);
            StorageProfile.Register(serviceCollection, appSettings);
            LoggingProfile.RegisterApiLogger(serviceCollection, "Api");
            MediatRProfile.Register(serviceCollection, typeof(Startup).Assembly);
            AutoMapperProfile.Register(serviceCollection, typeof(Startup).Assembly);
        }
예제 #3
0
        public IEncoder CreateEncoder(CommonProfile profile, IPlayerStream channel)
        {
            if (profile == null) return CreateDefault(channel);

            IEncoderFactory fac = _encoderFactories.FirstOrDefault(f => f.Id == profile.Id);
            if (fac == null) return CreateDefault(channel);

            var rec = fac.Create(profile, channel) ?? CreateDefault(channel);

            return rec;
        }
예제 #4
0
        private static ServiceProvider BuildContainer(IServiceCollection serviceCollection, bool isIntegrationTests)
        {
            var(config, appSettings) = isIntegrationTests ? BuildAppSettings() : BuildFakeAppSettings();

            RegisterTestDependencies(serviceCollection, appSettings);
            StorageProfile.Register(serviceCollection, appSettings);
            CommonProfile.Register(serviceCollection, appSettings, config);
            MediatRProfile.Register(serviceCollection);
            AutoMapperProfile.Register(serviceCollection);

            return(serviceCollection.BuildServiceProvider());
        }
        public static CommonProfile DeserializeProfile([NotNull] string name, [NotNull] string location)
        {
            if (name == null) throw new ArgumentNullException(nameof(name));
            if (location == null) throw new ArgumentNullException(nameof(location));

            string fullPath = location.CombinePath(name + Extension);

            if (!fullPath.ExisFile()) return null;

            try
            {
                XElement ele = XElement.Load(fullPath);
                var xElement = ele.Element("ID");
                CommonProfile profile = null;
                if (xElement != null)
                    profile = new CommonProfile(xElement.Value);

                if (profile == null) return null;

                foreach (var element in ele.Elements("Property"))
                {
                    string key = string.Empty;

                    var attr = element.Attribute("Key");
                    if (attr != null)
                        key = attr.Value;

                    profile.Properties.Add(new DataProperty(key, element.Value));
                }

                return profile;
            }
            catch (Exception e)
            {
                if (CriticalExceptions.IsCriticalException(e))
                    throw;

                return null;
            }
        }
 public IEncoder Create(CommonProfile profile, IPlayerStream channel)
 {
     if(profile == null) return null;
     return InternalCreate(profile, channel);
 }
예제 #7
0
        public RecordingStade StartRecording(string location, CommonProfile profile)
        {
            if(!_isPlaying) return new RecordingStade(RecordingErrorStade.NotPlaying, null);

            try
            {
                _currentRecordingLocation = location;
                InitRecorder(profile);

                StartRecordingInternal();
            }
            catch (BassException exception)
            {
                return new RecordingStade(RecordingErrorStade.Error, exception);
            }

            return new RecordingStade(RecordingErrorStade.Sucess, null);
        }
 protected override IEncoder InternalCreate(CommonProfile profile, IPlayerStream channel)
 {
     return new LameEncoderProfile(profile).CreateEncoder(channel);
 }
예제 #9
0
        public void StartRecording(string location, CommonProfile profile)
        {
            if (profile == null)
                return;

            _currentRecordingLocation = location;
            InitRecorder(profile);

            StartRecordingInternal();
        }