Ejemplo n.º 1
0
        /// <summary>
        ///     Sets rule level.
        /// </summary>
        /// <param name="applicationName">
        ///     Name of the application.
        /// </param>
        /// <param name="ruleName">
        ///     Name of the rule.
        /// </param>
        /// <param name="logLevel">
        ///     The log level.
        /// </param>
        /// <param name="enable">
        ///     true to enable, false to disable.
        /// </param>
        public static void SetRuleLevel(
            string applicationName,
            string ruleName,
            LogLevel logLevel,
            bool enable)
        {
            settingsHelperLogger.Debug("Entered static method.");

            if (!InstanceList.ContainsKey(applicationName))
            {
                settingsHelperLogger.Info("Configuration instance {0} does not exist.",
                                          applicationName);
                return;
            }

            LoggingRule loggingRule = InstanceList[applicationName].Rules[ruleName];

            if (enable)
            {
                loggingRule.EnableLoggingForLevel(logLevel);
            }
            else
            {
                loggingRule.DisableLoggingForLevel(logLevel);
            }
        }
Ejemplo n.º 2
0
        public void LoadActivityTree(Activity rootActivity, System.Activities.ActivityInstance rootInstance, List <System.Activities.ActivityInstance> secondaryRootInstances, ActivityExecutor executor)
        {
            this.instanceMapping = new Dictionary <Activity, InstanceList>(this.rawDeserializedLists.Length);
            for (int i = 0; i < this.rawDeserializedLists.Length; i++)
            {
                Activity     activity;
                InstanceList list = this.rawDeserializedLists[i];
                if (!QualifiedId.TryGetElementFromRoot(rootActivity, list.ActivityId, out activity))
                {
                    throw FxTrace.Exception.AsError(new InvalidOperationException(System.Activities.SR.ActivityInstanceFixupFailed));
                }
                this.instanceMapping.Add(activity, list);
                list.Load(activity, this);
            }
            this.rawDeserializedLists = null;
            Func <System.Activities.ActivityInstance, ActivityExecutor, bool> callback = new Func <System.Activities.ActivityInstance, ActivityExecutor, bool>(this.OnActivityInstanceLoaded);

            rootInstance.FixupInstance(null, this, executor);
            ActivityUtilities.ProcessActivityInstanceTree(rootInstance, executor, callback);
            if (secondaryRootInstances != null)
            {
                foreach (System.Activities.ActivityInstance instance in secondaryRootInstances)
                {
                    instance.FixupInstance(null, this, executor);
                    ActivityUtilities.ProcessActivityInstanceTree(instance, executor, callback);
                }
            }
        }
Ejemplo n.º 3
0
        protected void LoginButton_Click(object sender, EventArgs e)
        {
            try
            {
                DataTable dt = Client.GetOrganizations(WarehouseLoginTextBox.Text, WarehousePasswordTextBox.Text);
                if (dt.Rows.Count > 0)
                {
                    WarehouseLoginPanel.Visible = false;
                    ConnectPanel.Visible        = true;
                    OrganizationList.DataSource = dt;
                    OrganizationList.DataBind();
                    OrganizationList.SelectedIndex = 0;

                    dt = Client.GetInstances(new Guid(OrganizationList.SelectedValue));
                    if (dt.Rows.Count > 0)
                    {
                        InstanceList.DataSource = dt;
                        InstanceList.DataBind();
                    }
                }
            }
            catch
            {
                errorLabel.Visible = true;
            }
        }
Ejemplo n.º 4
0
        public Program()
        {
            // Fields are handled by S3010
            privateField = this;
            publicField  = this;

            StaticMethod(null);
            StaticMethod(this);
            StaticMethod(((this)));
            StaticProperty = this;
            StaticProperty = ((this));

            Other.StaticMethod(this);    // Noncompliant
            Other.StaticList.Add(this);  // Noncompliant
            Other.StaticProperty = this; // Noncompliant
            ProgramsStatic.Add(this);    // Noncompliant
            InstanceList.Add(this);      // Noncompliant
            this.InstanceList.Add(this); // Noncompliant
            InstanceProperty = this;
            InstanceMethod(this);
            this.InstanceMethod(this);
            Renamed(this);                      // Compliant, False Negative

            new Program().InstanceMethod(this); // Noncompliant
        }
