public ArkServerContext(ServerConfigSection config, ILifetimeScope scope) { Config = config; _scope = scope; _saveFileWatcher = _scope.Resolve <IArkSaveFileWatcher>(new TypedParameter(typeof(ArkServerContext), this)); Steam = new SteamManager(config); }
/// <summary> /// 填充EasemobServer配置节点 /// </summary> private static void FillEasemobServerConfigSection() { try { ServerConfigSection serverConfigSection = ConfigurationManager.GetSection("EasemobServer") as ServerConfigSection; if (serverConfigSection != null) { foreach (ServerConfigElement item in serverConfigSection.ServerConfigElementCollection) { if (!ServerConfigs.ContainsKey(item.AppName)) { ServerConfigs.Add(item.AppName, item); } } } else { throw new AggregateException("EasemobServer节点读取失败,请检查配置!"); } } catch (Exception ex) { LogTraceHelper.SendLog(string.Format("Message:{0}\r\n\tStackTrace:{1}", ex.Message, ex.StackTrace), "FillEasemobServerConfigSection", isDebug: true); } }
/// <summary> /// Effectue le traitement de préchargement du /// controle. /// </summary> /// <param name="e"></param> protected override void OnPreRender(EventArgs e) { base.OnPreRender(e); SiteWeb st = ECommerceServer.CurrentSite; string dt = ECommerceServer.User.CreateNewCSRFToken(); // Récupère les infos de configuration de Facebook // depuis la base de données FacebookSitesDS ds = ECommerceServer.DataCache.Facebook; if (ds == null || ds.ecommerce_facebook_siteswebs.Count == 0) { return; } FacebookSitesDS.ecommerce_facebook_siteswebsRow r = ds.ecommerce_facebook_siteswebs[0]; if (r.Isfcb_application_idNull()) { return; } ServerConfigSection sc = EConfigurationManager.GetConfig(st); string appId = r.fcb_application_id; // Prépare l'URL de connexion à la page de login StringBuilder blr = new StringBuilder(); blr.Append("https://www.facebook.com/dialog/oauth?client_id="); blr.Append(appId); blr.Append("&scope=email"); blr.Append("&state="); blr.Append(HttpUtility.UrlEncode(dt)); blr.Append("|"); if (!string.IsNullOrEmpty(Page.Request["ReturnUrl"])) { blr.Append(HttpUtility.UrlEncode(Page.Request["ReturnUrl"])); } else { blr.Append(HttpUtility.UrlEncode("/")); } blr.Append("&redirect_uri="); StringBuilder blrUri = new StringBuilder(); blrUri.Append(st.UrlPrincipale); if (!st.UrlPrincipale.EndsWith("/")) { blrUri.Append("/"); } blrUri.Append("oauth/facebook/process/"); blr.Append(HttpUtility.UrlEncode(blrUri.ToString())); // et en fait l'url du lien this.NavigateUrl = blr.ToString(); }
protected override void OnPreRender(EventArgs e) { base.OnPreRender(e); ServerConfigSection s = EConfigurationManager.GetConfig(ECommerceServer.CurrentSite); if (!s.ECommerce.ClickNMortar.Enabled) { this.Visible = false; } }
public ClickNMortarHomeLink() { ServerConfigSection s = EConfigurationManager.GetConfig(ECommerceServer.CurrentSite); if (!s.ECommerce.ClickNMortar.Enabled) { this.Visible = false; } else { this.NavigateUrl = s.ECommerce.ClickNMortar.RootPagePath; } }
public SavegameBackupResult CreateBackup(ServerConfigSection server, ClusterConfigSection cluster) { if (!File.Exists(server.SaveFilePath)) { Logging.Log($@"Savegame backup was requested but there are no files to backup (saveFilePath: ""{server.SaveFilePath}"", clusterSavePath: ""{cluster?.SavePath ?? "-"}"")", GetType(), LogLevel.DEBUG); return(null); } var dir = Path.GetDirectoryName(server.SaveFilePath); string[] arkprofiles = null; string[] arktribes = null; string[] clusters = null; var files = new[] { new Tuple <string, string, string[]>("", "", new [] { server.SaveFilePath }), Directory.Exists(dir) ? new Tuple <string, string, string[]>("", "", arkprofiles = Directory.GetFiles(dir, "*.arkprofile", SearchOption.TopDirectoryOnly)) : null, Directory.Exists(dir) ? new Tuple <string, string, string[]>("", "", arktribes = Directory.GetFiles(dir, "*.arktribe", SearchOption.TopDirectoryOnly)) : null, cluster != null ? new Tuple <string, string, string[]>(cluster.SavePath, "cluster", clusters = Directory.GetFiles(cluster.SavePath, "*", SearchOption.AllDirectories)) : null }.Where(x => x != null && x.Item2 != null).ToArray(); var backupDir = Path.Combine(_config.Backups.BackupsDirectoryPath, server.Key, DateTime.Now.ToString("yyyy-MM")); if (!Directory.Exists(backupDir)) { Directory.CreateDirectory(backupDir); } var path = Path.Combine(backupDir, "save_" + DateTime.Now.ToString("yyyy-MM-dd.HH.mm.ss.ffff") + ".zip"); string[] results = null; try { results = FileHelper.CreateDotNetZipArchive(files, path); } catch (Exception ex) { Logging.LogException("Failed to create savegame backup archive", ex, GetType(), LogLevel.ERROR, ExceptionLevel.Ignored); return(null); } return(new SavegameBackupResult { ArchivePaths = results, FilesInBackup = files.SelectMany(x => x.Item3).ToArray(), SaveGameCount = 1, ArkprofileCount = arkprofiles?.Length ?? 0, ArktribeCount = arktribes?.Length ?? 0, ClusterCount = clusters?.Length ?? 0 }); }
private void ConfigureRedisServers(ServerConfigSection serverConfig, NameValueCollection config) { int database; if (!int.TryParse(config["database"] ?? "0", out database)) { database = 0; } try { if (serverConfig != null && serverConfig.Hosts != null) { connection = new RedisConnectionWrapper(serverConfig.Hosts.Cast <RedisHostConfiguration>().Select(host => host.GetConnectionInformation()), database); } } catch { } }
/// <summary> /// Gère l'évènement de chargement de la page /// </summary> /// <param name="e"></param> protected override void OnLoad(EventArgs e) { base.OnLoad(e); SiteWeb st = ECommerceServer.CurrentSite; ServerConfigSection sc = EConfigurationManager.GetConfig(st); if (sc.ECommerce.Authentication == null || !sc.ECommerce.Authentication.UseFacebook) { this.Visible = false; } if (Page.User.Identity.IsAuthenticated) { this.Visible = false; } }
public ArkServerContext( IConfig fullconfig, ServerConfigSection config, ArkClusterContext clusterContext, ISavedState savedState, ArkAnonymizeData anonymizeData, ILifetimeScope scope) : base( config?.SaveFilePath, clusterContext, loadOnlyPropertiesInDomain: true) { Config = config; _clusterContext = clusterContext; _scope = scope; _saveFileWatcher = _scope.Resolve <IArkSaveFileWatcher>(new TypedParameter(typeof(ArkServerContext), this)); _savedState = savedState; _anonymizeData = anonymizeData; Steam = new SteamManager(config); }
public ArkServerContext( IConfig fullconfig, ServerConfigSection config, ArkClusterContext clusterContext, ISavedState savedState, ArkAnonymizeData anonymizeData, ILifetimeScope scope) : base( config?.SaveFilePath, clusterContext, fullconfig.SavegameExtractionMaxDegreeOfParallelism, true) { Config = config; _clusterContext = clusterContext; _scope = scope; _saveFileWatcher = _scope.Resolve <IArkSaveFileWatcher>(new TypedParameter(typeof(ArkServerContext), this)); _savedState = savedState; _anonymizeData = anonymizeData; Steam = new SteamManager(config); }
public SteamManager(ServerConfigSection config) { _config = config; }
public void BindTo(object o) { if (o == null) { return; } int sit_pk = ECommerceServer.SiteId; ServerConfigSection config = EConfigurationManager.GetConfig(ECommerceServer.CurrentSite); if (o is ArticlesDataSourceResult) { ArticlesDataSourceResult res = o as ArticlesDataSourceResult; VueArticlesWebDS.ecommerce_articles_webRow r = res.Article.ecommerce_articles_web[0]; BindTo(r); } else if (o is PromotionsLotsRepeater.ProduitLotRepeaterItemData) { PromotionsLotsRepeater.ProduitLotRepeaterItemData res = o as PromotionsLotsRepeater.ProduitLotRepeaterItemData; VueArticlesWebDS.ecommerce_articles_webRow r = res.ArticleLot; BindTo(r); } else if (o is VueArticlesWebDS.ecommerce_articles_webRow) { VueArticlesWebDS.ecommerce_articles_webRow r = o as VueArticlesWebDS.ecommerce_articles_webRow; if (string.IsNullOrEmpty(ImageUrl)) { if (config.ECommerce.DocumentBase.ProductImages.UseDocumentBase) { string code = config.ECommerce.DocumentBase.ProductImages.CodeForTiny; switch (_typeImage) { case TypeProduitImage.Petite: code = config.ECommerce.DocumentBase.ProductImages.CodeForSmall; break; case TypeProduitImage.Intermediaire: code = config.ECommerce.DocumentBase.ProductImages.CodeForIntermediate; break; case TypeProduitImage.Tiny: code = config.ECommerce.DocumentBase.ProductImages.CodeForTiny; break; case TypeProduitImage.Thumb: code = config.ECommerce.DocumentBase.ProductImages.CodeForThumb; break; case TypeProduitImage.Detail: code = config.ECommerce.DocumentBase.ProductImages.CodeForDetails; break; case TypeProduitImage.Aucune: this.ImageUrl = ECommerceServer.ResolveResourceUrl(this.ImageUrl); break; } //if (string.IsNullOrEmpty(this.ImageUrl)) //{ // this.ImageUrl = _GetResourceUrl(DocBaseHelper.(config.ECommerce.DocumentBase.ProductImages.MainDocumentType, // r.art_guid, // code)); //} } else { switch (_typeImage) { case TypeProduitImage.Petite: this.ImageUrl = ECommerceServer.ResolveResourceUrl(r.Isarw_url_img_smallNull() ? null : r.arw_url_img_small); break; case TypeProduitImage.Intermediaire: this.ImageUrl = ECommerceServer.ResolveResourceUrl(r.Isarw_url_img_intermediateNull() ? (r.Isarw_url_img_imagetteNull() ? null : r.arw_url_img_imagette) : r.arw_url_img_intermediate); break; case TypeProduitImage.Tiny: this.ImageUrl = ECommerceServer.ResolveResourceUrl(r.Isarw_url_img_tinyNull() ? null : r.arw_url_img_tiny); break; case TypeProduitImage.Thumb: this.ImageUrl = ECommerceServer.ResolveResourceUrl(r.Isarw_url_img_imagetteNull() ? null : r.arw_url_img_imagette); break; case TypeProduitImage.Detail: this.ImageUrl = ECommerceServer.ResolveResourceUrl(r.Isarw_url_img_bigNull() ? null : r.arw_url_img_big); break; case TypeProduitImage.Aucune: this.ImageUrl = ECommerceServer.ResolveResourceUrl(this.ImageUrl); break; } } } if (string.IsNullOrEmpty(this.ImageUrl)) { this.ImageUrl = ECommerceServer.ResolveResourceUrl(ImageUrlIfNone); } this.ToolTip = r.arw_libelle; this.AlternateText = r.arw_libelle; } }
public void BindTo(object o) { if (o == null) { return; } int sit_pk = ECommerceServer.SiteId; ServerConfigSection config = EConfigurationManager.GetConfig(ECommerceServer.CurrentSite); if (o is ArticlesDataSourceResult) { ArticlesDataSourceResult res = o as ArticlesDataSourceResult; VueArticlesWebDS.ecommerce_articles_webRow r = res.Article.ecommerce_articles_web[0]; BindTo(r); } else if (o is PromotionsLotsRepeater.ProduitLotRepeaterItemData) { PromotionsLotsRepeater.ProduitLotRepeaterItemData res = o as PromotionsLotsRepeater.ProduitLotRepeaterItemData; VueArticlesWebDS.ecommerce_articles_webRow r = res.ArticleLot; BindTo(r); } else if (o is VueArticlesWebDS.ecommerce_articles_webRow) { VueArticlesWebDS.ecommerce_articles_webRow r = o as VueArticlesWebDS.ecommerce_articles_webRow; if (string.IsNullOrEmpty(ImageUrl) && !RenderAsText) { if (config.ECommerce.DocumentBase.ProductImages.UseDocumentBase) { string code = config.ECommerce.DocumentBase.ProductImages.CodeForTiny; switch (_typeImage) { case TypeProduitImage.Petite: code = config.ECommerce.DocumentBase.ProductImages.CodeForSmall; break; case TypeProduitImage.Intermediaire: code = config.ECommerce.DocumentBase.ProductImages.CodeForIntermediate; break; case TypeProduitImage.Tiny: code = config.ECommerce.DocumentBase.ProductImages.CodeForTiny; break; case TypeProduitImage.Thumb: code = config.ECommerce.DocumentBase.ProductImages.CodeForThumb; break; case TypeProduitImage.Detail: code = config.ECommerce.DocumentBase.ProductImages.CodeForDetails; break; case TypeProduitImage.Aucune: this.ImageUrl = _GetResourceUrl(this.ImageUrl); break; } //if (string.IsNullOrEmpty(this.ImageUrl)) //{ // this.ImageUrl = _GetResourceUrl(DocBaseHelper.(config.ECommerce.DocumentBase.ProductImages.MainDocumentType, // r.art_guid, // code)); //} } else { switch (_typeImage) { case TypeProduitImage.Petite: this.ImageUrl = _GetResourceUrl(r.Isarw_url_img_smallNull() ? null : r.arw_url_img_small); break; case TypeProduitImage.Intermediaire: this.ImageUrl = _GetResourceUrl(r.Isarw_url_img_intermediateNull() ? (r.Isarw_url_img_imagetteNull() ? null : r.arw_url_img_imagette) : r.arw_url_img_intermediate); break; case TypeProduitImage.Tiny: this.ImageUrl = _GetResourceUrl(r.Isarw_url_img_tinyNull() ? null : r.arw_url_img_tiny); break; case TypeProduitImage.Thumb: this.ImageUrl = _GetResourceUrl(r.Isarw_url_img_imagetteNull() ? null : r.arw_url_img_imagette); break; case TypeProduitImage.Detail: this.ImageUrl = _GetResourceUrl(r.Isarw_url_img_bigNull() ? null : r.arw_url_img_big); break; case TypeProduitImage.Aucune: this.ImageUrl = _GetResourceUrl(this.ImageUrl); break; } } } if (string.IsNullOrEmpty(this.ImageUrl)) { this.ImageUrl = _GetResourceUrl(ImageUrlIfNone); } switch (LinkType) { case TypeLienProduit.Detail: string url = ECommerceServer.Contexte.GetProductPage(r.arw_sit_pk, r.art_guid, r.art_pk, r.art_ref, r.Isarw_url_persoNull() ? null : r.arw_url_perso, (int)r.arw_seg_pk_principale); if (PourPageAmp) { url = System.IO.Path.ChangeExtension(url, ".amp"); } this.NavigateUrl = url; break; case TypeLienProduit.Image: this.NavigateUrl = _GetResourceUrl(r.Isarw_url_img_bigNull() ? null : r.arw_url_img_big); if (this.NavigateUrl.Equals(this.ImageUrl, StringComparison.InvariantCultureIgnoreCase)) { if (CacherSiAucunZoom) { this.Visible = false; } } if (!IsZoomable()) { break; } this.ToolTip = r.arw_libelle; break; } this.ToolTip = r.arw_libelle; this.Text = r.arw_libelle; } }
void IEquihiraBindable.BindTo(object o) { if (o == null) { return; } int sit_pk = ECommerceServer.SiteId; ServerConfigSection config = EConfigurationManager.GetConfig(ECommerceServer.CurrentSite); if (o is ArticlesDataSourceResult) { ArticlesDataSourceResult res = o as ArticlesDataSourceResult; VueArticlesWebDS.ecommerce_articles_webRow r = res.Article.ecommerce_articles_web[0]; (this as IEquihiraBindable).BindTo(r); } else if (o is VueArticlesWebDS.ecommerce_articles_webRow) { VueArticlesWebDS.ecommerce_articles_webRow r = o as VueArticlesWebDS.ecommerce_articles_webRow; if (config.ECommerce.DocumentBase.ProductImages.UseDocumentBase) { string code = config.ECommerce.DocumentBase.ProductImages.CodeForTiny; switch (_typeImage) { case TypeProduitImage.Petite: code = config.ECommerce.DocumentBase.ProductImages.CodeForSmall; break; case TypeProduitImage.Intermediaire: code = config.ECommerce.DocumentBase.ProductImages.CodeForIntermediate; break; case TypeProduitImage.Tiny: code = config.ECommerce.DocumentBase.ProductImages.CodeForTiny; break; case TypeProduitImage.Thumb: code = config.ECommerce.DocumentBase.ProductImages.CodeForThumb; break; case TypeProduitImage.Detail: code = config.ECommerce.DocumentBase.ProductImages.CodeForDetails; break; } } else { switch (_typeImage) { case TypeProduitImage.Petite: this.ImageUrl = ECommerceServer.ResolveResourceUrl(r.Isarw_url_img_smallNull() ? null : r.arw_url_img_small); break; case TypeProduitImage.Intermediaire: this.ImageUrl = ECommerceServer.ResolveResourceUrl(r.Isarw_url_img_intermediateNull() ? (r.Isarw_url_img_imagetteNull() ? null : r.arw_url_img_imagette) : r.arw_url_img_intermediate); break; case TypeProduitImage.Tiny: this.ImageUrl = ECommerceServer.ResolveResourceUrl(r.Isarw_url_img_tinyNull() ? null : r.arw_url_img_tiny); break; case TypeProduitImage.Thumb: this.ImageUrl = ECommerceServer.ResolveResourceUrl(r.Isarw_url_img_imagetteNull() ? null : r.arw_url_img_imagette); break; case TypeProduitImage.Detail: this.ImageUrl = ECommerceServer.ResolveResourceUrl(r.Isarw_url_img_bigNull() ? null : r.arw_url_img_big); break; case TypeProduitImage.Aucune: this.ImageUrl = ECommerceServer.ResolveResourceUrl(this.ImageUrl); break; } } string url = ECommerceServer.Contexte.GetProductPage(r.arw_sit_pk, r.art_guid, r.art_pk, r.art_ref, r.Isarw_url_persoNull()?null:r.arw_url_perso, (int)r.arw_seg_pk_principale); url = System.IO.Path.ChangeExtension(url, ".amp"); ProductUrl = Page.ResolveUrl(url); if (string.IsNullOrEmpty(this.ImageUrl)) { this.ImageUrl = ECommerceServer.ResolveResourceUrl(ImageUrlIfNone); } this.ToolTip = r.arw_libelle; } }