Esempio n. 1
0
        } /* End of Function - RemoteStatus */

        /************************ Methods ****************************************/
        /*----------------------- GetAsync --------------------------------------*/
        /// <summary>
        /// Asynchronously gets the status for all of the references associated
        /// with the repository.
        /// </summary>
        /// <param name="localRepo">
        /// Reference to a repository to get the status for all references
        /// </param>
        public Task <ICollection <RefStatus> > GetAsync(ILocalRepository localRepo)
        {
            return(Task <ICollection <RefStatus> > .Factory.StartNew(() =>
            {
                var retval = new List <RefStatus>();
                lock (m_lock)
                {
                    var result = GitExecutor.FetchAsync(localRepo, true).Result;
                    if (null != result)
                    {
                        Regex pattern = new Regex(@"\s(?<flag>.)\s(?<summary>\b(\[up to date])|.*)\s(?<from>[^\s]+)\s+->\s+(?<to>[^\s]+)(?<reason> ?.*)");
                        foreach (var line in result.Split('\n'))
                        {
                            Match m = pattern.Match(line);
                            if (null != m && m.Success)
                            {
                                retval.Add(new RefStatus()
                                {
                                    Flag = RefStatus.GetMappedState(m.Groups["flag"].Value[0]),
                                    From = m.Groups["from"].Value,
                                    To = m.Groups["to"].Value,
                                    Summary = m.Groups["summary"].Value,
                                    Reason = m.Groups["reason"].Value
                                });
                            } // end of if - successful match
                        }     // end of foreach - line in the result
                    }         // end of if - valid result
                }
                return retval;
            }));
        } /* End of Function - GetAsync */
Esempio n. 2
0
        } // end of function - LFSBatchPost

        /// <summary>
        /// Creates a <see cref="BatchResponseObject"/> object with information for
        /// each LFS object in the batch request
        /// </summary>
        /// <param name="repo">
        /// The local cached repository
        /// </param>
        /// <param name="reqObj">
        /// The LFS batch request object, with information requested by the client
        /// </param>
        /// <returns>
        /// Task generating a <see cref="BatchResponseObject"/>, with information to
        /// send to the client
        /// </returns>
        public BatchResponseObject CreateBatchLFSResponse(ILocalRepository repo, BatchRequestObject reqObj)
        {
            // Create our main response object
            BatchResponseObject retval = new BatchResponseObject();

            // Loop through all of the objects in the request object
            foreach (var obj in reqObj.Objects)
            {
                // We will need a list of actions to return
                LFSActions actions = new LFSActions();

                // We will use the file info object to get the file size later
                var fileInfo = new FileInfo(repo.LFSObjectPath(obj.OID));
#warning Find a way to get the controller's mapping entry point to build a base URL
                string baseUrl = $"{Request.Scheme}://{Request.Host}/{Request.PathBase}/";

                // Right now, we only support a "download" action, so build it out
                actions.Download = new LFSActions.DownloadAction()
                {
                    ExpiresAt = null,
                    ExpiresIn = 0,
                    HREF      = $"{baseUrl}/{repo.Remote.Server}/{repo.Remote.Owner}/{repo.Remote.Name}/lfs/download/{obj.OID}"
                };

                retval.Objects.Add(new BatchResponseObject.ResponseLFSItem()
                {
                    Authenticated = true,
                    OID           = obj.OID,
                    Size          = (int)fileInfo.Length,
                    Actions       = actions,
                    Error         = null
                });
            } // end of foreach - object in the LFS request objects call
            return(retval);
        }     // end of function - CreateBatchLFSResponse
 public TrechoController(VooContext contexto, ITrechoRepository trechoRepositorio, TrechoService trechoService, ILocalRepository localRepository)
 {
     this.contexto          = contexto;
     this.trechoRepositorio = trechoRepositorio;
     this.trechoService     = trechoService;
     this.localRepository   = localRepository;
 }
Esempio n. 4
0
 public LocalService(ILocalRepository localRepository,
                     IMediatorHandler bus,
                     IUnitOfWork uow,
                     INotificationHandler <DomainNotification> notifications) : base(bus, uow, notifications)
 {
     _localRepository = localRepository;
 }
        } /* End of Function - GetWaitTimeSpan */

        /*----------------------- IsRepositoryUpToDate --------------------------*/
        /// <summary>
        /// Checks to see if the repository is considered out of date
        /// </summary>
        /// <param name="context">
        /// Context object to get repository information from
        /// </param>
        protected virtual bool IsRepositoryUpToDate(
            ILocalRepository localRepository)
        {
            if (System.IO.Directory.Exists(localRepository.Path))
            {
                var status = RemoteStatusService.GetAsync(localRepository).Result;

                var outOfDateItems = status?.Where(v =>
                {
                    switch (v.Flag)
                    {
                    case RefStatus.State.FailedOrRejected:
                    case RefStatus.State.ForcedUpdated:
                    case RefStatus.State.New:
                    case RefStatus.State.Pruned:
                    case RefStatus.State.TagUpdated:
                    case RefStatus.State.Updated:
                        return(true);

                    default:
                    case RefStatus.State.UpToDate:
                        return(false);
                    }
                }).ToList();
                return(outOfDateItems.Count == 0);
            }
            else
            {
                return(false);
            }
        } /* End of Function - IsRepositoryUpToDate */
