Exemple #1
0
    private static void LoadStylesheetsFromFile(string stylesheetsFileName)
    {
        string xml = XmlHelper.ReadXmlFromFile(stylesheetsFileName);

        StylesheetHelper.StylesheetCollection                   = StylesheetHelper.XmlToStylesheetCollection(xml);
        StylesheetHelper.StylesheetCollectionFileName           = stylesheetsFileName;
        SessionHelper.EnableLoadLastSessionStylesheetCollection = false;
    }
Exemple #2
0
    public static void LoadLastSession()
    {
        if (EnableLoadLastSessionTaskCollection)
        {
            TaskHelper.TaskCollectionFileName = RegistryHandler.ReadFromRegistry("TaskCollectionFileName");

            if (TaskHelper.TaskCollectionFileName == "")
            {
                TaskHelper.TaskCollectionFileName = null;
            }
            else
            {
                TaskCollection temporaryTaskCollection = TaskHelper.XmlToTaskCollection(XmlHelper.ReadXmlFromFile(TaskHelper.TaskCollectionFileName));

                if (temporaryTaskCollection == null)
                {
                    TaskHelper.TaskCollectionFileName = null;
                }
                else
                {
                    TaskHelper.TaskCollection = temporaryTaskCollection;
                }
            }
        }

        if (EnableLoadLastSessionStylesheetCollection)
        {
            StylesheetHelper.StylesheetCollectionFileName = RegistryHandler.ReadFromRegistry("StylesheetCollectionFileName");

            if (StylesheetHelper.StylesheetCollectionFileName == "")
            {
                StylesheetHelper.StylesheetCollectionFileName = null;
            }
            else
            {
                StylesheetCollection temporaryStylesheetCollection = StylesheetHelper.XmlToStylesheetCollection(XmlHelper.ReadXmlFromFile(StylesheetHelper.StylesheetCollectionFileName));

                if (StylesheetHelper.StylesheetCollection == null)
                {
                    StylesheetHelper.StylesheetCollectionFileName = null;
                }
                else
                {
                    StylesheetHelper.StylesheetCollection = temporaryStylesheetCollection;
                }
            }
        }
    }
