本文整理汇总了C#中IProjectContent类的典型用法代码示例。如果您正苦于以下问题:C# IProjectContent类的具体用法?C# IProjectContent怎么用?C# IProjectContent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IProjectContent类属于命名空间,在下文中一共展示了IProjectContent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ElementReturnType
public ElementReturnType(IProjectContent pc, IReturnType enumerableType)
{
if (pc == null)
throw new ArgumentNullException("pc");
this.enumerableType = enumerableType;
this.pc = pc;
}
示例2: CodeNamespace
public CodeNamespace(IProjectContent projectContent, NamespaceName namespaceName)
{
this.projectContent = projectContent;
this.namespaceName = namespaceName;
this.InfoLocation = vsCMInfoLocation.vsCMInfoLocationExternal;
this.Language = GetLanguage(projectContent);
}
示例3: AddAttributes
static void AddAttributes(IProjectContent pc, IList<IAttribute> list, CustomAttributeCollection attributes)
{
foreach (CustomAttribute att in attributes) {
DefaultAttribute a = new DefaultAttribute(CreateType(pc, null, att.Constructor.DeclaringType));
// Currently Cecil returns string instead of TypeReference for typeof() arguments to attributes
var parameters = att.Constructor.Parameters;
for (int i = 0; i < Math.Min(parameters.Count, att.ConstructorParameters.Count); i++) {
object o = att.ConstructorParameters[i];
if (parameters[i].ParameterType.FullName == "System.Type" && o is string) {
try {
a.PositionalArguments.Add(ReflectionReturnType.Parse(pc, (string)o));
} catch (ReflectionTypeNameSyntaxError ex) {
LoggingService.Warn("parsing '" + o + "'", ex);
a.PositionalArguments.Add(o);
}
} else {
a.PositionalArguments.Add(o);
}
}
foreach (DictionaryEntry entry in att.Properties) {
a.NamedArguments.Add(entry.Key.ToString(), entry.Value);
}
list.Add(a);
}
}
示例4: CreateCompilationUnit
void CreateCompilationUnit(IProjectContent projectContent, string fileName)
{
compilationUnit = new DefaultCompilationUnit(projectContent);
compilationUnit.FileName = fileName;
CreateUsingScopeForCompilationUnit(fileName);
}
示例5: Parse
public ICompilationUnit Parse(IProjectContent projectContent, string fileName, ITextBuffer fileContent)
{
var modelTypeLocater = new RazorCSharpModelTypeLocater(fileContent);
return new RazorCompilationUnit(projectContent) {
ModelTypeName = modelTypeLocater.ModelTypeName
};
}
示例6: Parse
public ICompilationUnit Parse(IProjectContent projectContent, string fileName, string fileContent)
{
LoggingService.Debug("Parse " + fileName);
int lineCount = 1;
foreach (char c in fileContent) {
if (c == '\n') {
lineCount++;
}
}
int[] lineLength = new int[lineCount];
int length = 0;
int i = 0;
foreach (char c in fileContent) {
if (c == '\n') {
lineLength[i] = length;
i += 1;
length = 0;
} else if (c != '\r') {
length += 1;
}
}
lineLength[i] = length;
BooCompiler compiler = new BooCompiler();
compiler.Parameters.Input.Add(new StringInput(fileName, fileContent));
ICompilationUnit cu = Parse(projectContent, fileName, lineLength, compiler);
AddCommentsAndRegions(cu, fileContent, fileName);
return cu;
}
示例7: GetProject
IProject GetProject(IProjectContent projectContent)
{
if (this.project.ProjectContent == projectContent) {
return project;
}
return null;
}
示例8: ParseInformationEventArgs
public ParseInformationEventArgs(string fileName, IProjectContent projectContent, ICompilationUnit oldCompilationUnit, ICompilationUnit newCompilationUnit)
{
this.fileName = fileName;
this.projectContent = projectContent;
this.oldCompilationUnit = oldCompilationUnit;
this.newCompilationUnit = newCompilationUnit;
}
示例9: GetValue
static object GetValue(IProjectContent pc, IEntity member, CustomAttributeArgument argument)
{
if (argument.Value is TypeReference)
return CreateType(pc, member, (TypeReference)argument.Value);
else
return argument.Value;
}
示例10: GetClassReturnType
public GetClassReturnType(IProjectContent content, string fullName, int typeArgumentCount, GetClassOptions options)
{
this.content = content;
this.typeArgumentCount = typeArgumentCount;
SetFullyQualifiedName(fullName);
this.options = options;
}
示例11: GetInfoLocation
global::EnvDTE.vsCMInfoLocation GetInfoLocation(IProjectContent projectContent, IClass c)
{
if (projectContent.Project == c.ProjectContent.Project) {
return global::EnvDTE.vsCMInfoLocation.vsCMInfoLocationProject;
}
return global::EnvDTE.vsCMInfoLocation.vsCMInfoLocationExternal;
}
示例12: VoidClass
public VoidClass(IProjectContent pc)
: base(new DefaultCompilationUnit(pc), VoidName)
{
this.ClassType = ClassType.Struct;
this.Modifiers = ModifierEnum.Public | ModifierEnum.Sealed;
Freeze();
}
示例13: CodeType
/// <summary>
/// Note that projectContent may be different to the IClass.ProjectContent since the class
/// is retrieved from the namespace contents and could belong to a separate project or
/// referenced assembly.
/// </summary>
public CodeType(IProjectContent projectContent, IClass c)
: base(c)
{
this.Class = c;
this.ProjectContent = projectContent;
InfoLocation = GetInfoLocation(projectContent, c);
}
示例14: GetClassIfTypeNameIsNotEmpty
IClass GetClassIfTypeNameIsNotEmpty(IProjectContent projectContent, string modelTypeName)
{
if (!String.IsNullOrEmpty(modelTypeName)) {
return projectContent.GetClass(modelTypeName, 0);
}
return null;
}
示例15: CSharpCompletion
public CSharpCompletion()
{
projectContent = new CSharpProjectContent();
var assemblies = new List<Assembly>
{
typeof(object).Assembly, // mscorlib
typeof(Uri).Assembly, // System.dll
typeof(Enumerable).Assembly, // System.Core.dll
// typeof(System.Xml.XmlDocument).Assembly, // System.Xml.dll
// typeof(System.Drawing.Bitmap).Assembly, // System.Drawing.dll
// typeof(Form).Assembly, // System.Windows.Forms.dll
// typeof(ICSharpCode.NRefactory.TypeSystem.IProjectContent).Assembly,
};
var unresolvedAssemblies = new IUnresolvedAssembly[assemblies.Count];
Stopwatch total = Stopwatch.StartNew();
Parallel.For(
0, assemblies.Count,
delegate(int i)
{
var loader = new CecilLoader();
var path = assemblies[i].Location;
loader.DocumentationProvider = GetXmlDocumentation(assemblies[i].Location);
unresolvedAssemblies[i] = loader.LoadAssemblyFile(assemblies[i].Location);
});
Debug.WriteLine("Init project content, loading base assemblies: " + total.Elapsed);
projectContent = projectContent.AddAssemblyReferences((IEnumerable<IUnresolvedAssembly>)unresolvedAssemblies);
}