Esempio n. 1
0
        private void ImportModelInfo([NotNull] ThreatModel source, [NotNull] IThreatModel target)
        {
            target.Owner       = source.Owner;
            target.Name        = source.ThreatModelName;
            target.Description = source.HighLevelSystemDescription;
            var assumptions = source.Assumptions?.Trim(' ', '\r', '\n').Split('\n');

            if (assumptions?.Any() ?? false)
            {
                foreach (var assumption in assumptions)
                {
                    if (!string.IsNullOrWhiteSpace(assumption.Trim('\r')))
                    {
                        target.AddAssumption(assumption.Trim(' ', '\r'));
                    }
                }
            }
            var dependencies = source.ExternalDependencies?.Trim(' ', '\r', '\n').Split('\n');

            if (dependencies?.Any() ?? false)
            {
                foreach (var dependency in dependencies)
                {
                    if (!string.IsNullOrWhiteSpace(dependency.Trim('\r')))
                    {
                        target.AddDependency(dependency.Trim(' ', '\r'));
                    }
                }
            }
            var contributors = source.Contributors?.Trim(' ', '\r', '\n').Split(',', ';');

            if (contributors?.Any() ?? false)
            {
                foreach (var contributor in contributors)
                {
                    if (!string.IsNullOrWhiteSpace(contributor.Trim('\r')))
                    {
                        target.AddContributor(contributor.Trim(' ', '\r'));
                    }
                }
            }
        }