Ejemplo n.º 5
0
    StatechartEngine()
    {
        monitor_workers = new EventWaitHandle(false, EventResetMode.ManualReset);
        monitor_main    = new EventWaitHandle(true, EventResetMode.ManualReset);

        threads = new List <Thread>(threadCount);
        for (int i = 0; i < threadCount; i++)
        {
            threads.Add(new Thread(ExecuteInstances)
            {
                Name         = "SCthread " + i,
                IsBackground = true
            });

            threads[threads.Count - 1].Start();
        }
        available = threads.Count;

        updateInstances = new InstanceList()
        {
            instances = new List <StatechartInstance>()
        };
        lateInstances = new InstanceList()
        {
            instances = new List <StatechartInstance>()
        };
        fixedInstances = new InstanceList()
        {
            instances = new List <StatechartInstance>()
        };
    }
Ejemplo n.º 6
0
        /// <summary>
        /// Loads instance source from a dictionary object (provided by JSON)
        /// </summary>
        /// <param name="obj">Key/value dictionary with <c>instances</c> and other optional elements</param>
        /// <exception cref="eduJSON.InvalidParameterTypeException"><paramref name="obj"/> type is not <c>Dictionary&lt;string, object&gt;</c></exception>
        public virtual void Load(object obj)
        {
            if (obj is Dictionary <string, object> obj2)
            {
                InstanceList.Clear();

                // Parse all instances listed. Don't do it in parallel to preserve the sort order.
                foreach (var el in eduJSON.Parser.GetValue <List <object> >(obj2, "instances"))
                {
                    var instance = new Instance();
                    instance.Load(el);
                    InstanceList.Add(instance);
                }

                // Parse sequence.
                Sequence = (uint)eduJSON.Parser.GetValue <int>(obj2, "seq");

                // Parse signed date.
                SignedAt = eduJSON.Parser.GetValue(obj2, "signed_at", out string signed_at) && DateTime.TryParse(signed_at, out var signed_at_date) ? signed_at_date : (DateTime?)null;
            }
            else
            {
                throw new eduJSON.InvalidParameterTypeException(nameof(obj), typeof(Dictionary <string, object>), obj.GetType());
            }
        }
        public async Task <Response <InstanceList> > ListByAccountAsync(string subscriptionId, string resourceGroupName, string accountName, CancellationToken cancellationToken = default)
        {
            if (subscriptionId == null)
            {
                throw new ArgumentNullException(nameof(subscriptionId));
            }
            if (resourceGroupName == null)
            {
                throw new ArgumentNullException(nameof(resourceGroupName));
            }
            if (accountName == null)
            {
                throw new ArgumentNullException(nameof(accountName));
            }

            using var message = CreateListByAccountRequest(subscriptionId, resourceGroupName, accountName);
            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);

            switch (message.Response.Status)
            {
            case 200:
            {
                InstanceList value = default;
                using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);

                value = InstanceList.DeserializeInstanceList(document.RootElement);
                return(Response.FromValue(value, message.Response));
            }
