Example #1
0
        static void Swap(ref ConfigurationList a, ref ConfigurationList b)
        {
            ConfigurationList tmp = a;

            a = b;
            b = tmp;
        }
        private void RenderModel()
        {
            // Get inputs
            GetInput();

            // If inputs are valid, get model
            if (ValidInput())
            {
                model = GetModel();
            }

            // If config file is not used, create a list to store current model rendering configurations
            if (!load_config)
            {
                list = ConfigurationList.CreateList(1);
                list.ModelConfig[0] = ConfigurationList.CreateNode();
            }

            // Set initial rendering parameters, as stored in the configuration list
            ResetRenderingConfigurations();

            // Initialize position and rotation of camera in 2D desktop view
            if (initialize_fallback_camera)
            {
                ResetFallbackCamera();
            }
        }
        private void LoadConfigurable(Type configurable)
        {
            string            path                      = null;
            ConfigurationList configurations            = null;
            Dictionary <Type, IConfigurable> dictionary = null;
            IConfigurable cfg = (IConfigurable)Activator.CreateInstance(configurable);

            path           = cfg.ConfigurationDirectory;
            configurations = cfg.Configurations;
            dictionary     = cfg.ConfigurationDictionary;
            if (dictionary != null)
            {
                dictionary.Add(configurable, cfg);
            }

            UniversalData UniData;

            if (_SavedConfigs.ContainsKey(cfg))
            {
                UniData = _SavedConfigs[cfg];
            }
            else
            {
                UniData = new UniversalData(PointBlankServer.ConfigurationsPath + "/" + (string.IsNullOrEmpty(path) ? "" : path + "/") + configurable.Name);
            }
            JsonData JSON = UniData.GetData(EDataType.JSON) as JsonData;

            if (!_SavedConfigs.ContainsKey(cfg))
            {
                _SavedConfigs.Add(cfg, UniData);
            }
            if (UniData.CreatedNew)
            {
                foreach (KeyValuePair <string, object> kvp in configurations)
                {
                    if (JSON.CheckKey(kvp.Key))
                    {
                        JSON.Document[kvp.Key] = JToken.FromObject(kvp.Value);
                    }
                    else
                    {
                        JSON.Document.Add(kvp.Key, JToken.FromObject(kvp.Value));
                    }
                }
            }
            else
            {
                foreach (JProperty property in JSON.Document.Properties())
                {
                    if (configurations[property.Name] == null)
                    {
                        continue;
                    }

                    configurations[property.Name] = property.Value.ToObject(configurations[property.Name].GetType());
                }
            }
            UniData.Save();
        }
