Ejemplo n.º 1
0
        public Workspace(
            string[] usings             = null,
            File[] files                = null,
            Buffer[] buffers            = null,
            string workspaceType        = DefaultWorkspaceType,
            bool includeInstrumentation = false)
        {
            WorkspaceType = workspaceType ?? DefaultWorkspaceType;
            Usings        = usings ?? Array.Empty <string>();
            Usings        = usings ?? Array.Empty <string>();
            Files         = files ?? Array.Empty <File>();
            Buffers       = buffers ?? Array.Empty <Buffer>();

            IncludeInstrumentation = includeInstrumentation;

            if (Files.Distinct().Count() != Files.Length)
            {
                throw new ArgumentException($"Duplicate file names:{Environment.NewLine}{string.Join(Environment.NewLine, Files.Select(f => f.Name))}");
            }

            if (Buffers.Distinct().Count() != Buffers.Length)
            {
                throw new ArgumentException($"Duplicate buffer ids:{Environment.NewLine}{string.Join(Environment.NewLine, Buffers.Select(b => b.Id))}");
            }
        }