Ejemplo n.º 8
0
        public void UpdateRawInstance(DynamicUpdateMap updateMap, Activity targetDefinition, List <ActivityInstance> secondaryRootInstances, ref Collection <ActivityBlockingUpdate> updateErrors)
        {
            this.updateList = GetInstanceListsNeedingUpdate(updateMap, targetDefinition, secondaryRootInstances, ref updateErrors);
            if (updateErrors != null && updateErrors.Count > 0)
            {
                // error found.
                // there is no need to proceed to updating the instances
                return;
            }

            // if UpdateType is either MapEntryExists or ParentIdShiftOnly,
            // update the ActivityIDs and update Environments
            // also, update the ImplementationVersion.
            foreach (InstanceListNeedingUpdate update in this.updateList)
            {
                Fx.Assert(update.InstanceList != null, "update.InstanceList must not be null.");

                if (update.NothingChanged)
                {
                    continue;
                }

                Fx.Assert(update.NewId != null, "update.NewId must not be null.");

                InstanceList instanceList = update.InstanceList;
                instanceList.ActivityId = update.NewId.AsByteArray();

                if (update.ParentIdShiftOnly)
                {
                    // this InstanceList must have been one of those whose IDs shifted by their parent's ID change,
                    // but no involvement in DU.
                    continue;
                }

                bool implementationVersionUpdateNeeded = false;
                if (update.MapEntry.ImplementationUpdateMap != null)
                {
                    implementationVersionUpdateNeeded = true;
                }

                if (update.MapEntry.HasEnvironmentUpdates)
                {
                    // update LocationEnvironemnt

                    Fx.Assert(update.NewActivity != null, "TryGetUpdateMapEntryFromRootMap should have thrown if it couldn't map to an activity");
                    instanceList.UpdateEnvironments(update.MapEntry.EnvironmentUpdateMap, update.NewActivity);
                }

                for (int i = 0; i < instanceList.Count; i++)
                {
                    ActivityInstance activityInstance = instanceList[i] as ActivityInstance;

                    if (implementationVersionUpdateNeeded)
                    {
                        activityInstance.ImplementationVersion = update.NewActivity.ImplementationVersion;
                    }
                }
            }
        }
Ejemplo n.º 9
0
 public void LoadInstances()
 {
     InstanceList.Clear();
     foreach (Instance inst in Instance.LoadInstances(AppSettings.Main.InstanceDir))
     {
         InstanceList.Add(inst);
     }
 }
Ejemplo n.º 10
0
        private static bool IsInvalidEnvironmentUpdate(InstanceList instanceList, DynamicUpdateMap.UpdatedActivity updatedActivity, ref Collection <ActivityBlockingUpdate> updateErrors)
        {
            if (updatedActivity.MapEntry == null || !updatedActivity.MapEntry.HasEnvironmentUpdates)
            {
                return(false);
            }

            for (int j = 0; j < instanceList.Count; j++)
            {
                ActivityInstance activityInstance = instanceList[j] as ActivityInstance;
                if (activityInstance != null)
                {
                    string error = null;
                    if (activityInstance.SubState == ActivityInstance.Substate.ResolvingVariables)
                    {
                        // if the entry has Environment update to do when the instance is in the
                        // middle of resolving variable, it is an error.
                        error = SR.CannotUpdateEnvironmentInTheMiddleOfResolvingVariables;
                    }
                    else if (activityInstance.SubState == ActivityInstance.Substate.ResolvingArguments)
                    {
                        // if the entry has Environment update to do when the instance is in the
                        // middle of resolving arguments, it is an error.
                        error = SR.CannotUpdateEnvironmentInTheMiddleOfResolvingArguments;
                    }

                    if (error != null)
                    {
                        AddBlockingActivity(ref updateErrors, updatedActivity, new QualifiedId(instanceList.ActivityId), error, activityInstance.Id);
                        return(true);
                    }
                }
                else
                {
                    LocationEnvironment environment = instanceList[j] as LocationEnvironment;
                    if (environment != null)
                    {
                        // environment that is referenced by a secondary root Adding a variable or
                        // argument that requires expression scheduling to this instanceless
                        // environment is not allowed.
                        List <int>           dummyIndexes;
                        EnvironmentUpdateMap envMap = updatedActivity.MapEntry.EnvironmentUpdateMap;

                        if ((envMap.HasVariableEntries && TryGatherSchedulableExpressions(envMap.VariableEntries, out dummyIndexes)) ||
                            (envMap.HasPrivateVariableEntries && TryGatherSchedulableExpressions(envMap.PrivateVariableEntries, out dummyIndexes)) ||
                            (envMap.HasArgumentEntries && TryGatherSchedulableExpressions(envMap.ArgumentEntries, out dummyIndexes)))
                        {
                            AddBlockingActivity(ref updateErrors, updatedActivity, new QualifiedId(instanceList.ActivityId), SR.VariableOrArgumentAdditionToReferencedEnvironmentNoDUSupported, null);
                            return(true);
                        }
                    }
                }
            }

            return(false);
        }
