Esempio n. 1
0
 public void Start(IDictionary <string, object> parameters)
 {
     //TODO Get node variables not process instance var
     InputParameters           = parameters.ToImmutableDictionary();
     StartNode.InputParameters = parameters.ToImmutableDictionary();
     Start();
 }
Esempio n. 2
0
        Task ReportShutdownInternal(AgentState agentState, DeploymentStatus status)
        {
            Option <IEdgeAgentModule> edgeAgentModule = agentState.SystemModules.EdgeAgent
                                                        .Map(ea => ea as IRuntimeStatusModule)
                                                        .Filter(ea => ea != null)
                                                        .Map(ea => (IEdgeAgentModule)ea.WithRuntimeStatus(ModuleStatus.Unknown))
                                                        .Else(agentState.SystemModules.EdgeAgent);

            Option <IEdgeHubModule> edgeHubModule = agentState.SystemModules.EdgeHub
                                                    .Map(eh => eh as IRuntimeStatusModule)
                                                    .Filter(eh => eh != null)
                                                    .Map(eh => (IEdgeHubModule)eh.WithRuntimeStatus(ModuleStatus.Unknown))
                                                    .Else(agentState.SystemModules.EdgeHub);

            IDictionary <string, IModule> updateUserModules = (agentState.Modules ?? ImmutableDictionary <string, IModule> .Empty)
                                                              .Where(m => m.Key != Constants.EdgeAgentModuleName)
                                                              .Where(m => m.Key != Constants.EdgeHubModuleName)
                                                              .Where(m => m.Value is IRuntimeModule)
                                                              .Select(pair =>
            {
                IModule updatedModule = (pair.Value as IRuntimeModule)?.WithRuntimeStatus(ModuleStatus.Unknown) ?? pair.Value;
                return(new KeyValuePair <string, IModule>(pair.Key, updatedModule));
            })
                                                              .ToDictionary(x => x.Key, x => x.Value);

            var currentState =
                new AgentState(
                    agentState.LastDesiredVersion, status, agentState.RuntimeInfo,
                    new SystemModules(edgeAgentModule, edgeHubModule),
                    updateUserModules.ToImmutableDictionary(),
                    agentState.SchemaVersion, this.versionInfo);

            return(this.DiffAndReportAsync(currentState, agentState));
        }
        public static IProjectRuleSnapshot Implement(
            string ruleName = null,
            IDictionary <string, IImmutableDictionary <string, string> > items = null,
            IDictionary <string, string> properties = null,
            MockBehavior?mockBehavior = null)
        {
            var behavior = mockBehavior ?? MockBehavior.Default;
            var mock     = new Mock <IProjectRuleSnapshot>(behavior);

            if (ruleName != null)
            {
                mock.Setup(x => x.RuleName).Returns(ruleName);
            }

            if (items != null)
            {
                mock.Setup(x => x.Items).Returns(items.ToImmutableDictionary());
            }

            if (properties != null)
            {
                mock.Setup(x => x.Properties).Returns(properties.ToImmutableDictionary());
            }

            return(mock.Object);
        }
Esempio n. 4
0
 internal StepEventStateMetadata(
     string urn,
     string type,
     bool?custom,
     bool?delete,
     string id,
     string parent,
     bool?protect,
     IDictionary <string, object> inputs,
     IDictionary <string, object> outputs,
     string provider,
     IEnumerable <string>?initErrors)
 {
     Urn        = urn;
     Type       = type;
     Custom     = custom;
     Delete     = delete;
     Id         = id;
     Parent     = parent;
     Protect    = protect;
     Inputs     = inputs.ToImmutableDictionary();
     Outputs    = outputs.ToImmutableDictionary();
     Provider   = provider;
     InitErrors = initErrors?.ToImmutableArray();
 }
Esempio n. 5
0
 public SemanticModel(FileSymbol root, ITypeManager typeManager, IDictionary <SyntaxBase, Symbol> bindings, ResourceScopeType targetScope)
 {
     this.Root        = root;
     this.typeManager = typeManager;
     this.TargetScope = targetScope;
     this.bindings    = bindings.ToImmutableDictionary();
 }