Esempio n. 6
0
 public PregledProdajeViewModel(ILocalRepository repository)
 {
     this.m_Repository   = repository;
     m_KonfiguracijaKase = repository.VratiKonfiguracijuKase();
     OdDana = DateTime.Now.Date;
     DoDana = DateTime.Now.Date;
     Racuni = new BindingList <Racun>();
 }
Esempio n. 7
0
 public PulseProcessing(ILocalRepository <PulseDTO> pulseDataRepo,
                        IPiSerialNumber serialNumber, IApi pushApi,
                        ILoggerFactory logger)
 {
     PulseRepo      = pulseDataRepo;
     Api            = pushApi;
     PiSerialNumber = serialNumber.Value;
     Logger         = logger.CreateLogger <PulseProcessing>();
 }
 public LocalController(
     ILocalRepository localRepository,
     PassagensAereasContext context,
     IOptions <SecuritySettings> settings)
 {
     this.localRepository = localRepository;
     this.context         = context;
     this.settings        = settings;
 }
Esempio n. 9
0
 public TrechoController(ITrechoRepository trechoRepository,
                         TrechoService trechoService, PassagensContext contexto,
                         ILocalRepository localRepository)
 {
     this.trechoRepository = trechoRepository;
     this.trechoService    = trechoService;
     this.localRepository  = localRepository;
     this.contexto         = contexto;
 }
Esempio n. 10
0
        /*======================= PUBLIC ========================================*/
        /************************ Events *****************************************/
        /************************ Properties *************************************/
        /************************ Construction ***********************************/
        /************************ Methods ****************************************/
        /************************ Fields *****************************************/
        /************************ Static *****************************************/
        /*----------------------- LFSObjectPath ---------------------------------*/
        /// <summary>
        /// Gets an LFS object path in the local repo
        /// </summary>
        /// <param name="repo">Local repo</param>
        /// <param name="oid">LFS object ID</param>
        public static string LFSObjectPath(this ILocalRepository repo, string oid)
        {
            if (oid == null)
            {
                throw new ArgumentNullException(nameof(oid), "OID must not be null");
            }
            if (oid.Length != 64)
            {
                throw new ArgumentException("OID does not appear to be correct length", nameof(oid));
            }
            var objFilePath       = $"lfs/objects/{oid.Substring(0, 2)}/{oid.Substring(2, 2)}/{oid}";
            var fullLfsObjectPath = System.IO.Path.Combine(repo.Path, objFilePath);

            return(fullLfsObjectPath);
        } /* End of Function - LFSObjectPath */
Esempio n. 11
0
 public LocalService(
     ILocalRepository localRepository,
     IEventLogService eventLogService,
     ITipoLocalRepository tipoLocalRepository,
     IEquipoService equipoService,
     IStatusService statusService,
     IImagenLocalRepository imagenRepository)
 {
     _localRepository     = localRepository;
     _eventLogService     = eventLogService;
     _tipoLocalRepository = tipoLocalRepository;
     _equipoService       = equipoService;
     _statusService       = statusService;
     _imagenRepository    = imagenRepository;
 }
        }                        /* End of Property - Shell */
        /************************ Construction ***********************************/

        /*----------------------- GitServiceAdvertisementResult -----------------*/
        /// <summary>
        /// Constructor for the service advertisement result
        /// </summary>
        /// <param name="service">
        /// Service the result is for
        /// </param>
        /// <param name="repo">
        /// The repository the result is for
        /// </param>
        public ServiceAdvertisementResult(
            string service,
            ILocalRepository repo,
            IShell shell)
        {
            Service = service;
            if (null == (Repository = repo))
            {
                throw new ArgumentNullException(nameof(repo), "Invalid repository given, must not be null");
            }
            if (null == (Shell = shell))
            {
                throw new ArgumentNullException(nameof(shell), "Invalid shell object givin, must not be null");
            }
        } /* End of Function - GitServiceAdvertisementResult */
