Ejemplo n.º 1
0
        public PutSettingsDirtyBits PutSettings(SmsSettings o)
        {
            bool ret = SmsSettings.RebootNeeded(Settings, o);

            Settings = o;
            return(ret ? PutSettingsDirtyBits.RebootCore : PutSettingsDirtyBits.None);
        }
Ejemplo n.º 2
0
        public bool PutSettings(SmsSettings o)
        {
            bool ret = SmsSettings.RebootNeeded(Settings, o);

            Settings = o;
            return(ret);
        }
Ejemplo n.º 3
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddTransient <IEmailSender, EmailSender> ();
            services.AddOptions();
            SmsSettings smsSettings = new SmsSettings();

            Configuration.GetSection("SmsSettings").Bind(smsSettings);
            EmailSettings emailSettings = new EmailSettings();

            Configuration.GetSection("EmailSettings").Bind(emailSettings);
            services.Configure <EmailSettings> (Configuration.GetSection("EmailSettings"));
            TwilioClient.Init(smsSettings.SID, smsSettings.ApiKey);
            services.Configure <SmsSettings> (Configuration.GetSection("SmsSettings"));
            services.AddTransient <ISmsSender, SmsSender> ();
            services.AddTransient <IProfileService, ProfileService>();
            services.AddTransient <IAuthService, AuthService>();
            services.AddTransient <IRideService, RideService>();
            services.AddJsonLocalization(o => {
                o.ResourcesPath = "Resources";
            });
            services.AddCors(options => {
                options.AddPolicy(MyAllowSpecificOrigins,
                                  builder => {
                    builder.AllowAnyHeader().AllowAnyMethod().AllowAnyOrigin().AllowCredentials();
                });
            });
            services.Configure <EmailSettings> (Configuration);
            services.AddMvc().AddFluentValidation(fv => fv.RegisterValidatorsFromAssemblyContaining <Startup> ());
            (new IdentityConfig()).ConfigureIdentity(services, Configuration);
            services.AddAuthorization();
            services.AddSingleton(provider => new MapperConfiguration(cfg => {
                cfg.AddProfile(new ViewModelToEntityMappingProfile(provider.GetService <IStringLocalizer <PublicProfileViewModel> > ()
                                                                   , provider.GetService <IStringLocalizer <Message> >()));
            }).CreateMapper());
        }
Ejemplo n.º 4
0
        public static bool IsSmsProviderActive(this ISmsProvider smsProvider,
                                               SmsSettings smsSettings)
        {
            if (smsProvider == null)
            {
                throw new ArgumentNullException("smsProvider");
            }

            if (smsSettings == null)
            {
                throw new ArgumentNullException("smsSettings");
            }

            if (smsSettings.ActiveSmsProviderSystemNames == null)
            {
                return(false);
            }
            foreach (string activeMethodSystemName in smsSettings.ActiveSmsProviderSystemNames)
            {
                if (smsProvider.PluginDescriptor.SystemName.Equals(activeMethodSystemName, StringComparison.InvariantCultureIgnoreCase))
                {
                    return(true);
                }
            }
            return(false);
        }
Ejemplo n.º 5
0
 public SmsController(ISmsService smsService, SmsSettings smsSettings,
                      ISettingService settingService, IPermissionService permissionService)
 {
     this._smsService        = smsService;
     this._smsSettings       = smsSettings;
     this._settingService    = settingService;
     this._permissionService = permissionService;
 }
Ejemplo n.º 6
0
 public TwilioSmsSender(IOptions <SmsSettings> smsSettings,
                        ILogger <TwilioSmsSender> logger,
                        ITwilioRestClient twilio)
 {
     _settings = smsSettings.Value;
     _twilio   = twilio;
     _logger   = logger;
 }
Ejemplo n.º 7
0
 public SmsClickatellController(SmsSettings clickatellSettings,
                                ISettingService settingService, IPluginFinder pluginFinder,
                                ILocalizationService localizationService)
 {
     this._clickatellSettings  = clickatellSettings;
     this._settingService      = settingService;
     this._pluginFinder        = pluginFinder;
     this._localizationService = localizationService;
 }