Esempio n. 6
0
 /// <summary>
 /// Create a RuleSet.
 /// </summary>
 public RuleSet(string filePath, ReportDiagnostic generalOption, IDictionary<string, ReportDiagnostic> specificOptions, IEnumerable<RuleSetInclude> includes)
 {
     this.filePath = filePath;
     this.generalDiagnosticOption = generalOption;
     this.specificDiagnosticOptions = specificOptions == null ? ImmutableDictionary<string, ReportDiagnostic>.Empty : specificOptions.ToImmutableDictionary();
     this.includes = includes == null ? ImmutableArray<RuleSetInclude>.Empty : includes.ToImmutableArray();
 }
 public RestRequest(HttpMethod method, Uri uri, HttpContent content, IDictionary <string, RestHeaderValue> headers)
 {
     Method         = method;
     RequestUri     = uri;
     Content        = content;
     RequestHeaders = headers?.ToImmutableDictionary() ?? ImmutableDictionary <string, RestHeaderValue> .Empty;
 }
Esempio n. 8
0
 public OciDescriptor(string mediaType, string digest, long size, IDictionary <string, string>?annotations)
 {
     this.MediaType   = mediaType;
     this.Digest      = digest;
     this.Size        = size;
     this.Annotations = annotations?.ToImmutableDictionary() ?? ImmutableDictionary <string, string> .Empty;
 }
Esempio n. 9
0
 public IDataInfoModel(string description, string name, string contentType, IDictionary <string, string> metadata)
 {
     Description = description;
     Metadata    = metadata?.ToImmutableDictionary();
     Name        = name;
     ContentType = contentType;
 }
Esempio n. 10
0
 static TypeExtensions()
 {
     lookupTable = new Dictionary <string, string>(StringComparer.OrdinalIgnoreCase);
     lookupTable.Add("System.Boolean", "LOGIC");
     lookupTable.Add("System.Byte", "BYTE");
     lookupTable.Add("System.String", "STRING");
     lookupTable.Add("System.Char", "CHAR");
     lookupTable.Add("System.Double", "REAL8");
     lookupTable.Add("System.Int16", "SHORT");
     lookupTable.Add("System.Int32", "INT");
     lookupTable.Add("System.Int64", "INT64");
     lookupTable.Add("System.Object", "OBJECT");
     lookupTable.Add("System.Single", "REAL4");
     lookupTable.Add("System.UInt16", "WORD");
     lookupTable.Add("System.UInt32", "DWORD");
     lookupTable.Add("System.UInt64", "UINT64");
     lookupTable.Add("System.Void", "VOID");
     lookupTable.Add("Vulcan._CodeBlock", "CODEBLOCK");
     lookupTable.Add("Vulcan.__Array", "UINT64");
     lookupTable.Add("Vulcan.__Psz", "PSZ");
     lookupTable.Add("Vulcan.__Symbol", "SYMBOL");
     lookupTable.Add("Vulcan.__Usual", "USUAL");
     lookupTable.Add("Vulcan.__VODate", "DATE");
     lookupTable.Add("Vulcan.__VOFloat", "FLOAT");
     lookupTable.Add("Vulcan.__WinBool", "LOGIC");
     lookupTable = lookupTable.ToImmutableDictionary();
 }
Esempio n. 11
0
        private static T ToAction(IDictionary <string, object> arg)
        {
            var action = new T();

            action.LoadPlainValue(arg.ToImmutableDictionary());
            return(action);
        }
Esempio n. 12
0
 public UpdatePackageInfo(SemVersion version, string?description, IDictionary <string, string>?customFields,
                          IEnumerable <UpdateFileInfo> files, IEnumerable <UpdateChangelogInfo>?changelogs,
                          IEnumerable <UpdatePackageDistributionInfo>?distribution)
     : this(version, description, customFields?.ToImmutableDictionary(), files.ToImmutableList(), changelogs?.ToImmutableList(),
            distribution?.ToImmutableList())
 {
 }
Esempio n. 13
0
 public ReconsumeLaterWithProperties(IMessage <T> message, AckType ackType, IDictionary <string, long> properties, long delayTime)
 {
     Message    = message;
     Properties = properties.ToImmutableDictionary();
     DelayTime  = delayTime;
     AckType    = ackType;
 }
 public ImmutableSentenceDomainModel(ISentenceFormModel formModel, IDictionary<ISentenceForm, ISentenceFormDomain> domains)
     : base(ImmutableSentenceFormModel.CopyOf(formModel))
 {
     //if (!formModel.SentenceForms.SetEquals(domains.Keys))
     //    throw new Exception();
     _domains = domains.ToImmutableDictionary();
 }
Esempio n. 15
0
 public MigrationMemento(string type, IDictionary <string, string> attributes, BigInteger hashCode, IDictionary <string, IEnumerable <BigInteger> > prerequisites)
 {
     Type          = type;
     Attributes    = attributes.ToImmutableDictionary();
     HashCode      = hashCode;
     Prerequisites = new PrerequisiteDictionary(prerequisites);
 }