Example #4
0
        /// <summary>
        /// Constructs a new <see cref="JsonSerializerOptions"/> instance.
        /// </summary>
        public JsonSerializerOptions()
        {
            _converters = new ConfigurationList <JsonConverter>(this);

#pragma warning disable CA2252 // This API requires opting into preview features
            _polymorphicTypeConfigurations = new ConfigurationList <JsonPolymorphicTypeConfiguration>(this)
            {
                OnElementAdded = static config => { config.IsAssignedToOptionsInstance = true; }
        private void StoreConfig()
        {
            ConfigList clist = ConfigurationList.CreateList(1);

            clist.ModelConfig[0] = ConfigurationList.CreateNode();

            string jsonOut = path_to_configs + output + ".json";

            File.WriteAllText(jsonOut, JsonUtility.ToJson(clist));
        }
        public static void EnsureConfigurationListForAnySite(SPSite site)
        {
            // Act
            ConfigurationList.EnsureConfigurationList(site);

            // Assert
            var rootWeb = site.RootWeb;
            var list    = rootWeb.Lists[ConfigurationList.ConfigListName];

            Assert.IsNotNull(list);
        }
        public ConfigurationForm()
        {
            InitializeComponent();

            Icon = ResourceStore.LoadIcon("Icons/Application.ico");

            mConfigurationList = ( ConfigurationList )ConfigurationList.Instance.Clone();

            mOriginalMap = new Dictionary <Configuration, Configuration>();
            for (int i = 0; i < mConfigurationList.Configurations.Count; i++)
            {
                mOriginalMap[mConfigurationList.Configurations[i]] = ConfigurationList.Instance.Configurations[i];
            }
        }
Example #8
0
        private void RemoveConfigGroup(object obj)
        {
            ConfigurationGroup configGroup = obj as ConfigurationGroup;

            if (configGroup != null)
            {
                var result = MessageBox.Show("Are you sure you want to remove this Configuration Group?", "",
                                             MessageBoxButton.YesNo);
                if (result == MessageBoxResult.Yes)
                {
                    ConfigurationList.Remove(configGroup);
                }
            }
        }
Example #9
0
        public Bundle BuildBundle()
        {
            Bundle bundle = new Bundle();

            bundle.PutInt("CurrentPageIndex", CurrentPageIndex);
            bundle.PutString("Site", Site);
            //User Information
            bundle.PutString("User", User);
            bundle.PutString("Password", Password);
            bundle.PutString("UserDesc", UserDesc);
            bundle.PutString("EmpNum", EmpNum);
            bundle.PutString("EmpName", EmpName);
            bundle.PutString("Currency", Currency);
            bundle.PutString("DefaultWarehouse", DefaultWarehouse);
            bundle.PutString("DefaultLocation", DefaultLocation);
            bundle.PutString("QuantityFormat", QuantityFormat);
            bundle.PutString("AmountFormat", AmountFormat);

            //Login Configurations
            bundle.PutString("Token", Token);
            bundle.PutString("Theme", Theme);
            bundle.PutString("CSIWebServerName", CSIWebServerName);
            bundle.PutBoolean("EnableHTTPS", EnableHTTPS);
            bundle.PutString("Configuration", Configuration);
            bundle.PutStringArray("ConfigurationList", ConfigurationList.ToArray());
            bundle.PutString("RecordCap", RecordCap);
            bundle.PutBoolean("SaveUser", SaveUser);
            bundle.PutString("SavedUser", SavedUser);
            bundle.PutBoolean("SavePassword", SavePassword);
            bundle.PutString("SavedPassword", SavedPassword);
            bundle.PutBoolean("UseRESTForRequest", UseRESTForRequest);
            bundle.PutBoolean("LoadPicture", LoadPicture);
            bundle.PutBoolean("ForceAutoPost", ForceAutoPost);
            bundle.PutBoolean("ShowSuccessMessage", ShowSuccessMessage);
            bundle.PutBoolean("DisplayWhenError", DisplayWhenError);

            //Passed Key Information
            bundle.PutString("Key", Key);
            bundle.PutString("LineSuffix", LineSuffix);
            bundle.PutString("Release", Release);
            bundle.PutString("Key2", Key2);
            bundle.PutString("LineSuffix2", LineSuffix2);
            bundle.PutString("Release2", Release2);

            //License
            bundle.PutString("LicenseString", LicenseString);
            bundle.PutString("ExpDate", ExpDate);

            return(bundle);
        }
Example #10
0
    public SCADAAnalogChangedNotificationResponse SCADAAnalogChangedNotification(SCADAAnalogChangedNotificationRequest request)
    {
        LogInfo("SCADAAnalogChangedNotification() Entered");
        String message = String.Empty;
        SCADAAnalogChangedNotificationResponse response = new SCADAAnalogChangedNotificationResponse();

        try
        {
            if (_UdpClient == null)
            {
                String            path = @"C:\\DCSystems\Logs\";
                ConfigurationList cl   = new ConfigurationList();
                cl.Add("Process Name", "MockNotServerService");
                cl.Add("Log Output Directory", path);
                _Logger = new Logger(cl);

                LogInfo("()");

                _UdpClient = new UdpClient();
                _UdpClient.Connect(new IPEndPoint(IPAddress.Parse("127.0.0.1"), 7373));
            }
            for (int i = 0; i < request.scadaAnalogs.Length; i++)
            {
                if (i == 0)
                {
                    message += String.Format("{0},{1:0.000} {2}   {3} GMT", request.scadaAnalogs[i].objectID, request.scadaAnalogs[i].value.Value, request.scadaAnalogs[i].value.units, request.scadaAnalogs[i].timeStamp);
                }
                else
                {
                    message += String.Format(";{0},{1:0.000} {2}   {3} GMT", request.scadaAnalogs[i].objectID, request.scadaAnalogs[i].value.Value, request.scadaAnalogs[i].value.units, request.scadaAnalogs[i].timeStamp);
                }
            }
            Byte[] sendBytes = Encoding.ASCII.GetBytes(message);
            _UdpClient.Send(sendBytes, sendBytes.Length);

            response.MultiSpeakMsgHeader = new MultiSpeakMsgHeader();
            response.MultiSpeakMsgHeader.TimeStampSpecified = true;
            response.MultiSpeakMsgHeader.TimeStamp          = DateTime.Now;
            response.SCADAAnalogChangedNotificationResult   = null;
            return(response);
        }
        catch (Exception ex)
        {
            LogError(String.Format("SCADAAnalogChangedNotification() ex:{0}", ex));
            response.SCADAAnalogChangedNotificationResult          = new errorObject[1];
            response.SCADAAnalogChangedNotificationResult[0]       = new errorObject();
            response.SCADAAnalogChangedNotificationResult[0].Value = ex.Message;
            return(response);
        }
    }
Example #11
0
    public PingURLResponse PingURL(PingURLRequest request)
    {
        LogInfo("PingURL() Entered");
        PingURLResponse response = new PingURLResponse();

        try
        {
            if (_UdpClient == null)
            {
                String            path = @"C:\\DCSystems\Logs\";
                ConfigurationList cl   = new ConfigurationList();
                cl.Add("Process Name", "MockNotServerService");
                cl.Add("Log Output Directory", path);
                _Logger = new Logger(cl);

                LogInfo("()");

                _UdpClient = new UdpClient();
                _UdpClient.Connect(new IPEndPoint(IPAddress.Parse("127.0.0.1"), 7373));
            }
            Byte[] sendBytes = Encoding.ASCII.GetBytes("PingURL,OK");
            _UdpClient.Send(sendBytes, sendBytes.Length);

            response.MultiSpeakMsgHeader = new MultiSpeakMsgHeader();
            response.MultiSpeakMsgHeader.MinorVersion       = "4";
            response.MultiSpeakMsgHeader.MinorVersion       = "1";
            response.MultiSpeakMsgHeader.Build              = "8";
            response.MultiSpeakMsgHeader.BuildString        = BuildDescriptor.Release;
            response.MultiSpeakMsgHeader.AppName            = "DCSystems";
            response.MultiSpeakMsgHeader.TimeStamp          = DateTime.Now;
            response.MultiSpeakMsgHeader.TimeStampSpecified = true;

            //errorObject[] eObject = new errorObject[1];
            //eObject[0] = new errorObject();
            //eObject[0].eventTime = DateTime.Now;
            //eObject[0].eventTimeSpecified = true;
            //response.PingURLResult = eObject;
            return(response);
        }
        catch (Exception ex)
        {
            LogError(String.Format("PingURL() ex:{0}", ex));
            response.PingURLResult                = new errorObject[1];
            response.PingURLResult[0].objectID    = "DCSystem";
            response.PingURLResult[0].errorString = ex.Message;
            return(response);
        }
    }
Example #12
0
        ImmutableStack <InternalObject> InsertPlaceholderTags(List <InternalObject> objects, CancellationToken cancellationToken)
        {
            // Calculate indentation levels in front of the tags:
            int[] indentationBeforeTags = new int[objects.Count];
            int   pos = 0;

            for (int i = 0; i < objects.Count; i++)
            {
                if (objects[i] is InternalTag)
                {
                    indentationBeforeTags[i] = GetIndentationBefore(pos);
                }
                pos += objects[i].Length;
            }

            // Create initial configuration:
            ConfigurationList listA = ConfigurationList.Create();
            ConfigurationList listB = ConfigurationList.Create();

            listA.Add(new Configuration(new OpenTagStack(), ImmutableStack <InternalObject> .Empty, 0));

            for (int i = 0; i < indentationBeforeTags.Length; i++)
            {
                cancellationToken.ThrowIfCancellationRequested();
                ProcessObject(objects[i], indentationBeforeTags[i], listA, ref listB);
                Swap(ref listA, ref listB);
            }

            Configuration cheapestConfiguration = new Configuration(null, null, InfiniteCost);

            for (int i = 0; i < listA.count; i++)
            {
                Configuration c = listA.configurations[i];
                if (c.Cost < cheapestConfiguration.Cost)
                {
                    while (!c.OpenTags.IsEmpty)
                    {
                        c = new Configuration(c.OpenTags.Pop(), c.Document.Push(EndTagPlaceholder), c.Cost + MissingEndTagCost);
                    }
                    if (c.Cost < cheapestConfiguration.Cost)
                    {
                        cheapestConfiguration = c;
                    }
                }
            }
            Log.WriteLine("Best configuration has cost {0}", cheapestConfiguration.Cost);
            return(cheapestConfiguration.Document);
        }
Example #13
0
        public Target(
            Bam.Core.Module module,
            Project project)
        {
            this.IsA = "PBXNativeTarget";
            this.Name = module.GetType().Name;
            this.Module = module;
            this.Project = project;
            this.Type = EProductType.NA;

            var configList = new ConfigurationList(this);
            this.ConfigurationList = configList;
            project.ConfigurationLists.Add(configList);

            this.TargetDependencies = new Bam.Core.Array<TargetDependency>();
        }
Example #14
0
    public GetMethodsResponse GetMethods(GetMethodsRequest request)
    {
        LogInfo("GetMethods() Entered");
        GetMethodsResponse response = null;

        try
        {
            if (_UdpClient == null)
            {
                String            path = @"C:\\DCSystems\Logs\";
                ConfigurationList cl   = new ConfigurationList();
                cl.Add("Process Name", "MockNotServerService");
                cl.Add("Log Output Directory", path);
                _Logger = new Logger(cl);

                LogInfo("()");

                _UdpClient = new UdpClient();
                _UdpClient.Connect(new IPEndPoint(IPAddress.Parse("127.0.0.1"), 7373));
            }
            Byte[] sendBytes = Encoding.ASCII.GetBytes("GetURL,OK");
            _UdpClient.Send(sendBytes, sendBytes.Length);

            response = new GetMethodsResponse();
            response.MultiSpeakMsgHeader = new MultiSpeakMsgHeader();
            response.MultiSpeakMsgHeader.TimeStampSpecified = true;
            response.MultiSpeakMsgHeader.TimeStamp          = DateTime.Now;
            response.GetMethodsResult    = new string[4];
            response.GetMethodsResult[0] = "GetMethods";
            response.GetMethodsResult[1] = "PingURL";
            response.GetMethodsResult[2] = "SCADAAnalogChangedNotification";
            response.GetMethodsResult[3] = "SCADAStatusChangedNotification";
            return(response);
        }
        catch (Exception ex)
        {
            LogError(String.Format("GetMethods() ex:{0}", ex));
            response.GetMethodsResult = new string[1];
            errorObject[] eObject = new errorObject[1];
            eObject[0]                   = new errorObject();
            eObject[0].Value             = ex.Message;
            response.GetMethodsResult[0] = ex.Message;
            return(response);
        }
    }
Example #15
0
        static void init()
        {
            string asm;

            if (!_didInit)
            {
                _didInit = true;

                /*
                 *  _OutputDirectory = m_config.getValue("Log Output Directory", @"c:\Colt\\Logs\");
                 * C:\Users\RTCOUSENS\colt\NewProjects\Colt3\Colt3\Logger.cs(199):            m_doubleBuffer = m_config.getValue("double Buffer", false);
                 * C:\Users\RTCOUSENS\colt\NewProjects\Colt3\Colt3\Logger.cs(204):                m_rollingSizeMessageCount = 10000 * m_config.getValue("Log File Bytes", 10);
                 * C:\Users\RTCOUSENS\colt\NewProjects\Colt3\Colt3\Logger.cs(205):                m_logCount = m_config.getValue("Log Archive Depth", 80);
                 * C:\Users\RTCOUSENS\colt\NewProjects\Colt3\Colt3\Logger.cs(209):                _ProcessName = m_config.getValue("Process Name", "Unknown Process");
                 * C:\Users\RTCOUSENS\colt\NewProjects\Colt3\Colt3\Logger.cs(210):                m_logLevel = m_config.getValue("File Logging Enabled", 3);
                 * C:\Users\RTCOUSENS\colt\NewProjects\Colt3\Colt3\Logger.cs(211):                m_format = m_config.getValue("Log Format", "{ticks} {Timestamp:MM-dd-yyyy HH:mm:ss.ffff} ({Thread}) - [{LevelName}] {Message}");
                 * C:\Users\RTCOUSENS\colt\NewProjects\Colt3\Colt3\Logger.cs(213):                m_matchSCLineFormat = m_config.getValue("Match SC Line Format", false);
                 * C:\Users\RTCOUSENS\colt\NewProjects\Colt3\Colt3\Logger.cs(231):            string tmp = m_config.getValue("Log To Trace", "false");
                 * C:\Users\RTCOUSENS\colt\NewProjects\Colt3\Colt3\Logger.cs(301):            m_logLevel = m_config.getValue("File Logging Enabled", 3);
                 * C:\Users\RTCOUSENS\colt\NewProjects\Colt3\Colt3\Logger.cs(317):            m_logCount = m_config.getValue("Log Archive Depth", DEFAULT_LOG_DEPTH);
                 * C:\Users\RTCOUSENS\colt\NewProjects\Colt3\Colt3\Logger.cs(318):            int logFileBytes = m_config.getValue("Log File Bytes", 3);
                 * C:\Users\RTCOUSENS\colt\NewProjects\Colt3\Colt3\Logger.cs(320):            _ProcessName = m_config.getValue("Process Name", "Unknown Process");
                 * C:\Users\RTCOUSENS\colt\NewProjects\Colt3\Colt3\Logger.cs(327):            _OutputDirectory = m_config.getValue("Log Output Directory", @"c:\Colt\Logs\");
                 * C:\Users\RTCOUSENS\colt\NewProjects\Colt3\Colt3\Logger.cs(331):            m_format = m_config.getValue("Log Format", "{ticks} {Timestamp:MM-dd-yyyy HH:mm:ss.ffff} ({Thread}) - [{LevelName}] {Message}");
                 * C:\Users\RTCOUSENS\colt\NewProjects\Colt3\Colt3\Logger.cs(333):            m_matchSCLineFormat = m_config.getValue("Match SC Line Format", false);
                 * C:\Users\RTCOUSENS\colt\NewProjects\Colt3\Colt3\Logger.cs(680):                _ProcessName = m_config.getValue("Process Name", "Unknown Process");
                 * C:\Users\RTCOUSENS\colt\NewProjects\Colt3\Colt3\Logger.cs(687):                m_format = m_config.getValue("Log Format", "{ticks} {Timestamp:MM-dd-yyyy HH:mm:ss.ffff} ({Thread}) - [{LevelName}] {Message}");
                 * C:\Users\RTCOUSENS\colt\NewProjects\Colt3\Colt3\Logger.cs(689):                m_matchSCLineFormat = m_config.getValue("Match SC Line Format", false);
                 * C:\Users\RTCOUSENS\colt\NewProjects\Colt3\Colt3\Logger.cs(692):                outfile.WriteLine(_ProcessName + ": Log initialized - Log Level: " + logLevelName() + ", Log File Bytes: " + m_config.getValue("Log F
                 * */
                _cfg = new ConfigurationList();
                asm  = Assembly.GetEntryAssembly().GetName().Name;
#if DEBUG
                _cfg.Add("File Logging Enabled", "5");
#endif
                _cfg.Add("Log To Trace", "true");
                _cfg.Add("Process Name", asm);
                _cfg.Add("Log Output Directory",
                         Path.Combine(
                             @"\\appdeploy\APPDEPLOY\Colt Software\Logs",
                             asm));

                _logger = new Logger(_cfg);
            }
        }
                static bool CompareLists <TValue>(ConfigurationList <TValue> left, ConfigurationList <TValue> right)
                {
                    int n;

                    if ((n = left.Count) != right.Count)
                    {
                        return(false);
                    }

                    for (int i = 0; i < n; i++)
                    {
                        if (!left[i] !.Equals(right[i]))
                        {
                            return(false);
                        }
                    }

                    return(true);
                }
Example #17
0
        //----------------------------------
        public static string SentStringGenerator()
        {
            string ObjectString = "";

            foreach (var item in ConfigurationList)
            {
                var MyValue = RowDictionary.First(x => x.Value.Name == item).Value.Value;
                ObjectString += MyValue.ToString();
                if (ConfigurationList.IndexOf(item) == ConfigurationList.Count - 1 && VM.ParamConfigurationList.Count == 0)
                {
                    ObjectString += ";";
                }
                else
                {
                    ObjectString += "|";
                }
            }
            ;
            return(ObjectString);
        }
Example #18
0
        public Project(
            Bam.Core.Module module,
            string name)
        {
            this.IsA = "PBXProject";
            this.Name = name;
            this.ProjectDir = module.CreateTokenizedString("$(buildroot)/$(packagename).xcodeproj");
            module.Macros.Add("xcodeprojectdir", this.ProjectDir);

            var projectPath = module.CreateTokenizedString("$(xcodeprojectdir)/project.pbxproj");
            this.ProjectPath = projectPath.Parse();

            this.SourceRoot = module.CreateTokenizedString("$(packagedir)").Parse();
            this.BuildRoot = module.CreateTokenizedString("$(buildroot)").Parse();

            this.Module = module;
            this.Targets = new System.Collections.Generic.Dictionary<System.Type, Target>();
            this.FileReferences = new System.Collections.Generic.List<FileReference>();
            this.BuildFiles = new System.Collections.Generic.List<BuildFile>();
            this.Groups = new System.Collections.Generic.List<Group>();
            this.GroupMap = new System.Collections.Generic.Dictionary<string, Group>();
            this.AllConfigurations = new System.Collections.Generic.List<Configuration>();
            this.ProjectConfigurations = new System.Collections.Generic.Dictionary<Bam.Core.EConfiguration, Configuration>();
            this.ConfigurationLists = new System.Collections.Generic.List<ConfigurationList>();
            this.SourcesBuildPhases = new System.Collections.Generic.List<SourcesBuildPhase>();
            this.FrameworksBuildPhases = new System.Collections.Generic.List<FrameworksBuildPhase>();
            this.ShellScriptsBuildPhases = new Bam.Core.Array<ShellScriptBuildPhase>();
            this.CopyFilesBuildPhases = new Bam.Core.Array<CopyFilesBuildPhase>();
            this.ContainerItemProxies = new Bam.Core.Array<ContainerItemProxy>();
            this.ReferenceProxies = new Bam.Core.Array<ReferenceProxy>();
            this.TargetDependencies = new Bam.Core.Array<TargetDependency>();
            this.ProjectReferences = new System.Collections.Generic.Dictionary<Group, FileReference>();

            this.Groups.Add(new Group()); // main group
            this.Groups.Add(new Group("Products")); // product ref group
            this.MainGroup.AddChild(this.ProductRefGroup);

            var configList = new ConfigurationList(this);
            this.ConfigurationLists.Add(configList);
        }
Example #19
0
        /// <summary>
        /// Copies the options from a <see cref="JsonSerializerOptions"/> instance to a new instance.
        /// </summary>
        /// <param name="options">The <see cref="JsonSerializerOptions"/> instance to copy options from.</param>
        /// <exception cref="System.ArgumentNullException">
        /// <paramref name="options"/> is <see langword="null"/>.
        /// </exception>
        public JsonSerializerOptions(JsonSerializerOptions options)
        {
            if (options is null)
            {
                ThrowHelper.ThrowArgumentNullException(nameof(options));
            }

            _memberAccessorStrategy   = options._memberAccessorStrategy;
            _dictionaryKeyPolicy      = options._dictionaryKeyPolicy;
            _jsonPropertyNamingPolicy = options._jsonPropertyNamingPolicy;
            _readCommentHandling      = options._readCommentHandling;
            _referenceHandler         = options._referenceHandler;
            _converters             = new ConverterList(this, options._converters);
            _encoder                = options._encoder;
            _defaultIgnoreCondition = options._defaultIgnoreCondition;
            _numberHandling         = options._numberHandling;
            _unknownTypeHandling    = options._unknownTypeHandling;

            _defaultBufferSize           = options._defaultBufferSize;
            _maxDepth                    = options._maxDepth;
            _allowTrailingCommas         = options._allowTrailingCommas;
            _ignoreNullValues            = options._ignoreNullValues;
            _ignoreReadOnlyProperties    = options._ignoreReadOnlyProperties;
            _ignoreReadonlyFields        = options._ignoreReadonlyFields;
            _includeFields               = options._includeFields;
            _propertyNameCaseInsensitive = options._propertyNameCaseInsensitive;
            _writeIndented               = options._writeIndented;
            // Preserve backward compatibility with .NET 6
            // This should almost certainly be changed, cf. https://github.com/dotnet/aspnetcore/issues/38720
            _typeInfoResolver         = options._typeInfoResolver is JsonSerializerContext ? null : options._typeInfoResolver;
            EffectiveMaxDepth         = options.EffectiveMaxDepth;
            ReferenceHandlingStrategy = options.ReferenceHandlingStrategy;

            // _cachingContext is not copied as sharing the JsonTypeInfo and JsonPropertyInfo caches can result in
            // unnecessary references to type metadata, potentially hindering garbage collection on the source options.

            TrackOptionsInstance(this);
        }
        /// <summary>
        /// Provisions the service locator settings, and ensures the list is created for storing configuration
        /// on the site collection root web.  The service locator configuration is defined for the site level.
        /// </summary>
        /// <param name="properties">The properties for this configuration</param>
        public override void FeatureActivated(SPFeatureReceiverProperties properties)
        {
            string configListLocation = CentralSiteConfig.GetCentralConfigSiteUrl();

            // Configuration List Deployment
            using (var centralSite = new SPSite(configListLocation))
            {
                ConfigurationList.EnsureConfigurationList(centralSite);
            }

            var site     = properties.Feature.Parent as SPSite;
            var slConfig = SharePointServiceLocator.GetCurrent(site).GetInstance <IServiceLocatorConfig>();

            slConfig.Site = site;
            slConfig.RegisterTypeMapping <IConfigManager, ListBackedConfigManager>();
            slConfig.RegisterTypeMapping <IHierarchicalConfig, ListBackedHierarchicalConfig>();
            SharePointServiceLocator.Reset();
            ConfigurationList.EnsureConfigurationList(site);

            // Add WP to new page and add to navigation


            AddWPToSiteNavigation(site.RootWeb, "listconfig.aspx", "List Configuration Test", wpXml, "left");
        }
 public ConfigHandler()
 {
     Configuration = new ConfigurationList();
 }
        public ConfigurationForm()
        {
            InitializeComponent();

            mConfigurationList = ( ConfigurationList )ConfigurationList.Instance.Clone();
        }
Example #23
0
        public Configuration EnsureTargetConfigurationExists(
            Bam.Core.Module module,
            ConfigurationList configList)
        {
            lock (configList)
            {
                var config = module.BuildEnvironment.Configuration;
                var existingConfig = configList.Where(item => item.Config == config).FirstOrDefault();
                if (null != existingConfig)
                {
                    return existingConfig;
                }

                // if a new target config is needed, then a new project config is needed too
                this.EnsureProjectConfigurationExists(module);

                var newConfig = new Configuration(module.BuildEnvironment.Configuration);
                this.AllConfigurations.Add(newConfig);
                configList.AddConfiguration(newConfig);

                var clangMeta = Bam.Core.Graph.Instance.PackageMetaData<Clang.MetaData>("Clang");

                // set which SDK to build against
                newConfig["SDKROOT"] = new UniqueConfigurationValue(clangMeta.SDK);

                // set the minimum version of OSX/iPhone to run against
                var minVersionRegEx = new System.Text.RegularExpressions.Regex("^(?<Type>[a-z]+)(?<Version>[0-9.]+)$");
                var match = minVersionRegEx.Match(clangMeta.MinimumVersionSupported);
                if (!match.Groups["Type"].Success)
                {
                    throw new Bam.Core.Exception("Unable to extract SDK type from: '{0}'", clangMeta.MinimumVersionSupported);
                }
                if (!match.Groups["Version"].Success)
                {
                    throw new Bam.Core.Exception("Unable to extract SDK version from: '{0}'", clangMeta.MinimumVersionSupported);
                }

                var optionName = System.String.Format("{0}_DEPLOYMENT_TARGET", match.Groups["Type"].Value.ToUpper());
                newConfig[optionName] = new UniqueConfigurationValue(match.Groups["Version"].Value);

                return newConfig;
            }
        }
		void ProcessObject(InternalObject obj, int indentationLevel, ConfigurationList oldConfigurations, ref ConfigurationList newConfigurations)
		{
			newConfigurations.Clear();
			InternalTag tag = obj as InternalTag;
			for (int i = 0; i < oldConfigurations.count; i++) {
				Configuration c = oldConfigurations.configurations[i];
				if (c.Cost == InfiniteCost)
					continue;
				if (tag != null && tag.IsStartTag) {
					// Push start tag
					newConfigurations.Add(
						c.OpenTags.Push(tag.Name, indentationLevel),
						c.Document.Push(obj),
						c.Cost
					);
				} else if (tag != null && tag.IsEndTag) {
					// We can ignore this end tag
					newConfigurations.Add(
						c.OpenTags,
						c.Document.Push(StartTagPlaceholder).Push(obj),
						c.Cost + IgnoreEndTagCost
					);
					// We can match this end tag with one of the currently open tags
					var openTags = c.OpenTags;
					var documentWithInsertedEndTags = c.Document;
					uint newCost = c.Cost;
					while (!openTags.IsEmpty) {
						uint matchCost = 0;
						if (openTags.IndentationLevel >= 0 && indentationLevel >= 0)
							matchCost += (uint)Math.Abs(openTags.IndentationLevel - indentationLevel);
						if (openTags.Name != tag.Name)
							matchCost += MismatchedNameCost;
						newConfigurations.Add(
							openTags.Pop(),
							documentWithInsertedEndTags.Push(obj),
							newCost + matchCost
						);
						newCost += MissingEndTagCost;
						openTags = openTags.Pop();
						documentWithInsertedEndTags = documentWithInsertedEndTags.Push(EndTagPlaceholder);
					}
				} else {
					newConfigurations.Add(
						c.OpenTags,
						c.Document.Push(obj),
						c.Cost
					);
				}
			}
		}
Example #25
0
 public static void Reset()
 {
     config = new ConfigurationList();
 }
Example #26
0
 static Configuration()
 {
     TransformationCallbacks.Install();
     config = new ConfigurationList();
 }
		static void Swap(ref ConfigurationList a, ref ConfigurationList b)
		{
			ConfigurationList tmp = a;
			a = b;
			b = tmp;
		}
Example #28
0
 public static void Reset()
 {
     config = new ConfigurationList();
 }
Example #29
0
 private void AddNewGroup()
 {
     ConfigurationList.Add(new ConfigurationGroup("New Group", null, TimeSpan.Zero));
 }
Example #30
0
        void ProcessObject(InternalObject obj, int indentationLevel, ConfigurationList oldConfigurations, ref ConfigurationList newConfigurations)
        {
            newConfigurations.Clear();
            InternalTag tag = obj as InternalTag;

            for (int i = 0; i < oldConfigurations.count; i++)
            {
                Configuration c = oldConfigurations.configurations[i];
                if (c.Cost == InfiniteCost)
                {
                    continue;
                }
                if (tag != null && tag.IsStartTag)
                {
                    // Push start tag
                    newConfigurations.Add(
                        c.OpenTags.Push(tag.Name, indentationLevel),
                        c.Document.Push(obj),
                        c.Cost
                        );
                }
                else if (tag != null && tag.IsEndTag)
                {
                    // We can ignore this end tag
                    newConfigurations.Add(
                        c.OpenTags,
                        c.Document.Push(StartTagPlaceholder).Push(obj),
                        c.Cost + IgnoreEndTagCost
                        );
                    // We can match this end tag with one of the currently open tags
                    var  openTags = c.OpenTags;
                    var  documentWithInsertedEndTags = c.Document;
                    uint newCost = c.Cost;
                    while (!openTags.IsEmpty)
                    {
                        uint matchCost = 0;
                        if (openTags.IndentationLevel >= 0 && indentationLevel >= 0)
                        {
                            matchCost += (uint)Math.Abs(openTags.IndentationLevel - indentationLevel);
                        }
                        if (openTags.Name != tag.Name)
                        {
                            matchCost += MismatchedNameCost;
                        }
                        newConfigurations.Add(
                            openTags.Pop(),
                            documentWithInsertedEndTags.Push(obj),
                            newCost + matchCost
                            );
                        newCost += MissingEndTagCost;
                        openTags = openTags.Pop();
                        documentWithInsertedEndTags = documentWithInsertedEndTags.Push(EndTagPlaceholder);
                    }
                }
                else
                {
                    newConfigurations.Add(
                        c.OpenTags,
                        c.Document.Push(obj),
                        c.Cost
                        );
                }
            }
        }
 public static void Reset()
 {
     config = new ConfigurationList(Installation.Properties.Product);
 }
Example #32
0
 /// <summary>
 /// Constructs a new <see cref="JsonSerializerOptions"/> instance.
 /// </summary>
 public JsonSerializerOptions()
 {
     _converters = new ConverterList(this);
     TrackOptionsInstance(this);
 }
Example #33
0
 public Logger(ConfigurationList cfg)
 {
     _cfg = cfg;
 }
Example #34
0
 static Configuration()
 {
     TransformationCallbacks.Install();
     config = new ConfigurationList();
 }
Example #35
0
 public static void Reset()
 {
     config = new ConfigurationList(Installation.Properties.Product);
 }
Example #36
0
 /// <summary>
 /// Returns any configuration groups that can make the item
 /// </summary>
 /// <param name="nextItem"></param>
 /// <returns></returns>
 public IEnumerable <ConfigurationGroup> GetConfigGroups(ProductMasterItem nextItem)
 {
     return(ConfigurationList.Where(c => c.CanMake(nextItem)));
 }