Ejemplo n.º 8
0
        public static SmsSettings DeliverSmsSettings()
        {
            SmsSettings smsSetting = new SmsSettings();

            using (NotifyMeServiceEntities entity = new NotifyMeServiceEntities())
            {
                smsSetting = entity.SmsSettings.FirstOrDefault();
            }

            return(smsSetting);
        }
        public JsonResult updateSmsSettings(SmsSettings settingModel)
        {
            ResponseModel result = new ResponseModel();

            if (ModelState.IsValid)
            {
                result = _siteM.UpdateSmsSettings(settingModel);
            }
            else
            {
                result.Message = "Lütfen zorunlu alanları doldurun!";
            }

            return(Json(result, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 10
0
 public SmsCommandHandler(
     SmsSettings smsSettings,
     ISettingsService settingsService,
     ISmsSenderFactory smsSenderFactory,
     ISmsRepository smsRepository,
     ISmsProviderInfoRepository smsProviderInfoRepository,
     ILog log)
 {
     _smsSettings               = smsSettings;
     _settingsService           = settingsService;
     _smsSenderFactory          = smsSenderFactory;
     _smsRepository             = smsRepository;
     _smsProviderInfoRepository = smsProviderInfoRepository;
     _log = log.CreateComponentScope(nameof(SmsCommandHandler));
 }
Ejemplo n.º 11
0
        private static void Startup()
        {
            // setup RabbitMQ
            var    configSection = Config.GetSection("RabbitMQ");
            string host          = configSection["Host"];
            string userName      = configSection["UserName"];
            string password      = configSection["Password"];
            string exchange      = configSection["Exchange"];
            string connName      = configSection["ConnectionName"];

            var    mailConfigSection = Config.GetSection("EmailSettings");
            string mailHost          = mailConfigSection["MailServer"];
            int    mailPort          = Convert.ToInt32(mailConfigSection["MailPort"]);
            string mailUserName      = mailConfigSection["Sender"];
            string mailSenderName    = mailConfigSection["SenderName"];
            string mailPassword      = mailConfigSection["Password"];
            //ISMTPMailSender smtpMailServer = new SMTPMailSender(mailHost, mailPort, mailUserName, mailPassword, mailSenderName); // original

            var    smsConfiguration = Config.GetSection("SmsSettings");
            string accountSid       = smsConfiguration["AccountSID"];
            string authCode         = smsConfiguration["AuthToken"];


            EmailSettings settings       = new EmailSettings(mailHost, mailPort, mailSenderName, mailUserName, mailPassword);
            IEmailSender  smtpMailServer = new EmailSender(settings);

            SmsSettings smsSettings = new SmsSettings(accountSid, authCode);
            ISmsSender  smsSender   = new TextSender(smsSettings);
            //ITwilioRestClient smsSender = new SmsSender();

            //var emailSender = new EmailSender();
            //var emailSettings = new EmailSettings();

            // setup messagehandler
            RabbitMQMessageHandler messageHandler = new RabbitMQMessageHandler(host, userName, password, exchange, connName, "notification", "notification.#");

            // ABOVE: subscribe/listen to queue - queue name to be updated

            //IEmailSender emailSender = null;
            EventHandlers.EventHandler eventHandler = new EventHandlers.EventHandler(messageHandler, smtpMailServer, smsSender); //, dbContext);
            //EventHandler eventHandler = new EventHandler(messageHandler, smtpMailServer);

            //EmailNotificationEventHandler eventHandler = new EmailNotificationEventHandler(messageHandler, smtpMailServer); // original
            eventHandler.Start();
        }
Ejemplo n.º 12
0
        internal string Send(string smsTo, string smsMsg)
        {
            var client      = new WebClient();
            var smsSettings = new SmsSettings();

            // Add a user agent header in case the requested URI contains a query.
            client.Headers.Add("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)");
            client.QueryString.Add("user", smsSettings.SmsUsername);
            client.QueryString.Add("password", smsSettings.SmsPassword);
            client.QueryString.Add("api_id", smsSettings.SmsAPI);
            client.QueryString.Add("to", smsTo);
            client.QueryString.Add("text", smsMsg);
            const string baseurl = "http://api.clickatell.com/http/sendmsg";

            //using (Stream data = client.OpenRead(baseurl))
            using (var reader = new StreamReader(client.OpenRead(baseurl))) // data
                return(reader.ReadToEnd());
        }
Ejemplo n.º 13
0
        public ResponseModel UpdateSmsSettings(SmsSettings updObj)
        {
            ResponseModel result = new ResponseModel();
            bool          value  = _smsRepo.Update(updObj);

            if (updObj.RequiredIsRegister)
            {
                var mail_ = _mailRepo.GetAll().FirstOrDefault();
                mail_.ApproveSendMailNewUser = false;
                _mailRepo.Update(mail_);
            }

            result.IsSuccess = value;
            if (result.IsSuccess)
            {
                result.Message = "Bilgiler başarı ile güncellendi!";
            }
            StaticSettings.ReloadSettings();
            return(result);
        }
 private StaticSettings()
 {
     SiteSettings = new SiteSettings();
     MailSettings = new MailSettings();
     SmsSettings  = new SmsSettings();
     LastComments = new List <Comments>();
     ContentViews = new List <ContentViewListModel>();
     Writers      = new List <Users>();
     StaticPages  = new List <StaticPages>();
     Categories   = new List <Categories>();
     _catRepo     = new CategoryRepository();
     _staticRepo  = new StaticPageRepository();
     _siteRepo    = new SiteSettingsRepository();
     _mailRepo    = new MailSettingRepository();
     _smsRepo     = new SmsSettingsRepository();
     _commentRepo = new CommentRepository();
     _contentRepo = new ContentViewRepository();
     _userRepo    = new UserRepository();
     _mainRepo    = new MainPageSettingRepository();
     _sliderRepo  = new MainSliderSettingRepository();
     ReloadSettings();
 }
Ejemplo n.º 15
0
        public SMS(CoreComm comm, GameInfo game, byte[] rom, SmsSettings settings, SmsSyncSettings syncSettings)
        {
            var ser = new BasicServiceProvider(this);

            ServiceProvider = ser;
            Settings        = (SmsSettings)settings ?? new SmsSettings();
            SyncSettings    = (SmsSyncSettings)syncSettings ?? new SmsSyncSettings();

            IsGameGear   = game.System == "GG";
            IsGameGear_C = game.System == "GG";
            IsSG1000     = game.System == "SG";
            RomData      = rom;

            if (RomData.Length % BankSize != 0)
            {
                Array.Resize(ref RomData, ((RomData.Length / BankSize) + 1) * BankSize);
            }

            RomBanks = (byte)(RomData.Length / BankSize);

            Region = DetermineDisplayType(SyncSettings.DisplayType, game.Region);
            if (game["PAL"] && Region != DisplayType.PAL)
            {
                Region = DisplayType.PAL;
                comm.Notify("Display was forced to PAL mode for game compatibility.");
            }

            if (IsGameGear)
            {
                Region = DisplayType.NTSC;                 // all game gears run at 60hz/NTSC mode
            }

            _region = SyncSettings.ConsoleRegion;
            if (_region == SmsSyncSettings.Regions.Auto)
            {
                _region = DetermineRegion(game.Region);
            }

            if (game["Japan"] && _region != SmsSyncSettings.Regions.Japan)
            {
                _region = SmsSyncSettings.Regions.Japan;
                comm.Notify("Region was forced to Japan for game compatibility.");
            }

            if (game["Korea"] && _region != SmsSyncSettings.Regions.Korea)
            {
                _region = SmsSyncSettings.Regions.Korea;
                comm.Notify("Region was forced to Korea for game compatibility.");
            }

            if ((game.NotInDatabase || game["FM"]) && SyncSettings.EnableFm && !IsGameGear)
            {
                HasYM2413 = true;
            }

            Cpu = new Z80A
            {
                ReadHardware    = ReadPort,
                WriteHardware   = WritePort,
                FetchMemory     = FetchMemory,
                ReadMemory      = ReadMemory,
                WriteMemory     = WriteMemory,
                MemoryCallbacks = MemoryCallbacks,
                OnExecFetch     = OnExecMemory
            };

            if (game["GG_in_SMS"])
            {
                // skip setting the BIOS because this is a game gear game that puts the system
                // in SMS compatibility mode (it will fail the check sum if played on an actual SMS though.)
                IsGameGear   = false;
                IsGameGear_C = true;
                game.System  = "GG";
                Console.WriteLine("Using SMS Compatibility mode for Game Gear System");
            }

            Vdp = new VDP(this, Cpu, IsGameGear ? VdpMode.GameGear : VdpMode.SMS, Region);
            ser.Register <IVideoProvider>(Vdp);
            PSG    = new SN76489sms();
            YM2413 = new YM2413();
            //SoundMixer = new SoundMixer(YM2413, PSG);
            if (HasYM2413 && game["WhenFMDisablePSG"])
            {
                disablePSG = true;
            }

            BlipL.SetRates(3579545, 44100);
            BlipR.SetRates(3579545, 44100);

            ser.Register <ISoundProvider>(this);

            SystemRam = new byte[0x2000];

            if (game["CMMapper"])
            {
                InitCodeMastersMapper();
            }
            else if (game["CMMapperWithRam"])
            {
                InitCodeMastersMapperRam();
            }
            else if (game["ExtRam"])
            {
                InitExt2kMapper(int.Parse(game.OptionValue("ExtRam")));
            }
            else if (game["KoreaMapper"])
            {
                InitKoreaMapper();
            }
            else if (game["MSXMapper"])
            {
                InitMSXMapper();
            }
            else if (game["NemesisMapper"])
            {
                InitNemesisMapper();
            }
            else if (game["TerebiOekaki"])
            {
                InitTerebiOekaki();
            }
            else if (game["EEPROM"])
            {
                InitEEPROMMapper();
            }
            else
            {
                InitSegaMapper();
            }

            if (Settings.ForceStereoSeparation && !IsGameGear)
            {
                if (game["StereoByte"])
                {
                    ForceStereoByte = byte.Parse(game.OptionValue("StereoByte"));
                }

                PSG.Set_Panning(ForceStereoByte);
            }

            if (SyncSettings.AllowOverClock && game["OverclockSafe"])
            {
                Vdp.IPeriod = 512;
            }

            if (Settings.SpriteLimit)
            {
                Vdp.SpriteLimit = true;
            }

            if (game["3D"])
            {
                IsGame3D = true;
            }

            if (game["BIOS"])
            {
                Port3E = 0xF7;                 // Disable cartridge, enable BIOS rom
                InitBiosMapper();
            }
            else if (game.System == "SMS" && !game["GG_in_SMS"])
            {
                BiosRom = comm.CoreFileProvider.GetFirmware("SMS", _region.ToString(), false);

                if (BiosRom == null)
                {
                    throw new MissingFirmwareException("No BIOS found");
                }

                if (!game["RequireBios"] && !SyncSettings.UseBios)
                {
                    // we are skipping the BIOS
                    // but only if it won't break the game
                }
                else
                {
                    Port3E = 0xF7;
                }
            }

            if (game["SRAM"])
            {
                SaveRAM = new byte[int.Parse(game.OptionValue("SRAM"))];
                Console.WriteLine(SaveRAM.Length);
            }
            else if (game.NotInDatabase)
            {
                SaveRAM = new byte[0x8000];
            }

            SetupMemoryDomains();

            //this manages the linkage between the cpu and mapper callbacks so it needs running before bootup is complete
            ((ICodeDataLogger)this).SetCDL(null);

            Tracer = new TraceBuffer {
                Header = Cpu.TraceHeader
            };

            ser.Register(Tracer);
            ser.Register <IDisassemblable>(Cpu);
            ser.Register <IStatable>(new StateSerializer(SyncState));
            Vdp.ProcessOverscan();

            Cpu.ReadMemory  = ReadMemory;
            Cpu.WriteMemory = WriteMemory;

            // Z80 SP initialization
            // stops a few SMS and GG games from crashing
            Cpu.Regs[Cpu.SPl] = 0xF0;
            Cpu.Regs[Cpu.SPh] = 0xDF;

            if (!IsSG1000)
            {
                ser.Register <ISmsGpuView>(new SmsGpuView(Vdp));
            }
        }
Ejemplo n.º 16
0
 public static bool RebootNeeded(SmsSettings x, SmsSettings y) => false;
Ejemplo n.º 17
0
 public SmsService(IOptions <SmsSettings> smsSettings)
 {
     _smsSettings = smsSettings.Value;
 }
Ejemplo n.º 18
0
 internal string Send(string smsTo, string smsMsg)
 {
     var client = new WebClient();
     var smsSettings = new SmsSettings();
     // Add a user agent header in case the requested URI contains a query.
     client.Headers.Add("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)");
     client.QueryString.Add("user", smsSettings.SmsUsername);
     client.QueryString.Add("password", smsSettings.SmsPassword);
     client.QueryString.Add("api_id", smsSettings.SmsAPI);
     client.QueryString.Add("to", smsTo);
     client.QueryString.Add("text", smsMsg);
     const string baseurl = "http://api.clickatell.com/http/sendmsg";
     //using (Stream data = client.OpenRead(baseurl))
     using (var reader = new StreamReader(client.OpenRead(baseurl))) // data
         return reader.ReadToEnd();
 }
        public static void ReloadSettings()
        {
            SiteSettings = _siteRepo.GetAll().FirstOrDefault();
            MailSettings = _mailRepo.GetAll().FirstOrDefault();
            SmsSettings  = _smsRepo.GetAll().FirstOrDefault();
            LastComments = _commentRepo.GetByCustomQuery("select * from Comments where IsPublish = 1 order by ID desc", null).ToList();
            ContentViews = _contentRepo.GetPublishedViewList();
            Writers      = _userRepo.GetByCustomQuery("select * from Users where (select COUNT(*) from UserRoleRels ur where ur.RoleID = 2) > 0 and IsActive = 1 and IsApproved = 1", null).ToList();

            Categories = _catRepo.GetByCustomQuery("select * from Categories where IsActive = 1", null).ToList();

            StaticPages = _staticRepo.GetAll();

            MainPageSetting = _mainRepo.GetAll().FirstOrDefault();

            MainPageSliders = _sliderRepo.GetAll();

            if (LastComments == null)
            {
                LastComments = new List <Comments>();
            }

            if (SiteSettings == null)
            {
                SiteSettings = new SiteSettings();
            }
            if (MailSettings == null)
            {
                MailSettings = new MailSettings();
            }
            if (SmsSettings == null)
            {
                SmsSettings = new SmsSettings();
            }

            if (ContentViews == null)
            {
                ContentViews = new List <ContentViewListModel>();
            }

            if (Writers == null)
            {
                Writers = new List <Users>();
            }

            if (Categories == null)
            {
                Categories = new List <Categories>();
            }

            if (StaticPages == null)
            {
                StaticPages = new List <StaticPages>();
            }

            if (MainPageSetting == null)
            {
                MainPageSetting = new MainPageSettings();
            }

            if (MainPageSliders == null)
            {
                MainPageSliders = new List <MainSliderSettings>();
            }
        }
Ejemplo n.º 20
0
 /// <summary>
 /// Ctor
 /// </summary>
 /// <param name="pluginFinder">Plugin finder</param>
 /// <param name="smsSettings">SmsSettings instance</param>
 public SmsService(IPluginFinder pluginFinder, SmsSettings smsSettings)
 {
     this._pluginFinder = pluginFinder;
     this._smsSettings  = smsSettings;
 }
Ejemplo n.º 21
0
 public SmsService(FaraApi faraApi, IConfiguration configuration)
 {
     _faraApi     = faraApi;
     _siteSetting = configuration.GetSection(nameof(SmsSettings)).Get <SmsSettings>();
 }
Ejemplo n.º 22
0
 public Settings()
 {
     Email = new EmailSettings();
     Sms   = new SmsSettings();
 }
Ejemplo n.º 23
0
 public SmsSender(IOptions <SmsSettings> smsSettings)
 {
     this.smsSettings = smsSettings.Value;
 }
Ejemplo n.º 24
0
 public SmsService(IRepository <SmsLog> smsRepository, IOptions <SmsSettings> smsSettings)
 {
     this.SmsRepository = smsRepository;
     this.SmsSettings   = smsSettings.Value;
 }
Ejemplo n.º 25
0
 public NexmoSmsSender(SmsSettings settings, ILog log)
 {
     _settings = settings;
     _log      = log;
 }