Esempio n. 16
0
        public void Build()
        {
            if (_versions.Count == 0)
            {
                ShipVersion(ApiVersion.Default);
            }

            var types = _versions.Values.SelectMany(x => x.Values).ToHashSet();

            var versions = _versions;

            if (_addMissingResources)
            {
                // we might modify this during validation, so use a copy
                versions = new Dictionary <ApiVersion, Dictionary <string, Type> >();
                foreach (var(key, value) in _versions)
                {
                    versions.Add(key, new Dictionary <string, Type>(value));
                }
            }

            foreach (var(version, manifest) in versions)
            {
                foreach (var(resourceName, resourceType) in manifest)
                {
                    ValidateTypeExistsInChangeLog(resourceName, version, resourceType, types, _addMissingResources);
                }
            }

            ResourceTypes = _versions.SelectMany(x => x.Value.Values).Distinct().ToHashSet();
            Versions      = _versions.ToImmutableDictionary();
        }
Esempio n. 17
0
 public APIRequest(string url, string segment, string body, IDictionary <string, string> parameters)
 {
     Url     = url;
     Segment = segment;
     Body    = body;
     Params  = (IReadOnlyDictionary <string, string>)parameters?.ToImmutableDictionary() ?? new Dictionary <string, string>();
 }
 public GameServer(byte[] address, ushort port, IDictionary <string, string> data, DateTime lastLive)
 {
     Address  = address;
     Port     = port;
     Data     = data.ToImmutableDictionary();
     LastLive = lastLive;
 }
Esempio n. 19
0
 private IDictionary <string, string> checkTags(IDictionary <string, string> tags)
 {
     if (tags == null || tags.Count == 0)
     {
         return(EMPTY_TAGS);
     }
     return(tags.ToImmutableDictionary());
 }
Esempio n. 20
0
 /// <summary>
 /// Initializes a new instance of a <see cref="BadgeProgress"/>.
 /// </summary>
 /// <param name="member">The member the progress is for.</param>
 /// <param name="badge">The badge the progress is for.</param>
 /// <param name="isCompleted">Whether the badge has been completed or not.</param>
 /// <param name="whenAwarded">When the badge was awarded; <c>null</c> if not awarded yet.</param>
 /// <param name="taskStatus">The status for each individual task.</param>
 public BadgeProgress(Member member, Badge badge, bool isCompleted, DateTime?whenAwarded, IDictionary <string, string> taskStatus)
 {
     this.member      = member;
     this.badge       = badge;
     this.isCompleted = isCompleted;
     this.whenAwarded = whenAwarded;
     this.progress    = taskStatus.ToImmutableDictionary();
 }
Esempio n. 21
0
 public SemanticModel(FileSymbol root, ITypeManager typeManager, IDictionary <SyntaxBase, Symbol> bindings, ResourceScopeType targetScope)
 {
     this.Root                   = root;
     this.typeManager            = typeManager;
     this.TargetScope            = targetScope;
     this.bindings               = bindings.ToImmutableDictionary();
     this.emitLimitationInfoLazy = new Lazy <EmitLimitationInfo>(() => EmitLimitationCalculator.Calculate(this));
 }
 public TasmotaDeviceFullStatus(string jsonStatus,
                                IDictionary <string, string> switchText,
                                string fullTopicPrefix3) :
     base(jsonStatus)
 {
     SwitchText = switchText.ToImmutableDictionary();
     this.MQTTPrefix3FinalTopic = CalculateFinalPrefix3MQTTTopic(fullTopicPrefix3);
 }
 public IDependencyNode TestCreateDependencyNode(string itemSpec,
                                                 string itemType,
                                                 int priority,
                                                 IDictionary <string, string> properties,
                                                 bool resolved)
 {
     return(CreateDependencyNode(itemSpec, itemType, priority, properties.ToImmutableDictionary(), resolved));
 }
Esempio n. 24
0
        public ChangeLogBuilder(IServiceCollection services)
        {
            _pendingTypes = new Dictionary <string, Type>();
            _versions     = new Dictionary <ApiVersion, Dictionary <string, Type> >();

            Versions = _versions.ToImmutableDictionary();
            Services = services;
        }
Esempio n. 25
0
        protected IImmutableDictionary <string, T> ModelCopy <T>(IDictionary <string, T> dictionary)
        {
            if (dictionary == null)
            {
                return(new Dictionary <string, T>().ToImmutableDictionary());
            }

            return(dictionary.ToImmutableDictionary());
        }