Ejemplo n.º 11
0
 public void Method()
 {
     StaticMethod(this);
     StaticMethod(((this)));
     Other.StaticMethod(this);
     Other.StaticList.Add(this);
     ProgramsStatic.Add(this);
     InstanceList.Add(this);
     InstanceMethod(this);
 }
Ejemplo n.º 12
0
        private void LoadInstances(InstanceConfiguration configuration)
        {
            _localInstancesEnumerated = true;
            InstanceList instances = configuration.Instances;

            _cbInProcessInstanceName.Items.Clear();
            for (int index = 0; index < instances.Count; index++)
            {
                _cbInProcessInstanceName.Items.Add(instances[index].Name);
            }
        }
        private void FillList()
        {
            var query = string.Format("SELECT [objID], [name] FROM [{0}]", hasWork ? "_Division" : "Division");
            var da    = new SqlDataAdapter(query, ConString);
            var dt    = new DataTable();

            da.Fill(dt);
            InstanceList.DataSource     = dt;
            InstanceList.DataTextField  = "name";
            InstanceList.DataValueField = "objID";
            InstanceList.DataBind();
        }
        InstanceSelectionWindow(List <Gamelet> instances)
        {
            InitializeComponent();
            InstanceList.ItemsSource = instances;
            InstanceList.Focus();

            // Force sorting by the Name column (DisplayName property) in ascending order.
            var dataView = CollectionViewSource.GetDefaultView(InstanceList.ItemsSource);

            dataView.SortDescriptions.Add(
                new SortDescription("DisplayName", ListSortDirection.Ascending));
        }
Ejemplo n.º 15
0
        public void Read(BinaryReaderEx br)
        {
            ReadSampleNames();

            header = HowlHeader.FromReader(br);

            for (int i = 0; i < header.cntUnk; i++)
            {
                if (br.ReadUInt16() != 0)
                {
                    Helpers.Panic(this, "upper word is not 0.");
                }

                unk.Add(br.ReadUInt16());
            }

            samples1 = InstanceList <SampleDef> .FromReader(br, (uint)br.BaseStream.Position, (uint)header.cntSfx);

            samples2 = InstanceList <SampleDef> .FromReader(br, (uint)br.BaseStream.Position, (uint)header.cntEngineSfx);

            /*
             * for (int i = 0; i < header.cntSfx; i++)
             *  samples1.Add(SampleDef.FromReader(br));
             *
             * for (int i = 0; i < header.cntEngineSfx; i++)
             *  samples2.Add(SampleDef.FromReader(br));
             */

            for (int i = 0; i < header.cntBank; i++)
            {
                ptrBanks.Add(br.ReadUInt16() * Meta.SectorSize);
            }

            for (int i = 0; i < header.cntSeq; i++)
            {
                ptrSeqs.Add(br.ReadUInt16() * Meta.SectorSize);
            }

            foreach (var ptr in ptrBanks)
            {
                br.Jump(ptr);
                banks.Add(new Bank(br));
            }

            foreach (var ptr in ptrSeqs)
            {
                br.Jump(ptr);
                sequences.Add(CSEQ.FromReader(br));
            }
        }
Ejemplo n.º 16
0
        //インスタンスが利用可能かをチェックする
        void CheckInstanceAvailable()
        {
            for (int i = deactiveInstanceList.Count - 1; i >= 0; i--)
            {
                if (deactiveInstanceList[i] != null)
                {
                    continue;
                }

                T removeInstance = deactiveInstanceList[i];
                deactiveInstanceList.Remove(removeInstance);
                InstanceList.Remove(removeInstance);
            }
        }
Ejemplo n.º 17
0
        private Instance FindInstanceByUniqueName(string _UniqueName, Action <string> _ErrorMessageAction = null)
        {
            InstanceList RequestedList = GetInstanceList(_ErrorMessageAction);

            if (RequestedList != null && RequestedList.Items != null && RequestedList.Items.Count > 0)
            {
                foreach (var Current in RequestedList.Items)
                {
                    if (Current != null && Current.Name == _UniqueName)
                    {
                        return(Current);
                    }
                }
            }
            return(null);
        }
