internal static async Task <User> GetUser(this RealmSettings realmSettings) { SyncConfigurationBase.Initialize(UserPersistenceMode.NotEncrypted, basePath: Path.GetTempPath()); return(await Realms.Sync.User.LoginAsync( Credentials.UsernamePassword(realmSettings.Login, realmSettings.Password, createUser: false), new Uri($"https://{realmSettings.RealmServerUrl}"))); }
public RealmController( ILogger <DiagnosticsController> logger, RealmSettings appSettings, PushNotificationsManager pushNotificationsManager) { this.logger = logger; this.realmSettings = appSettings; this.pushNotificationsManager = pushNotificationsManager; }
public VkontakteController( ILogger <DiagnosticsController> logger, VkontakteSettings vkontakteSettings, RealmSettings realmSettings) { this.logger = logger; this.vkontakteSettings = vkontakteSettings; this.realmSettings = realmSettings; }
public TweetController( ILogger <DiagnosticsController> logger, TweetSettings tweetSettings, RealmSettings realmSettings, PushNotificationsManager pushNotificationsManager) { this.logger = logger; this.tweetSettings = tweetSettings; this.realmSettings = realmSettings; this.pushNotificationsManager = pushNotificationsManager; }
public DiagnosticsController( ILogger <DiagnosticsController> logger, RealmSettings realmSettings, TweetSettings tweetSettings, VkontakteSettings vkontakteSettings, PushSettings pushSettings) { this.logger = logger; this.realmSettings = realmSettings; this.tweetSettings = tweetSettings; this.vkontakteSettings = vkontakteSettings; this.pushSettings = pushSettings; }
public async Task AddRealm(RealmSettings r) { var current = await GetRealm(r.ID); if (current != null) { current.RealmSettings = r; } else { Realm realm = new Realm(); realm.RealmSettings = r; State.RealmMap.Add(r.ID, realm); } await WriteStateAsync(); }
public static void Run() { if (System.IO.File.Exists("Config-Realm.xml") == false) { return; } PacketHandler.Init(); TextReader configReader = File.OpenText("Config-Realm.xml"); if (configReader == null) { throw new Exception("Unable to open Config-Realm.xml"); } var doc = new XmlDocument(); var xmlReader = XmlReader.Create(configReader); doc.Load(xmlReader); var els = doc.GetElementsByTagName("Realm"); foreach (XmlNode node in els) { var el = node as XmlElement; string port = el.GetAttribute("Port"); if (port == null) { throw new Exception("Config-Realm.xml includes a Realm entry that does not specify Port"); } string realmid = el.GetAttribute("RealmID"); if (realmid == null) { throw new Exception("Config-Realm.xml includes a Realm entry that does not specify RealmID"); } string realmname = el.GetAttribute("Name"); if (realmname == null) { throw new Exception("Config-Realm.xml includes a Realm entry that does not specify Name"); } string realmaddress = el.GetAttribute("Address"); if (realmaddress == null) { throw new Exception("Config-Realm.xml includes a Realm entry that does not specify Address"); } RealmSettings settings = new RealmSettings(); settings.ID = int.Parse(realmid); settings.RealmID = settings.ID; settings.Name = realmname; settings.Address = realmaddress; settings.Port = UInt16.Parse(port); string attrib; attrib = el.GetAttribute("MaxPlayers"); if (attrib != null && attrib.Length > 0) { settings.MaxPlayers = int.Parse(attrib); } attrib = el.GetAttribute("RealID"); if (attrib != null && attrib.Length > 0) { settings.RealmID = int.Parse(attrib); } attrib = el.GetAttribute("RequiredAccountLevel"); if (attrib != null && attrib.Length > 0) { settings.RequiredAccountLevel = int.Parse(attrib); } attrib = el.GetAttribute("Category"); if (attrib != null && attrib.Length > 0) { settings.Cat = int.Parse(attrib); } RealmClient client = new RealmClient(settings); Realms.Add(client); client.Run(); //RealmPacketHandler } Running = true; }
public void SetRealmSettings(RealmSettings s) { settings = s; }
public Task SetRealmInfo(RealmSettings settings) { SessionType = SessionType.RealmSession; RealmID = settings.RealmID; return(TaskDone.Done); }
public RealmClient(RealmSettings realmsettings) { settings = realmsettings; }
internal static async Task <IEnumerable <SubscriptionModel> > GetAllCommunitiesAsync(this RealmSettings realmSettings, SocialMediaType socialMediaType) { var user = await realmSettings.GetUser(); var realmUrl = new Uri($"realms://{realmSettings.RealmServerUrl}/{realmSettings.RealmName}"); var realm = await user.GetRealm(realmUrl); return(SubscriptionsHelper.GetDefaultCommunitySubscriptionsByRealm(realm) .Where(x => x.Type == socialMediaType)); }