Example #1
0
        public void NewGuidTest()
        {
            GuidService guidService = new GuidService();
            Guid        newGuid     = guidService.CreateNewGuid();

            Assert.NotEqual(Guid.Empty, newGuid);
        }
Example #2
0
 public HomeController(ILogger <HomeController> logger,
                       GuidService service1, GuidService service2)
 {
     _logger   = logger;
     _service1 = service1;
     _service2 = service2;
 }
 //[!] 생성자
 public GuidServiceDemoController(
     GuidService guidService, IGuidService iguidService)
 {
     _gs           = new GuidService();
     _guidService  = guidService;
     _iguidService = iguidService;
 }
Example #4
0
        public static byte[] createZipFile(String path, Boolean IC)
        {
            byte[] filePackageZip = new byte[1];
            try
            {
                String pathPackage = "";

                if (IC)
                {
                    pathPackage = path + @"/deploy";
                }
                else
                {
                    pathPackage = Environment.CurrentDirectory + @"/package";
                }

                String g = GuidService.createGuid();

                String pathZipDirectory = Environment.CurrentDirectory + @"/package//deploy/";
                String pathZip          = pathZipDirectory + g + ".zip";

                ManageFileDirectory.createPackageDirectory(pathZipDirectory);

                ZipFile.CreateFromDirectory(path, pathZip, CompressionLevel.Fastest, true);

                filePackageZip = System.IO.File.ReadAllBytes(pathZip);

                System.IO.File.Delete(pathZip);
            }catch (Exception e) {
                String errorException = String.Format("The process failed: {0}", e.ToString());
                ConsoleHelper.WriteErrorLine(errorException);
            }

            return(filePackageZip);
        }
        //[1] 액션 메서드에서 직접 GuidService의 인스턴스 생성
        public IActionResult Index()
        {
            GuidService gs = new GuidService();

            ViewBag.GuidString = gs.GetGuid();

            return(View());
        }
Example #6
0
        public async Task InvokeAsync(HttpContext context, GuidService guidService)
        {
            var logMessage = $"Middleware: {guidService.ResultadoGuid}";

            _logger.LogInformation(logMessage);
            context.Items.Add("MiddlewareGuid", logMessage);
            await _next(context);
        }
Example #7
0
 public SimpleTimeAndGuidServiceHelper()
 {
     ExpectedGuid = Guid.NewGuid();
     TimeService  = Substitute.For <ITimeService>();
     TimeService.GetUtcNow().Returns(ExpectedDateTime);
     GuidService = Substitute.For <IGuidService>();
     GuidService.NewGuid().Returns(ExpectedGuid);
 }
Example #8
0
        public Guid Create()
        {
            GuidService myObj = new GuidService();

            Guid result = myObj.createGuid();

            return(result);
        }
Example #9
0
        public async Task InvokeAsync(HttpContext httpContext, GuidService guidService)
        {
            var logMeaasge = $"Middleware: The Guid from" + $"GuidService is {guidService.GetGuid()}";

            _logger.LogInformation(logMeaasge);
            httpContext.Items.Add("MiddlewareGuid", logMeaasge);
            await _next(httpContext);
        }
Example #10
0
 public Fatura(DateTime dataChegada, DateTime dataVencimento, DateTime mesReferencia, decimal valor, string observacao)
 {
     Id             = GuidService.NovoGuid();
     DataChegada    = dataChegada;
     DataVencimento = dataVencimento;
     MesReferencia  = mesReferencia;
     Valor          = valor;
     Observacao     = observacao;
 }
 public HomeController(IWeatherForecaster weatherForecaster,
                       IOptions <FeaturesConfiguration> options,
                       GuidService guidService,
                       ILogger <HomeController> logger)
 {
     _weatherForecaster     = weatherForecaster;
     _featuresConfiguration = options.Value;
     _guidService           = guidService;
     _logger = logger;
 }
 public HomeController(FileService fileService,
                       GuidService guidService,
                       ImageService imageService,
                       ApplicationSettings applicationSettings)
 {
     _fileService         = fileService;
     _guidService         = guidService;
     _imageService        = imageService;
     _applicationSettings = applicationSettings;
 }
 public CreateDocumentViewModel(PageNavigator pageNavigator, SafeCommandFactory commandFactory,
                                Func <DateTimeOffset> timeStamp, ILoggerService loggerService, IPropertiesRepository propertiesRepository,
                                BotService botService, GuidService guidService, BlockChainConfiguration config,
                                AccountService accountService)
     : base(pageNavigator, commandFactory, timeStamp, loggerService, propertiesRepository, botService)
 {
     this.guidService    = guidService;
     this.config         = config;
     this.accountService = accountService;
 }