Esempio n. 13
0
 }                                       /* End of Property - Repository */
 /************************ Construction ***********************************/
 /*----------------------- GitServiceResultResult ------------------------*/
 /// <summary>
 /// Constructor for the result
 /// </summary>
 /// <param name="service">
 /// Service for the result
 /// </param>
 /// <param name="repo">
 /// Repository associated with the result
 /// </param>
 /// <param name="useGzip">
 /// True if the result should be compressed, false otherwise
 /// </param>
 public ServiceResult(string service, ILocalRepository repo, IShell shell, bool useGzip = false)
 {
     Service = service;
     UseGZip = useGzip;
     if (null == (Repository = repo))
     {
         throw new ArgumentNullException(
                   nameof(repo),
                   "Local repository is invalid, value must not be null");
     }
     if (null == (Shell = shell))
     {
         throw new ArgumentNullException(
                   nameof(shell),
                   "Shell object is invalid, value must not be null");
     }
 } /* End of Function - GitServiceResultResult */
Esempio n. 14
0
        } /* End of Function - GitContext */

        /************************ Methods ****************************************/
        /*----------------------- UpdateLocalAsync ------------------------------*/
        /// <summary>
        /// Updates the local storage in async fashion
        /// </summary>
        /// <param name="local">
        /// The local repository
        /// </param>
        public async Task <string> UpdateLocalAsync(ILocalRepository local)
        {
            string output = null;

            try
            {
                // First try to fetch the details...
                output = await GitExecuter.FetchAsync(local);

                await LFSExecuter.FetchAsync(local);
            }
            catch (Exception)
            {
                // If fetch failed, then we must need to clone everything!
                output = await GitExecuter.CloneAsync(local);

                await LFSExecuter.FetchAsync(local);
            }
            return(output);
        } /* End of Function - UpdateLocalAsync */
Esempio n. 15
0
 public LocalQueries(ILocalRepository localRepository)
 {
     _localRepository = localRepository;
 }
Esempio n. 16
0
 public Podesavanja(ILocalRepository repository) : this()
 {
     m_Repository = repository;
 }
Esempio n. 17
0
 public LocalController(ILocalRepository localRepository)
 {
     _localRepository = localRepository;
 }
Esempio n. 18
0
 public RacunViewModel(ILocalRepository repository, ISyncService syncService)
 {
     fRepository  = repository;
     fSyncService = syncService;
     Racun        = new Racun();
 }
Esempio n. 19
0
 public LocalController(VooContext contexto, ILocalRepository localRepositorio, LocalService localService)
 {
     this.contexto         = contexto;
     this.localRepositorio = localRepositorio;
     this.localService     = localService;
 }
Esempio n. 20
0
 public LocalService(ILocalRepository localRepository, ILocalMapper localMapper)
 {
     _localRepository = localRepository;
     _localMapper     = localMapper;
 }
Esempio n. 21
0
 public LocalService(IUnnitOfWork unnitOfWork, ILocalRepository localRepository)
 {
     _unnitOfWork     = unnitOfWork;
     _localRepository = localRepository;
 }
Esempio n. 22
0
 public LocalCommandHandler(ILocalRepository LocalRepository)
 {
     _localRepository = LocalRepository;
 }
Esempio n. 23
0
 public LocalAppService(ILocalRepository repository)
 {
     _repository = repository;
 }
Esempio n. 24
0
 public LocalController(IMediatorHandler mediator, ILocalRepository localRepository, IMapper mapper)
 {
     _localRepository = localRepository;
     _mediator        = mediator;
     _mapper          = mapper;
 }
Esempio n. 25
0
 public LocalService(ILocalRepository repo)
 {
     repository = repo;
 }
Esempio n. 26
0
 public FileService(ILocalRepository <T> localRepository)
 {
     this.localRepository = localRepository;
 }
 public LocalService(ILocalRepository localRepository)
 {
     _localRepository = localRepository;
 }
Esempio n. 28
0
 public PretragaArtikalaViewModel(ILocalRepository repository)
 {
     m_Repository = repository;
     Zalihe       = new BindingList <Zaliha>();
     JediniceMere = m_Repository.JediniceMere().ToList();
 }
Esempio n. 29
0
 public LocalService(ILocalRepository localRepository)
 {
     _localRepository = localRepository;
 }
 public LocalController(ILocalRepository localRepository, LocalService localService, PassagensAereasContext contexto)
 {
     this.localRepository = localRepository;
     this.localService    = localService;
     this.contexto        = contexto;
 }
Esempio n. 31
0
 public PokedexUsecase(IPokeAPIRepository pokeAPIRepository, ILocalRepository localRepository)
 {
     _pokeAPIRepository = pokeAPIRepository;
     _localRepository   = localRepository;
 }