Example #1
0
 public ReleaseLoggingService(
     IAppCenterService appCenterService,
     IFileLoggingService fileLoggingService)
 {
     this.appCenterService   = appCenterService;
     this.fileLoggingService = fileLoggingService;
 }
Example #2
0
        public string GenerateResult(ScanOptions scanOptions, DiscoveredScanner scanner)
        {
            try
            {
                string result = "";

                foreach (IFileNamingBlock block in Blocks)
                {
                    result += block.ToString(scanOptions, scanner);
                }

                return(result + ConvertImageScannerFormatToString(scanOptions.Format.TargetFormat));
            }
            catch (Exception exc)
            {
                ILogService       logService       = Ioc.Default.GetService <ILogService>();
                IAppCenterService appCenterService = Ioc.Default.GetService <IAppCenterService>();

                logService.Log.Error(exc, "Generating file name from {pattern} failed", GetSerialized(true));
                appCenterService.TrackError(exc);

                // fallback to rudimentary legacy file naming
                return("SCN" + DateTime.Now.Hour.ToString("00") + DateTime.Now.Minute.ToString("00") + DateTime.Now.Second.ToString("00"));;
            }
        }
Example #3
0
 public UserService(IApiRequest <IUserEndpoint> request,
                    IApiRequestSelector <IUserEndpoint> apiRequestSelector,
                    IAppCenterService appCenterService)
 {
     _request = request;
     //_request.BaseApiAddress = "https://reqres.in/api";
     _apiRequestSelector = apiRequestSelector;
     _appCenterService   = appCenterService;
 }
Example #4
0
 private void StartService(IAppCenterService service)
 {
     if (service == null)
     {
         throw new AppCenterException("Attempted to start an invalid App Center service.");
     }
     if (_channelGroup == null)
     {
         throw new AppCenterException("Attempted to start a service after App Center has been shut down.");
     }
     if (_services.Contains(service))
     {
         AppCenterLog.Warn(AppCenterLog.LogTag, $"App Center has already started the service with class name '{service.GetType().Name}'");
         return;
     }
     service.OnChannelGroupReady(_channelGroup, _appSecret);
     _services.Add(service);
     AppCenterLog.Info(AppCenterLog.LogTag, $"'{service.GetType().Name}' service started.");
 }
Example #5
0
        public FileNamingPattern(string serialized)
        {
            try
            {
                Guard.IsNotNullOrEmpty(serialized, nameof(serialized));

                string[] parts = serialized.Split('*', StringSplitOptions.RemoveEmptyEntries);
                Type[]   types = new Type[]
                {
                    typeof(string),
                };

                // iterate through blocks
                List <IFileNamingBlock> newList = new List <IFileNamingBlock>();
                foreach (string part in parts)
                {
                    Type     blockType = FileNamingStatics.FileNamingBlocksDictionary[part.Split("|", StringSplitOptions.RemoveEmptyEntries)[0]];
                    string[] partArray = new string[1] {
                        part
                    };
                    newList.Add(blockType.GetConstructor(types).Invoke(partArray) as IFileNamingBlock);
                }

                Blocks  = newList;
                IsValid = CheckValidity();
            }
            catch (Exception exc)
            {
                ILogService       logService       = Ioc.Default.GetService <ILogService>();
                IAppCenterService appCenterService = Ioc.Default.GetService <IAppCenterService>();

                logService?.Log.Error(exc, "Generating file naming pattern from {source} failed", serialized);
                appCenterService.TrackError(exc);
                throw;
            }
        }
Example #6
0
 public ApiRequestSelector(IAppCenterService appCenterService)
 {
     _appCenterService = appCenterService;
 }
Example #7
0
 public MainPageViewModel(IAppCenterService appCenterService)
 {
     _appCenterService = appCenterService;
 }