Example #14
0
 public HomeController(INameParserService nameParserService,
                       GuidService guidService,
                       IOptions <FeaturesConfiguration> options,
                       ILogger <HomeController> logger)
 {
     _logger                = logger;
     _guidService           = guidService;
     _nameParserService     = nameParserService;
     _featuresConfiguration = options.Value;
 }
        public async Task InvokeAsync(HttpContext context, GuidService guidService)
        {
            var logMessage = $"Middleware: The GUID from GuidService is {guidService.GetGuid()}";

            _logger.LogInformation(logMessage);

            context.Items.Add("MiddlewareGuid", logMessage);

            // Call the next delegate/middleware in the pipeline
            await _next(context);
        }
        public CreateAccountViewModel(PageNavigator pageNavigator, SafeCommandFactory commandFactory,
                                      Func <DateTimeOffset> timeStamp, ILoggerService loggerService, IPropertiesRepository propertiesRepository,
                                      BotService botService, AccountService accountService, GuidService guidService,
                                      BlockChainConfiguration config, StateSynchronizer stateSynchronizer)
            : base(pageNavigator, commandFactory, timeStamp, loggerService, propertiesRepository, botService)
        {
            this.accountService = accountService;
            this.guidService    = guidService;
            this.config         = config;

            RemoteState = CommandFactory.Create(async() => { await stateSynchronizer.SetStartState(Identifier); });
        }
        public IActionResult GetToken([FromServices] GuidService guidService)
        {
            var guid = guidService.GetGuid();

            var logMessage = $"Controller: The GUID from the GuidService is {guid}";

            _logger.LogInformation(logMessage);
            if (_guidTokenConfiguration.CanSaveToken)
            {
                // save logic
            }

            return(Ok());
        }
Example #18
0
 public BlockChainController(BotService botService,
                             GuidService guidService,
                             AccountService accountService,
                             PageNavigator navigator,
                             UserProvider userProvider,
                             IDocumentDataRepository documentDataRepository,
                             IUserDataRepository userDataRepository,
                             BlockChainConfiguration configuration)
 {
     this.botService             = botService;
     this.guidService            = guidService;
     this.accountService         = accountService;
     this.navigator              = navigator;
     this.userProvider           = userProvider;
     this.documentDataRepository = documentDataRepository;
     this.userDataRepository     = userDataRepository;
     this.configuration          = configuration;
 }
        public DiscordClient(GuidService guidService,
                             CoursesService coursesService,
                             BalanceService balanceService,
                             AccountService accountService,

                             HostConfig config)
        {
            this.guidService    = guidService;
            this.coursesService = coursesService;
            this.balanceService = balanceService;
            this.accountService = accountService;
            this.config         = config;

            client = new DiscordSocketClient();

            client.Log             += LogAsync;
            client.Ready           += ReadyAsync;
            client.MessageReceived += MessageReceivedAsync;
        }
Example #20
0
 public GuidController()
 {
     _guidService = new GuidService();
 }
Example #21
0
        public static PackageManifest createPackageManifest(string branchName, string pathRepository)
        {
            string pathPackage = pathRepository + @"/package.xml";

            string pathtarget = Environment.CurrentDirectory + @"/package/" + branchName + @"/" + GuidService.createGuid();

            ManageFileDirectory.createPackageDirectory(pathtarget);

            return(new PackageManifest()
            {
                PackageFile = pathPackage,
                RepositorySource = pathRepository,
                DirectoryTarget = pathtarget
            });
        }
Example #22
0
 public DiscordController(GuidService guidService,
                          AccountService accountService)
 {
     this.guidService    = guidService;
     this.accountService = accountService;
 }
 public HomeController(GuidService guidService, ILogger <HomeController> logger)
 {
     _guidService = guidService;
     _logger      = logger;
 }
Example #24
0
        public virtual bool PublicApi(HttpListenerContext context, string raw)
        {
            switch (context.Request.Url.LocalPath.ToLower())
            {
            case "/~checklogging":
                IsLoged(context);
                break;

            case "/~login":
                Login(context);
                break;

            case "/~signup":
                Signup(context);
                break;

            case "/~signout":
                Signout(context);
                break;

            case "/~newGuid":
                Server.Send(context, (context.Response.ContentEncoding ?? context.Request.ContentEncoding ?? Encoding.UTF8).GetBytes(Guid.NewGuid().ToString()));
                break;

            case "/~guid":
                var r = string.Format(Server.SGuidService, GuidService.GetGuid());
                Server.Send(context, (context.Response.ContentEncoding ?? context.Request.ContentEncoding ?? Encoding.UTF8).GetBytes(r));
                break;

            case "/~issecured":
                Server.Send(context, RequestArgs.https ? Server.True : Server.False);
                break;

            case "/~sessionid":
                Server.Send(context, (context.Response.ContentEncoding ?? context.Request.ContentEncoding ?? Encoding.UTF8).GetBytes(SessionIdService.SessionId));
                break;

            case "/~isadmin":
                var  cc   = getId(context);
                User user = null;
                if (cc != null && (_connectedUsers.TryGetValue(cc, out user)))
                {
                    if (user.IsBlocked)
                    {
                        _connectedUsers.Remove(cc);
                        context.Response.StatusCode = (int)HttpStatusCode.Forbidden;
                        break;
                    }
                    if (context.Request.RemoteEndPoint.Address.GetHashCode() != user.Address.GetHashCode())
                    {
                        if (AnotherAccountIsStillOpened(context, user))
                        {
                            context.Response.StatusCode = (int)HttpStatusCode.Forbidden;
                        }

                        user.Address = context.Request.RemoteEndPoint.Address;
                    }
                    using (var rr = RequestArgs.NewRequestArgs(context, this.server, user))
                        if (user.IsAgent)
                        {
                            rr.SendSuccess();
                        }
                        else
                        {
                            rr.SendFail();
                        }
                }
                break;

            default:
                if (raw.StartsWith("/~$?id") || raw.StartsWith("/~%24?"))
                {
                    Downloader.Send(context);
                }
                else
                {
                    return(false);
                }
                break;
            }
            context.Response.Close();
            return(true);
        }
Example #25
0
 public async Task AdicionarPrestadorNoBD(PrestadorDeServico prestador)
 {
     prestador.Id = GuidService.NovoGuid();
     BD.Add(prestador);
     await BD.SaveChangesAsync();
 }