Ejemplo n.º 18
0
        public void RegisterComponentType <TInst>(DrawComponentsFunc <TInst> drawFunc)
            where TInst : struct, IInstance, IEquatable <TInst>
        {
            // FIXME: Better error
            if (ComponentsDict.ContainsKey(typeof(TInst)))
            {
                throw new Exception($"Instance type already registered! (type: {typeof(TInst)})");
            }

            InstanceList list = InstanceList.Create <TInst>(16);

            ComponentsDict.Add(typeof(TInst), list);
            DrawFuncs.Add((cr, comps) => drawFunc(cr, comps.GetInstances <TInst>()));
            AddFuncDict.Add(typeof(TInst), (list, inst) => list.Add((TInst)inst));
            RemoveFuncDict.Add(typeof(TInst), (list, inst) => list.Remove((TInst)inst));
        }
Ejemplo n.º 19
0
        public async Task InitScanServerAsync()
        {
            var targets = await store.GetTargetListAsync();

            foreach (var ext in TerminalClient.Instance.ChannelList)
            {
                try
                {
                    //PLC实例下所有节点
                    var nodes = (from u in targets
                                 where u.PlcId == ext.Id
                                 select new TargetNode(u.Address, u.Name, u.Id, u.Interval, u.IsStoreTarget)
                    {
                        DataType = (PLC.Drive.S7.NetCore.DataType)u.DataType,
                        OpcNodeType = u.OpcNodeType,
                        VarType = (VarType)u.VarType,
                        DB = u.DB,
                        StartByteAdr = u.StartByteAdr,
                        BitAdr = (byte)u.BitAdr,
                        Count = u.Count
                    }).ToList();

                    foreach (var node in nodes)
                    {
                        ext.Nodes.Add(node.Key, node);
                    }

                    //逻辑分组
                    LogicGroup logic = new LogicGroup(ext.Name);
                    logic.IntervalList = (from u in nodes select u.Interval).Distinct().ToList();

                    foreach (var inter in logic.IntervalList)
                    {
                        var keys = (from u in nodes where u.Interval == inter select u.Key).ToList();
                        logic.TargetNodeIdList.Add(inter, keys);

                        ScanInstance instance = new ScanInstance(ext, logic, inter, store);
                        InstanceList.Add(instance);
                    }
                    ext.LogicGroups.Add(logic);
                }
                catch (Exception ex)
                {
                    LogHelper.Instance.Error("InitScanServerAsync:" + ex.Message);
                }
            }
        }
Ejemplo n.º 20
0
        /// <summary>
        /// Loads instance source from a dictionary object (provided by JSON)
        /// </summary>
        /// <param name="obj">Key/value dictionary with <c>instances</c> and other optional elements</param>
        /// <exception cref="eduJSON.InvalidParameterTypeException"><paramref name="obj"/> type is not <c>Dictionary&lt;string, object&gt;</c></exception>
        public virtual void Load(object obj)
        {
            if (!(obj is Dictionary <string, object> obj2))
            {
                throw new eduJSON.InvalidParameterTypeException(nameof(obj), typeof(Dictionary <string, object>), obj.GetType());
            }

            InstanceList.Clear();

            // Parse all instances listed. Don't do it in parallel to preserve the sort order.
            foreach (var el in eduJSON.Parser.GetValue <List <object> >(obj2, "instances"))
            {
                var instance = new Instance();
                instance.Load(el);
                InstanceList.Add(instance);
            }
        }
Ejemplo n.º 21
0
        public virtual void SetOriginal(T original)
        {
            if (original.Equals(this.original))
            {
                return;
            }
            this.original = original;

            for (int i = 0; i < InstanceList.Count; i++)
            {
                Destroy(InstanceList[i].gameObject);
            }

            InstanceList.Clear();
            ActiveInstanceList.Clear();
            deactiveInstanceList.Clear();
        }
