public PlanetRenderingSection( ProfileSection parent ) : base(parent, "Planet Rendering") { FlatPlanetRendering = new ProfileSection( this, "Flat Planet Rendering" ); TerrainRendering = new ProfileSection( this, "Terrain Rendering" ); OceanRendering = new ProfileSection( this, "Ocean Rendering" ); CloudRendering = new ProfileSection( this, "Cloud Rendering" ); }
private static void InitializeWizardPipeline(XmlElement element) { using (new ProfileSection("Initialize wizard pipeline")) { ProfileSection.Argument("element", element); var name1 = element.Name; try { XmlElement argsElement = element.SelectSingleElement("args"); Type args = argsElement != null ? Type.GetType(argsElement.GetAttribute("type")).IsNotNull( "Cannot find the {0} type".FormatWith(argsElement.GetAttribute("type"))) : null; XmlElement finish = element.SelectSingleElement("finish"); var title = element.GetAttribute("title"); var steps = element.SelectSingleElement("steps").IsNotNull( "Can't find the steps element in the WizardPipelines.config file").ChildNodes.OfType <XmlElement>(). Select( step => new StepInfo(step.GetAttribute("name"), Type.GetType(step.GetAttribute("type")), step.GetAttribute("param"))).ToArray(); var cancelButtonText = element.GetAttribute("cancelButton"); var startButtonText = element.GetAttribute("startButton"); var finishText = element.GetAttribute("finishText"); FinishAction[] finishActions = finish != null?GetFinishActions(finish, args).ToArray() : null; var finishActionHives = GetFinishActionHives(finish, args); WizardPipeline wizardPipeline = new WizardPipeline(name1, title, steps, args, startButtonText, cancelButtonText, finishText, finishActions, finishActionHives); Definitions.Add(name1, wizardPipeline); ProfileSection.Result("Done"); } catch (Exception ex) { WindowHelper.HandleError("WizardPipelineManager failed to load the {0} pipeline".FormatWith(name1), true, ex); ProfileSection.Result("Failed"); } } }
private bool ProcessStepUserControl(bool next = true) { using (new ProfileSection("Process StepUserControl", this)) { ProfileSection.Argument("next", next); try { var item = (TabItem)this.TabControl.SelectedItem; var content = item.Content; Assert.IsNotNull(content, "content"); var fullName = content.GetType().FullName; var step = content as IWizardStep; if (step == null) { Log.Warn("The {0} control does not implement IWizardStep", fullName); return(ProfileSection.Result(true)); } bool onMove = true; bool saveChanges = step.SaveChanges(this.ProcessorArgs); var flowControl = step as IFlowControl; if (flowControl != null) { onMove = next ? flowControl.OnMovingNext(this.ProcessorArgs) : flowControl.OnMovingBack(this.ProcessorArgs); } if (!saveChanges || !onMove) { return(ProfileSection.Result(false)); } } catch (Exception ex) { WindowHelper.HandleError(ex.Message, true, ex); return(ProfileSection.Result(false)); } return(ProfileSection.Result(true)); } }
public virtual XmlDocument GetShowconfig(bool normalize = false) { using (new ProfileSection("Computing showconfig", this)) { try { ProfileSection.Argument("normalize", normalize); var showConfig = ConfigBuilder.Build(WebConfigPath, false, normalize); return(ProfileSection.Result(showConfig)); } catch (Exception ex) { throw new InvalidOperationException($"Failed to get showconfig of {Instance.WebRootPath}", ex); } } }
public void OnClick(Window mainWindow, Instance instance) { using (new ProfileSection("Publish", this)) { ProfileSection.Argument("mainWindow", mainWindow); ProfileSection.Argument("instance", instance); var modeText = GetMode(mainWindow); if (modeText == null || modeText == CancelOption) { return; } var mode = ParseMode(modeText); MainWindowHelper.Publish(instance, mainWindow, mode); } }
private static void LoadEnabledPlugin(Plugin plugin) { using (new ProfileSection("Loading enabled plugin", typeof(PluginManager))) { ProfileSection.Argument("plugin", plugin); try { plugin.Load(); ProfileSection.Result("Loaded"); } catch (Exception ex) { WindowHelper.HandleError("Error while loading {0} plugin".FormatWith(plugin.PluginFolder), true, ex); ProfileSection.Result("Failed"); } } }
public virtual XmlDocument GetWebConfigResult(bool normalize = false) { using (new ProfileSection("Computing web config result", this)) { try { ProfileSection.Argument("normalize", normalize); var webConfigResult = ConfigBuilder.Build(WebConfigPath, true, normalize); return(ProfileSection.Result(webConfigResult)); } catch (Exception ex) { throw new InvalidOperationException($"Failed to get web config result of {Instance.WebRootPath}", ex); } } }
public Wizard(WizardPipeline wizardPipeline, ProcessorArgs args, [NotNull] Func <WizardArgs> createWizardArgs) { using (new ProfileSection("Create wizard instance", this)) { ProfileSection.Argument("wizardPipeline", wizardPipeline); ProfileSection.Argument("args", args); WizardArgs = createWizardArgs(); WizardPipeline = wizardPipeline; Args = args; InitializeComponent(); ProgressBar1Foreground = progressBar1.Foreground; if (!WinAppSettings.AppSysIsSingleThreaded.Value) { CancelButton.IsCancel = false; ResizeMode = ResizeMode.CanMinimize; } } }
private static IEnumerable <Site> GetOperableSites([NotNull] WebServerManager.WebServerContext context, [CanBeNull] string defaultRootFolder = null) { Assert.IsNotNull(context, "Context cannot be null"); using (new ProfileSection("Getting operable sites")) { ProfileSection.Argument("context", context); ProfileSection.Argument("defaultRootFolder", defaultRootFolder); IEnumerable <Site> sites = context.Sites; if (defaultRootFolder != null) { instancesFolder = defaultRootFolder.ToLower(); sites = sites.Where(s => WebServerManager.GetWebRootPath(s).ToLower().Contains(instancesFolder)); } return(ProfileSection.Result(sites)); } }
internal void StartSection(string sectionName) { if (!Enabled) { return; } sectionName = activeSection.Name + "." + sectionName.ToLower(); ProfileSection child = activeSection.Children.Where(c => c.Name == sectionName).FirstOrDefault(); if (child == null) { child = new ProfileSection(sectionName); allSections.Add(child.Name, child); activeSection.Children.Add(child); child.Parent = activeSection; } activeSection = child; child.Stopwatch.Start(); }
private static void InitializeRibbonButton(MainWindow window, Func <string, ImageSource> getImage, ButtonDefinition button, RibbonGroupBox ribbonGroup) { using (new ProfileSection("Initialize ribbon button")) { ProfileSection.Argument("button", button); ProfileSection.Argument("ribbonGroup", ribbonGroup); ProfileSection.Argument("window", window); ProfileSection.Argument("getImage", getImage); try { // create handler var mainWindowButton = button.Handler; FrameworkElement ribbonButton; ribbonButton = GetRibbonButton(window, getImage, button, ribbonGroup, mainWindowButton); Assert.IsNotNull(ribbonButton, nameof(ribbonButton)); var width = button.Width; double d; if (!string.IsNullOrEmpty(width) && double.TryParse(width, out d)) { ribbonButton.Width = d; } // bind IsEnabled and IsVisible events if (mainWindowButton != null) { ribbonButton.Tag = mainWindowButton; ribbonButton.IsEnabled = mainWindowButton.IsEnabled(window, SelectedInstance); ribbonButton.Visibility = mainWindowButton.IsVisible(window, SelectedInstance) ? Visibility.Visible : Visibility.Collapsed; SetIsEnabledProperty(ribbonButton, mainWindowButton); SetIsVisibleProperty(ribbonButton, mainWindowButton); } } catch (Exception ex) { WindowHelper.HandleError($"Plugin Button caused an exception: {button.Label}", true, ex); } } }
public static bool CheckSqlServer() { if (!CheckSqlServerState.Value) { return(true); } try { using (new ProfileSection("Check SQL Server")) { var profile = ProfileManager.Profile; Assert.IsNotNull(profile, "Profile is unavailable"); var ds = new SqlConnectionStringBuilder(profile.ConnectionString).DataSource; var arr = ds.Split('\\'); var name = arr.Length == 2 ? arr[1] : String.Empty; var serviceName = GetSqlServerServiceName(profile.ConnectionString); if (String.IsNullOrEmpty(serviceName)) { WindowHelper.HandleError("The {0} instance of SQL Server cannot be reached".FormatWith(ds), false); return(ProfileSection.Result(false)); } ServiceController[] serviceControllers = ServiceController.GetServices(); ServiceController server = (!String.IsNullOrEmpty(name) ? serviceControllers.FirstOrDefault(s => s.ServiceName.EqualsIgnoreCase(name)) : null) ?? serviceControllers.FirstOrDefault( s => s.ServiceName.EqualsIgnoreCase(serviceName)) ?? serviceControllers.FirstOrDefault(s => s.ServiceName.EqualsIgnoreCase(serviceName)); Assert.IsNotNull(server, "Cannot find the " + (name.EmptyToNull() ?? "default") + " sql server instance"); var result = CheckSqlServer(server); return(ProfileSection.Result(result)); } } catch (Exception ex) { Log.Warn(ex, string.Format("Failed to check SQL Server state")); return(ProfileSection.Result(true)); } }
protected virtual string GetRootFolderViaDatabases(ICollection <Database> databases) { string webRootPath = this.WebRootPath; using (new ProfileSection("Get root folder (using databases)", this)) { ProfileSection.Argument("databases", databases); foreach (var database in databases) { Log.Debug("Database: {0}", database); string fileName = database.FileName; if (string.IsNullOrEmpty(fileName)) { Log.Warn("The {0} database seems to be detached since it doesn't have a FileName property filled in", database.RealName); continue; } Log.Debug( "name: {0}, fileName: {1}", database.Name, fileName); var folder = Path.GetDirectoryName(fileName); if (folder.ContainsIgnoreCase(webRootPath)) { continue; } Assert.IsNotNullOrEmpty(folder, "folder1"); var common = FileSystem.FileSystem.Local.Directory.FindCommonParent(webRootPath, folder); if (string.IsNullOrEmpty(common)) { continue; } if (Math.Abs(FileSystem.FileSystem.Local.Directory.GetDistance(webRootPath, common)) <= 1) { return(ProfileSection.Result(common)); } } return(ProfileSection.Result((string)null)); } }
public Wizard(WizardPipeline wizardPipeline, ProcessorArgs args, object[] parameters = null) { using (new ProfileSection("Create wizard instance", this)) { ProfileSection.Argument("wizardPipeline", wizardPipeline); ProfileSection.Argument("args", args); ProfileSection.Argument("parameters", parameters); this.wizardPipeline = wizardPipeline; this.args = args; this.InitializeComponent(); this.progressBar1Foreground = this.progressBar1.Foreground; this.wizardParams = parameters; if (!AppSettings.AppSysIsSingleThreaded.Value) { this.CancelButton.IsCancel = false; this.ResizeMode = ResizeMode.CanMinimize; } } }
private static void InitializeRibbonButton(MainWindow window, Func <string, ImageSource> getImage, XmlElement button, RibbonGroupBox ribbonGroup) { using (new ProfileSection("Initialize ribbon button")) { ProfileSection.Argument("button", button); ProfileSection.Argument("ribbonGroup", ribbonGroup); ProfileSection.Argument("window", window); ProfileSection.Argument("getImage", getImage); try { // create handler var mainWindowButton = (IMainWindowButton)Plugin.CreateInstance(button); FrameworkElement ribbonButton; ribbonButton = GetRibbonButton(window, getImage, button, ribbonGroup, mainWindowButton); Assert.IsNotNull(ribbonButton, nameof(ribbonButton)); var width = button.GetAttribute("width"); double d; if (!string.IsNullOrEmpty(width) && double.TryParse(width, out d)) { ribbonButton.Width = d; } // bind IsEnabled event if (mainWindowButton != null) { ribbonButton.Tag = mainWindowButton; ribbonButton.IsEnabled = mainWindowButton.IsEnabled(window, SelectedInstance); SetIsEnabledProperty(ribbonButton, mainWindowButton); } } catch (Exception ex) { WindowHelper.HandleError("Plugin Button caused an exception: " + button.OuterXml, true, ex); } } }
public static void Start(string name, Window owner, ProcessorArgs args = null, bool?isAsync = null, Action <WizardArgs> action = null, params object[] wizardArgsParameters) { Log.Info($"Wizard pipeline '{name}' starts"); using (new ProfileSection("Start wizard")) { ProfileSection.Argument("name", name); ProfileSection.Argument("owner", owner); ProfileSection.Argument("args", args); ProfileSection.Argument("wizardArgsParameters", wizardArgsParameters); WizardPipeline wizardPipeline = Definitions[name]; var wizard = CreateWizardWindow(wizardPipeline, args, wizardArgsParameters); var isSync = !(isAsync ?? !WinAppSettings.AppSysIsSingleThreaded.Value); if (isSync) { WindowHelper.ShowDialog(wizard, owner); if (action != null) { var wizardArgs = wizard.ProcessorArgs; action(wizardArgs); } } else { if (action != null && !flag) { flag = true; wizard.Closed += (o, e) => { var wizardArgs = wizard.ProcessorArgs; action(wizardArgs); flag = false; }; } WindowHelper.ShowWindow(wizard, owner); } } }
public static ICollection <MongoDbDatabase> GetMongoDatabases([NotNull] string webRootPath, XmlDocument webConfigDocument = null) { Assert.ArgumentNotNullOrEmpty(webRootPath, "webRootPath"); using (new ProfileSection("Get mongo databases from web.config", typeof(WebConfig))) { ProfileSection.Argument("webRootPath", webRootPath); ProfileSection.Argument("webConfigDocument", webConfigDocument); var databases = new List <MongoDbDatabase>(); webConfigDocument = webConfigDocument ?? GetWebConfig(webRootPath); XmlElement connectionStringsNode = webConfigDocument.SelectSingleNode("/configuration/connectionStrings") as XmlElement; if (connectionStringsNode != null) { Log.Debug("WebConfig:GetDatabases(...)#connectionStringsNode: " + connectionStringsNode.OuterXml); AddMongoDatabases(connectionStringsNode, databases); string configSourceValue = connectionStringsNode.GetAttribute("configSource"); Log.Debug("WebConfig:GetDatabases(...)#configSourceValue: " + configSourceValue); if (string.IsNullOrEmpty(configSourceValue)) { return(databases); } string filePath = Path.Combine(webRootPath, configSourceValue); Log.Debug("WebConfig:GetDatabases(...)#filePath: " + filePath); if (!FileSystem.FileSystem.Local.File.Exists(filePath)) { return(databases); } XmlDocumentEx document = XmlDocumentEx.LoadFile(filePath); XmlElement root = document.DocumentElement; if (root != null) { AddMongoDatabases(root, databases); } } return(ProfileSection.Result(databases)); } }
public void DeleteTempFolders() { using (new ProfileSection("Delete temp folders", this)) { var tempFoldersCacheFilePath = Path.Combine(ApplicationManager.TempFolder, "tempFolders.txt"); if (!System.IO.File.Exists(tempFoldersCacheFilePath)) { ProfileSection.Result("Skipped"); return; } var paths = System.IO.File.ReadAllLines(tempFoldersCacheFilePath); foreach (var path in paths) { DeleteIfExists(path); } System.IO.File.Delete(tempFoldersCacheFilePath); ProfileSection.Result("Done"); } }
private static void ExecuteInitProcessor(XmlElement processorNode) { using (new ProfileSection("Execute <init> processor", typeof(PluginManager))) { ProfileSection.Argument("processorNode", processorNode); var isAsync = processorNode.GetAttribute("mode").EqualsIgnoreCase("async"); var obj = (IInitProcessor)Plugin.CreateInstance(processorNode); if (!isAsync) { obj.Process(); ProfileSection.Result("Done"); return; } ExecuteAsync(obj.Process); ProfileSection.Result("Started async"); } }
private void FinishUnsafe([NotNull] string message, bool allDone) { Assert.ArgumentNotNull(message, nameof(message)); using (new ProfileSection("Finish wizard (unsafe)", this)) { ProfileSection.Argument("message", message); ProfileSection.Argument("allDone", allDone); if (allDone) { WizardPipeline.AfterLastStep?.Execute(this.WizardArgs); AddFinishActions(WizardPipeline._FinishActions); if (WizardPipeline._FinishActionHives != null) { foreach (FinishActionHive hive in WizardPipeline._FinishActionHives.NotNull()) { AddFinishActions(hive.GetFinishActions(WizardArgs)); } } FinishTextBlock.Text = WizardPipeline.FinishText; TaskbarItemInfo.ProgressState = TaskbarItemProgressState.None; Progress = 0; NextButton.Visibility = Visibility.Hidden; CancelButton.Content = "Finish"; CancelButton.Focus(); PageNumber++; HeaderDetails.Text = "Completed"; } else { SetStatusUnsafe("Some steps require your attention"); TaskbarItemInfo.ProgressState = TaskbarItemProgressState.Error; progressBar1.Foreground = Brushes.Red; NextButton.IsEnabled = true; } } }
private bool Grant(string path, string accountName) { if (!FileSystem.FileSystem.Local.Directory.Exists(path)) { WindowHelper.ShowMessage( "The \"{0}\" folder does not exist, please create it or return to preceding step to change it".FormatWith(path), MessageBoxButton.OK, MessageBoxImage.Asterisk); return(false); } try { FileSystem.FileSystem.Local.Security.EnsurePermissions(path, accountName); return(ProfileSection.Result(true)); } catch (Exception ex) { Log.Error(ex, "Granting security permissions failed"); WindowHelper.ShowMessage(string.Format("Something went wrong while assigning necessary permissions, so please assign them manually: grant the \"{0}\" folder with FULL ACCESS rights for {1} user account.", path, accountName), MessageBoxButton.OK, MessageBoxImage.Asterisk); return(ProfileSection.Result(false)); } }
private void FinishUnsafe([NotNull] string message, bool allDone) { Assert.ArgumentNotNull(message, "message"); using (new ProfileSection("Finish wizard (unsafe)", this)) { ProfileSection.Argument("message", message); ProfileSection.Argument("allDone", allDone); if (allDone) { this.AddFinishActions(this.wizardPipeline.FinishActions); if (this.wizardPipeline.FinishActionHives != null) { foreach (FinishActionHive hive in this.wizardPipeline.FinishActionHives.NotNull()) { this.AddFinishActions(hive.GetFinishActions(this.ProcessorArgs)); } } this.FinishTextBlock.Text = this.wizardPipeline.FinishText; this.TaskbarItemInfo.ProgressState = TaskbarItemProgressState.None; this.Progress = 0; this.NextButton.Visibility = Visibility.Hidden; this.CancelButton.Content = "Finish"; this.CancelButton.Focus(); this.PageNumber++; this.HeaderDetails.Text = "Completed"; } else { this.SetStatusUnsafe("Some steps require your attention"); this.TaskbarItemInfo.ProgressState = TaskbarItemProgressState.Error; this.progressBar1.Foreground = Brushes.Red; this.NextButton.IsEnabled = true; } } }
public void ToggleMarkedSection() { ProfileSection profileSection = allSections[SelectedSection]; ProfileSection markedSection = allSections[MarkedSection]; if (profileSection == markedSection) { MarkedSection = profileSection.Children[0].Name; } else { int newIndex = profileSection.Children.IndexOf(markedSection); if (newIndex == profileSection.Children.Count - 1) { MarkedSection = SelectedSection; } else { MarkedSection = profileSection.Children[newIndex + 1].Name; } } }
public override void Process(HttpRequestArgs args) { Assert.ArgumentNotNull(args, nameof(args)); using (ProfileSection profileSection = new ProfileSection("Resolve AMP device.")) { Database database = Context.Database; SiteContext site = Context.Site; if (database != null) { //Get the ampDevice from Site context if (site.Properties[Constants.AMPDevice] != null) { DeviceItem deviceItem = database.Resources.Devices[site.Properties[Constants.AMPDevice]]; if (Context.RawUrl.ToLower().EndsWith(Constants.AMPPrefix)) { Context.Device = deviceItem; Tracer.Info(String.Format("Device set to \"{0}\".", deviceItem.Name)); } } } } }
private static bool ExecuteProcessors([NotNull] ProcessorArgs args, [NotNull] IEnumerable <Processor> processorList, [CanBeNull] IPipelineController controller = null, bool startThisAndNestedProcessors = true) { Assert.ArgumentNotNull(args, nameof(args)); Assert.ArgumentNotNull(processorList, nameof(processorList)); using (new ProfileSection("Execute pipeline processors")) { ProfileSection.Argument("args", args); ProfileSection.Argument("processorList", processorList); ProfileSection.Argument("controller", controller); ProfileSection.Argument("startThisAndNestedProcessors", startThisAndNestedProcessors); bool result = startThisAndNestedProcessors; foreach (Processor processor in processorList) { bool processorResult = startThisAndNestedProcessors; if (processorResult) { processorResult = processor.Execute(args); } else { processor.Skip(); } if (controller != null) { controller.IncrementProgress(); } // Process nested steps result &= ExecuteProcessors(args, processor._NestedProcessors, controller, processorResult); } return(ProfileSection.Result(result)); } }
public static void InitializeContextMenu(ButtonDefinition[] menuItems) { using (new ProfileSection("Initialize context menu")) { MainWindow window = MainWindow.Instance; foreach (var item in menuItems) { using (new ProfileSection("Fill in context menu")) { ProfileSection.Argument("item", item); var header = item.Label; if (string.IsNullOrEmpty(header)) { window.ContextMenu.Items.Add(new Separator()); continue; } InitializeContextMenuItem(item, window.ContextMenu.Items, window, uri => Plugin.GetImage(uri)); } } } }
private bool Grant(string path, string accountName) { if (!FileSystem.FileSystem.Local.Directory.Exists(path)) { WindowHelper.ShowMessage( "The \"{0}\" folder does not exist, please create it or return to preceding step to change it".FormatWith(path), MessageBoxButton.OK, MessageBoxImage.Asterisk); return(false); } try { FileSystem.FileSystem.Local.Security.EnsurePermissions(path, accountName); return(ProfileSection.Result(true)); } catch (Exception ex) { Log.Error("Granting security permissions failed", this, ex); WindowHelper.ShowMessage("Something went wrong while assigning necessary permissions, so please do it manually according to the guide that will be opened.", MessageBoxButton.OK, MessageBoxImage.Asterisk); this.ShowGuide(); return(ProfileSection.Result(false)); } }
public static string ReplaceVariables([NotNull] string message, [NotNull] object args) { Assert.ArgumentNotNull(message, nameof(message)); Assert.ArgumentNotNull(args, nameof(args)); using (new ProfileSection("Replace pipeline variables in message")) { ProfileSection.Argument("message", message); ProfileSection.Argument("args", args); Type type = args.GetType(); foreach (var propertyName in message.Extract('{', '}', false)) { var propertyValue = type.GetProperty(propertyName, BindingFlags.Public | BindingFlags.Instance).GetValue(args, new object[0]) as string; if (propertyValue != null) { message = message.Replace('{' + propertyName + '}', propertyValue); } } return(ProfileSection.Result(message)); } }
public static XmlDocumentEx Compute(string packageFile, string originalName = null) { using (new ProfileSection("Compute manifest")) { ProfileSection.Argument("packageFile", packageFile); ProfileSection.Argument("originalName", originalName); try { var manifestLookupFolders = GetManifestLookupFolders(packageFile); var fileNamePatterns = GetFileNamePatterns(packageFile, originalName); var result = Compute(packageFile, manifestLookupFolders, fileNamePatterns); return(ProfileSection.Result(result)); } catch (Exception ex) { Log.Error(ex, string.Format("Failed to build a manifest for " + packageFile)); return(Product.EmptyManifest); } } }
public override void Process(HttpRequestArgs args) { Assert.ArgumentNotNull(args, nameof(args)); using (ProfileSection profileSection = new ProfileSection("Resolve Sitecore item from AMP URL.")) { var localPath = args.LocalPath.ToLower(); if (!String.IsNullOrEmpty(localPath) && args.LocalPath.StartsWith(Constants.AMPPrefix)) { var path = localPath.Replace(Constants.AMPPrefix, Constants.URLSepatator); var itemPath = String.Format("{0}{1}", Sitecore.Context.Site.StartPath, path); Sitecore.Data.Items.Item item = Sitecore.Context.Database.GetItem(itemPath); if (item != null) { Sitecore.Context.Item = item; Tracer.Info($"Item resolved from AMP URL: {localPath}"); } else { Tracer.Warning($"No item found from AMP URL: {localPath}"); } } } }
public override void Initialize(string name, NameValueCollection config) { if (config == null) { throw new ArgumentNullException("config"); } if (string.IsNullOrEmpty(name)) { name = "DerbyProfileProvider"; } if (string.IsNullOrEmpty(config ["description"])) { config.Remove("description"); config.Add("description", "Derby profile provider"); } base.Initialize(name, config); _applicationName = GetStringConfigValue(config, "applicationName", "/"); ProfileSection profileSection = (ProfileSection)WebConfigurationManager.GetSection("system.web/profile"); string connectionStringName = config ["connectionStringName"]; _connectionString = WebConfigurationManager.ConnectionStrings [connectionStringName]; if (_connectionString == null) { throw new ProviderException(String.Format("The connection name '{0}' was not found in the applications configuration or the connection string is empty.", connectionStringName)); } string shutdown = config ["shutdown"]; if (!String.IsNullOrEmpty(shutdown)) { _shutDownPolicy = (DerbyUnloadManager.DerbyShutDownPolicy)Enum.Parse(typeof(DerbyUnloadManager.DerbyShutDownPolicy), shutdown, true); } }
public RenderingSection( ProfileSection parent ) : base(parent, "Rendering") { PlanetRendering = new PlanetRenderingSection( this ); StarSphereRendering = new ProfileSection(this, "Star Sphere Rendering"); }
public void SetSectionPen( ProfileSection section, Pen colour ) { if ( !m_SectionPens.ContainsKey( section ) ) { m_SectionPens.Add( section, colour ); } else { m_SectionPens[ section ] = colour; } }
public RootSection( ) : base("Game") { Rendering = new RenderingSection( this ); CloudGeneration = new ProfileSection( this, "Cloud Generation" ); }
private TreeNode CreateNodeForSection( ProfileSection section ) { TreeNode node = new TreeNode( section.Name ); node.Tag = section; foreach ( ProfileSection subSection in section.SubSections ) { node.Nodes.Add( CreateNodeForSection( subSection ) ); } return node; }
private static void DrawSection( Graphics graphics, Pen pen, int samplesPerTick, float zoom, double maxTime, int startX, int xStep, int height, ProfileSection section ) { IEnumerator<ProfileSection.Sample> samplePos = section.Samples.GetEnumerator( ); if ( !samplePos.MoveNext( ) ) { return; } // Move past first total % samplesPerTick samples int skip = section.TotalSampleCount % samplesPerTick; for ( int i = 0; i < skip; ++i ) { if ( !samplePos.MoveNext( ) ) { return; } } bool done; int x = startX; double normalize = zoom / maxTime; float lastY = ( float )( AverageNSamples( samplePos, samplesPerTick, out done ) * normalize ) * height; while ( !done ) { float y = ( float )( AverageNSamples( samplePos, samplesPerTick, out done ) * normalize ) * height; if ( !done ) { graphics.DrawLine( pen, x - xStep, height - y, x, height - lastY ); } lastY = y; x -= xStep; if ( x < 0 ) { break; } } }
private void SectionReset( ProfileSection section ) { Invalidate( ); }
public Pen GetSectionPen( ProfileSection section ) { return !m_SectionPens.ContainsKey( section ) ? Pens.Black : m_SectionPens[ section ]; }