<commit_before>﻿//******************************************************************************************************
//  CommonFunctions.cs - Gbtc
//
//  Copyright © 2012, Grid Protection Alliance.  All Rights Reserved.
//
//  Licensed to the Grid Protection Alliance (GPA) under one or more contributor license agreements. See
//  the NOTICE file distributed with this work for additional information regarding copyright ownership.
//  The GPA licenses this file to you under the MIT License (MIT), the "License"; you may
//  not use this file except in compliance with the License. You may obtain a copy of the License at:
//
//      http://www.opensource.org/licenses/MIT
//
//  Unless agreed to in writing, the subject software distributed under the License is distributed on an
//  "AS-IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. Refer to the
//  License for the specific language governing permissions and limitations.
//
//  Code Modification History:
//  ----------------------------------------------------------------------------------------------------
//  03/31/2011 - <NAME>
//       Generated original version of source code.
//  12/20/2012 - <NAME>
//       Modified Header.
//
//******************************************************************************************************

using System;
using System.Collections.Generic;
using System.Data;
using System.Diagnostics;
using System.IO.Ports;
using System.Linq;
using System.Net;
using System.Net.Sockets;
using System.Security.Principal;
using System.Threading;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Documents;
using System.Windows.Media;
using System.Windows.Threading;
using GSF.Communication;
using GSF.Data;
using GSF.Identity;
using GSF.IO;
using GSF.Security;
using GSF.TimeSeries.UI.DataModels;

namespace GSF.TimeSeries.UI
{
    /// <summary>
    /// Represents a static class containing common methods.
    /// </summary>
    public static class CommonFunctions
    {
        #region [ Members ]

        /// <summary>
        /// Defines the default settings category for TimeSeriesFramework data connections.
        /// </summary>
        public const string DefaultSettingsCategory = "systemSettings";

        /// <summary>
        /// Defines the maximum number of pages to be stored in page history.
        /// </summary>
        public const int MaxPageHistory = 10;

        #endregion

        #region [ Static ]

        // Static Fields
        private static SecurityPrincipal s_currentPrincipal;
        private static Guid s_currentNodeID;
        private static string s_serviceConnectionString;
        private static string s_dataPublisherConnectionString;
        private static string s_realTimeStatisticServiceUrl;
        private static string s_timeSeriesDataServiceUrl;
        private static WindowsServiceClient s_windowsServiceClient;
        private static bool s_retryServiceConnection;
        private static LinkedList<Tuple<string, Type, object[]>> s_pageHistory;
        private static LinkedListNode<Tuple<string, Type, object[]>> s_currentPage;

        // Static Properties

        /// <summary>
        /// Defines the current principal for the thread owning the common functions.
        /// </summary>
        public static SecurityPrincipal CurrentPrincipal
        {
            get
            {
                return s_currentPrincipal;
            }
            set
            {
                s_currentPrincipal = value;
            }
        }

        /// <summary>
        /// Defines the current user name as defined in the CurrentPrincipal.Identity.
        /// </summary>
        public static string CurrentUser = CurrentPrincipal.Identity.Name;

        /// <summary><commit_msg>GSF.TimeSeries.UI: Fixed NullReferenceException in the manager at startup.<commit_after>﻿//******************************************************************************************************
//  CommonFunctions.cs - Gbtc
//
//  Copyright © 2012, Grid Protection Alliance.  All Rights Reserved.
//
//  Licensed to the Grid Protection Alliance (GPA) under one or more contributor license agreements. See
//  the NOTICE file distributed with this work for additional information regarding copyright ownership.
//  The GPA licenses this file to you under the MIT License (MIT), the "License"; you may
//  not use this file except in compliance with the License. You may obtain a copy of the License at:
//
//      http://www.opensource.org/licenses/MIT
//
//  Unless agreed to in writing, the subject software distributed under the License is distributed on an
//  "AS-IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. Refer to the
//  License for the specific language governing permissions and limitations.
//
//  Code Modification History:
//  ----------------------------------------------------------------------------------------------------
//  03/31/2011 - <NAME>
//       Generated original version of source code.
//  12/20/2012 - <NAME>
//       Modified Header.
//
//******************************************************************************************************

using System;
using System.Collections.Generic;
using System.Data;
using System.Diagnostics;
using System.IO.Ports;
using System.Linq;
using System.Net;
using System.Net.Sockets;
using System.Security.Principal;
using System.Threading;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Documents;
using System.Windows.Media;
using System.Windows.Threading;
using GSF.Communication;
using GSF.Data;
using GSF.Identity;
using GSF.IO;
using GSF.Security;
using GSF.TimeSeries.UI.DataModels;

namespace GSF.TimeSeries.UI
{
    /// <summary>
    /// Represents a static class containing common methods.
    /// </summary>
    public static class CommonFunctions
    {
        #region [ Members ]

        /// <summary>
        /// Defines the default settings category for TimeSeriesFramework data connections.
        /// </summary>
        public const string DefaultSettingsCategory = "systemSettings";

        /// <summary>
        /// Defines the maximum number of pages to be stored in page history.
        /// </summary>
        public const int MaxPageHistory = 10;

        #endregion

        #region [ Static ]

        // Static Fields
        private static SecurityPrincipal s_currentPrincipal;
        private static Guid s_currentNodeID;
        private static string s_serviceConnectionString;
        private static string s_dataPublisherConnectionString;
        private static string s_realTimeStatisticServiceUrl;
        private static string s_timeSeriesDataServiceUrl;
        private static WindowsServiceClient s_windowsServiceClient;
        private static bool s_retryServiceConnection;
        private static LinkedList<Tuple<string, Type, object[]>> s_pageHistory;
        private static LinkedListNode<Tuple<string, Type, object[]>> s_currentPage;

        // Static Properties

        /// <summary>
        /// Defines the current principal for the thread owning the common functions.
        /// </summary>
        public static SecurityPrincipal CurrentPrincipal
        {
            get
            {
                return s_currentPrincipal;
            }
            set
            {
                s_currentPrincipal = value;
            }
        }

        /// <summary>
        /// Defines the current user name as defined in the CurrentPrincipal.Identity.
        /// </summary>
        public static string CurrentUser => CurrentPrincipal.Identity.Name;

        /// <summary>
{'fraction_non_alphanumeric': 0.15508780991735538, 'fraction_numerical': 0.005681818181818182, 'mean_word_length': 2.534915563669557, 'pattern_counts': {'":': 0, '<': 37, '<?xml version=': 0, '>': 38, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5775583', 'n_tokens_mistral': 1849, 'n_tokens_neox': 1749, 'n_words': 646}