Ejemplo n.º 22
0
        //MaxCountを超えてオブジェクトが生成されている場合は使用していないオブジェクトを破棄する
        void RemoveCheck()
        {
            CheckInstanceAvailable();
            T removeInstance;

            while (0 < deactiveInstanceList.Count)
            {
                if (InstanceList.Count <= maxCount)
                {
                    break;
                }
                removeInstance = deactiveInstanceList[0];
                deactiveInstanceList.Remove(removeInstance);
                InstanceList.Remove(removeInstance);
                Destroy(removeInstance.gameObject);
            }
        }
Ejemplo n.º 23
0
        private InstanceList GetInstanceList(Action <string> _ErrorMessageAction = null)
        {
            InstanceList RequestedList = null;

            try
            {
                using (var Service = GetService())
                {
                    var Request = Service.Instances.List(ProjectID, ZoneName);
                    RequestedList = Request.Execute();
                }
            }
            catch (Exception e)
            {
                _ErrorMessageAction?.Invoke("BVMServiceGC->GetInstanceList: " + e.Message + ", Trace: " + e.StackTrace);
                return(null);
            }
            return(RequestedList);
        }
Ejemplo n.º 24
0
        public virtual T GetInstance()
        {
            CheckInstanceAvailable();
            T instance;

            if (deactiveInstanceList.Count >= 1)
            {
                instance = deactiveInstanceList[0];
                deactiveInstanceList.Remove(instance);
                ActiveInstanceList.Add(instance);
                instance.gameObject.SetActive(true);
                return(instance);
            }

            //足りない場合は生成する
            instance = Instantiate(GetOriginal, transform);
            InstanceList.Add(instance);
            ActiveInstanceList.Add(instance);
            instance.gameObject.SetActive(true);
            return(instance);
        }
Ejemplo n.º 25
0
        public override object Visit(Subsumption e)
        {
            var iC = getSingleNamgedInstance(e.C);
            var iD = getSingleNamgedInstance(e.D);

            if (iC != null)
            {
                if (iD != null)
                {
                    var list = new InstanceList(null)
                    {
                        List = new List <Instance>(new Instance[] { iC, iD })
                    };
                    return(new SameInstances(null, list, e.modality));
                }
                else
                {
                    return(ConvertToAbox(iC, e.modality, e.D));
                }
            }
            return(e);
        }
Ejemplo n.º 26
0
    void DoWork(InstanceList task)
    {
        if (task.instances.Count <= 0)
        {
            return;
        }

        if (threadCount <= 0)
        {
            foreach (var i in task.instances)
            {
                i.SuperStep();
            }
            return;
        }

        currentTask = task;
        monitor_workers.Set();
        // Wait until all threads have started
        if (!monitor_main.WaitOne(34))
        {
            Debug.LogError("One or more threads did not start.");
        }
        monitor_main.Reset();
        monitor_workers.Reset();
        // Wait until all threads have finished
        if (!monitor_main.WaitOne(1000))
        {
            Debug.LogError("Deadlock or loop detected.");
        }
        monitor_main.Reset();

        task.Reset();

        if (available != threadCount)
        {
            Debug.Log(available);
        }
    }
Ejemplo n.º 27
0
 protected void Page_Load(object sender, EventArgs e)
 {
     this.OrgId = _functions.GetUserOrgId(HttpContext.Current.User.Identity.Name, false);
     if (!IsPostBack)
     {
         string key = orders.GetIntegrationKey(this.OrgId);
         MessagePanel.Visible        = !string.IsNullOrEmpty(key);
         WarehouseLoginPanel.Visible = string.IsNullOrEmpty(key);
     }
     else
     {
         if (OrganizationList.Items.Count > 0 && ConnectPanel.Visible)
         {
             DataTable dt = Client.GetInstances(new Guid(OrganizationList.SelectedValue));
             if (dt.Rows.Count > 0)
             {
                 InstanceList.DataSource = dt;
                 InstanceList.DataBind();
             }
         }
     }
 }
