Esempio n. 1
0
        public ExtendedState(State state)
        {
            this.State = state;

            var leftPath  = ExtendedState.GetFullPath(state.LeftPath);
            var rightPath = ExtendedState.GetFullPath(state.RightPath);

            if (Directory.Exists(leftPath))
            {
                leftPath = ExtendedState.GetNormalizedDirectoryName(leftPath);

                this.LeftDirectoryExists = true;
            }
            else if (File.Exists(leftPath))
            {
                this.LeftFileExists = true;
            }

            this.LeftPath = leftPath;

            if (Directory.Exists(rightPath))
            {
                rightPath = ExtendedState.GetNormalizedDirectoryName(rightPath);

                this.RightDirectoryExists = true;
            }
            else if (File.Exists(rightPath))
            {
                this.RightFileExists = true;
            }

            this.RightPath = rightPath;

            if (!string.IsNullOrWhiteSpace(state.Filters))
            {
                foreach (var extension in state.Filters.Split(';'))
                {
                    if (extension.Length != 0)
                    {
                        if (extension[0] == '-')
                        {
                            if (_excluded == null)
                            {
                                _excluded = new HashSet <string>(StringComparer.OrdinalIgnoreCase);
                            }

                            _excluded.Add(extension.Substring(1));
                        }
                        else
                        {
                            if (_included == null)
                            {
                                _included = new HashSet <string>(StringComparer.OrdinalIgnoreCase);
                            }

                            _included.Add(extension);
                        }
                    }
                }
            }
        }