示例#1
0
        private string TryGetGeneratedClassNameFromFile()
        {
            var projectFile = File.GetSourceFile()?.ToProjectFile();

            if (projectFile == null)
            {
                return(null);
            }
            var dataManager = File.GetSolution().GetComponent <IT4TemplateKindProvider>();

            if (!dataManager.IsPreprocessedTemplate(projectFile))
            {
                return(null);
            }
            string fileName = File.GetSourceFile()?.Name.WithoutExtension();

            if (fileName == null)
            {
                return(null);
            }
            if (!ValidityChecker.IsValidIdentifier(fileName))
            {
                return(null);
            }
            return(fileName);
        }
示例#2
0
        public static string CreateGeneratedClassName([NotNull] this IPsiSourceFile thіs)
        {
            string fileName = thіs.Name.WithoutExtension();

            if (ValidityChecker.IsValidIdentifier(fileName))
            {
                return(fileName);
            }
            return(T4CSharpIntermediateConverterBase.GeneratedClassNameString);
        }
        public PreferAddressByIdToGraphicsParamsQuickFix(PreferAddressByIdToGraphicsParamsWarning warning)
        {
            myInvocationExpression = warning.InvocationMethod;
            myArgument             = warning.Argument;
            myFieldName            = myGraphicsPropertyName = warning.Literal;
            if (!ValidityChecker.IsValidIdentifier(myFieldName))
            {
                myFieldName = "Property";
            }

            myArgumentExpression = warning.ArgumentExpression;
            myMapFunction        = warning.MapFunction;
            myTypeName           = warning.TypeName;
        }