Пример #1
0
        bool TrySubmit()
        {
            var trimmedInterfaceName = InterfaceName.Trim();
            var trimmedFileName      = FileName.Trim();

            if (!IncludedMembers.Any())
            {
                return(false);
            }
            if (conflictingTypeNames.Contains(trimmedInterfaceName))
            {
                return(false);
            }
            if (!syntaxFactsService.IsValidIdentifier(trimmedInterfaceName))
            {
                return(false);
            }
            if (trimmedFileName.IndexOfAny(System.IO.Path.GetInvalidFileNameChars()) >= 0)
            {
                return(false);
            }

            if (!System.IO.Path.GetExtension(trimmedFileName).Equals(fileExtension, StringComparison.OrdinalIgnoreCase))
            {
                return(false);
            }
            return(true);
        }
        internal bool TrySubmit()
        {
            var trimmedInterfaceName = InterfaceName.Trim();
            var trimmedFileName      = FileName.Trim();

            if (!MemberContainers.Any(c => c.IsChecked))
            {
                SendFailureNotification(ServicesVSResources.You_must_select_at_least_one_member);
                return(false);
            }

            if (_conflictingTypeNames.Contains(trimmedInterfaceName))
            {
                SendFailureNotification(ServicesVSResources.Interface_name_conflicts_with_an_existing_type_name);
                return(false);
            }

            if (!_syntaxFactsService.IsValidIdentifier(trimmedInterfaceName))
            {
                SendFailureNotification(string.Format(ServicesVSResources.Interface_name_is_not_a_valid_0_identifier, _languageName));
                return(false);
            }

            if (trimmedFileName.IndexOfAny(Path.GetInvalidFileNameChars()) >= 0)
            {
                SendFailureNotification(ServicesVSResources.Illegal_characters_in_path);
                return(false);
            }

            if (!System.IO.Path.GetExtension(trimmedFileName).Equals(_fileExtension, StringComparison.OrdinalIgnoreCase))
            {
                SendFailureNotification(string.Format(ServicesVSResources.File_name_must_have_the_0_extension, _fileExtension));
                return(false);
            }

            // TODO: Deal with filename already existing

            return(true);
        }
Пример #3
0
        internal bool TrySubmit()
        {
            var trimmedInterfaceName = InterfaceName.Trim();
            var trimmedFileName      = FileName.Trim();

            if (!MemberContainers.Any(c => c.IsChecked))
            {
                SendFailureNotification(ServicesVSResources.YouMustSelectAtLeastOneMember);
                return(false);
            }

            if (_conflictingTypeNames.Contains(trimmedInterfaceName))
            {
                SendFailureNotification(ServicesVSResources.InterfaceNameConflictsWithTypeName);
                return(false);
            }

            if (!_syntaxFactsService.IsValidIdentifier(trimmedInterfaceName))
            {
                SendFailureNotification(string.Format(ServicesVSResources.InterfaceNameIsNotAValidIdentifier, _languageName));
                return(false);
            }

            if (trimmedFileName.IndexOfAny(Path.GetInvalidFileNameChars()) >= 0)
            {
                SendFailureNotification(ServicesVSResources.IllegalCharactersInPath);
                return(false);
            }

            if (!System.IO.Path.GetExtension(trimmedFileName).Equals(_fileExtension, StringComparison.OrdinalIgnoreCase))
            {
                SendFailureNotification(string.Format(ServicesVSResources.FileNameMustHaveTheExtension, _fileExtension));
                return(false);
            }

            // TODO: Deal with filename already existing

            return(true);
        }
Пример #4
0
        internal bool TrySubmit()
        {
            var trimmedInterfaceName = InterfaceName.Trim();
            var trimmedFileName      = FileName.Trim();

            if (!MemberContainers.Any(c => c.IsChecked))
            {
                SendFailureNotification("YouMustSelectAtLeastOneMember");
                return(false);
            }

            if (_conflictingTypeNames.Contains(trimmedInterfaceName))
            {
                SendFailureNotification("InterfaceNameConflictsWithTypeName");
                return(false);
            }

            //if (!_syntaxFactsService.IsValidIdentifier(trimmedInterfaceName))
            //{
            //    SendFailureNotification($"InterfaceNameIsNotAValidIdentifier {_languageName}");
            //    return false;
            //}

            if (trimmedFileName.IndexOfAny(Path.GetInvalidFileNameChars()) >= 0)
            {
                SendFailureNotification("IllegalCharactersInPath");
                return(false);
            }

            if (!Path.GetExtension(trimmedFileName).Equals(_fileExtension, StringComparison.OrdinalIgnoreCase))
            {
                SendFailureNotification($"FileNameMustHaveTheExtension {_fileExtension}");
                return(false);
            }

            // TODO: Deal with filename already existing

            return(true);
        }