Ejemplo n.º 28
0
        /// <summary>
        ///     Closes this YoderZone.NLogConfig.SettingsHelper.
        /// </summary>
        public void Close()
        {
            lock (this.configLock)
            {
                LogManager.ConfigurationChanged -= this.LogManager_ConfigurationChanged;

                if (this.rules != null)
                {
                    foreach (var loggingRule in
                             this.rules.Where(
                                 loggingRule =>
                                 this.Configuration.LoggingRules.Contains(loggingRule.Value)))
                    {
                        this.Configuration.LoggingRules.Remove(loggingRule.Value);
                    }

                    this.Rules.Clear();
                    this.rules = null;
                }

                if (this.targets == null)
                {
                    return;
                }

                foreach (var target in
                         this.targets.Where(
                             target => this.Configuration.ConfiguredNamedTargets.Contains(
                                 target.Value)))
                {
                    this.config.RemoveTarget(target.Key);
                }

                this.targets.Clear();
                this.targets = null;
                InstanceList.Remove(this.ApplicationName);
                LogManager.ReconfigExistingLoggers();
            }
        }
Ejemplo n.º 29
0
        /// <summary>
        ///     Creates a new NLog configuration.
        /// </summary>
        /// <param name="applicationName">
        ///     Name of the application.
        /// </param>
        /// <param name="companyName">
        ///     Name of the company.
        /// </param>
        /// <param name="logFilesFolder">
        ///     Folder name where o store log files.
        /// </param>
        /// <returns>
        ///     A SettingsHelper.
        /// </returns>
        public static SettingsHelper NewConfiguration(
            string applicationName,
            string companyName,
            string logFilesFolder = "logs")
        {
            if (settingsHelperLogger != null)
            {
                settingsHelperLogger.Debug("Entered static method.");
                settingsHelperLogger.Trace("applicationName: {0}", applicationName);
                settingsHelperLogger.Trace("companyName:     {0}", companyName);
                settingsHelperLogger.Trace("logFilesFolder:  {0}", logFilesFolder);
            }

            var nLogConfiguration = new SettingsHelper
            {
                ApplicationName = applicationName,
                CompanyName     = companyName,
                LogFilesFolder  = logFilesFolder
            };

            InstanceList.Add(applicationName, nLogConfiguration);
            return(nLogConfiguration);
        }
Ejemplo n.º 30
0
        public void LoadActivityTree(Activity rootActivity, ActivityInstance rootInstance, List <ActivityInstance> secondaryRootInstances, ActivityExecutor executor)
        {
            Fx.Assert(_rawDeserializedLists != null, "We should always have deserialized some lists.");

            _instanceMapping = new Dictionary <Activity, InstanceList>(_rawDeserializedLists.Length);

            for (int i = 0; i < _rawDeserializedLists.Length; i++)
            {
                InstanceList list = _rawDeserializedLists[i];
                Activity     activity;
                if (!QualifiedId.TryGetElementFromRoot(rootActivity, list.ActivityId, out activity))
                {
                    throw Microsoft.CoreWf.Internals.FxTrace.Exception.AsError(new InvalidOperationException(SR.ActivityInstanceFixupFailed));
                }
                _instanceMapping.Add(activity, list);
                list.Load(activity, this);
            }

            // We need to null this out once we've recreated the dictionary to avoid
            // having out of sync data
            _rawDeserializedLists = null;

            // then walk our instance list, fixup parent references, and perform basic validation
            Func <ActivityInstance, ActivityExecutor, bool> processInstanceCallback = new Func <ActivityInstance, ActivityExecutor, bool>(OnActivityInstanceLoaded);

            rootInstance.FixupInstance(null, this, executor);
            ActivityUtilities.ProcessActivityInstanceTree(rootInstance, executor, processInstanceCallback);

            if (secondaryRootInstances != null)
            {
                foreach (ActivityInstance instance in secondaryRootInstances)
                {
                    instance.FixupInstance(null, this, executor);
                    ActivityUtilities.ProcessActivityInstanceTree(instance, executor, processInstanceCallback);
                }
            }
        }