Esempio n. 26
0
        public IImmutableDictionary <string, FunctionDecl> WaddleProgram(ProgramSyntax program)
        {
            foreach (var function in program.FunctionDeclarations)
            {
                WaddleFunctionDeclaration(function);
            }

            return(_functions.ToImmutableDictionary());
        }
Esempio n. 27
0
        /// <summary>
        /// Create an instance of <see cref="R6StatsClient"/>
        /// </summary>
        /// <param name="config"><see cref="Config"/>Object containing the necessary information to instanciate the client</param>
        /// <param name="headers">Optional request headers to be used while making REST API requests</param>
        public R6StatsClient(Config config, IDictionary <string, IEnumerable <string> > headers) : this(config)
        {
            _headers = headers.ToImmutableDictionary();

            foreach (var header in _headers)
            {
                _httpClient.DefaultRequestHeaders.Add(header.Key, header.Value);
            }
        }
Esempio n. 28
0
 public GangCryptoParameters(
     IGangCryptoService crypto,
     IDictionary <string, string> parameters)
 {
     _crypto     = crypto;
     _parameters = parameters
                   ?.ToImmutableDictionary()
                   ?? throw new ArgumentNullException(nameof(parameters));
 }
 public NormalizedEnvironmentVariableConfigurationProvider(
     string?prefix = null,
     IDictionary <string, string>?aliases = null
     )
 {
     Aliases = aliases?.ToImmutableDictionary(StringComparer.OrdinalIgnoreCase)
               ?? ImmutableDictionary <string, string> .Empty;
     Prefix = prefix ?? "";
 }
Esempio n. 30
0
        public DiagramEvent GetDiagramEvent()
        {
            var newDiagram = new ImmutableDiagram(
                _model,
                _nodes.ToImmutableDictionary(),
                _connectors.ToImmutableDictionary());

            return(new DiagramEvent(_initialDiagram, newDiagram, _shapeEvents));
        }
Esempio n. 31
0
 public DownloadResultData(Func <Stream> byteStreamSupplier, string digest, string dataHash, long timestamp,
                           string description, string name, string contentType, IDictionary <string, string> metadata)
     : base(description, name, contentType,
            metadata == null ? ImmutableDictionary <string, string> .Empty : metadata.ToImmutableDictionary())
 {
     ByteStreamSupplier = byteStreamSupplier;
     Digest             = digest;
     DataHash           = dataHash;
     Timestamp          = timestamp;
 }
Esempio n. 32
0
        /// <summary>
        /// Initializes a new instance of the <see cref="GenomeResults{I,R}"/> class.
        /// </summary>
        /// <param name="runResults">The run results.</param>
        /// <exception cref="ArgumentNullException">Thrown if result parameter is null.</exception>
        public GenomeResults(IDictionary <TInstance, TResult> runResults)
        {
            if (runResults == null)
            {
                throw new ArgumentNullException(nameof(runResults));
            }

            // Translate the dictionary into an immutable one to keep the message immutable.
            this.RunResults = runResults.ToImmutableDictionary();
        }
Esempio n. 33
0
        /// <summary>
        /// Create a new instance of a workspace that can be populated by opening solution and project files.
        /// </summary>
        /// <param name="properties">The MSBuild properties used when interpreting project files.
        /// These are the same properties that are passed to msbuild via the /property:&lt;n&gt;=&lt;v&gt; command line argument.</param>
        /// <param name="hostServices">The <see cref="HostServices"/> used to configure this workspace.</param>
        public static MSBuildWorkspace Create(IDictionary<string, string> properties, HostServices hostServices)
        {
            if (properties == null)
            {
                throw new ArgumentNullException(nameof(properties));
            }

            if (hostServices == null)
            {
                throw new ArgumentNullException(nameof(hostServices));
            }

            return new MSBuildWorkspace(hostServices, properties.ToImmutableDictionary());
        }
Esempio n. 34
0
 private ConwaysLife(int width, int height, IDictionary<Point, int> cellAge)
 {
     this.width = width;
     this.height = height;
     this.cellAge = cellAge.ToImmutableDictionary();
 }
 public ParameterizedSql(string sql, IDictionary<string, string> userInputVariables)
 {
     Sql = sql;
     UserInputVariables = userInputVariables.ToImmutableDictionary();
 }
Esempio n. 36
0
 public AnalyzerOptions(IEnumerable<AdditionalStream> additionalStreams, IDictionary<string, string> globalOptions)
 {
     this.AdditionalStreams = additionalStreams == null ? ImmutableArray<AdditionalStream>.Empty : additionalStreams.ToImmutableArray();
     this.GlobalOptions = globalOptions == null ? ImmutableDictionary<string, string>.Empty : globalOptions.ToImmutableDictionary();
 }