Exemple #3
0
    private bool Import(string xml)
    {
        StylesheetCollection temporaryStylesheetCollection = StylesheetHelper.XmlToStylesheetCollection(xml);

        if (temporaryStylesheetCollection != null)
        {
            StylesheetHelper.StylesheetCollection = temporaryStylesheetCollection;
            FillList();
            SelectFirstItem();

            descriptionTextBox.Text = StylesheetHelper.StylesheetCollection.Description;
            SetChangesMade(false);
            return(true);
        }

        return(false);
    }
    public static void LoadConfig()
    {
        ConnectionString = ConnectionStringSecurity.Decode(RegistryHandler.ReadFromRegistry("ConnectionString"), "ConnectionString");

        if (ConnectionString == "")
        {
            ConnectionString = @"Data Source=SQLServerName\SQLServerInstance;Initial Catalog=master;Integrated Security=True";
        }

        ConnectionStringToSave = ConnectionStringSecurity.Decode(RegistryHandler.ReadFromRegistry("ConnectionString"), "ConnectionString");

        if (ConnectionStringToSave == "")
        {
            ConnectionStringToSave = @"Data Source=SQLServerName\SQLServerInstance;Initial Catalog=master;Integrated Security=True";
        }

        SaveConnectionString = RegistryHandler.ReadFromRegistry("SaveConnectionString");

        if (SaveConnectionString == "")
        {
            SaveConnectionString = "True";
        }

        WordWrap = RegistryHandler.ReadFromRegistry("WordWrap");

        if (WordWrap == "")
        {
            WordWrap = "False";
        }

        if (TraceFileDirectory == null)
        {
            TraceFileDirectory = "";
        }

        EditWindowSize = RegistryHandler.ReadFromRegistry("EditWindowSize");

        if (EditWindowSize == "")
        {
            EditWindowSize = GenericHelper.DefaultWindowSize;
        }

        EditorWindowSize = RegistryHandler.ReadFromRegistry("EditorWindowSize");

        if (EditorWindowSize == "")
        {
            EditorWindowSize = GenericHelper.DefaultWindowSize;
        }

        CommandLineParametersWindowSize = RegistryHandler.ReadFromRegistry("CommandLineParametersWindowSize");

        if (CommandLineParametersWindowSize == "")
        {
            CommandLineParametersWindowSize = GenericHelper.DefaultWindowSize;
        }

        MainWindowSize = RegistryHandler.ReadFromRegistry("MainWindowSize");

        if (MainWindowSize == "")
        {
            MainWindowSize = GenericHelper.DefaultWindowSize;
        }

        ResultsWindowSize = RegistryHandler.ReadFromRegistry("ResultsWindowSize");

        if (ResultsWindowSize == "")
        {
            ResultsWindowSize = GenericHelper.DefaultWindowSize;
        }

        ValueSubstitutorWindowSize = RegistryHandler.ReadFromRegistry("ValueSubstitutorWindowSize");

        if (ValueSubstitutorWindowSize == "")
        {
            ValueSubstitutorWindowSize = GenericHelper.DefaultWindowSize;
        }

        EditorFontFamily = RegistryHandler.ReadFromRegistry("EditorFontFamily");

        if (EditorFontFamily == "")
        {
            EditorFontFamily = "Courier New";
        }

        EditorFontSize = RegistryHandler.ReadFromRegistry("EditorFontSize");

        if (EditorFontSize == "")
        {
            EditorFontSize = "10";
        }

        DefaultStylesheet = RegistryHandler.ReadFromRegistry("DefaultStylesheet");

        if (DefaultStylesheet == "")
        {
            DefaultStylesheet = "Graphs";
        }

        UseExtendedEvents = RegistryHandler.ReadFromRegistry("UseExtendedEvents");

        if (UseExtendedEvents == "")
        {
            UseExtendedEvents = "";
        }

        IgnoreErrors = RegistryHandler.ReadFromRegistry("IgnoreErrors");

        OfflineMode = RegistryHandler.ReadFromRegistry("OfflineMode");

        if (OfflineMode == "")
        {
            OfflineMode = "False";
        }

        OfflineModeToSave = RegistryHandler.ReadFromRegistry("OfflineModeToSave");

        if (OfflineModeToSave == "")
        {
            OfflineModeToSave = "False";
        }

        CheckForUpdatesOnStart = RegistryHandler.ReadFromRegistry("CheckForUpdatesOnStart");

        if (CheckForUpdatesOnStart == "")
        {
            CheckForUpdatesOnStart = "True";
        }

        string installed = RegistryHandler.ReadFromRegistry("Installed", Registry.CurrentUser);

        if (installed == "1")
        {
            SaveConfig();             // To set default values in registry

            if (TaskHelper.TaskCollection.Tasks.Count == 0)
            {
                TaskHelper.TaskCollection.Description = "No Task Collection loaded.\r\nTo load or create a Task Collection choose \"Options\", \"Task Collection Editor...\".";
                TaskHelper.TaskCollection.Connections = 1;
                TaskHelper.TaskCollection.PerformanceCountersSamplingInterval = 0;
                TaskHelper.TaskCollection.TimeBetweenConnections = 0;
            }

            if (StylesheetHelper.StylesheetCollection.Stylesheets.Count == 0)
            {
                StylesheetHelper.StylesheetCollection = StylesheetHelper.XmlToStylesheetCollection(PerformanceTestTool.Properties.Resources.DefaultStylesheets);
            }

            SessionHelper.SaveSession();
            RegistryHandler.SaveToRegistry("Installed", "2", Registry.CurrentUser);
        }

        UpdateServiceUrl = RegistryHandler.ReadFromRegistry("UpdateServiceUrl");

        if (UpdateServiceUrl == "")
        {
            UpdateServiceUrl = "http://virtcore.com/VirtcoreService.asmx";
            RegistryHandler.SaveToRegistry("UpdateServiceUrl", UpdateServiceUrl);
        }
    }