├── .nuget ├── NuGet.exe ├── NuGet.Config └── NuGet.targets ├── xcopy └── html │ ├── css │ ├── c.png │ ├── n.png │ ├── s.png │ └── index.css │ └── index.html ├── codevis ├── graph_light.ico ├── packages.config ├── DependencyForceGraph │ ├── Do │ │ ├── DependencyKind.cs │ │ ├── Uses.cs │ │ ├── Contains.cs │ │ ├── Implements.cs │ │ ├── Graph.cs │ │ ├── MethodCall.cs │ │ └── Dependency.cs │ ├── DataStructures │ │ ├── DependencyGraph │ │ │ ├── DependencyKinds.cs │ │ │ ├── DependecyKindExtensions.cs │ │ │ ├── Edge.cs │ │ │ └── AdjacencyMatrix.cs │ │ └── TypeTree │ │ │ ├── INode.cs │ │ │ ├── Leaf.cs │ │ │ ├── NodeFactory.cs │ │ │ ├── QualifiedName.cs │ │ │ ├── NodeBase.cs │ │ │ ├── Tree.cs │ │ │ └── Node.cs │ ├── EdgeAddedEventArgs.cs │ ├── AnalyzesProgress.cs │ ├── Analyzer.cs │ └── AnalyzerExtensions.cs ├── Properties │ └── AssemblyInfo.cs ├── AssemblyLoadHelper.cs ├── Options.cs ├── AssemblySearchHelper.cs ├── Program.cs └── codevis.csproj ├── Gma.CodeVisuals.WebApi ├── graph.ico ├── html │ ├── img │ │ ├── graph.ico │ │ └── assembly.png │ ├── css │ │ ├── jstree │ │ │ ├── 32px.png │ │ │ ├── 40px.png │ │ │ └── throbber.gif │ │ ├── index.css │ │ └── main.css │ ├── main.html │ ├── index.html │ └── js │ │ ├── index.js │ │ ├── tree.js │ │ ├── vertex.js │ │ ├── main.js │ │ └── lib │ │ └── jquery.ui.touch.js ├── DependencyForceGraph │ ├── Dto │ │ ├── GraphDto.cs │ │ ├── Tree.cs │ │ └── LinkDto.cs │ ├── DependenciesController.cs │ └── Storage.cs ├── packages.config ├── Properties │ └── AssemblyInfo.cs ├── Server │ ├── FileType.cs │ └── WebServerOnFolder.cs ├── port8080problem.html ├── Program.cs └── Gma.CodeVisuals.WebApi.csproj ├── Gma.CodeGravity.Tests ├── TestData │ ├── TypeB.cs │ ├── TypeOfTWithFieldOfIDictionaryTChar.cs │ ├── TypeWithFieldOfTypeTupleIntFloat.cs │ ├── TypeWithMethodAcceptingIEnumerableOfChar.cs │ ├── TypeWithFieldOfIEnumerableString.cs │ ├── TypeWithMethodReturnIEnumerableOfInt.cs │ ├── TypeA.cs │ ├── TypeWithPublicNestedType.cs │ ├── TypeC.cs │ └── TypeWithPrivateNestedType.cs ├── packages.config ├── AnalyzerTests.cs └── Gma.CodeVisuals.DependencyForceGraph.Tests.csproj ├── packages └── Depender.Parser │ ├── lib │ ├── Depender.Parser.dll │ └── Depender.Parser.pdb │ └── src │ └── Depender.Parser │ ├── IILProvider.cs │ ├── IILStringCollector.cs │ ├── ITokenResolver.cs │ ├── InlineNoneInstruction.cs │ ├── IFormatProvider.cs │ ├── RawILStringToTextWriter.cs │ ├── ReadableILStringToTextWriter.cs │ ├── InlineIInstruction.cs │ ├── InlineI8Instruction.cs │ ├── InlineRInstruction.cs │ ├── ShortInlineIInstruction.cs │ ├── InlineVarInstruction.cs │ ├── ShortInlineRInstruction.cs │ ├── ShortInlineVarInstruction.cs │ ├── MethodBaseILProvider.cs │ ├── ILInstruction.cs │ ├── InlineBrTargetInstruction.cs │ ├── ShortInlineBrTargetInstruction.cs │ ├── InlineTypeInstruction.cs │ ├── InlineStringInstruction.cs │ ├── InlineSigInstruction.cs │ ├── InlineTokInstruction.cs │ ├── InlineFieldInstruction.cs │ ├── InlineMethodInstruction.cs │ ├── InlineSwitchInstruction.cs │ ├── ModuleScopeTokenResolver.cs │ ├── ILInstructionVisitor.cs │ ├── MethodBodyInfo.cs │ ├── RawILStringVisitor.cs │ ├── DefaultFormatProvider.cs │ ├── Depender.Parser.csproj │ ├── ReadableILStringVisitor.cs │ └── ILReader.cs ├── README.md ├── Gma.CodeVisuals.sln.DotSettings ├── LICENSE ├── .gitignore └── Gma.CodeVisuals.sln /.nuget/NuGet.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fgreinacher/codegravity/HEAD/.nuget/NuGet.exe -------------------------------------------------------------------------------- /xcopy/html/css/c.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fgreinacher/codegravity/HEAD/xcopy/html/css/c.png -------------------------------------------------------------------------------- /xcopy/html/css/n.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fgreinacher/codegravity/HEAD/xcopy/html/css/n.png -------------------------------------------------------------------------------- /xcopy/html/css/s.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fgreinacher/codegravity/HEAD/xcopy/html/css/s.png -------------------------------------------------------------------------------- /codevis/graph_light.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fgreinacher/codegravity/HEAD/codevis/graph_light.ico -------------------------------------------------------------------------------- /Gma.CodeVisuals.WebApi/graph.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fgreinacher/codegravity/HEAD/Gma.CodeVisuals.WebApi/graph.ico -------------------------------------------------------------------------------- /Gma.CodeVisuals.WebApi/html/img/graph.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fgreinacher/codegravity/HEAD/Gma.CodeVisuals.WebApi/html/img/graph.ico -------------------------------------------------------------------------------- /Gma.CodeVisuals.WebApi/html/img/assembly.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fgreinacher/codegravity/HEAD/Gma.CodeVisuals.WebApi/html/img/assembly.png -------------------------------------------------------------------------------- /Gma.CodeGravity.Tests/TestData/TypeB.cs: -------------------------------------------------------------------------------- 1 | namespace Gma.CodeGravity.Tests.TestData 2 | { 3 | internal class TypeB : TypeA 4 | { 5 | } 6 | } -------------------------------------------------------------------------------- /Gma.CodeVisuals.WebApi/html/css/jstree/32px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fgreinacher/codegravity/HEAD/Gma.CodeVisuals.WebApi/html/css/jstree/32px.png -------------------------------------------------------------------------------- /Gma.CodeVisuals.WebApi/html/css/jstree/40px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fgreinacher/codegravity/HEAD/Gma.CodeVisuals.WebApi/html/css/jstree/40px.png -------------------------------------------------------------------------------- /packages/Depender.Parser/lib/Depender.Parser.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fgreinacher/codegravity/HEAD/packages/Depender.Parser/lib/Depender.Parser.dll -------------------------------------------------------------------------------- /packages/Depender.Parser/lib/Depender.Parser.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fgreinacher/codegravity/HEAD/packages/Depender.Parser/lib/Depender.Parser.pdb -------------------------------------------------------------------------------- /Gma.CodeVisuals.WebApi/html/css/jstree/throbber.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fgreinacher/codegravity/HEAD/Gma.CodeVisuals.WebApi/html/css/jstree/throbber.gif -------------------------------------------------------------------------------- /Gma.CodeGravity.Tests/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | codegravity 2 | =========== 3 | 4 | [![Build status](https://ci.appveyor.com/api/projects/status/h5by4sfoa5sx32f0)](https://ci.appveyor.com/project/floriangreinacher/codegravity) 5 | -------------------------------------------------------------------------------- /.nuget/NuGet.Config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /codevis/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Gma.CodeGravity.Tests/TestData/TypeOfTWithFieldOfIDictionaryTChar.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace Gma.CodeGravity.Tests.TestData 4 | { 5 | class TypeOfTWithFieldOfIDictionaryTChar 6 | { 7 | private IDictionary _; 8 | } 9 | } -------------------------------------------------------------------------------- /Gma.CodeGravity.Tests/TestData/TypeWithFieldOfTypeTupleIntFloat.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Gma.CodeGravity.Tests.Annotations; 3 | 4 | namespace Gma.CodeGravity.Tests.TestData 5 | { 6 | class TypeWithFieldOfTypeTupleIntFloat 7 | { 8 | [UsedImplicitly] 9 | Tuple _; 10 | } 11 | } -------------------------------------------------------------------------------- /Gma.CodeGravity.Tests/TestData/TypeWithMethodAcceptingIEnumerableOfChar.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace Gma.CodeGravity.Tests.TestData 4 | { 5 | class TypeWithMethodAcceptingIEnumerableOfChar 6 | { 7 | public void _(IEnumerable _) 8 | { 9 | } 10 | } 11 | } -------------------------------------------------------------------------------- /Gma.CodeGravity.Tests/TestData/TypeWithFieldOfIEnumerableString.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using Gma.CodeGravity.Tests.Annotations; 3 | 4 | namespace Gma.CodeGravity.Tests.TestData 5 | { 6 | class TypeWithFieldOfIEnumerableString 7 | { 8 | [UsedImplicitly] 9 | IEnumerable _; 10 | } 11 | } -------------------------------------------------------------------------------- /Gma.CodeGravity.Tests/TestData/TypeWithMethodReturnIEnumerableOfInt.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace Gma.CodeGravity.Tests.TestData 4 | { 5 | class TypeWithMethodReturnIEnumerableOfInt 6 | { 7 | public IEnumerable _() 8 | { 9 | return null; 10 | } 11 | } 12 | } -------------------------------------------------------------------------------- /Gma.CodeGravity.Tests/TestData/TypeA.cs: -------------------------------------------------------------------------------- 1 | using Gma.CodeGravity.Tests.Annotations; 2 | 3 | namespace Gma.CodeGravity.Tests.TestData 4 | { 5 | internal class TypeA 6 | { 7 | [UsedImplicitly] 8 | public static void Method2Call() 9 | { 10 | TypeC.Method2(); 11 | } 12 | } 13 | } -------------------------------------------------------------------------------- /packages/Depender.Parser/src/Depender.Parser/IILProvider.cs: -------------------------------------------------------------------------------- 1 | // Type: ClrTest.Reflection.IILProvider 2 | // Assembly: Depender.Parser, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null 3 | // MVID: 7BFB306E-D2F0-493B-8C2F-5C3CEA04F731 4 | // Assembly location: D:\temp\NSplit\Depender\Depender.Parser.dll 5 | 6 | namespace ClrTest.Reflection 7 | { 8 | public interface IILProvider 9 | { 10 | byte[] GetByteArray(); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /codevis/DependencyForceGraph/Do/DependencyKind.cs: -------------------------------------------------------------------------------- 1 | // This code is distributed under MIT license. 2 | // Copyright (c) 2014 George Mamaladze, Florian Greinacher 3 | // See license.txt or http://opensource.org/licenses/mit-license.php 4 | 5 | namespace Gma.CodeVisuals.Generator.DependencyForceGraph.Do 6 | { 7 | public enum DependencyKind 8 | { 9 | MethodCall = 1, 10 | Uses = 2, 11 | Implements = 4, 12 | Contains = 8 13 | } 14 | } -------------------------------------------------------------------------------- /packages/Depender.Parser/src/Depender.Parser/IILStringCollector.cs: -------------------------------------------------------------------------------- 1 | // Type: ClrTest.Reflection.IILStringCollector 2 | // Assembly: Depender.Parser, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null 3 | // MVID: 7BFB306E-D2F0-493B-8C2F-5C3CEA04F731 4 | // Assembly location: D:\temp\NSplit\Depender\Depender.Parser.dll 5 | 6 | namespace ClrTest.Reflection 7 | { 8 | public interface IILStringCollector 9 | { 10 | void Process(ILInstruction ilInstruction, string operandString); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Gma.CodeGravity.Tests/TestData/TypeWithPublicNestedType.cs: -------------------------------------------------------------------------------- 1 | // This code is distributed under MIT license. 2 | // Copyright (c) 2014 George Mamaladze, Florian Greinacher 3 | // See license.txt or http://opensource.org/licenses/mit-license.php 4 | 5 | namespace Gma.CodeGravity.Tests.TestData 6 | { 7 | public class TypeWithPublicNestedType 8 | { 9 | 10 | public class NestedPublic 11 | { 12 | public void Bar() 13 | { 14 | } 15 | } 16 | } 17 | } -------------------------------------------------------------------------------- /Gma.CodeVisuals.WebApi/DependencyForceGraph/Dto/GraphDto.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.Serialization; 2 | 3 | namespace Gma.CodeVisuals.WebApi.DependencyForceGraph.Dto 4 | { 5 | [DataContract] 6 | public class GraphDto 7 | { 8 | [DataMember(Name = "name")] 9 | public string Name { get; set; } 10 | 11 | [DataMember(Name = "tree")] 12 | public Tree Tree { get; set; } 13 | 14 | [DataMember(Name = "links")] 15 | public LinkDto[] Links { get; set; } 16 | } 17 | } -------------------------------------------------------------------------------- /Gma.CodeVisuals.WebApi/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Gma.CodeGravity.Tests/TestData/TypeC.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Gma.CodeGravity.Tests.Annotations; 3 | 4 | namespace Gma.CodeGravity.Tests.TestData 5 | { 6 | internal static class TypeC 7 | { 8 | [UsedImplicitly] 9 | public static void Method1() 10 | { 11 | Method2(); 12 | } 13 | 14 | public static void Method2() 15 | { 16 | } 17 | 18 | public static TypeA Do() 19 | { 20 | throw new Exception(); 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /codevis/DependencyForceGraph/DataStructures/DependencyGraph/DependencyKinds.cs: -------------------------------------------------------------------------------- 1 | // This code is distributed under MIT license. 2 | // Copyright (c) 2014 George Mamaladze, Florian Greinacher 3 | // See license.txt or http://opensource.org/licenses/mit-license.php 4 | 5 | #region usings 6 | 7 | using System; 8 | 9 | #endregion 10 | 11 | namespace Gma.CodeVisuals.Generator.DependencyForceGraph.DataStructures.DependencyGraph 12 | { 13 | [Flags] 14 | public enum DependencyKinds 15 | { 16 | None = 0, 17 | MethodCall = 1, 18 | Uses = 2, 19 | Implements = 4, 20 | Contains = 8 21 | } 22 | } -------------------------------------------------------------------------------- /Gma.CodeGravity.Tests/TestData/TypeWithPrivateNestedType.cs: -------------------------------------------------------------------------------- 1 | // This code is distributed under MIT license. 2 | // Copyright (c) 2014 George Mamaladze, Florian Greinacher 3 | // See license.txt or http://opensource.org/licenses/mit-license.php 4 | 5 | namespace Gma.CodeGravity.Tests.TestData 6 | { 7 | public class TypeWithPrivateNestedType 8 | { 9 | public void Foo() 10 | { 11 | var instance = new NestedPrivate(); 12 | instance.Bar(); 13 | } 14 | 15 | private class NestedPrivate 16 | { 17 | public void Bar() 18 | { 19 | } 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /codevis/DependencyForceGraph/Do/Uses.cs: -------------------------------------------------------------------------------- 1 | // This code is distributed under MIT license. 2 | // Copyright (c) 2014 George Mamaladze, Florian Greinacher 3 | // See license.txt or http://opensource.org/licenses/mit-license.php 4 | 5 | #region usings 6 | 7 | using System; 8 | 9 | #endregion 10 | 11 | namespace Gma.CodeVisuals.Generator.DependencyForceGraph.Do 12 | { 13 | public class Uses : Dependency 14 | { 15 | public Uses(Type source, Type target) 16 | : base(source, target) 17 | { 18 | } 19 | 20 | public override DependencyKind Kind 21 | { 22 | get { return DependencyKind.Uses;} 23 | } 24 | } 25 | } -------------------------------------------------------------------------------- /codevis/DependencyForceGraph/DataStructures/TypeTree/INode.cs: -------------------------------------------------------------------------------- 1 | // This code is distributed under MIT license. 2 | // Copyright (c) 2014 George Mamaladze, Florian Greinacher 3 | // See license.txt or http://opensource.org/licenses/mit-license.php 4 | 5 | #region usings 6 | 7 | using System.Collections.Generic; 8 | 9 | #endregion 10 | 11 | namespace Gma.CodeVisuals.Generator.DependencyForceGraph.DataStructures.TypeTree 12 | { 13 | internal interface INode 14 | { 15 | int Id { get; } 16 | string Name { get; } 17 | IEnumerable Children(); 18 | bool IsLeaf(); 19 | IEnumerable Leafs(); 20 | IEnumerable Path(); 21 | } 22 | } -------------------------------------------------------------------------------- /codevis/DependencyForceGraph/Do/Contains.cs: -------------------------------------------------------------------------------- 1 | // This code is distributed under MIT license. 2 | // Copyright (c) 2014 George Mamaladze, Florian Greinacher 3 | // See license.txt or http://opensource.org/licenses/mit-license.php 4 | 5 | #region usings 6 | 7 | using System; 8 | 9 | #endregion 10 | 11 | namespace Gma.CodeVisuals.Generator.DependencyForceGraph.Do 12 | { 13 | public class Contains : Dependency 14 | { 15 | public Contains(Type source, Type nested) 16 | : base(source, nested) 17 | { 18 | } 19 | 20 | public override DependencyKind Kind 21 | { 22 | get { return DependencyKind.Contains; } 23 | } 24 | } 25 | } -------------------------------------------------------------------------------- /codevis/DependencyForceGraph/Do/Implements.cs: -------------------------------------------------------------------------------- 1 | // This code is distributed under MIT license. 2 | // Copyright (c) 2014 George Mamaladze, Florian Greinacher 3 | // See license.txt or http://opensource.org/licenses/mit-license.php 4 | 5 | #region usings 6 | 7 | using System; 8 | 9 | #endregion 10 | 11 | namespace Gma.CodeVisuals.Generator.DependencyForceGraph.Do 12 | { 13 | public class Implements : Dependency 14 | { 15 | public Implements(Type source, Type target) 16 | : base(source, target) 17 | { 18 | } 19 | 20 | public override DependencyKind Kind 21 | { 22 | get { return DependencyKind.Implements;} 23 | } 24 | } 25 | } -------------------------------------------------------------------------------- /packages/Depender.Parser/src/Depender.Parser/ITokenResolver.cs: -------------------------------------------------------------------------------- 1 | // Type: ClrTest.Reflection.ITokenResolver 2 | // Assembly: Depender.Parser, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null 3 | // MVID: 7BFB306E-D2F0-493B-8C2F-5C3CEA04F731 4 | // Assembly location: D:\temp\NSplit\Depender\Depender.Parser.dll 5 | 6 | using System; 7 | using System.Reflection; 8 | 9 | namespace ClrTest.Reflection 10 | { 11 | public interface ITokenResolver 12 | { 13 | MethodBase AsMethod(int token); 14 | 15 | FieldInfo AsField(int token); 16 | 17 | Type AsType(int token); 18 | 19 | string AsString(int token); 20 | 21 | MemberInfo AsMember(int token); 22 | 23 | byte[] AsSignature(int token); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Gma.CodeVisuals.WebApi/DependencyForceGraph/Dto/Tree.cs: -------------------------------------------------------------------------------- 1 | // This code is distributed under MIT license. 2 | // Copyright (c) 2014 George Mamaladze, Florian Greinacher 3 | // See license.txt or http://opensource.org/licenses/mit-license.php 4 | 5 | #region usings 6 | 7 | using System.Runtime.Serialization; 8 | 9 | #endregion 10 | 11 | namespace Gma.CodeVisuals.WebApi.DependencyForceGraph.Dto 12 | { 13 | [DataContract] 14 | public class Tree 15 | { 16 | [DataMember(Name = "id")] 17 | public int Id { get; set; } 18 | 19 | [DataMember(Name = "text")] 20 | public string Name { get; set; } 21 | 22 | [DataMember(Name = "children")] 23 | public Tree[] Children { get; set; } 24 | } 25 | } -------------------------------------------------------------------------------- /packages/Depender.Parser/src/Depender.Parser/InlineNoneInstruction.cs: -------------------------------------------------------------------------------- 1 | // Type: ClrTest.Reflection.InlineNoneInstruction 2 | // Assembly: Depender.Parser, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null 3 | // MVID: 7BFB306E-D2F0-493B-8C2F-5C3CEA04F731 4 | // Assembly location: D:\temp\NSplit\Depender\Depender.Parser.dll 5 | 6 | using System.Reflection.Emit; 7 | 8 | namespace ClrTest.Reflection 9 | { 10 | public class InlineNoneInstruction : ILInstruction 11 | { 12 | internal InlineNoneInstruction(int offset, OpCode opCode) 13 | : base(offset, opCode) 14 | { 15 | } 16 | 17 | public override void Accept(ILInstructionVisitor vistor) 18 | { 19 | vistor.VisitInlineNoneInstruction(this); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Gma.CodeVisuals.WebApi/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | // This code is distributed under MIT license. 2 | // Copyright (c) 2014 George Mamaladze, Florian Greinacher 3 | // See license.txt or http://opensource.org/licenses/mit-license.php 4 | 5 | #region usings 6 | 7 | using System.Reflection; 8 | using System.Runtime.InteropServices; 9 | 10 | #endregion 11 | 12 | [assembly: AssemblyTitle("nsplit")] 13 | [assembly: AssemblyDescription("")] 14 | [assembly: AssemblyProduct("nsplit")] 15 | [assembly: AssemblyCopyright("Copyright (c) 2014 George Mamaladze, Florian Greinacher")] 16 | 17 | [assembly: ComVisible(false)] 18 | [assembly: Guid("b18cd6c6-f24f-469a-a59e-622796dfd19f")] 19 | 20 | [assembly: AssemblyVersion("1.0.0.0")] 21 | [assembly: AssemblyFileVersion("1.0.0.0")] -------------------------------------------------------------------------------- /Gma.CodeVisuals.sln.DotSettings: -------------------------------------------------------------------------------- 1 | 2 | True 3 | // This code is distributed under MIT license. 4 | // Copyright (c) 2014 George Mamaladze, Florian Greinacher 5 | // See license.txt or http://opensource.org/licenses/mit-license.php -------------------------------------------------------------------------------- /packages/Depender.Parser/src/Depender.Parser/IFormatProvider.cs: -------------------------------------------------------------------------------- 1 | // Type: ClrTest.Reflection.IFormatProvider 2 | // Assembly: Depender.Parser, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null 3 | // MVID: 7BFB306E-D2F0-493B-8C2F-5C3CEA04F731 4 | // Assembly location: D:\temp\NSplit\Depender\Depender.Parser.dll 5 | 6 | namespace ClrTest.Reflection 7 | { 8 | public interface IFormatProvider 9 | { 10 | string Int32ToHex(int int32); 11 | 12 | string Int16ToHex(int int16); 13 | 14 | string Int8ToHex(int int8); 15 | 16 | string Argument(int ordinal); 17 | 18 | string EscapedString(string str); 19 | 20 | string Label(int offset); 21 | 22 | string MultipleLabels(int[] offsets); 23 | 24 | string SigByteArrayToString(byte[] sig); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Gma.CodeVisuals.WebApi/DependencyForceGraph/Dto/LinkDto.cs: -------------------------------------------------------------------------------- 1 | // This code is distributed under MIT license. 2 | // Copyright (c) 2014 George Mamaladze, Florian Greinacher 3 | // See license.txt or http://opensource.org/licenses/mit-license.php 4 | 5 | #region usings 6 | 7 | using System.Runtime.Serialization; 8 | 9 | #endregion 10 | 11 | namespace Gma.CodeVisuals.WebApi.DependencyForceGraph.Dto 12 | { 13 | [DataContract] 14 | public class LinkDto 15 | { 16 | [DataMember(Name = "source")] 17 | public int Source { get; set; } 18 | 19 | [DataMember(Name = "target")] 20 | public int Target { get; set; } 21 | 22 | [DataMember(Name = "value")] 23 | public int Value 24 | { 25 | get { return 1; } 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /codevis/DependencyForceGraph/EdgeAddedEventArgs.cs: -------------------------------------------------------------------------------- 1 | // This code is distributed under MIT license. 2 | // Copyright (c) 2014 George Mamaladze, Florian Greinacher 3 | // See license.txt or http://opensource.org/licenses/mit-license.php 4 | 5 | #region usings 6 | 7 | using System; 8 | using Gma.CodeVisuals.Generator.DependencyForceGraph.DataStructures.DependencyGraph; 9 | 10 | #endregion 11 | 12 | namespace Gma.CodeVisuals.Generator.DependencyForceGraph 13 | { 14 | internal class EdgeAddedEventArgs : EventArgs 15 | { 16 | private readonly Edge m_Edge; 17 | 18 | public EdgeAddedEventArgs(Edge edge) 19 | { 20 | m_Edge = edge; 21 | } 22 | 23 | public Edge Edge 24 | { 25 | get { return m_Edge; } 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /codevis/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | // This code is distributed under MIT license. 2 | // Copyright (c) 2014 George Mamaladze, Florian Greinacher 3 | // See license.txt or http://opensource.org/licenses/mit-license.php 4 | 5 | #region usings 6 | 7 | using System.Reflection; 8 | using System.Runtime.InteropServices; 9 | 10 | #endregion 11 | 12 | [assembly: AssemblyTitle("codevis")] 13 | [assembly: AssemblyDescription("")] 14 | [assembly: AssemblyConfiguration("")] 15 | [assembly: AssemblyProduct("codevis")] 16 | [assembly: AssemblyCopyright("Copyright (c) 2014 George Mamaladze, Florian Greinacher")] 17 | [assembly: AssemblyTrademark("")] 18 | [assembly: AssemblyCulture("")] 19 | [assembly: ComVisible(false)] 20 | [assembly: Guid("25a273c5-0916-4fe4-b821-653c3f113b45")] 21 | [assembly: AssemblyVersion("1.0.0.0")] 22 | [assembly: AssemblyFileVersion("1.0.0.0")] -------------------------------------------------------------------------------- /codevis/DependencyForceGraph/DataStructures/TypeTree/Leaf.cs: -------------------------------------------------------------------------------- 1 | // This code is distributed under MIT license. 2 | // Copyright (c) 2014 George Mamaladze, Florian Greinacher 3 | // See license.txt or http://opensource.org/licenses/mit-license.php 4 | 5 | #region usings 6 | 7 | using System.Collections.Generic; 8 | using System.Linq; 9 | 10 | #endregion 11 | 12 | namespace Gma.CodeVisuals.Generator.DependencyForceGraph.DataStructures.TypeTree 13 | { 14 | internal class Leaf : NodeBase 15 | { 16 | public Leaf(string name, int id, Node node) : base(name, id, node) 17 | { 18 | } 19 | 20 | public override IEnumerable Children() 21 | { 22 | return Enumerable.Empty(); 23 | } 24 | 25 | public override bool IsLeaf() 26 | { 27 | return true; 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /packages/Depender.Parser/src/Depender.Parser/RawILStringToTextWriter.cs: -------------------------------------------------------------------------------- 1 | // Type: ClrTest.Reflection.RawILStringToTextWriter 2 | // Assembly: Depender.Parser, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null 3 | // MVID: 7BFB306E-D2F0-493B-8C2F-5C3CEA04F731 4 | // Assembly location: D:\temp\NSplit\Depender\Depender.Parser.dll 5 | 6 | using System.IO; 7 | 8 | namespace ClrTest.Reflection 9 | { 10 | public class RawILStringToTextWriter : ReadableILStringToTextWriter 11 | { 12 | public RawILStringToTextWriter(TextWriter writer) 13 | : base(writer) 14 | { 15 | } 16 | 17 | public override void Process(ILInstruction ilInstruction, string operandString) 18 | { 19 | this.writer.WriteLine("IL_{0:x4}: {1,-4}| {2, -8}", (object) ilInstruction.Offset, (object) ilInstruction.OpCode.Value.ToString("x2"), (object) operandString); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Gma.CodeVisuals.WebApi/DependencyForceGraph/DependenciesController.cs: -------------------------------------------------------------------------------- 1 | // This code is distributed under MIT license. 2 | // Copyright (c) 2014 George Mamaladze, Florian Greinacher 3 | // See license.txt or http://opensource.org/licenses/mit-license.php 4 | 5 | #region usings 6 | 7 | using System.Collections.Generic; 8 | using System.Web.Http; 9 | using Gma.CodeVisuals.WebApi.DependencyForceGraph.Dto; 10 | 11 | #endregion 12 | 13 | namespace Gma.CodeVisuals.WebApi.DependencyForceGraph 14 | { 15 | public class DependenciesController : ApiController 16 | { 17 | [ActionName("graph")] 18 | public GraphDto GetGraph(string name) 19 | { 20 | return Program.Storage.Load(name); 21 | } 22 | 23 | [ActionName("names")] 24 | public IEnumerable GetNames() 25 | { 26 | return Program.Storage.GetNames(); 27 | } 28 | } 29 | } -------------------------------------------------------------------------------- /packages/Depender.Parser/src/Depender.Parser/ReadableILStringToTextWriter.cs: -------------------------------------------------------------------------------- 1 | // Type: ClrTest.Reflection.ReadableILStringToTextWriter 2 | // Assembly: Depender.Parser, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null 3 | // MVID: 7BFB306E-D2F0-493B-8C2F-5C3CEA04F731 4 | // Assembly location: D:\temp\NSplit\Depender\Depender.Parser.dll 5 | 6 | using System.IO; 7 | 8 | namespace ClrTest.Reflection 9 | { 10 | public class ReadableILStringToTextWriter : IILStringCollector 11 | { 12 | protected TextWriter writer; 13 | 14 | public ReadableILStringToTextWriter(TextWriter writer) 15 | { 16 | this.writer = writer; 17 | } 18 | 19 | public virtual void Process(ILInstruction ilInstruction, string operandString) 20 | { 21 | this.writer.WriteLine("IL_{0:x4}: {1,-10} {2}", (object) ilInstruction.Offset, (object) ilInstruction.OpCode.Name, (object) operandString); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /packages/Depender.Parser/src/Depender.Parser/InlineIInstruction.cs: -------------------------------------------------------------------------------- 1 | // Type: ClrTest.Reflection.InlineIInstruction 2 | // Assembly: Depender.Parser, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null 3 | // MVID: 7BFB306E-D2F0-493B-8C2F-5C3CEA04F731 4 | // Assembly location: D:\temp\NSplit\Depender\Depender.Parser.dll 5 | 6 | using System.Reflection.Emit; 7 | 8 | namespace ClrTest.Reflection 9 | { 10 | public class InlineIInstruction : ILInstruction 11 | { 12 | private int m_int32; 13 | 14 | public int Int32 15 | { 16 | get 17 | { 18 | return this.m_int32; 19 | } 20 | } 21 | 22 | internal InlineIInstruction(int offset, OpCode opCode, int value) 23 | : base(offset, opCode) 24 | { 25 | this.m_int32 = value; 26 | } 27 | 28 | public override void Accept(ILInstructionVisitor vistor) 29 | { 30 | vistor.VisitInlineIInstruction(this); 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /packages/Depender.Parser/src/Depender.Parser/InlineI8Instruction.cs: -------------------------------------------------------------------------------- 1 | // Type: ClrTest.Reflection.InlineI8Instruction 2 | // Assembly: Depender.Parser, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null 3 | // MVID: 7BFB306E-D2F0-493B-8C2F-5C3CEA04F731 4 | // Assembly location: D:\temp\NSplit\Depender\Depender.Parser.dll 5 | 6 | using System.Reflection.Emit; 7 | 8 | namespace ClrTest.Reflection 9 | { 10 | public class InlineI8Instruction : ILInstruction 11 | { 12 | private long m_int64; 13 | 14 | public long Int64 15 | { 16 | get 17 | { 18 | return this.m_int64; 19 | } 20 | } 21 | 22 | internal InlineI8Instruction(int offset, OpCode opCode, long value) 23 | : base(offset, opCode) 24 | { 25 | this.m_int64 = value; 26 | } 27 | 28 | public override void Accept(ILInstructionVisitor vistor) 29 | { 30 | vistor.VisitInlineI8Instruction(this); 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /packages/Depender.Parser/src/Depender.Parser/InlineRInstruction.cs: -------------------------------------------------------------------------------- 1 | // Type: ClrTest.Reflection.InlineRInstruction 2 | // Assembly: Depender.Parser, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null 3 | // MVID: 7BFB306E-D2F0-493B-8C2F-5C3CEA04F731 4 | // Assembly location: D:\temp\NSplit\Depender\Depender.Parser.dll 5 | 6 | using System.Reflection.Emit; 7 | 8 | namespace ClrTest.Reflection 9 | { 10 | public class InlineRInstruction : ILInstruction 11 | { 12 | private double m_value; 13 | 14 | public double Double 15 | { 16 | get 17 | { 18 | return this.m_value; 19 | } 20 | } 21 | 22 | internal InlineRInstruction(int offset, OpCode opCode, double value) 23 | : base(offset, opCode) 24 | { 25 | this.m_value = value; 26 | } 27 | 28 | public override void Accept(ILInstructionVisitor vistor) 29 | { 30 | vistor.VisitInlineRInstruction(this); 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /codevis/DependencyForceGraph/Do/Graph.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using Gma.CodeVisuals.Generator.DependencyForceGraph.DataStructures.DependencyGraph; 3 | using Gma.CodeVisuals.Generator.DependencyForceGraph.DataStructures.TypeTree; 4 | 5 | namespace Gma.CodeVisuals.Generator.DependencyForceGraph.Do 6 | { 7 | internal class Graph 8 | { 9 | private readonly INode m_Tree; 10 | private readonly IEnumerable m_Links; 11 | 12 | public Graph(INode tree, IEnumerable links) 13 | { 14 | m_Tree = tree; 15 | m_Links = links; 16 | } 17 | 18 | public INode Tree 19 | { 20 | get { return m_Tree; } 21 | } 22 | 23 | public IEnumerable Links 24 | { 25 | get { return m_Links; } 26 | } 27 | 28 | public string Name 29 | { 30 | get { return m_Tree.Name; } 31 | } 32 | } 33 | } -------------------------------------------------------------------------------- /packages/Depender.Parser/src/Depender.Parser/ShortInlineIInstruction.cs: -------------------------------------------------------------------------------- 1 | // Type: ClrTest.Reflection.ShortInlineIInstruction 2 | // Assembly: Depender.Parser, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null 3 | // MVID: 7BFB306E-D2F0-493B-8C2F-5C3CEA04F731 4 | // Assembly location: D:\temp\NSplit\Depender\Depender.Parser.dll 5 | 6 | using System.Reflection.Emit; 7 | 8 | namespace ClrTest.Reflection 9 | { 10 | public class ShortInlineIInstruction : ILInstruction 11 | { 12 | private byte m_int8; 13 | 14 | public byte Byte 15 | { 16 | get 17 | { 18 | return this.m_int8; 19 | } 20 | } 21 | 22 | internal ShortInlineIInstruction(int offset, OpCode opCode, byte value) 23 | : base(offset, opCode) 24 | { 25 | this.m_int8 = value; 26 | } 27 | 28 | public override void Accept(ILInstructionVisitor vistor) 29 | { 30 | vistor.VisitShortInlineIInstruction(this); 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /packages/Depender.Parser/src/Depender.Parser/InlineVarInstruction.cs: -------------------------------------------------------------------------------- 1 | // Type: ClrTest.Reflection.InlineVarInstruction 2 | // Assembly: Depender.Parser, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null 3 | // MVID: 7BFB306E-D2F0-493B-8C2F-5C3CEA04F731 4 | // Assembly location: D:\temp\NSplit\Depender\Depender.Parser.dll 5 | 6 | using System.Reflection.Emit; 7 | 8 | namespace ClrTest.Reflection 9 | { 10 | public class InlineVarInstruction : ILInstruction 11 | { 12 | private ushort m_ordinal; 13 | 14 | public ushort Ordinal 15 | { 16 | get 17 | { 18 | return this.m_ordinal; 19 | } 20 | } 21 | 22 | internal InlineVarInstruction(int offset, OpCode opCode, ushort ordinal) 23 | : base(offset, opCode) 24 | { 25 | this.m_ordinal = ordinal; 26 | } 27 | 28 | public override void Accept(ILInstructionVisitor vistor) 29 | { 30 | vistor.VisitInlineVarInstruction(this); 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /packages/Depender.Parser/src/Depender.Parser/ShortInlineRInstruction.cs: -------------------------------------------------------------------------------- 1 | // Type: ClrTest.Reflection.ShortInlineRInstruction 2 | // Assembly: Depender.Parser, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null 3 | // MVID: 7BFB306E-D2F0-493B-8C2F-5C3CEA04F731 4 | // Assembly location: D:\temp\NSplit\Depender\Depender.Parser.dll 5 | 6 | using System.Reflection.Emit; 7 | 8 | namespace ClrTest.Reflection 9 | { 10 | public class ShortInlineRInstruction : ILInstruction 11 | { 12 | private float m_value; 13 | 14 | public float Single 15 | { 16 | get 17 | { 18 | return this.m_value; 19 | } 20 | } 21 | 22 | internal ShortInlineRInstruction(int offset, OpCode opCode, float value) 23 | : base(offset, opCode) 24 | { 25 | this.m_value = value; 26 | } 27 | 28 | public override void Accept(ILInstructionVisitor vistor) 29 | { 30 | vistor.VisitShortInlineRInstruction(this); 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /packages/Depender.Parser/src/Depender.Parser/ShortInlineVarInstruction.cs: -------------------------------------------------------------------------------- 1 | // Type: ClrTest.Reflection.ShortInlineVarInstruction 2 | // Assembly: Depender.Parser, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null 3 | // MVID: 7BFB306E-D2F0-493B-8C2F-5C3CEA04F731 4 | // Assembly location: D:\temp\NSplit\Depender\Depender.Parser.dll 5 | 6 | using System.Reflection.Emit; 7 | 8 | namespace ClrTest.Reflection 9 | { 10 | public class ShortInlineVarInstruction : ILInstruction 11 | { 12 | private byte m_ordinal; 13 | 14 | public byte Ordinal 15 | { 16 | get 17 | { 18 | return this.m_ordinal; 19 | } 20 | } 21 | 22 | internal ShortInlineVarInstruction(int offset, OpCode opCode, byte ordinal) 23 | : base(offset, opCode) 24 | { 25 | this.m_ordinal = ordinal; 26 | } 27 | 28 | public override void Accept(ILInstructionVisitor vistor) 29 | { 30 | vistor.VisitShortInlineVarInstruction(this); 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /packages/Depender.Parser/src/Depender.Parser/MethodBaseILProvider.cs: -------------------------------------------------------------------------------- 1 | // Type: ClrTest.Reflection.MethodBaseILProvider 2 | // Assembly: Depender.Parser, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null 3 | // MVID: 7BFB306E-D2F0-493B-8C2F-5C3CEA04F731 4 | // Assembly location: D:\temp\NSplit\Depender\Depender.Parser.dll 5 | 6 | using System.Reflection; 7 | 8 | namespace ClrTest.Reflection 9 | { 10 | public class MethodBaseILProvider : IILProvider 11 | { 12 | private MethodBase m_method; 13 | private byte[] m_byteArray; 14 | 15 | public MethodBaseILProvider(MethodBase method) 16 | { 17 | this.m_method = method; 18 | } 19 | 20 | public byte[] GetByteArray() 21 | { 22 | if (this.m_byteArray == null) 23 | { 24 | MethodBody methodBody = this.m_method.GetMethodBody(); 25 | this.m_byteArray = methodBody == null ? new byte[0] : methodBody.GetILAsByteArray(); 26 | } 27 | return this.m_byteArray; 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /packages/Depender.Parser/src/Depender.Parser/ILInstruction.cs: -------------------------------------------------------------------------------- 1 | // Type: ClrTest.Reflection.ILInstruction 2 | // Assembly: Depender.Parser, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null 3 | // MVID: 7BFB306E-D2F0-493B-8C2F-5C3CEA04F731 4 | // Assembly location: D:\temp\NSplit\Depender\Depender.Parser.dll 5 | 6 | using System.Reflection.Emit; 7 | 8 | namespace ClrTest.Reflection 9 | { 10 | public abstract class ILInstruction 11 | { 12 | protected int m_offset; 13 | protected OpCode m_opCode; 14 | 15 | public int Offset 16 | { 17 | get 18 | { 19 | return this.m_offset; 20 | } 21 | } 22 | 23 | public OpCode OpCode 24 | { 25 | get 26 | { 27 | return this.m_opCode; 28 | } 29 | } 30 | 31 | internal ILInstruction(int offset, OpCode opCode) 32 | { 33 | this.m_offset = offset; 34 | this.m_opCode = opCode; 35 | } 36 | 37 | public abstract void Accept(ILInstructionVisitor vistor); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /packages/Depender.Parser/src/Depender.Parser/InlineBrTargetInstruction.cs: -------------------------------------------------------------------------------- 1 | // Type: ClrTest.Reflection.InlineBrTargetInstruction 2 | // Assembly: Depender.Parser, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null 3 | // MVID: 7BFB306E-D2F0-493B-8C2F-5C3CEA04F731 4 | // Assembly location: D:\temp\NSplit\Depender\Depender.Parser.dll 5 | 6 | using System.Reflection.Emit; 7 | 8 | namespace ClrTest.Reflection 9 | { 10 | public class InlineBrTargetInstruction : ILInstruction 11 | { 12 | private int m_delta; 13 | 14 | public int Delta 15 | { 16 | get 17 | { 18 | return this.m_delta; 19 | } 20 | } 21 | 22 | public int TargetOffset 23 | { 24 | get 25 | { 26 | return this.m_offset + this.m_delta + 1 + 4; 27 | } 28 | } 29 | 30 | internal InlineBrTargetInstruction(int offset, OpCode opCode, int delta) 31 | : base(offset, opCode) 32 | { 33 | this.m_delta = delta; 34 | } 35 | 36 | public override void Accept(ILInstructionVisitor vistor) 37 | { 38 | vistor.VisitInlineBrTargetInstruction(this); 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /packages/Depender.Parser/src/Depender.Parser/ShortInlineBrTargetInstruction.cs: -------------------------------------------------------------------------------- 1 | // Type: ClrTest.Reflection.ShortInlineBrTargetInstruction 2 | // Assembly: Depender.Parser, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null 3 | // MVID: 7BFB306E-D2F0-493B-8C2F-5C3CEA04F731 4 | // Assembly location: D:\temp\NSplit\Depender\Depender.Parser.dll 5 | 6 | using System.Reflection.Emit; 7 | 8 | namespace ClrTest.Reflection 9 | { 10 | public class ShortInlineBrTargetInstruction : ILInstruction 11 | { 12 | private sbyte m_delta; 13 | 14 | public sbyte Delta 15 | { 16 | get 17 | { 18 | return this.m_delta; 19 | } 20 | } 21 | 22 | public int TargetOffset 23 | { 24 | get 25 | { 26 | return this.m_offset + (int) this.m_delta + 1 + 1; 27 | } 28 | } 29 | 30 | internal ShortInlineBrTargetInstruction(int offset, OpCode opCode, sbyte delta) 31 | : base(offset, opCode) 32 | { 33 | this.m_delta = delta; 34 | } 35 | 36 | public override void Accept(ILInstructionVisitor vistor) 37 | { 38 | vistor.VisitShortInlineBrTargetInstruction(this); 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 George Mamaladze, Florian Greinacher 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | this software and associated documentation files (the "Software"), to deal in 7 | the Software without restriction, including without limitation the rights to 8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software is furnished to do so, 10 | subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /Gma.CodeVisuals.WebApi/html/main.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Dependency Force Graph 4 | 5 | 6 | 7 | 8 | 9 |
10 | 14 |
15 |
16 |
17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /codevis/DependencyForceGraph/DataStructures/DependencyGraph/DependecyKindExtensions.cs: -------------------------------------------------------------------------------- 1 | // This code is distributed under MIT license. 2 | // Copyright (c) 2014 George Mamaladze, Florian Greinacher 3 | // See license.txt or http://opensource.org/licenses/mit-license.php 4 | 5 | #region usings 6 | 7 | using System; 8 | using System.Collections.Generic; 9 | using Gma.CodeVisuals.Generator.DependencyForceGraph.Do; 10 | 11 | #endregion 12 | 13 | namespace Gma.CodeVisuals.Generator.DependencyForceGraph.DataStructures.DependencyGraph 14 | { 15 | public static class DependecyKindExtensions 16 | { 17 | public static DependencyKinds ToFlags(this DependencyKind kind) 18 | { 19 | return (DependencyKinds) (int) kind; 20 | } 21 | 22 | public static IEnumerable Flatten(this DependencyKinds kinds) 23 | { 24 | foreach (DependencyKind kind in Enum.GetValues(typeof (DependencyKind))) 25 | { 26 | var mask = kind.ToFlags(); 27 | var matches = kinds & mask; 28 | if (matches == DependencyKinds.None) continue; 29 | yield return mask; 30 | } 31 | } 32 | } 33 | } -------------------------------------------------------------------------------- /xcopy/html/css/index.css: -------------------------------------------------------------------------------- 1 | body { 2 | font-family: Arial; 3 | margin: 50px; 4 | } 5 | 6 | input { 7 | border: 1px solid #000000; 8 | padding: 2px; 9 | } 10 | 11 | button { 12 | text-transform: uppercase; 13 | } 14 | 15 | h2 { 16 | text-align: center; 17 | } 18 | 19 | #warning { 20 | font-size: large; 21 | color:darkred; 22 | visibility: hidden; 23 | } 24 | 25 | #middle { 26 | display: block; 27 | margin-left: auto; 28 | margin-right: auto; 29 | width: 800px; 30 | } 31 | 32 | #progress { 33 | width: 100%; 34 | } 35 | 36 | #message { 37 | width: 100%; 38 | font-size: larger; 39 | } 40 | 41 | #assembly { 42 | width: 500px; 43 | } 44 | 45 | 46 | #loaded { 47 | width: 100%; 48 | font-size: larger; 49 | } 50 | 51 | #progressArea { 52 | font-family: monospace; 53 | font-size: larger; 54 | border: 1px; 55 | border-style: groove; 56 | border-color: lightslategray; 57 | padding: 10px; 58 | } 59 | 60 | #results { 61 | font-family: monospace; 62 | font-size: larger; 63 | border: 1px; 64 | border-style: groove; 65 | border-color: lightslategray; 66 | padding: 10px; 67 | height: 200px; 68 | overflow-y: auto; 69 | } 70 | 71 | .fieldName { 72 | margin-right: 2px; 73 | text-align: right; 74 | } -------------------------------------------------------------------------------- /codevis/DependencyForceGraph/DataStructures/TypeTree/NodeFactory.cs: -------------------------------------------------------------------------------- 1 | // This code is distributed under MIT license. 2 | // Copyright (c) 2014 George Mamaladze, Florian Greinacher 3 | // See license.txt or http://opensource.org/licenses/mit-license.php 4 | 5 | #region usings 6 | 7 | using System.Collections.Generic; 8 | 9 | #endregion 10 | 11 | namespace Gma.CodeVisuals.Generator.DependencyForceGraph.DataStructures.TypeTree 12 | { 13 | internal class NodeFactory 14 | { 15 | private readonly Stack m_Nodes; 16 | 17 | public NodeFactory() 18 | { 19 | m_Nodes = new Stack(); 20 | } 21 | 22 | public int Count 23 | { 24 | get { return m_Nodes.Count; } 25 | } 26 | 27 | public IEnumerable Nodes 28 | { 29 | get { return m_Nodes; } 30 | } 31 | 32 | public Node CreateNode(string name, Node parent) 33 | { 34 | var node = new Node(name, Count, parent); 35 | m_Nodes.Push(node); 36 | return node; 37 | } 38 | 39 | public Leaf CreateLeaf(string name, Node parent) 40 | { 41 | var leaf = new Leaf(name, Count, parent); 42 | m_Nodes.Push(leaf); 43 | return leaf; 44 | } 45 | } 46 | } -------------------------------------------------------------------------------- /Gma.CodeVisuals.WebApi/html/css/index.css: -------------------------------------------------------------------------------- 1 | body { 2 | font-family: Arial; 3 | margin: 50px; 4 | } 5 | 6 | input { 7 | border: 1px solid #000000; 8 | padding: 2px; 9 | } 10 | 11 | button { 12 | text-transform: uppercase; 13 | } 14 | 15 | h2 { 16 | text-align: center; 17 | } 18 | 19 | #warning { 20 | font-size: large; 21 | color:darkred; 22 | visibility: hidden; 23 | } 24 | 25 | #middle { 26 | display: block; 27 | margin-left: auto; 28 | margin-right: auto; 29 | width: 800px; 30 | } 31 | 32 | #progress { 33 | width: 100%; 34 | } 35 | 36 | #message { 37 | width: 100%; 38 | font-size: larger; 39 | } 40 | 41 | #assembly { 42 | width: 500px; 43 | } 44 | 45 | 46 | #loaded { 47 | width: 100%; 48 | font-size: larger; 49 | } 50 | 51 | #progressArea { 52 | font-family: monospace; 53 | font-size: larger; 54 | border: 1px; 55 | border-style: groove; 56 | border-color: lightslategray; 57 | padding: 10px; 58 | } 59 | 60 | #results { 61 | font-family: monospace; 62 | font-size: larger; 63 | border: 1px; 64 | border-style: groove; 65 | border-color: lightslategray; 66 | padding: 10px; 67 | height: 200px; 68 | overflow-y: auto; 69 | } 70 | 71 | .fieldName { 72 | margin-right: 2px; 73 | text-align: right; 74 | } -------------------------------------------------------------------------------- /packages/Depender.Parser/src/Depender.Parser/InlineTypeInstruction.cs: -------------------------------------------------------------------------------- 1 | // Type: ClrTest.Reflection.InlineTypeInstruction 2 | // Assembly: Depender.Parser, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null 3 | // MVID: 7BFB306E-D2F0-493B-8C2F-5C3CEA04F731 4 | // Assembly location: D:\temp\NSplit\Depender\Depender.Parser.dll 5 | 6 | using System; 7 | using System.Reflection.Emit; 8 | 9 | namespace ClrTest.Reflection 10 | { 11 | public class InlineTypeInstruction : ILInstruction 12 | { 13 | private ITokenResolver m_resolver; 14 | private int m_token; 15 | private Type m_type; 16 | 17 | public Type Type 18 | { 19 | get 20 | { 21 | if (this.m_type == null) 22 | this.m_type = this.m_resolver.AsType(this.m_token); 23 | return this.m_type; 24 | } 25 | } 26 | 27 | public int Token 28 | { 29 | get 30 | { 31 | return this.m_token; 32 | } 33 | } 34 | 35 | internal InlineTypeInstruction(int offset, OpCode opCode, int token, ITokenResolver resolver) 36 | : base(offset, opCode) 37 | { 38 | this.m_resolver = resolver; 39 | this.m_token = token; 40 | } 41 | 42 | public override void Accept(ILInstructionVisitor vistor) 43 | { 44 | vistor.VisitInlineTypeInstruction(this); 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /Gma.CodeVisuals.WebApi/html/css/main.css: -------------------------------------------------------------------------------- 1 | body { 2 | font-family: Arial; 3 | font-size: smaller; 4 | height: 100vh; 5 | width: 100vw; 6 | margin: 0; 7 | } 8 | 9 | #right { 10 | float: right; 11 | height: 100vh; 12 | width: 30vw; 13 | overflow: auto; 14 | } 15 | 16 | #viewport { 17 | float: left; 18 | height: 100vh; 19 | width: 70vw; 20 | } 21 | 22 | .node { 23 | stroke: #fff; 24 | stroke-opacity: .75; 25 | stroke-width: 2px; 26 | cursor: pointer; 27 | } 28 | 29 | .link { 30 | stroke: #999; 31 | stroke-opacity: .6; 32 | cursor: pointer; 33 | } 34 | 35 | .hint { 36 | color: blue; 37 | font-family: Arial; 38 | font-size: smaller; 39 | pointer-events: none; 40 | } 41 | 42 | .tooltip { 43 | color: blue; 44 | background: ghostwhite; 45 | width: auto; 46 | height: auto; 47 | position: absolute; 48 | font-family: Arial; 49 | pointer-events: none; 50 | border: darkgrey solid thin; 51 | padding: 5px; 52 | padding-right: 10px; 53 | padding-top: 3px; 54 | padding-bottom: 3px; 55 | } 56 | 57 | .tooltiphead { 58 | font-size: medium; 59 | } 60 | 61 | .tooltipbody { 62 | font-size: small; 63 | } 64 | 65 | #imgAssembly { 66 | margin-left: 4px; 67 | margin-top: 4px; 68 | margin-bottom: -2px; 69 | } -------------------------------------------------------------------------------- /packages/Depender.Parser/src/Depender.Parser/InlineStringInstruction.cs: -------------------------------------------------------------------------------- 1 | // Type: ClrTest.Reflection.InlineStringInstruction 2 | // Assembly: Depender.Parser, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null 3 | // MVID: 7BFB306E-D2F0-493B-8C2F-5C3CEA04F731 4 | // Assembly location: D:\temp\NSplit\Depender\Depender.Parser.dll 5 | 6 | using System.Reflection.Emit; 7 | 8 | namespace ClrTest.Reflection 9 | { 10 | public class InlineStringInstruction : ILInstruction 11 | { 12 | private ITokenResolver m_resolver; 13 | private int m_token; 14 | private string m_string; 15 | 16 | public string String 17 | { 18 | get 19 | { 20 | if (this.m_string == null) 21 | this.m_string = this.m_resolver.AsString(this.Token); 22 | return this.m_string; 23 | } 24 | } 25 | 26 | public int Token 27 | { 28 | get 29 | { 30 | return this.m_token; 31 | } 32 | } 33 | 34 | internal InlineStringInstruction(int offset, OpCode opCode, int token, ITokenResolver resolver) 35 | : base(offset, opCode) 36 | { 37 | this.m_resolver = resolver; 38 | this.m_token = token; 39 | } 40 | 41 | public override void Accept(ILInstructionVisitor vistor) 42 | { 43 | vistor.VisitInlineStringInstruction(this); 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /packages/Depender.Parser/src/Depender.Parser/InlineSigInstruction.cs: -------------------------------------------------------------------------------- 1 | // Type: ClrTest.Reflection.InlineSigInstruction 2 | // Assembly: Depender.Parser, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null 3 | // MVID: 7BFB306E-D2F0-493B-8C2F-5C3CEA04F731 4 | // Assembly location: D:\temp\NSplit\Depender\Depender.Parser.dll 5 | 6 | using System.Reflection.Emit; 7 | 8 | namespace ClrTest.Reflection 9 | { 10 | public class InlineSigInstruction : ILInstruction 11 | { 12 | private ITokenResolver m_resolver; 13 | private int m_token; 14 | private byte[] m_signature; 15 | 16 | public byte[] Signature 17 | { 18 | get 19 | { 20 | if (this.m_signature == null) 21 | this.m_signature = this.m_resolver.AsSignature(this.m_token); 22 | return this.m_signature; 23 | } 24 | } 25 | 26 | public int Token 27 | { 28 | get 29 | { 30 | return this.m_token; 31 | } 32 | } 33 | 34 | internal InlineSigInstruction(int offset, OpCode opCode, int token, ITokenResolver resolver) 35 | : base(offset, opCode) 36 | { 37 | this.m_resolver = resolver; 38 | this.m_token = token; 39 | } 40 | 41 | public override void Accept(ILInstructionVisitor vistor) 42 | { 43 | vistor.VisitInlineSigInstruction(this); 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /packages/Depender.Parser/src/Depender.Parser/InlineTokInstruction.cs: -------------------------------------------------------------------------------- 1 | // Type: ClrTest.Reflection.InlineTokInstruction 2 | // Assembly: Depender.Parser, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null 3 | // MVID: 7BFB306E-D2F0-493B-8C2F-5C3CEA04F731 4 | // Assembly location: D:\temp\NSplit\Depender\Depender.Parser.dll 5 | 6 | using System.Reflection; 7 | using System.Reflection.Emit; 8 | 9 | namespace ClrTest.Reflection 10 | { 11 | public class InlineTokInstruction : ILInstruction 12 | { 13 | private ITokenResolver m_resolver; 14 | private int m_token; 15 | private MemberInfo m_member; 16 | 17 | public MemberInfo Member 18 | { 19 | get 20 | { 21 | if (this.m_member == null) 22 | this.m_member = this.m_resolver.AsMember(this.Token); 23 | return this.m_member; 24 | } 25 | } 26 | 27 | public int Token 28 | { 29 | get 30 | { 31 | return this.m_token; 32 | } 33 | } 34 | 35 | internal InlineTokInstruction(int offset, OpCode opCode, int token, ITokenResolver resolver) 36 | : base(offset, opCode) 37 | { 38 | this.m_resolver = resolver; 39 | this.m_token = token; 40 | } 41 | 42 | public override void Accept(ILInstructionVisitor vistor) 43 | { 44 | vistor.VisitInlineTokInstruction(this); 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /packages/Depender.Parser/src/Depender.Parser/InlineFieldInstruction.cs: -------------------------------------------------------------------------------- 1 | // Type: ClrTest.Reflection.InlineFieldInstruction 2 | // Assembly: Depender.Parser, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null 3 | // MVID: 7BFB306E-D2F0-493B-8C2F-5C3CEA04F731 4 | // Assembly location: D:\temp\NSplit\Depender\Depender.Parser.dll 5 | 6 | using System.Reflection; 7 | using System.Reflection.Emit; 8 | 9 | namespace ClrTest.Reflection 10 | { 11 | public class InlineFieldInstruction : ILInstruction 12 | { 13 | private ITokenResolver m_resolver; 14 | private int m_token; 15 | private FieldInfo m_field; 16 | 17 | public FieldInfo Field 18 | { 19 | get 20 | { 21 | if (this.m_field == null) 22 | this.m_field = this.m_resolver.AsField(this.m_token); 23 | return this.m_field; 24 | } 25 | } 26 | 27 | public int Token 28 | { 29 | get 30 | { 31 | return this.m_token; 32 | } 33 | } 34 | 35 | internal InlineFieldInstruction(ITokenResolver resolver, int offset, OpCode opCode, int token) 36 | : base(offset, opCode) 37 | { 38 | this.m_resolver = resolver; 39 | this.m_token = token; 40 | } 41 | 42 | public override void Accept(ILInstructionVisitor vistor) 43 | { 44 | vistor.VisitInlineFieldInstruction(this); 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /packages/Depender.Parser/src/Depender.Parser/InlineMethodInstruction.cs: -------------------------------------------------------------------------------- 1 | // Type: ClrTest.Reflection.InlineMethodInstruction 2 | // Assembly: Depender.Parser, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null 3 | // MVID: 7BFB306E-D2F0-493B-8C2F-5C3CEA04F731 4 | // Assembly location: D:\temp\NSplit\Depender\Depender.Parser.dll 5 | 6 | using System.Reflection; 7 | using System.Reflection.Emit; 8 | 9 | namespace ClrTest.Reflection 10 | { 11 | public class InlineMethodInstruction : ILInstruction 12 | { 13 | private ITokenResolver m_resolver; 14 | private int m_token; 15 | private MethodBase m_method; 16 | 17 | public MethodBase Method 18 | { 19 | get 20 | { 21 | if (this.m_method == null) 22 | this.m_method = this.m_resolver.AsMethod(this.m_token); 23 | return this.m_method; 24 | } 25 | } 26 | 27 | public int Token 28 | { 29 | get 30 | { 31 | return this.m_token; 32 | } 33 | } 34 | 35 | internal InlineMethodInstruction(int offset, OpCode opCode, int token, ITokenResolver resolver) 36 | : base(offset, opCode) 37 | { 38 | this.m_resolver = resolver; 39 | this.m_token = token; 40 | } 41 | 42 | public override void Accept(ILInstructionVisitor vistor) 43 | { 44 | vistor.VisitInlineMethodInstruction(this); 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /codevis/DependencyForceGraph/DataStructures/TypeTree/QualifiedName.cs: -------------------------------------------------------------------------------- 1 | // This code is distributed under MIT license. 2 | // Copyright (c) 2014 George Mamaladze, Florian Greinacher 3 | // See license.txt or http://opensource.org/licenses/mit-license.php 4 | 5 | #region usings 6 | 7 | using System; 8 | using System.Collections.Generic; 9 | 10 | #endregion 11 | 12 | namespace Gma.CodeVisuals.Generator.DependencyForceGraph.DataStructures.TypeTree 13 | { 14 | public class QualifiedName 15 | { 16 | public const char Qualifier = '.'; 17 | private readonly string m_Leaf; 18 | private readonly string[] m_Path; 19 | 20 | protected QualifiedName(string[] path, string leaf) 21 | { 22 | m_Path = path; 23 | m_Leaf = leaf; 24 | } 25 | 26 | public IEnumerable Nodes 27 | { 28 | get { return m_Path; } 29 | } 30 | 31 | public string Leaf 32 | { 33 | get { return m_Leaf; } 34 | } 35 | 36 | public static QualifiedName Parse(string fullName) 37 | { 38 | string[] parts = fullName.Split(Qualifier); 39 | var length = parts.Length - 1; 40 | var path = new string[length]; 41 | Array.Copy(parts, path, length); 42 | var leaf = parts[length]; 43 | return new QualifiedName(path, leaf); 44 | } 45 | } 46 | } -------------------------------------------------------------------------------- /packages/Depender.Parser/src/Depender.Parser/InlineSwitchInstruction.cs: -------------------------------------------------------------------------------- 1 | // Type: ClrTest.Reflection.InlineSwitchInstruction 2 | // Assembly: Depender.Parser, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null 3 | // MVID: 7BFB306E-D2F0-493B-8C2F-5C3CEA04F731 4 | // Assembly location: D:\temp\NSplit\Depender\Depender.Parser.dll 5 | 6 | using System.Reflection.Emit; 7 | 8 | namespace ClrTest.Reflection 9 | { 10 | public class InlineSwitchInstruction : ILInstruction 11 | { 12 | private int[] m_deltas; 13 | private int[] m_targetOffsets; 14 | 15 | public int[] Deltas 16 | { 17 | get 18 | { 19 | return (int[]) this.m_deltas.Clone(); 20 | } 21 | } 22 | 23 | public int[] TargetOffsets 24 | { 25 | get 26 | { 27 | if (this.m_targetOffsets == null) 28 | { 29 | int length = this.m_deltas.Length; 30 | int num = 5 + 4 * length; 31 | this.m_targetOffsets = new int[length]; 32 | for (int index = 0; index < length; ++index) 33 | this.m_targetOffsets[index] = this.m_offset + this.m_deltas[index] + num; 34 | } 35 | return this.m_targetOffsets; 36 | } 37 | } 38 | 39 | internal InlineSwitchInstruction(int offset, OpCode opCode, int[] deltas) 40 | : base(offset, opCode) 41 | { 42 | this.m_deltas = deltas; 43 | } 44 | 45 | public override void Accept(ILInstructionVisitor vistor) 46 | { 47 | vistor.VisitInlineSwitchInstruction(this); 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /Gma.CodeVisuals.WebApi/Server/FileType.cs: -------------------------------------------------------------------------------- 1 | // This code is distributed under MIT license. 2 | // Copyright (c) 2014 George Mamaladze, Florian Greinacher 3 | // See license.txt or http://opensource.org/licenses/mit-license.php 4 | 5 | #region usings 6 | 7 | using System.Net.Http.Headers; 8 | using System.Net.Mime; 9 | 10 | #endregion 11 | 12 | namespace Gma.CodeVisuals.WebApi.Server 13 | { 14 | public class FileType 15 | { 16 | public static FileType Html = new FileType(".html", MediaTypeNames.Text.Html); 17 | public static FileType Javascript = new FileType(".js", "text/javascript"); 18 | public static FileType Css = new FileType(".css", "text/css"); 19 | public static FileType Gif = new FileType(".gif", MediaTypeNames.Image.Gif); 20 | public static FileType Png = new FileType(".png", "image/png"); 21 | public static FileType Json = new FileType(".json", MediaTypeNames.Text.Plain); 22 | public static FileType Ico = new FileType(".ico", "image/ico"); 23 | 24 | 25 | private readonly string m_Extension; 26 | private readonly string m_MediaType; 27 | 28 | private FileType(string extension, string mediaType) 29 | { 30 | m_Extension = extension; 31 | m_MediaType = mediaType; 32 | } 33 | 34 | public string Extension 35 | { 36 | get { return m_Extension; } 37 | } 38 | 39 | public MediaTypeHeaderValue ContentType 40 | { 41 | get { return new MediaTypeHeaderValue(m_MediaType); } 42 | } 43 | } 44 | } -------------------------------------------------------------------------------- /codevis/DependencyForceGraph/Do/MethodCall.cs: -------------------------------------------------------------------------------- 1 | // This code is distributed under MIT license. 2 | // Copyright (c) 2014 George Mamaladze, Florian Greinacher 3 | // See license.txt or http://opensource.org/licenses/mit-license.php 4 | 5 | #region usings 6 | 7 | using System; 8 | using System.Reflection; 9 | 10 | #endregion 11 | 12 | namespace Gma.CodeVisuals.Generator.DependencyForceGraph.Do 13 | { 14 | public class MethodCall : Dependency 15 | { 16 | private readonly MethodBase m_Method; 17 | 18 | public MethodCall(Type source, Type target, MethodBase method) 19 | : base(source, target) 20 | { 21 | m_Method = method; 22 | } 23 | 24 | public MethodBase Method 25 | { 26 | get { return m_Method; } 27 | } 28 | 29 | public override DependencyKind Kind 30 | { 31 | get { return DependencyKind.MethodCall;} 32 | } 33 | 34 | public override int GetHashCode() 35 | { 36 | return base.GetHashCode() ^ m_Method.GetHashCode(); 37 | } 38 | 39 | public override bool Equals(object other) 40 | { 41 | var otherMethodCall = other as MethodCall; 42 | return otherMethodCall != null && 43 | otherMethodCall.m_Method == m_Method && 44 | base.Equals(other); 45 | } 46 | 47 | public override string ToString() 48 | { 49 | return string.Format("{0,20}=[{1,20}]=>{2,-20}", Source.Name, Method.Name, Target.Name); 50 | } 51 | } 52 | } -------------------------------------------------------------------------------- /codevis/DependencyForceGraph/AnalyzesProgress.cs: -------------------------------------------------------------------------------- 1 | // This code is distributed under MIT license. 2 | // Copyright (c) 2014 George Mamaladze, Florian Greinacher 3 | // See license.txt or http://opensource.org/licenses/mit-license.php 4 | 5 | #region usings 6 | 7 | using System; 8 | 9 | #endregion 10 | 11 | namespace Gma.CodeVisuals.Generator.DependencyForceGraph 12 | { 13 | internal class AnalyzesProgress : EventArgs 14 | { 15 | private readonly int m_Actual; 16 | private readonly int m_Max; 17 | private readonly bool m_Finished; 18 | private readonly string m_Message; 19 | 20 | public static AnalyzesProgress Started() 21 | { 22 | return new AnalyzesProgress("Started", 0, 1, false); 23 | } 24 | 25 | public static AnalyzesProgress Finished() 26 | { 27 | return new AnalyzesProgress("Finished", 0, 1, true); 28 | } 29 | 30 | public static AnalyzesProgress Idle() 31 | { 32 | return new AnalyzesProgress("Idle", 0, 1, false); 33 | } 34 | 35 | public AnalyzesProgress(string message, int actual, int max, bool finished) 36 | { 37 | m_Message = message; 38 | m_Actual = actual; 39 | m_Max = max; 40 | m_Finished = finished; 41 | } 42 | 43 | public string Message 44 | { 45 | get { return m_Message; } 46 | } 47 | 48 | public int Actual 49 | { 50 | get { return m_Actual; } 51 | } 52 | 53 | public int Max 54 | { 55 | get { return m_Max; } 56 | } 57 | 58 | public bool IsFinished 59 | { 60 | get { return m_Finished; } 61 | } 62 | } 63 | } -------------------------------------------------------------------------------- /xcopy/html/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Dependency Force Graph 4 | 5 | 6 | 7 | 8 |
9 |
10 | This browser do not support SVG.
11 | See: SVG browser compatibility table 12 |
13 |

Dependency Force Graph

14 |

1. Select a dependency graph file:

15 |
16 |
    17 |
18 |
19 |

2. Generate your own dependency graph files:

20 |

21 |

22 |                     > codevis.exe C:\Framework\System.Core.dll
23 |                     > codevis.exe C:\Framework\System.Data*
24 |                     > codevis.exe MyAssembly System.Core System.Linq -p:C:\framework\;c:\myfolder
25 |                 
26 |

27 |

3. Play with it:

28 |
    29 |
  • Mouse over nodes to see details
  • 30 |
  • Click namespace nodes to burst them
  • 31 |
  • Try to drag nodes
  • 32 |
  • Expand/collapse the tree
  • 33 |
  • Expand/collapse a subtree tree unding context menu
  • 34 |
  • Check/uncheck tree nodes to highlight them on the graph
  • 35 |
  • Use mouse wheel to zoom
  • 36 |
  • Drag the surface to pan
  • 37 |
38 |
39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /Gma.CodeVisuals.WebApi/html/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Dependency Force Graph 4 | 5 | 6 | 7 | 8 |
9 |
10 | This browser do not support SVG.
11 | See: SVG browser compatibility table 12 |
13 |

Dependency Force Graph

14 |

1. Select a dependency graph file:

15 |
16 |
    17 |
18 |
19 |

2. Generate your own dependency graph files:

20 |

21 |

22 |                     > codevis.exe C:\Framework\System.Core.dll
23 |                     > codevis.exe C:\Framework\System.Data*
24 |                     > codevis.exe MyAssembly System.Core System.Linq -p:C:\framework\;c:\myfolder
25 |                 
26 |

27 |

3. Play with it:

28 |
    29 |
  • Mouse over nodes to see details
  • 30 |
  • Click namespace nodes to burst them
  • 31 |
  • Try to drag nodes
  • 32 |
  • Expand/collapse the tree
  • 33 |
  • Expand/collapse a subtree tree unding context menu
  • 34 |
  • Check/uncheck tree nodes to highlight them on the graph
  • 35 |
  • Use mouse wheel to zoom
  • 36 |
  • Drag the surface to pan
  • 37 |
38 |
39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /codevis/DependencyForceGraph/Do/Dependency.cs: -------------------------------------------------------------------------------- 1 | // This code is distributed under MIT license. 2 | // Copyright (c) 2014 George Mamaladze, Florian Greinacher 3 | // See license.txt or http://opensource.org/licenses/mit-license.php 4 | 5 | #region usings 6 | 7 | using System; 8 | 9 | #endregion 10 | 11 | namespace Gma.CodeVisuals.Generator.DependencyForceGraph.Do 12 | { 13 | public abstract class Dependency 14 | { 15 | private readonly Type m_Source; 16 | private readonly Type m_Target; 17 | 18 | protected Dependency(Type source, Type target) 19 | { 20 | m_Source = Unnest(source); 21 | m_Target = Unnest(target); 22 | } 23 | 24 | public Type Target 25 | { 26 | get { return m_Target; } 27 | } 28 | 29 | public Type Source 30 | { 31 | get { return m_Source; } 32 | } 33 | 34 | public abstract DependencyKind Kind { get;} 35 | 36 | protected static Type Unnest(Type type) 37 | { 38 | if (type.IsNestedPrivate && type.DeclaringType != null) return Unnest(type.DeclaringType); 39 | return type; 40 | } 41 | 42 | public override int GetHashCode() 43 | { 44 | return m_Source.GetHashCode() ^ m_Target.GetHashCode() ^ Kind.GetHashCode(); 45 | } 46 | 47 | public override bool Equals(object other) 48 | { 49 | var otherDependency = other as Dependency; 50 | return otherDependency != null && 51 | otherDependency.m_Source == m_Source && 52 | otherDependency.m_Target == m_Target && 53 | otherDependency.Kind == Kind; 54 | } 55 | 56 | public override string ToString() 57 | { 58 | return string.Format("{0,20} => {1,-20}", Source.Name, Target.Name); 59 | } 60 | } 61 | } -------------------------------------------------------------------------------- /codevis/DependencyForceGraph/DataStructures/TypeTree/NodeBase.cs: -------------------------------------------------------------------------------- 1 | // This code is distributed under MIT license. 2 | // Copyright (c) 2014 George Mamaladze, Florian Greinacher 3 | // See license.txt or http://opensource.org/licenses/mit-license.php 4 | 5 | #region usings 6 | 7 | using System.Collections.Generic; 8 | using System.Diagnostics; 9 | 10 | #endregion 11 | 12 | namespace Gma.CodeVisuals.Generator.DependencyForceGraph.DataStructures.TypeTree 13 | { 14 | [DebuggerDisplay("{Name}:{Id}}")] 15 | internal abstract class NodeBase : INode 16 | { 17 | private readonly int m_Id; 18 | private readonly string m_Name; 19 | private readonly NodeBase m_Parent; 20 | 21 | internal NodeBase(string name, int id, NodeBase parent) 22 | { 23 | m_Name = name; 24 | m_Id = id; 25 | m_Parent = parent; 26 | } 27 | 28 | public NodeBase Parent 29 | { 30 | get { return m_Parent; } 31 | } 32 | 33 | public int Id 34 | { 35 | get { return m_Id; } 36 | } 37 | 38 | public string Name 39 | { 40 | get { return m_Name; } 41 | } 42 | 43 | public abstract IEnumerable Children(); 44 | public abstract bool IsLeaf(); 45 | 46 | public IEnumerable Leafs() 47 | { 48 | if (IsLeaf()) yield return this; 49 | foreach (var child in Children()) 50 | { 51 | foreach (var leaf in child.Leafs()) 52 | { 53 | yield return leaf; 54 | } 55 | } 56 | } 57 | 58 | public IEnumerable Path() 59 | { 60 | var current = this; 61 | while (current != null) 62 | { 63 | yield return current; 64 | current = current.Parent; 65 | } 66 | } 67 | } 68 | } -------------------------------------------------------------------------------- /packages/Depender.Parser/src/Depender.Parser/ModuleScopeTokenResolver.cs: -------------------------------------------------------------------------------- 1 | // Type: ClrTest.Reflection.ModuleScopeTokenResolver 2 | // Assembly: Depender.Parser, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null 3 | // MVID: 7BFB306E-D2F0-493B-8C2F-5C3CEA04F731 4 | // Assembly location: D:\temp\NSplit\Depender\Depender.Parser.dll 5 | 6 | using System; 7 | using System.Reflection; 8 | 9 | namespace ClrTest.Reflection 10 | { 11 | public class ModuleScopeTokenResolver : ITokenResolver 12 | { 13 | private Module m_module; 14 | private MethodBase m_enclosingMethod; 15 | private Type[] m_methodContext; 16 | private Type[] m_typeContext; 17 | 18 | public ModuleScopeTokenResolver(MethodBase method) 19 | { 20 | this.m_enclosingMethod = method; 21 | this.m_module = method.Module; 22 | this.m_methodContext = method is ConstructorInfo ? (Type[]) null : method.GetGenericArguments(); 23 | this.m_typeContext = method.DeclaringType == null ? (Type[]) null : method.DeclaringType.GetGenericArguments(); 24 | } 25 | 26 | public MethodBase AsMethod(int token) 27 | { 28 | return this.m_module.ResolveMethod(token, this.m_typeContext, this.m_methodContext); 29 | } 30 | 31 | public FieldInfo AsField(int token) 32 | { 33 | return this.m_module.ResolveField(token, this.m_typeContext, this.m_methodContext); 34 | } 35 | 36 | public Type AsType(int token) 37 | { 38 | return this.m_module.ResolveType(token, this.m_typeContext, this.m_methodContext); 39 | } 40 | 41 | public MemberInfo AsMember(int token) 42 | { 43 | return this.m_module.ResolveMember(token, this.m_typeContext, this.m_methodContext); 44 | } 45 | 46 | public string AsString(int token) 47 | { 48 | return this.m_module.ResolveString(token); 49 | } 50 | 51 | public byte[] AsSignature(int token) 52 | { 53 | return this.m_module.ResolveSignature(token); 54 | } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /codevis/AssemblyLoadHelper.cs: -------------------------------------------------------------------------------- 1 | // This code is distributed under MIT license. 2 | // Copyright (c) 2014 George Mamaladze, Florian Greinacher 3 | // See license.txt or http://opensource.org/licenses/mit-license.php 4 | 5 | #region usings 6 | 7 | using System; 8 | using System.Collections.Generic; 9 | using System.IO; 10 | using System.Linq; 11 | using System.Reflection; 12 | 13 | #endregion 14 | 15 | namespace Gma.CodeVisuals.Generator 16 | { 17 | internal class AssemblyLoadHelper : IDisposable 18 | { 19 | private readonly ResolveEventHandler m_Resolver; 20 | 21 | public AssemblyLoadHelper(IEnumerable searchPaths) 22 | { 23 | m_Resolver = (sender, args) => Resolve(args, searchPaths); 24 | AppDomain.CurrentDomain.AssemblyResolve += m_Resolver; 25 | } 26 | 27 | 28 | public Assembly Load(string fullPath) 29 | { 30 | Console.WriteLine(fullPath); 31 | return Assembly.LoadFile(fullPath); 32 | } 33 | 34 | private static Assembly Resolve(ResolveEventArgs args, IEnumerable directories) 35 | { 36 | return directories 37 | .Select(d => Resolve(args, d)) 38 | .FirstOrDefault(); 39 | } 40 | 41 | private static Assembly Resolve(ResolveEventArgs args, string directory) 42 | { 43 | var name = args.Name; 44 | var fileName = name.Substring(0, name.IndexOf(',')); 45 | var fullPath = Path.Combine(directory, fileName + ".dll"); 46 | if (File.Exists(fullPath)) return Assembly.LoadFile(fullPath); 47 | fullPath = Path.Combine(directory, fileName + ".exe"); 48 | if (File.Exists(fullPath)) return Assembly.LoadFile(fullPath); 49 | Console.WriteLine("Can not resolve assembly [{0}] in folder [{1}].", name, directory); 50 | return null; 51 | } 52 | 53 | public void Dispose() 54 | { 55 | AppDomain.CurrentDomain.AssemblyResolve -= m_Resolver; 56 | } 57 | } 58 | } -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Build Folders (you can keep bin if you'd like, to store dlls and pdbs) 2 | [Bb]in/ 3 | [Oo]bj/ 4 | 5 | # mstest test results 6 | TestResults 7 | 8 | ## Ignore Visual Studio temporary files, build results, and 9 | ## files generated by popular Visual Studio add-ons. 10 | 11 | # User-specific files 12 | *.suo 13 | *.user 14 | *.sln.docstates 15 | 16 | # Build results 17 | [Dd]ebug/ 18 | [Rr]elease/ 19 | x64/ 20 | *_i.c 21 | *_p.c 22 | *.ilk 23 | *.meta 24 | *.obj 25 | *.pch 26 | *.pdb 27 | *.pgc 28 | *.pgd 29 | *.rsp 30 | *.sbr 31 | *.tlb 32 | *.tli 33 | *.tlh 34 | *.tmp 35 | *.log 36 | *.vspscc 37 | *.vssscc 38 | .builds 39 | 40 | # Visual C++ cache files 41 | ipch/ 42 | *.aps 43 | *.ncb 44 | *.opensdf 45 | *.sdf 46 | 47 | # Visual Studio profiler 48 | *.psess 49 | *.vsp 50 | *.vspx 51 | 52 | # Guidance Automation Toolkit 53 | *.gpState 54 | 55 | # ReSharper is a .NET coding add-in 56 | _ReSharper* 57 | 58 | # NCrunch 59 | *.ncrunch* 60 | .*crunch*.local.xml 61 | 62 | # Installshield output folder 63 | [Ee]xpress 64 | 65 | # DocProject is a documentation generator add-in 66 | DocProject/buildhelp/ 67 | DocProject/Help/*.HxT 68 | DocProject/Help/*.HxC 69 | DocProject/Help/*.hhc 70 | DocProject/Help/*.hhk 71 | DocProject/Help/*.hhp 72 | DocProject/Help/Html2 73 | DocProject/Help/html 74 | 75 | # Click-Once directory 76 | publish 77 | 78 | # Publish Web Output 79 | *.Publish.xml 80 | 81 | # NuGet Packages Directory 82 | packages 83 | 84 | # Windows Azure Build Output 85 | csx 86 | *.build.csdef 87 | 88 | # Windows Store app package directory 89 | AppPackages/ 90 | 91 | # Others 92 | [Bb]in 93 | [Oo]bj 94 | sql 95 | TestResults 96 | [Tt]est[Rr]esult* 97 | *.Cache 98 | ClientBin 99 | [Ss]tyle[Cc]op.* 100 | ~$* 101 | *.dbmdl 102 | Generated_Code #added for RIA/Silverlight projects 103 | 104 | # Backup & report files from converting an old project file to a newer 105 | # Visual Studio version. Backup files are not needed, because we have git ;-) 106 | _UpgradeReport_Files/ 107 | Backup*/ 108 | UpgradeLog*.XML 109 | *.DS_Store 110 | -------------------------------------------------------------------------------- /Gma.CodeVisuals.WebApi/html/js/index.js: -------------------------------------------------------------------------------- 1 | // This code is distributed under MIT license. 2 | // Copyright (c) 2014 George Mamaladze, Florian Greinacher 3 | // See license.txt or http://opensource.org/licenses/mit-license.php 4 | 5 | function startAnalyzes(file) { 6 | var saveChecked = $("input:checked").length>0; 7 | $.getJSON("api/analyzes/start?file=" + file + "&save=" + saveChecked, function (data) { 8 | $("#loaded").text(data.message); 9 | $("#message").text("Started"); 10 | if (data.ok) { 11 | setTimeout(getPorgress, 100); 12 | $("#goto") 13 | .removeAttr("disabled") 14 | .on("click", goToGraph); 15 | } 16 | }); 17 | } 18 | 19 | function getPorgress() { 20 | $.getJSON("api/analyzes/progress", function(progress) { 21 | $("#progress").text(Math.round(progress.actual * 100 / progress.max) + "%"); 22 | $("#message").text(progress.message); 23 | if (progress.finished) goToGraph(); 24 | else setTimeout(getPorgress, 200); 25 | }); 26 | } 27 | 28 | function goToGraph() { 29 | var newUrl = window.location.protocol + "//" + window.location.host + "/main.html"; 30 | //window.location = newUrl; 31 | window.location.replace(newUrl); 32 | } 33 | 34 | function supportsSvg() { 35 | return document.createElement('svg'); 36 | } 37 | 38 | $(document).ready(function () { 39 | 40 | if (!supportsSvg()) { 41 | $("#warning").style("visibility", "visible"); 42 | } 43 | 44 | $("#analyze").on("click", function () { 45 | var fileName = $("#assembly").val(); 46 | startAnalyzes(fileName); 47 | }); 48 | 49 | $("#demo").on("click", function () { 50 | startAnalyzes(""); 51 | }); 52 | 53 | $.getJSON("api/dependencies/names", function(data) { 54 | var list = $("#list"); 55 | data.forEach(function(name) { 56 | var li = $("
  • "); 57 | var a = $("") 58 | .text(name) 59 | .attr("href", "/main.html?name=" + name); 60 | li.append(a); 61 | list.append(li); 62 | }); 63 | }); 64 | }); -------------------------------------------------------------------------------- /codevis/DependencyForceGraph/DataStructures/TypeTree/Tree.cs: -------------------------------------------------------------------------------- 1 | // This code is distributed under MIT license. 2 | // Copyright (c) 2014 George Mamaladze, Florian Greinacher 3 | // See license.txt or http://opensource.org/licenses/mit-license.php 4 | 5 | #region usings 6 | 7 | using System.Collections.Generic; 8 | 9 | #endregion 10 | 11 | namespace Gma.CodeVisuals.Generator.DependencyForceGraph.DataStructures.TypeTree 12 | { 13 | internal class Tree 14 | { 15 | private readonly NodeFactory m_NodeFactory; 16 | 17 | private readonly Node m_Root; 18 | 19 | public Tree(NodeFactory nodeFactory, string rootName) 20 | { 21 | m_NodeFactory = nodeFactory; 22 | m_Root = m_NodeFactory.CreateNode(rootName, null); 23 | } 24 | 25 | public int Count 26 | { 27 | get { return m_NodeFactory.Count; } 28 | } 29 | 30 | public IEnumerable Nodes 31 | { 32 | get { return m_NodeFactory.Nodes; } 33 | } 34 | 35 | public INode Root 36 | { 37 | get { return m_Root; } 38 | } 39 | 40 | public INode Add(string fullName) 41 | { 42 | var qualifiedName = QualifiedName.Parse(fullName); 43 | var names = new Queue(qualifiedName.Nodes); 44 | var node = m_Root.GetOrCreate(names, m_NodeFactory); 45 | var leaf = m_NodeFactory.CreateLeaf(qualifiedName.Leaf, node); 46 | node.AddLeaf(leaf); 47 | return leaf; 48 | } 49 | 50 | public bool TryGet(string fullName, out INode leaf) 51 | { 52 | leaf = null; 53 | if (string.IsNullOrEmpty(fullName)) return false; 54 | var qualifiedName = QualifiedName.Parse(fullName); 55 | var names = new Queue(qualifiedName.Nodes); 56 | Node node; 57 | bool nodeFound = m_Root.TryGetNode(names, out node); 58 | if (!nodeFound) return false; 59 | Leaf result; 60 | bool isOk = node.TryGetLeaf(qualifiedName.Leaf, out result); 61 | leaf = result; 62 | return isOk; 63 | } 64 | } 65 | } -------------------------------------------------------------------------------- /codevis/DependencyForceGraph/DataStructures/DependencyGraph/Edge.cs: -------------------------------------------------------------------------------- 1 | // This code is distributed under MIT license. 2 | // Copyright (c) 2014 George Mamaladze, Florian Greinacher 3 | // See license.txt or http://opensource.org/licenses/mit-license.php 4 | 5 | #region usings 6 | 7 | using System.Collections.Generic; 8 | using System.Linq; 9 | 10 | #endregion 11 | 12 | namespace Gma.CodeVisuals.Generator.DependencyForceGraph.DataStructures.DependencyGraph 13 | { 14 | internal class Edge 15 | { 16 | private readonly DependencyKinds m_Kinds; 17 | private readonly int m_Source; 18 | private readonly int m_Target; 19 | 20 | public Edge(int source, int target, DependencyKinds kinds) 21 | { 22 | m_Source = source; 23 | m_Target = target; 24 | m_Kinds = kinds; 25 | } 26 | 27 | public int Source 28 | { 29 | get { return m_Source; } 30 | } 31 | 32 | public int Target 33 | { 34 | get { return m_Target; } 35 | } 36 | 37 | public DependencyKinds Kinds 38 | { 39 | get { return m_Kinds; } 40 | } 41 | 42 | public IEnumerable FlattenFlags() 43 | { 44 | return Kinds.Flatten().Select(kind => new Edge(Source, Target, kind)); 45 | } 46 | 47 | protected bool Equals(Edge other) 48 | { 49 | return m_Source == other.m_Source && m_Target == other.m_Target && m_Kinds == other.m_Kinds; 50 | } 51 | 52 | public override bool Equals(object obj) 53 | { 54 | if (ReferenceEquals(null, obj)) return false; 55 | if (ReferenceEquals(this, obj)) return true; 56 | if (obj.GetType() != this.GetType()) return false; 57 | return Equals((Edge) obj); 58 | } 59 | 60 | public override int GetHashCode() 61 | { 62 | unchecked 63 | { 64 | var hashCode = m_Source; 65 | hashCode = (hashCode*397) ^ m_Target; 66 | hashCode = (hashCode*397) ^ (int) m_Kinds; 67 | return hashCode; 68 | } 69 | } 70 | } 71 | } -------------------------------------------------------------------------------- /Gma.CodeVisuals.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2013 4 | VisualStudioVersion = 12.0.21005.1 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Gma.CodeVisuals.DependencyForceGraph.Tests", "Gma.CodeGravity.Tests\Gma.CodeVisuals.DependencyForceGraph.Tests.csproj", "{8AA40642-7259-45BC-B96D-A0EE4B6CC68E}" 7 | EndProject 8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Gma.CodeVisuals.WebApi", "Gma.CodeVisuals.WebApi\Gma.CodeVisuals.WebApi.csproj", "{7416F52D-821A-4392-8BAF-A2F705D099E2}" 9 | EndProject 10 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{D45C4C08-8A43-43A6-9100-F2B27EBAD5BE}" 11 | ProjectSection(SolutionItems) = preProject 12 | .nuget\NuGet.Config = .nuget\NuGet.Config 13 | .nuget\NuGet.exe = .nuget\NuGet.exe 14 | .nuget\NuGet.targets = .nuget\NuGet.targets 15 | EndProjectSection 16 | EndProject 17 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "codevis", "codevis\codevis.csproj", "{3CBA0E73-9F7B-4F72-9FBB-44D123B37806}" 18 | EndProject 19 | Global 20 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 21 | Debug|Any CPU = Debug|Any CPU 22 | Release|Any CPU = Release|Any CPU 23 | EndGlobalSection 24 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 25 | {8AA40642-7259-45BC-B96D-A0EE4B6CC68E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 26 | {8AA40642-7259-45BC-B96D-A0EE4B6CC68E}.Debug|Any CPU.Build.0 = Debug|Any CPU 27 | {8AA40642-7259-45BC-B96D-A0EE4B6CC68E}.Release|Any CPU.ActiveCfg = Release|Any CPU 28 | {8AA40642-7259-45BC-B96D-A0EE4B6CC68E}.Release|Any CPU.Build.0 = Release|Any CPU 29 | {7416F52D-821A-4392-8BAF-A2F705D099E2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 30 | {7416F52D-821A-4392-8BAF-A2F705D099E2}.Debug|Any CPU.Build.0 = Debug|Any CPU 31 | {7416F52D-821A-4392-8BAF-A2F705D099E2}.Release|Any CPU.ActiveCfg = Release|Any CPU 32 | {7416F52D-821A-4392-8BAF-A2F705D099E2}.Release|Any CPU.Build.0 = Release|Any CPU 33 | {3CBA0E73-9F7B-4F72-9FBB-44D123B37806}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 34 | {3CBA0E73-9F7B-4F72-9FBB-44D123B37806}.Debug|Any CPU.Build.0 = Debug|Any CPU 35 | {3CBA0E73-9F7B-4F72-9FBB-44D123B37806}.Release|Any CPU.ActiveCfg = Release|Any CPU 36 | {3CBA0E73-9F7B-4F72-9FBB-44D123B37806}.Release|Any CPU.Build.0 = Release|Any CPU 37 | EndGlobalSection 38 | GlobalSection(SolutionProperties) = preSolution 39 | HideSolutionNode = FALSE 40 | EndGlobalSection 41 | EndGlobal 42 | -------------------------------------------------------------------------------- /codevis/Options.cs: -------------------------------------------------------------------------------- 1 | // This code is distributed under MIT license. 2 | // Copyright (c) 2014 George Mamaladze, Florian Greinacher 3 | // See license.txt or http://opensource.org/licenses/mit-license.php 4 | 5 | #region usings 6 | 7 | using System; 8 | using System.Collections.Generic; 9 | using CommandLine; 10 | using CommandLine.Text; 11 | using Gma.CodeVisuals.WebApi.DependencyForceGraph; 12 | 13 | #endregion 14 | 15 | namespace Gma.CodeVisuals.Generator 16 | { 17 | internal class Options 18 | { 19 | [ValueList(typeof (List))] 20 | public IList Assemblies { get; set; } 21 | 22 | [Option('v', "verbose", DefaultValue = true, HelpText = "Prints all messages to standard output.")] 23 | public bool Verbose { get; set; } 24 | 25 | [OptionList('p', "path", Separator = ';', HelpText = "Specify search path, separated by a semicolon.")] 26 | public IList Path { get; set; } 27 | 28 | [Option('o', "output", DefaultValue = Storage.DefaultDirectoryName, HelpText = "Oputput folder for graph files.")] 29 | public string Output { get; set; } 30 | 31 | [ParserState] 32 | public IParserState LastParserState { get; set; } 33 | 34 | [HelpOption] 35 | public string GetUsage() 36 | { 37 | var help = HelpText.AutoBuild(this, 38 | current => HelpText.DefaultParsingErrorsHandler(this, current)); 39 | help.MaximumDisplayWidth = 80; 40 | help.AddPreOptionsLine( 41 | string.Format( 42 | @"{0}" 43 | + "Usage:{0}" 44 | + "{0}" 45 | + "codevis.exe assembly1 [assembly2...N] [-p[[;]directories]] [-v] [-o outdir] {0}" 46 | + "{0}" 47 | + "Enter assembly names separated by space. " 48 | + "Assembly names can contain '*' and '?' wildcards. " 49 | + "Names are either absolute paths or file names under one of the folders from path option.{0}" 50 | + "{0}" 51 | + "Examples:{0}" 52 | + "{0}" 53 | + " codevis.exe c:/dir/System.Core.dll {0}" 54 | + " codevis.exe c:/dir/System.Data*{0}" 55 | + " codevis.exe MyDll System.Core -p: C:/dir/;c:/mydir{0}" 56 | + "{0}" 57 | , Environment.NewLine)); 58 | 59 | return help; 60 | } 61 | } 62 | } -------------------------------------------------------------------------------- /codevis/DependencyForceGraph/DataStructures/DependencyGraph/AdjacencyMatrix.cs: -------------------------------------------------------------------------------- 1 | // This code is distributed under MIT license. 2 | // Copyright (c) 2014 George Mamaladze, Florian Greinacher 3 | // See license.txt or http://opensource.org/licenses/mit-license.php 4 | 5 | #region usings 6 | 7 | using System.Collections.Generic; 8 | using Gma.CodeVisuals.Generator.DependencyForceGraph.Do; 9 | 10 | #endregion 11 | 12 | namespace Gma.CodeVisuals.Generator.DependencyForceGraph.DataStructures.DependencyGraph 13 | { 14 | internal class AdjacencyMatrix 15 | { 16 | private readonly DependencyKinds[,] m_Matrix; 17 | 18 | public AdjacencyMatrix(int count) 19 | { 20 | m_Matrix = new DependencyKinds[count, count]; 21 | } 22 | 23 | public bool Add(int source, int target, DependencyKind kind, out Edge edge) 24 | { 25 | return Add(source, target, kind.ToFlags(), out edge); 26 | } 27 | 28 | public bool Add(int source, int target, DependencyKinds kinds, out Edge edge) 29 | { 30 | edge = null; 31 | var value = m_Matrix[source, target]; 32 | if (value == kinds) return false; 33 | m_Matrix[source, target] = value | kinds; 34 | edge = new Edge(source, target, kinds); 35 | return true; 36 | } 37 | 38 | public IEnumerable Out(int id) 39 | { 40 | for (int i = 0; i < m_Matrix.GetLength(1); i++) 41 | { 42 | var value = m_Matrix[id, i]; 43 | if (value == DependencyKinds.None) continue; 44 | yield return new Edge(id, i, value); 45 | } 46 | } 47 | 48 | public IEnumerable In(int id) 49 | { 50 | for (int i = 0; i < m_Matrix.GetLength(0); i++) 51 | { 52 | var value = m_Matrix[i, id]; 53 | if (value == DependencyKinds.None) continue; 54 | yield return new Edge(i, id, value); 55 | } 56 | } 57 | 58 | public IEnumerable All() 59 | { 60 | for (int i = 0; i < m_Matrix.GetLength(0); i++) 61 | { 62 | for (int j = 0; j < m_Matrix.GetLength(1); j++) 63 | { 64 | var value = m_Matrix[i, j]; 65 | if (value == DependencyKinds.None) continue; 66 | yield return new Edge(i, j, value); 67 | } 68 | } 69 | } 70 | } 71 | } -------------------------------------------------------------------------------- /codevis/DependencyForceGraph/DataStructures/TypeTree/Node.cs: -------------------------------------------------------------------------------- 1 | // This code is distributed under MIT license. 2 | // Copyright (c) 2014 George Mamaladze, Florian Greinacher 3 | // See license.txt or http://opensource.org/licenses/mit-license.php 4 | 5 | #region usings 6 | 7 | using System.Collections.Generic; 8 | using System.Linq; 9 | 10 | #endregion 11 | 12 | namespace Gma.CodeVisuals.Generator.DependencyForceGraph.DataStructures.TypeTree 13 | { 14 | internal class Node : NodeBase 15 | { 16 | private readonly Dictionary m_ChildNodes; 17 | private readonly Dictionary m_Leafs; 18 | 19 | internal Node(string name, int id, Node node) : base(name, id, node) 20 | { 21 | m_ChildNodes = new Dictionary(); 22 | m_Leafs = new Dictionary(); 23 | } 24 | 25 | public override IEnumerable Children() 26 | { 27 | return 28 | m_ChildNodes.Values.OrderBy(node => node.Name) 29 | .Concat(m_Leafs.Values.OrderBy(l => l.Name).Cast()); 30 | } 31 | 32 | 33 | public override bool IsLeaf() 34 | { 35 | return false; 36 | } 37 | 38 | internal Node GetOrCreate(Queue nodeNames, NodeFactory factory) 39 | { 40 | if (nodeNames.Count == 0) return this; 41 | var name = nodeNames.Dequeue(); 42 | Node node; 43 | bool isOk = m_ChildNodes.TryGetValue(name, out node); 44 | if (!isOk) 45 | { 46 | node = factory.CreateNode(name, this); 47 | m_ChildNodes.Add(name, node); 48 | } 49 | return node.GetOrCreate(nodeNames, factory); 50 | } 51 | 52 | public void AddLeaf(Leaf leaf) 53 | { 54 | m_Leafs.Add(leaf.Name, leaf); 55 | } 56 | 57 | public bool TryGetLeaf(string leaf, out Leaf node) 58 | { 59 | return m_Leafs.TryGetValue(leaf, out node); 60 | } 61 | 62 | public bool TryGetNode(Queue nodeNames, out Node node) 63 | { 64 | if (nodeNames.Count == 0) 65 | { 66 | node = this; 67 | return true; 68 | } 69 | 70 | var name = nodeNames.Dequeue(); 71 | bool isOk = m_ChildNodes.TryGetValue(name, out node); 72 | if (!isOk) 73 | { 74 | return false; 75 | } 76 | return node.TryGetNode(nodeNames, out node); 77 | } 78 | } 79 | } -------------------------------------------------------------------------------- /packages/Depender.Parser/src/Depender.Parser/ILInstructionVisitor.cs: -------------------------------------------------------------------------------- 1 | // Type: ClrTest.Reflection.ILInstructionVisitor 2 | // Assembly: Depender.Parser, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null 3 | // MVID: 7BFB306E-D2F0-493B-8C2F-5C3CEA04F731 4 | // Assembly location: D:\temp\NSplit\Depender\Depender.Parser.dll 5 | 6 | namespace ClrTest.Reflection 7 | { 8 | public abstract class ILInstructionVisitor 9 | { 10 | public virtual void VisitInlineBrTargetInstruction(InlineBrTargetInstruction inlineBrTargetInstruction) 11 | { 12 | } 13 | 14 | public virtual void VisitInlineFieldInstruction(InlineFieldInstruction inlineFieldInstruction) 15 | { 16 | } 17 | 18 | public virtual void VisitInlineIInstruction(InlineIInstruction inlineIInstruction) 19 | { 20 | } 21 | 22 | public virtual void VisitInlineI8Instruction(InlineI8Instruction inlineI8Instruction) 23 | { 24 | } 25 | 26 | public virtual void VisitInlineMethodInstruction(InlineMethodInstruction inlineMethodInstruction) 27 | { 28 | } 29 | 30 | public virtual void VisitInlineNoneInstruction(InlineNoneInstruction inlineNoneInstruction) 31 | { 32 | } 33 | 34 | public virtual void VisitInlineRInstruction(InlineRInstruction inlineRInstruction) 35 | { 36 | } 37 | 38 | public virtual void VisitInlineSigInstruction(InlineSigInstruction inlineSigInstruction) 39 | { 40 | } 41 | 42 | public virtual void VisitInlineStringInstruction(InlineStringInstruction inlineStringInstruction) 43 | { 44 | } 45 | 46 | public virtual void VisitInlineSwitchInstruction(InlineSwitchInstruction inlineSwitchInstruction) 47 | { 48 | } 49 | 50 | public virtual void VisitInlineTokInstruction(InlineTokInstruction inlineTokInstruction) 51 | { 52 | } 53 | 54 | public virtual void VisitInlineTypeInstruction(InlineTypeInstruction inlineTypeInstruction) 55 | { 56 | } 57 | 58 | public virtual void VisitInlineVarInstruction(InlineVarInstruction inlineVarInstruction) 59 | { 60 | } 61 | 62 | public virtual void VisitShortInlineBrTargetInstruction(ShortInlineBrTargetInstruction shortInlineBrTargetInstruction) 63 | { 64 | } 65 | 66 | public virtual void VisitShortInlineIInstruction(ShortInlineIInstruction shortInlineIInstruction) 67 | { 68 | } 69 | 70 | public virtual void VisitShortInlineRInstruction(ShortInlineRInstruction shortInlineRInstruction) 71 | { 72 | } 73 | 74 | public virtual void VisitShortInlineVarInstruction(ShortInlineVarInstruction shortInlineVarInstruction) 75 | { 76 | } 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /codevis/AssemblySearchHelper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Linq; 5 | 6 | namespace Gma.CodeVisuals.Generator 7 | { 8 | internal class AssemblySearchHelper 9 | { 10 | private static readonly string[] AssemblyExtensions = { ".dll", ".exe" }; 11 | 12 | public static List GetAssemblyFullNames(IEnumerable patterns, IEnumerable searchPaths) 13 | { 14 | return patterns 15 | .SelectMany(pattern => SeacrhAssembly(searchPaths, pattern)) 16 | .Where(IsAssembly) 17 | .ToList(); 18 | } 19 | 20 | public static void OptionsToNamesAndSearchPath(Options options, out IEnumerable patterns, out IEnumerable searchPaths) 21 | { 22 | var files = new Stack(); 23 | var paths = new Stack(options.Path); 24 | 25 | foreach (var item in options.Assemblies) 26 | { 27 | string pattern; 28 | if (Path.IsPathRooted(item)) 29 | { 30 | pattern = Path.GetFileName(item); 31 | string path = Path.GetDirectoryName(item); 32 | paths.Push(path); 33 | } 34 | else 35 | { 36 | pattern = item; 37 | } 38 | files.Push(pattern); 39 | } 40 | 41 | patterns = files; 42 | searchPaths = paths; 43 | } 44 | 45 | private static IEnumerable SeacrhAssembly(IEnumerable paths, string pattern) 46 | { 47 | return paths 48 | .SelectMany(p => GetBestMatchFullNames(p, pattern)); 49 | } 50 | 51 | private static bool IsAssembly(string path) 52 | { 53 | return 54 | AssemblyExtensions.Contains( 55 | Path.GetExtension(path) ?? String.Empty, 56 | StringComparer.InvariantCultureIgnoreCase); 57 | } 58 | 59 | private static IEnumerable GetBestMatchFullNames(string path, string pattern) 60 | { 61 | return GetBestMatchNames(path, pattern).Select(shortName => Path.Combine(path, shortName)); 62 | } 63 | 64 | private static IEnumerable GetBestMatchNames(string path, string pattern) 65 | { 66 | var result = Directory.GetFiles(path, pattern).Where(IsAssembly).ToArray(); 67 | if (result.Length > 0) return result; 68 | foreach (var extension in AssemblyExtensions) 69 | { 70 | result = Directory.GetFiles(path, pattern + extension); 71 | if (result.Length > 0) return result; 72 | } 73 | return result; 74 | } 75 | } 76 | } -------------------------------------------------------------------------------- /Gma.CodeVisuals.WebApi/port8080problem.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Upsss! 7 | 8 | 9 | 22 |
    23 |

    Upsss! Unable to start an HTTP server here.

    24 |

    The port 8080 is already ocupied

    25 |

    Another instance of this application or some othe service is listening to port 8080. You can close this application or mofify code (a constant in Program.cs file) and recompile this application to use another port.

    26 |

    Not enaugh persmissions to listen port 8080

    27 |

    28 | This application listens to http://localhost:8080/. By default, listening at a particular HTTP address requires administrator privileges. 29 |

    30 |

    31 | When you run it, therefore, you may get this error: "HTTP could not register URL http://+:8080/" 32 |

    33 |

    34 | There are two ways to avoid this error: 35 |

    36 |
      37 |
    • Run Visual Studio with elevated administrator permissions (right click and "Run as Administrator"), or
    • 38 |
    • Use Netsh.exe to give your account permissions to reserve the URL.
    • 39 |
    40 |

    41 | To use Netsh.exe, open a command prompt with administrator privileges and enter the following command:following command: 42 |

    43 |
    netsh http add urlacl url = http:/+:8080/ user=machine\username
    44 |

    45 | When you are finished self-hosting, be sure to delete the reservation: 46 |

    47 |
    //+:8080/
    48 |

    Application requires administrator rights. Why?

    49 |

    50 | This application listens to http://localhost:8080/. By default, listening at a particular HTTP address requires administrator privileges.
    51 | There is an entry in app.manifest which eforces that: 52 |

    53 | <requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
    54 |     <requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
    55 | </requestedPrivileges>
    56 |             
    57 | If you remove it (and recompile) you will either need to start it using "Run as Administrator" or you will need to run netsh as described above. 58 |

    59 |
    60 | 61 | -------------------------------------------------------------------------------- /packages/Depender.Parser/src/Depender.Parser/MethodBodyInfo.cs: -------------------------------------------------------------------------------- 1 | // Type: ClrTest.Reflection.MethodBodyInfo 2 | // Assembly: Depender.Parser, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null 3 | // MVID: 7BFB306E-D2F0-493B-8C2F-5C3CEA04F731 4 | // Assembly location: D:\temp\NSplit\Depender\Depender.Parser.dll 5 | 6 | using System; 7 | using System.Collections.Generic; 8 | using System.Reflection; 9 | 10 | namespace ClrTest.Reflection 11 | { 12 | [Serializable] 13 | public class MethodBodyInfo 14 | { 15 | private List m_instructions = new List(); 16 | private List m_realInstructions = new List(); 17 | private int m_methodId; 18 | private string m_typeName; 19 | private string m_methodToString; 20 | 21 | public int Identity 22 | { 23 | get 24 | { 25 | return this.m_methodId; 26 | } 27 | set 28 | { 29 | this.m_methodId = value; 30 | } 31 | } 32 | 33 | public string TypeName 34 | { 35 | get 36 | { 37 | return this.m_typeName; 38 | } 39 | set 40 | { 41 | this.m_typeName = value; 42 | } 43 | } 44 | 45 | public string MethodToString 46 | { 47 | get 48 | { 49 | return this.m_methodToString; 50 | } 51 | set 52 | { 53 | this.m_methodToString = value; 54 | } 55 | } 56 | 57 | public List InstructionStrings 58 | { 59 | get 60 | { 61 | return this.m_instructions; 62 | } 63 | } 64 | 65 | public List Instructions 66 | { 67 | get 68 | { 69 | return this.m_realInstructions; 70 | } 71 | } 72 | 73 | private void AddInstruction(string inst, ILInstruction instruction) 74 | { 75 | this.m_instructions.Add(inst); 76 | this.m_realInstructions.Add(instruction); 77 | } 78 | 79 | public static MethodBodyInfo Create(MethodBase method) 80 | { 81 | MethodBodyInfo mbi = new MethodBodyInfo(); 82 | mbi.Identity = method.GetHashCode(); 83 | mbi.TypeName = method.GetType().Name; 84 | mbi.MethodToString = method.ToString(); 85 | ReadableILStringVisitor readableIlStringVisitor = new ReadableILStringVisitor((IILStringCollector) new MethodBodyInfo.MethodBodyInfoBuilder(mbi), (IFormatProvider) DefaultFormatProvider.Instance); 86 | new ILReader(method).Accept((ILInstructionVisitor) readableIlStringVisitor); 87 | return mbi; 88 | } 89 | 90 | private class MethodBodyInfoBuilder : IILStringCollector 91 | { 92 | private MethodBodyInfo m_mbi; 93 | 94 | public MethodBodyInfoBuilder(MethodBodyInfo mbi) 95 | { 96 | this.m_mbi = mbi; 97 | } 98 | 99 | public void Process(ILInstruction instruction, string operandString) 100 | { 101 | this.m_mbi.AddInstruction(string.Format("IL_{0:x4}: {1,-10} {2}", (object) instruction.Offset, (object) instruction.OpCode.Name, (object) operandString), instruction); 102 | } 103 | } 104 | } 105 | } 106 | -------------------------------------------------------------------------------- /Gma.CodeVisuals.WebApi/Server/WebServerOnFolder.cs: -------------------------------------------------------------------------------- 1 | // This code is distributed under MIT license. 2 | // Copyright (c) 2014 George Mamaladze, Florian Greinacher 3 | // See license.txt or http://opensource.org/licenses/mit-license.php 4 | 5 | #region usings 6 | 7 | using System; 8 | using System.Collections.Generic; 9 | using System.IO; 10 | using System.Net; 11 | using System.Net.Http; 12 | using System.Threading; 13 | using System.Threading.Tasks; 14 | 15 | #endregion 16 | 17 | namespace Gma.CodeVisuals.WebApi.Server 18 | { 19 | internal class WebServerOnFolder : DelegatingHandler 20 | { 21 | private readonly string m_BaseFolder; 22 | private readonly Dictionary m_FileTypes; 23 | private readonly Func m_Matches; 24 | 25 | public WebServerOnFolder(Func matches, string folderPath, 26 | params FileType[] allowedFileTypes) 27 | { 28 | m_Matches = matches; 29 | m_BaseFolder = folderPath; 30 | m_FileTypes = new Dictionary(); 31 | 32 | foreach (var fileType in allowedFileTypes) 33 | { 34 | m_FileTypes.Add(fileType.Extension, fileType); 35 | } 36 | } 37 | 38 | protected override Task SendAsync( 39 | HttpRequestMessage request, 40 | CancellationToken cancellationToken) 41 | { 42 | return 43 | !m_Matches(request) 44 | ? base.SendAsync(request, cancellationToken) 45 | : Task 46 | .Factory 47 | .StartNew( 48 | () => Response(request), 49 | cancellationToken); 50 | } 51 | 52 | private HttpResponseMessage Response(HttpRequestMessage request) 53 | { 54 | const string defaultPageName = "index.html"; 55 | var path = request.RequestUri.AbsolutePath; 56 | var suffix = path == string.Empty ? defaultPageName : path.Substring(1); 57 | var fullPath = Path.Combine(m_BaseFolder, suffix); 58 | 59 | if (!File.Exists(fullPath)) 60 | { 61 | return request.CreateErrorResponse( 62 | HttpStatusCode.NotFound, 63 | string.Format("Sorry about that, but there is no file named '{0}' here.", suffix)); 64 | } 65 | 66 | string extension = Path.GetExtension(path); 67 | FileType fileType; 68 | if (!m_FileTypes.TryGetValue(extension, out fileType)) 69 | { 70 | return request.CreateErrorResponse( 71 | HttpStatusCode.UnsupportedMediaType, 72 | string.Format("Sorry I can not process files like '{0}'.", extension)); 73 | } 74 | 75 | var response = request.CreateResponse(); 76 | var fileStream = new FileStream(fullPath, FileMode.Open); 77 | response.Content = new StreamContent(fileStream); 78 | response.Content.Headers.ContentType = fileType.ContentType; 79 | return response; 80 | } 81 | } 82 | } -------------------------------------------------------------------------------- /Gma.CodeVisuals.WebApi/Program.cs: -------------------------------------------------------------------------------- 1 | // This code is distributed under MIT license. 2 | // Copyright (c) 2014 George Mamaladze, Florian Greinacher 3 | // See license.txt or http://opensource.org/licenses/mit-license.php 4 | 5 | #region usings 6 | 7 | using System; 8 | using System.Diagnostics; 9 | using System.IO; 10 | using System.Net.Http; 11 | using System.Reflection; 12 | using System.ServiceModel; 13 | using System.Web.Http; 14 | using System.Web.Http.SelfHost; 15 | using Gma.CodeVisuals.WebApi.DependencyForceGraph; 16 | using Gma.CodeVisuals.WebApi.Server; 17 | 18 | #endregion 19 | 20 | namespace Gma.CodeVisuals.WebApi 21 | { 22 | internal class Program 23 | { 24 | public const string HttpLocalhost = "http://localhost:8080"; 25 | 26 | public static Storage Storage; 27 | 28 | [STAThread] 29 | private static void Main(string[] args) 30 | { 31 | AppDomain.CurrentDomain.UnhandledException += (sender, e) => 32 | { 33 | Console.WriteLine(e.ExceptionObject.ToString()); 34 | Environment.Exit(1); 35 | }; 36 | 37 | var storagePath = args.Length > 0 38 | ? args[0] 39 | : Storage.GetDefaultPath(); 40 | Storage = new Storage(storagePath); 41 | StartHttpServer(); 42 | } 43 | 44 | private static void StartHttpServer() 45 | { 46 | var config = new HttpSelfHostConfiguration(HttpLocalhost) 47 | { 48 | HostNameComparisonMode = HostNameComparisonMode.Exact 49 | }; 50 | 51 | string webFolder = Path.Combine(GetExePath(), "html"); 52 | 53 | Func matchesAllExceptApi = 54 | request => !request.RequestUri.AbsolutePath.StartsWith("/api/"); 55 | 56 | var webServerOnFolder = new WebServerOnFolder( 57 | matchesAllExceptApi, 58 | webFolder, 59 | FileType.Html, 60 | FileType.Css, 61 | FileType.Javascript, 62 | FileType.Gif, 63 | FileType.Png, 64 | FileType.Json, 65 | FileType.Ico); 66 | 67 | config.MessageHandlers.Add(webServerOnFolder); 68 | config.Routes.MapHttpRoute( 69 | "API", 70 | "api/{controller}/{action}", 71 | new {id = RouteParameter.Optional}); 72 | 73 | using (var server = new HttpSelfHostServer(config)) 74 | { 75 | try 76 | { 77 | server.OpenAsync().Wait(); 78 | Console.WriteLine("Server started on [{0}]", HttpLocalhost); 79 | } 80 | catch (AggregateException ex) 81 | { 82 | Console.WriteLine("Failed to start server on [{0}]", HttpLocalhost); 83 | Console.WriteLine(ex.ToString()); 84 | Process.Start("port8080problem.html"); 85 | return; 86 | } 87 | Process.Start(HttpLocalhost + "/index.html"); 88 | Console.WriteLine("Press any key to quit."); 89 | Console.ReadKey(); 90 | } 91 | } 92 | 93 | private static string GetExePath() 94 | { 95 | return Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); 96 | } 97 | 98 | } 99 | } -------------------------------------------------------------------------------- /Gma.CodeVisuals.WebApi/html/js/tree.js: -------------------------------------------------------------------------------- 1 | // This code is distributed under MIT license. 2 | // Copyright (c) 2014 George Mamaladze, Florian Greinacher 3 | // See license.txt or http://opensource.org/licenses/mit-license.php 4 | 5 | function Tree(element, jsonTree) { 6 | var instance = this; 7 | $(element) 8 | .jstree({ 9 | "core": { 10 | "data": 11 | jsonTree, 12 | "themes": { 13 | "icons": false 14 | } 15 | }, 16 | "checkbox": { 17 | "keep_selected_style": false 18 | }, 19 | "contextmenu": { 20 | "items": function(n) { 21 | return { 22 | "ExpandSubTree": { 23 | "label": "EXPAND ALL", 24 | "action": function() { 25 | var tree = $('#typetree').jstree(true); 26 | tree.open_all(n); 27 | tree.deselect_all(); 28 | if (instance.onOpenCallback != null) { 29 | var id = n.original.id; 30 | instance.onOpenCallback(id, true); 31 | } 32 | } 33 | }, 34 | "CollapseSubTree": { 35 | "label": "COLLAPSE ALL", 36 | "action": function() { 37 | var tree = $('#typetree').jstree(true); 38 | tree.close_all(n); 39 | tree.deselect_all(); 40 | if (instance.onCloseCallback != null) { 41 | var id = n.original.id; 42 | instance.onCloseCallback(id, true); 43 | } 44 | } 45 | } 46 | }; 47 | } 48 | }, 49 | "plugins": ["checkbox", "contextmenu"] 50 | }) 51 | .on('open_node.jstree', function(e, data) { 52 | if (instance.onOpenCallback != null) { 53 | var id = data.node.original.id; 54 | instance.onOpenCallback(id, false); 55 | } 56 | }) 57 | .on('close_node.jstree', function(e, data) { 58 | var n = data.node; 59 | if (!n.children) return; 60 | n.children.forEach(function(el) { data.instance.close_node(el); }); 61 | if (instance.onCloseCallback != null) { 62 | var id = data.node.original.id; 63 | instance.onCloseCallback(id, false); 64 | } 65 | }) 66 | .on('changed.jstree', function(e, data) { 67 | if (instance.onSelectCallback != null) { 68 | var selected = []; 69 | data.selected.forEach(function(el) { 70 | selected[el] = true; 71 | }); 72 | instance.onSelectCallback(selected); 73 | } 74 | }); 75 | } 76 | 77 | Tree.prototype.onOpen = function(callback) { 78 | this.onOpenCallback = callback; 79 | return this; 80 | }; 81 | Tree.prototype.onClose = function(callback) { 82 | this.onCloseCallback = callback; 83 | return this; 84 | }; 85 | Tree.prototype.onSelect = function(callback) { 86 | this.onSelectCallback = callback; 87 | return this; 88 | }; -------------------------------------------------------------------------------- /packages/Depender.Parser/src/Depender.Parser/RawILStringVisitor.cs: -------------------------------------------------------------------------------- 1 | // Type: ClrTest.Reflection.RawILStringVisitor 2 | // Assembly: Depender.Parser, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null 3 | // MVID: 7BFB306E-D2F0-493B-8C2F-5C3CEA04F731 4 | // Assembly location: D:\temp\NSplit\Depender\Depender.Parser.dll 5 | 6 | namespace ClrTest.Reflection 7 | { 8 | public class RawILStringVisitor : ReadableILStringVisitor 9 | { 10 | public RawILStringVisitor(IILStringCollector collector) 11 | : this(collector, (IFormatProvider) DefaultFormatProvider.Instance) 12 | { 13 | } 14 | 15 | public RawILStringVisitor(IILStringCollector collector, IFormatProvider formatProvider) 16 | : base(collector, formatProvider) 17 | { 18 | } 19 | 20 | public override void VisitInlineBrTargetInstruction(InlineBrTargetInstruction inlineBrTargetInstruction) 21 | { 22 | this.collector.Process((ILInstruction) inlineBrTargetInstruction, this.formatProvider.Int32ToHex(inlineBrTargetInstruction.Delta)); 23 | } 24 | 25 | public override void VisitInlineFieldInstruction(InlineFieldInstruction inlineFieldInstruction) 26 | { 27 | this.collector.Process((ILInstruction) inlineFieldInstruction, this.formatProvider.Int32ToHex(inlineFieldInstruction.Token)); 28 | } 29 | 30 | public override void VisitInlineMethodInstruction(InlineMethodInstruction inlineMethodInstruction) 31 | { 32 | this.collector.Process((ILInstruction) inlineMethodInstruction, this.formatProvider.Int32ToHex(inlineMethodInstruction.Token)); 33 | } 34 | 35 | public override void VisitInlineSigInstruction(InlineSigInstruction inlineSigInstruction) 36 | { 37 | this.collector.Process((ILInstruction) inlineSigInstruction, this.formatProvider.Int32ToHex(inlineSigInstruction.Token)); 38 | } 39 | 40 | public override void VisitInlineStringInstruction(InlineStringInstruction inlineStringInstruction) 41 | { 42 | this.collector.Process((ILInstruction) inlineStringInstruction, this.formatProvider.Int32ToHex(inlineStringInstruction.Token)); 43 | } 44 | 45 | public override void VisitInlineSwitchInstruction(InlineSwitchInstruction inlineSwitchInstruction) 46 | { 47 | this.collector.Process((ILInstruction) inlineSwitchInstruction, "..."); 48 | } 49 | 50 | public override void VisitInlineTokInstruction(InlineTokInstruction inlineTokInstruction) 51 | { 52 | this.collector.Process((ILInstruction) inlineTokInstruction, this.formatProvider.Int32ToHex(inlineTokInstruction.Token)); 53 | } 54 | 55 | public override void VisitInlineTypeInstruction(InlineTypeInstruction inlineTypeInstruction) 56 | { 57 | this.collector.Process((ILInstruction) inlineTypeInstruction, this.formatProvider.Int32ToHex(inlineTypeInstruction.Token)); 58 | } 59 | 60 | public override void VisitInlineVarInstruction(InlineVarInstruction inlineVarInstruction) 61 | { 62 | this.collector.Process((ILInstruction) inlineVarInstruction, this.formatProvider.Int16ToHex((int) inlineVarInstruction.Ordinal)); 63 | } 64 | 65 | public override void VisitShortInlineBrTargetInstruction(ShortInlineBrTargetInstruction shortInlineBrTargetInstruction) 66 | { 67 | this.collector.Process((ILInstruction) shortInlineBrTargetInstruction, this.formatProvider.Int8ToHex((int) shortInlineBrTargetInstruction.Delta)); 68 | } 69 | 70 | public override void VisitShortInlineVarInstruction(ShortInlineVarInstruction shortInlineVarInstruction) 71 | { 72 | this.collector.Process((ILInstruction) shortInlineVarInstruction, this.formatProvider.Int8ToHex((int) shortInlineVarInstruction.Ordinal)); 73 | } 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /packages/Depender.Parser/src/Depender.Parser/DefaultFormatProvider.cs: -------------------------------------------------------------------------------- 1 | // Type: ClrTest.Reflection.DefaultFormatProvider 2 | // Assembly: Depender.Parser, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null 3 | // MVID: 7BFB306E-D2F0-493B-8C2F-5C3CEA04F731 4 | // Assembly location: D:\temp\NSplit\Depender\Depender.Parser.dll 5 | 6 | using System.Text; 7 | 8 | namespace ClrTest.Reflection 9 | { 10 | public class DefaultFormatProvider : IFormatProvider 11 | { 12 | public static DefaultFormatProvider Instance = new DefaultFormatProvider(); 13 | 14 | static DefaultFormatProvider() 15 | { 16 | } 17 | 18 | private DefaultFormatProvider() 19 | { 20 | } 21 | 22 | public virtual string Int32ToHex(int int32) 23 | { 24 | return int32.ToString("X8"); 25 | } 26 | 27 | public virtual string Int16ToHex(int int16) 28 | { 29 | return int16.ToString("X4"); 30 | } 31 | 32 | public virtual string Int8ToHex(int int8) 33 | { 34 | return int8.ToString("X2"); 35 | } 36 | 37 | public virtual string Argument(int ordinal) 38 | { 39 | return string.Format("V_{0}", (object) ordinal); 40 | } 41 | 42 | public virtual string Label(int offset) 43 | { 44 | return string.Format("IL_{0:x4}", (object) offset); 45 | } 46 | 47 | public virtual string MultipleLabels(int[] offsets) 48 | { 49 | StringBuilder stringBuilder = new StringBuilder(); 50 | int length = offsets.Length; 51 | for (int index = 0; index < length; ++index) 52 | { 53 | if (index == 0) 54 | stringBuilder.AppendFormat("(", new object[0]); 55 | else 56 | stringBuilder.AppendFormat(", ", new object[0]); 57 | stringBuilder.Append(this.Label(offsets[index])); 58 | } 59 | stringBuilder.AppendFormat(")", new object[0]); 60 | return ((object) stringBuilder).ToString(); 61 | } 62 | 63 | public virtual string EscapedString(string str) 64 | { 65 | int length = str.Length; 66 | StringBuilder stringBuilder = new StringBuilder(length * 2); 67 | for (int index = 0; index < length; ++index) 68 | { 69 | char ch = str[index]; 70 | switch (ch) 71 | { 72 | case '\t': 73 | stringBuilder.Append("\\t"); 74 | break; 75 | case '\n': 76 | stringBuilder.Append("\\n"); 77 | break; 78 | case '\r': 79 | stringBuilder.Append("\\r"); 80 | break; 81 | case '"': 82 | stringBuilder.Append("\\\""); 83 | break; 84 | case '\\': 85 | stringBuilder.Append("\\"); 86 | break; 87 | default: 88 | if ((int) ch < 32 || (int) ch >= (int) sbyte.MaxValue) 89 | { 90 | stringBuilder.AppendFormat("\\u{0:x4}", (object) (int) ch); 91 | break; 92 | } 93 | else 94 | { 95 | stringBuilder.Append(ch); 96 | break; 97 | } 98 | } 99 | } 100 | return "\"" + ((object) stringBuilder).ToString() + "\""; 101 | } 102 | 103 | public virtual string SigByteArrayToString(byte[] sig) 104 | { 105 | StringBuilder stringBuilder = new StringBuilder(); 106 | int length = sig.Length; 107 | for (int index = 0; index < length; ++index) 108 | { 109 | if (index == 0) 110 | stringBuilder.AppendFormat("SIG [", new object[0]); 111 | else 112 | stringBuilder.AppendFormat(" ", new object[0]); 113 | stringBuilder.Append(this.Int8ToHex((int) sig[index])); 114 | } 115 | stringBuilder.AppendFormat("]", new object[0]); 116 | return ((object) stringBuilder).ToString(); 117 | } 118 | } 119 | } 120 | -------------------------------------------------------------------------------- /Gma.CodeVisuals.WebApi/DependencyForceGraph/Storage.cs: -------------------------------------------------------------------------------- 1 | // This code is distributed under MIT license. 2 | // Copyright (c) 2014 George Mamaladze, Florian Greinacher 3 | // See license.txt or http://opensource.org/licenses/mit-license.php 4 | 5 | #region usings 6 | 7 | using System.Collections.Generic; 8 | using System.IO; 9 | using System.Linq; 10 | using System.Reflection; 11 | using Gma.CodeVisuals.WebApi.DependencyForceGraph.Dto; 12 | using Newtonsoft.Json; 13 | 14 | #endregion 15 | 16 | namespace Gma.CodeVisuals.WebApi.DependencyForceGraph 17 | { 18 | public class Storage 19 | { 20 | private const string FilePattern = "{0}{1}.json"; 21 | private readonly string m_RootPath; 22 | private readonly HashSet m_IvalidChars; 23 | 24 | 25 | public Storage(string rootPath) 26 | { 27 | m_RootPath = rootPath; 28 | m_IvalidChars = new HashSet(Path.GetInvalidFileNameChars()); 29 | } 30 | 31 | public void Save(GraphDto data) 32 | { 33 | Save(data.Name, data); 34 | } 35 | 36 | public void Save(string name, GraphDto data) 37 | { 38 | if (!Directory.Exists(m_RootPath)) Directory.CreateDirectory(m_RootPath); 39 | 40 | string path = GetUniqueFilePath(name); 41 | using (var writer = File.CreateText(path)) 42 | { 43 | JsonSerializer.Create().Serialize(writer, data); 44 | } 45 | } 46 | 47 | public GraphDto Load(string name) 48 | { 49 | string path = GetFilePath(name); 50 | using (var reader = File.OpenText(path)) 51 | using (var jsonReader = new JsonTextReader(reader)) 52 | { 53 | return JsonSerializer.Create().Deserialize(jsonReader); 54 | } 55 | } 56 | 57 | public IEnumerable GetNames() 58 | { 59 | var searchPattern = string.Format(FilePattern, "*", string.Empty); 60 | return Directory 61 | .GetFiles(m_RootPath, searchPattern) 62 | .Select(Path.GetFileNameWithoutExtension); 63 | } 64 | 65 | private string GetUniqueFilePath(string name) 66 | { 67 | var normalizedName = NormalizeName(name); 68 | string suffix = string.Empty; 69 | int i = 1; 70 | do 71 | { 72 | string fileName = CombinePath(normalizedName, suffix); 73 | if (!File.Exists(fileName)) return fileName; 74 | suffix = string.Format("_{0}", i++); 75 | } while (true); 76 | } 77 | 78 | private string GetFilePath(string name) 79 | { 80 | var normalizedName = NormalizeName(name); 81 | return CombinePath(normalizedName, string.Empty); 82 | } 83 | 84 | private string CombinePath(string normalizedName, string suffix) 85 | { 86 | return Path.Combine(m_RootPath, string.Format(FilePattern, normalizedName, suffix)); 87 | } 88 | 89 | private string NormalizeName(string name) 90 | { 91 | return new string( 92 | name 93 | .Where(ch=>!m_IvalidChars.Contains(ch)) 94 | .ToArray()); 95 | } 96 | 97 | public const string DefaultDirectoryName = "_DependencyForceGraphs"; 98 | public static string GetDefaultPath() 99 | { 100 | string exePath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) ?? string.Empty; 101 | return Path.Combine(exePath, DefaultDirectoryName); 102 | } 103 | 104 | public void Save(object graph) 105 | { 106 | var graphDto = AutoMapper.Mapper.DynamicMap(graph); 107 | Save(graphDto); 108 | } 109 | } 110 | } -------------------------------------------------------------------------------- /Gma.CodeGravity.Tests/AnalyzerTests.cs: -------------------------------------------------------------------------------- 1 | // This code is distributed under MIT license. 2 | // Copyright (c) 2014 George Mamaladze, Florian Greinacher 3 | // See license.txt or http://opensource.org/licenses/mit-license.php 4 | 5 | #region usings 6 | 7 | using System.Collections.Generic; 8 | using System.Linq; 9 | using Gma.CodeGravity.Tests.TestData; 10 | using Gma.CodeVisuals.Generator.DependencyForceGraph; 11 | using Gma.CodeVisuals.Generator.DependencyForceGraph.Do; 12 | using NUnit.Framework; 13 | using Contains = Gma.CodeVisuals.Generator.DependencyForceGraph.Do.Contains; 14 | 15 | #endregion 16 | 17 | namespace Gma.CodeGravity.Tests 18 | { 19 | [TestFixture] 20 | public class AnalyzerTests 21 | { 22 | [Test] 23 | public void Calls_CallToStaticMethodOfType_IsDetected() 24 | { 25 | var typeA = typeof (TypeA); 26 | 27 | var calls = typeA.Calls().ToArray(); 28 | 29 | Assert.AreEqual(1, calls.Length); 30 | var call = calls[0]; 31 | Assert.AreEqual(call.Kind, DependencyKind.MethodCall); 32 | } 33 | 34 | [Test] 35 | public void Contains_NestedPrivate_IsNotDetected() 36 | { 37 | var type = typeof (TypeWithPrivateNestedType); 38 | 39 | var contains = type.Contains(); 40 | 41 | Assert.That(contains, Is.Empty); 42 | } 43 | 44 | [Test] 45 | public void Contains_NestedPublic_IsDetected() 46 | { 47 | var type = typeof (TypeWithPublicNestedType); 48 | 49 | var contains = type.Contains(); 50 | 51 | Assert.That(contains, Has.Member(new Contains(type, typeof (TypeWithPublicNestedType.NestedPublic)))); 52 | } 53 | 54 | [Test] 55 | public void Uses_GenericTypeArgumentInMethodParameter_IsDetected() 56 | { 57 | var type = typeof (TypeWithMethodAcceptingIEnumerableOfChar); 58 | 59 | var uses = type.Uses(); 60 | 61 | Assert.That(uses, Has.Member(new Uses(type, typeof (char)))); 62 | } 63 | 64 | [Test] 65 | public void Uses_GenericTypeArgumentInMethodReturn_IsDetected() 66 | { 67 | var type = typeof (TypeWithMethodReturnIEnumerableOfInt); 68 | 69 | var uses = type.Uses(); 70 | 71 | Assert.That(uses, Has.Member(new Uses(type, typeof (int)))); 72 | } 73 | 74 | [Test] 75 | public void Uses_GenericTypeInField_IsDetected() 76 | { 77 | var type = typeof (TypeWithFieldOfIEnumerableString); 78 | 79 | var uses = type.Uses(); 80 | 81 | Assert.That(uses, Has.Member(new Uses(type, typeof (IEnumerable<>)))); 82 | } 83 | 84 | [Test] 85 | public void Uses_MultipleGenericTypeArgumentsInField_AreDetected() 86 | { 87 | var type = typeof (TypeWithFieldOfTypeTupleIntFloat); 88 | 89 | var uses = type.Uses(); 90 | 91 | Assert.That(uses, Has.Member(new Uses(type, typeof (int))).And.Member(new Uses(type, typeof (float)))); 92 | } 93 | 94 | [Test] 95 | public void Uses_PartiallyConstructedGenericTypeArgumentInField_IsDetected() 96 | { 97 | var type = typeof (TypeOfTWithFieldOfIDictionaryTChar<>); 98 | 99 | var uses = type.Uses(); 100 | 101 | Assert.That(uses, Has.Member(new Uses(type, typeof (char)))); 102 | } 103 | 104 | [Test] 105 | public void Uses_SingleGenericTypeArgumentInField_IsDetected() 106 | { 107 | var type = typeof (TypeWithFieldOfIEnumerableString); 108 | 109 | var uses = type.Uses(); 110 | 111 | Assert.That(uses, Has.Member(new Uses(type, typeof (string)))); 112 | } 113 | } 114 | } -------------------------------------------------------------------------------- /codevis/DependencyForceGraph/Analyzer.cs: -------------------------------------------------------------------------------- 1 | // This code is distributed under MIT license. 2 | // Copyright (c) 2014 George Mamaladze, Florian Greinacher 3 | // See license.txt or http://opensource.org/licenses/mit-license.php 4 | 5 | #region usings 6 | 7 | using System; 8 | using System.Collections.Generic; 9 | using System.Linq; 10 | using System.Reflection; 11 | using Gma.CodeVisuals.Generator.DependencyForceGraph.DataStructures.DependencyGraph; 12 | using Gma.CodeVisuals.Generator.DependencyForceGraph.DataStructures.TypeTree; 13 | using Gma.CodeVisuals.Generator.DependencyForceGraph.Do; 14 | 15 | #endregion 16 | 17 | namespace Gma.CodeVisuals.Generator.DependencyForceGraph 18 | { 19 | internal class Analyzer 20 | { 21 | private readonly Action m_OnProgres; 22 | private AdjacencyMatrix m_Matrix; 23 | private Tree m_Tree; 24 | 25 | public Analyzer() 26 | : this(null) 27 | { 28 | } 29 | 30 | public Analyzer(Action onProgres) 31 | { 32 | m_OnProgres = onProgres; 33 | m_Tree = new Tree(new NodeFactory(), string.Empty); 34 | Progress = AnalyzesProgress.Started(); 35 | } 36 | 37 | public AnalyzesProgress Progress { get; private set; } 38 | 39 | public Graph GetGraph() 40 | { 41 | var tree = m_Tree.Root; 42 | var links = m_Matrix.All(); 43 | return new Graph(tree, links); 44 | } 45 | 46 | 47 | public Graph Analyze(IEnumerable assemblies, string rootName) 48 | { 49 | var types = assemblies 50 | .SelectMany(a => a.Types()) 51 | .ToArray(); 52 | Analyze(types, rootName); 53 | return GetGraph(); 54 | } 55 | 56 | private void Analyze(Type[] types, string rootName) 57 | { 58 | m_Tree = BuildTree(types, rootName); 59 | var nodesById = m_Tree.Nodes.Reverse().ToArray(); 60 | m_Matrix = new AdjacencyMatrix(nodesById.Length); 61 | InvokeOnProgress(new AnalyzesProgress(string.Format("{0} types found.", types.Length), 0, 1, false)); 62 | if (types.Length == 0) return; 63 | DoAnalyzeTasks(types); 64 | } 65 | 66 | private static Tree BuildTree(IEnumerable types, string rootName) 67 | { 68 | var nodeFactory = new NodeFactory(); 69 | var tree = new Tree(nodeFactory, rootName); 70 | 71 | foreach (var type in types) 72 | { 73 | var fullName = type.FullName; 74 | tree.Add(fullName); 75 | } 76 | return tree; 77 | } 78 | 79 | private void DoAnalyzeTasks(Type[] types) 80 | { 81 | DoAnalyzeTask(types, AnalyzerExtensions.Uses, "Analyzing uses"); 82 | DoAnalyzeTask(types, AnalyzerExtensions.Implements, "Analyzing implements"); 83 | DoAnalyzeTask(types, AnalyzerExtensions.Contains, "Analyzing contain"); 84 | DoAnalyzeTask(types, AnalyzerExtensions.Calls, "Analyzing calls"); 85 | } 86 | 87 | 88 | private void DoAnalyzeTask(Type[] types, Func> getter, string taskName) 89 | { 90 | for (int i = 0; i < types.Length; i++) 91 | { 92 | var type = types[i]; 93 | foreach (var dependecy in getter(type)) 94 | { 95 | Edge edge; 96 | Add(dependecy, out edge); 97 | } 98 | InvokeOnProgress(new AnalyzesProgress(taskName, i, types.Length, false)); 99 | } 100 | InvokeOnProgress(new AnalyzesProgress(taskName, types.Length, types.Length, false)); 101 | } 102 | 103 | private void InvokeOnProgress(AnalyzesProgress eventArgs) 104 | { 105 | Progress = eventArgs; 106 | if (m_OnProgres == null) return; 107 | m_OnProgres.Invoke(eventArgs); 108 | } 109 | 110 | private void Add(Dependency dependency, out Edge edge) 111 | { 112 | edge = null; 113 | INode source; 114 | bool sourceFound = m_Tree.TryGet(dependency.Source.FullName, out source); 115 | if (!sourceFound) return; 116 | 117 | INode target; 118 | bool targetFound = m_Tree.TryGet(dependency.Target.FullName, out target); 119 | if (!targetFound) return; 120 | 121 | m_Matrix.Add(source.Id, target.Id, dependency.Kind, out edge); 122 | } 123 | } 124 | } -------------------------------------------------------------------------------- /Gma.CodeVisuals.WebApi/html/js/vertex.js: -------------------------------------------------------------------------------- 1 | // This code is distributed under MIT license. 2 | // Copyright (c) 2014 George Mamaladze, Florian Greinacher 3 | // See license.txt or http://opensource.org/licenses/mit-license.php 4 | 5 | function Vertex(node) { 6 | 7 | var vertex = this; 8 | //copy all properties 9 | Object.keys(node).forEach(function (key) { 10 | vertex[key] = node[key]; 11 | }); 12 | 13 | if (node.children == null || node.children.length == 0) { 14 | vertex.size = 1; 15 | this.children = null; 16 | return vertex; 17 | } 18 | 19 | vertex.children = []; 20 | node.children.forEach(function(childNode) { 21 | var childVertex = new Vertex(childNode); 22 | childVertex.parent = vertex; 23 | vertex.children.push(childVertex); 24 | }); 25 | 26 | vertex.adjustSizeDeep(); 27 | return vertex; 28 | } 29 | 30 | 31 | Vertex.prototype.adjustSizeDeep = function() { 32 | if (!this.children) return this.size; 33 | var sumSize = 0; 34 | this.children.forEach(function (child) { 35 | sumSize += child.adjustSizeDeep(); 36 | }); 37 | return this.size = sumSize; 38 | }; 39 | 40 | Array.prototype.indexById = function() { 41 | var arrayById = []; 42 | this.forEach(function(n) { 43 | arrayById[n.id] = n; 44 | }); 45 | return arrayById; 46 | }; 47 | 48 | Vertex.prototype.leafsDeep = function() { 49 | return (this.isExpanded && this.children) 50 | ? this.children 51 | .reduce( 52 | function(s, e) { 53 | return s.concat(e.leafsDeep()); 54 | }, []) 55 | : [this]; 56 | }; 57 | 58 | Vertex.prototype.subtree = function() { 59 | return this.flatten(function(node) { return node.children; }); 60 | }; 61 | 62 | Vertex.prototype.visibleSubtree = function () { 63 | return this.flatten(function (node) { return node.isExpanded ? node.children : []; }); 64 | }; 65 | 66 | Vertex.prototype.flatten = function(deep) { 67 | return deep(this) 68 | ? [this].concat( 69 | deep(this) 70 | .reduce( 71 | function(s, e) { 72 | return s.concat(e.flatten(deep)); 73 | }, [])) 74 | : [this]; 75 | }; 76 | 77 | 78 | Vertex.prototype.toggle = function (expand, deep) { 79 | var vertex = this; 80 | if (vertex.isExpanded == expand) return; 81 | if (expand) this.explode(); 82 | else this.implode(); 83 | if (!deep || !vertex.children) return; 84 | vertex.children.forEach(function (el) { el.toggle(expand, deep); }); 85 | } 86 | 87 | Vertex.prototype.explode = function() { 88 | if (this.children == null) return; 89 | var vertex=this; 90 | var radius = this.getRadius(); 91 | var initialX = vertex.x; 92 | var initialY = vertex.y; 93 | force.stop(); 94 | this.isExpanded = true; 95 | this.children.forEach(function(child) { 96 | { 97 | child.x = initialX + 2 * radius * (Math.random() - .5); 98 | child.y = initialY + 2 * radius * (Math.random() - .5); 99 | } 100 | }); 101 | force.resume(); 102 | }; 103 | 104 | Vertex.prototype.implode = function() { 105 | if (this.children == null) return; 106 | var sumX = 0; 107 | var sumY = 0; 108 | this.children.forEach(function(child) { 109 | { 110 | sumX += child.x; 111 | sumY += child.y; 112 | } 113 | }); 114 | this.x = sumX / this.children.length; 115 | this.Y = sumY / this.children.length; 116 | this.isExpanded = false; 117 | }; 118 | 119 | Vertex.prototype.getRadius = function() { 120 | return this.isExpanded 121 | ? 4.5 122 | : Math.max(Math.sqrt(1000 / root.size * this.size), 3); 123 | }; 124 | 125 | 126 | Vertex.prototype.getColor = function() { 127 | return this.isSelected 128 | ? "#000" 129 | : this.color 130 | ? this.color 131 | : this.parent.color; 132 | }; 133 | 134 | Vertex.prototype.getClass = function() { 135 | return this.isSelected 136 | ? "selectedNode" 137 | : "node"; 138 | }; 139 | 140 | Vertex.prototype.setIsSelectedDeep = function(isSelected) { 141 | this.isSelected = isSelected; 142 | if (!this.children) return; 143 | this.children.forEach(function(child) { child.setIsSelectedDeep(isSelected); }); 144 | }; 145 | 146 | 147 | Vertex.prototype.fullName = function () { 148 | var current = this; 149 | var path = []; 150 | while (current != null && current.parent!=null) { 151 | path.push(current.text); 152 | current = current.parent; 153 | } 154 | return path.reverse().join("."); 155 | }; 156 | -------------------------------------------------------------------------------- /packages/Depender.Parser/src/Depender.Parser/Depender.Parser.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {4F7E0C60-13E1-402A-B79B-4CF337885CBA} 8 | Library 9 | Depender.Parser 10 | ClrTest.Reflection 11 | v4.5 12 | 13 | 14 | 15 | 16 | 2.0 17 | publish\ 18 | true 19 | Disk 20 | false 21 | Foreground 22 | 7 23 | Days 24 | false 25 | false 26 | true 27 | 0 28 | 1.0.0.0 29 | false 30 | false 31 | true 32 | 33 | 34 | 35 | AnyCPU 36 | true 37 | full 38 | false 39 | bin\Debug\ 40 | DEBUG;TRACE 41 | prompt 42 | 4 43 | false 44 | 45 | 46 | AnyCPU 47 | pdbonly 48 | true 49 | bin\Release\ 50 | TRACE 51 | prompt 52 | 4 53 | false 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | False 92 | .NET Framework 3.5 SP1 Client Profile 93 | false 94 | 95 | 96 | False 97 | .NET Framework 3.5 SP1 98 | true 99 | 100 | 101 | 102 | -------------------------------------------------------------------------------- /codevis/Program.cs: -------------------------------------------------------------------------------- 1 | // This code is distributed under MIT license. 2 | // Copyright (c) 2014 George Mamaladze, Florian Greinacher 3 | // See license.txt or http://opensource.org/licenses/mit-license.php 4 | 5 | #region usings 6 | 7 | using System; 8 | using System.Collections.Generic; 9 | using System.Diagnostics; 10 | using System.IO; 11 | using System.Linq; 12 | using System.Reflection; 13 | using CommandLine; 14 | using Gma.CodeVisuals.Generator.DependencyForceGraph; 15 | using Gma.CodeVisuals.Generator.DependencyForceGraph.Do; 16 | using Gma.CodeVisuals.WebApi.DependencyForceGraph; 17 | 18 | #endregion 19 | 20 | namespace Gma.CodeVisuals.Generator 21 | { 22 | internal class Program 23 | { 24 | private static void Main(string[] args) 25 | { 26 | RedirectUnhandledExceptionsToConsole(); 27 | var options = GetParsedArguments(args); 28 | var graph = Generate(options); 29 | Save(graph, options.Output); 30 | //if (options.Verbose) Process.Start("Gma.CodeVisuals.WebApi.exe"); 31 | } 32 | 33 | private static Options GetParsedArguments(string[] args) 34 | { 35 | var options = new Options(); 36 | bool isOk = Parser.Default.ParseArguments(args, options); 37 | if (!isOk || options.Assemblies==null || options.Assemblies.Count==0) 38 | { 39 | Console.WriteLine(options.GetUsage()); 40 | Environment.Exit(1); 41 | } 42 | 43 | if (options.Path == null || options.Path.Count == 0) 44 | { 45 | options.Path = new[] {Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)}; 46 | } 47 | return options; 48 | } 49 | 50 | private static void RedirectUnhandledExceptionsToConsole() 51 | { 52 | AppDomain.CurrentDomain.UnhandledException += (sender, e) => 53 | { 54 | var exception = e.ExceptionObject as Exception; 55 | var message = exception != null 56 | ? string.Format("ERROR: {0}", exception.Message) 57 | : e.ExceptionObject; 58 | Console.WriteLine(message); 59 | Environment.Exit(1); 60 | }; 61 | } 62 | 63 | private static Graph Generate(Options options) 64 | { 65 | IEnumerable patterns; 66 | IEnumerable searchPaths; 67 | 68 | AssemblySearchHelper.OptionsToNamesAndSearchPath(options, out patterns, out searchPaths); 69 | var assemblyFullNames = AssemblySearchHelper.GetAssemblyFullNames(patterns, searchPaths); 70 | 71 | Console.WriteLine("{0} files found.", assemblyFullNames.Count); 72 | if (assemblyFullNames.Count == 0) Environment.Exit(1); 73 | Console.WriteLine("Loading assemblies:"); 74 | var rootName = GenerateResultFileName(assemblyFullNames); 75 | 76 | var ePrev = AnalyzesProgress.Started(); 77 | var analyzer = new Analyzer(eCurrent => { ePrev = ConsoleProgress(eCurrent, ePrev); }); 78 | 79 | using(var loadHelper = new AssemblyLoadHelper(searchPaths)) 80 | { 81 | var assemblies = assemblyFullNames.Select(loadHelper.Load); 82 | analyzer.Analyze(assemblies, rootName); 83 | } 84 | return analyzer.GetGraph(); 85 | } 86 | 87 | private static string GenerateResultFileName(List assemblyFullPaths) 88 | { 89 | if (assemblyFullPaths.Count == 0) Environment.Exit(1); 90 | if (assemblyFullPaths.Count == 1) return Path.GetFileNameWithoutExtension(assemblyFullPaths[0]); 91 | string dirName = 92 | (Path.GetDirectoryName(assemblyFullPaths[0]) ?? "unknown").Split(Path.PathSeparator).LastOrDefault(); 93 | return string.Format("{0} assemblies in ({1})", assemblyFullPaths.Count, dirName); 94 | } 95 | 96 | private static void Save(Graph graph, string output) 97 | { 98 | var storagePath = output.Length > 0 99 | ? output 100 | : Storage.GetDefaultPath(); 101 | var storage = new Storage(storagePath); 102 | storage.Save(graph); 103 | } 104 | 105 | private static AnalyzesProgress ConsoleProgress(AnalyzesProgress eCurrent, AnalyzesProgress ePrev) 106 | { 107 | if (eCurrent.IsFinished) 108 | { 109 | Console.WriteLine("Analyzes finished."); 110 | return ePrev; 111 | } 112 | var currentPercentage = eCurrent.Actual*100/eCurrent.Max; 113 | int prevPercentage = ePrev.Actual*100/ePrev.Max; 114 | if (currentPercentage != prevPercentage) 115 | { 116 | Console.Write("\r{0} {1}% ", eCurrent.Message, currentPercentage); 117 | ePrev = eCurrent; 118 | } 119 | return ePrev; 120 | } 121 | } 122 | } -------------------------------------------------------------------------------- /codevis/DependencyForceGraph/AnalyzerExtensions.cs: -------------------------------------------------------------------------------- 1 | // This code is distributed under MIT license. 2 | // Copyright (c) 2014 George Mamaladze, Florian Greinacher 3 | // See license.txt or http://opensource.org/licenses/mit-license.php 4 | 5 | #region usings 6 | 7 | using System; 8 | using System.Collections.Generic; 9 | using System.Linq; 10 | using System.Reflection; 11 | using System.Runtime.CompilerServices; 12 | using ClrTest.Reflection; 13 | using Gma.CodeVisuals.Generator.DependencyForceGraph.Do; 14 | 15 | #endregion 16 | 17 | namespace Gma.CodeVisuals.Generator.DependencyForceGraph 18 | { 19 | public static class AnalyzerExtensions 20 | { 21 | public static IEnumerable Types(this Assembly assembly) 22 | { 23 | return 24 | assembly 25 | .GetTypes() 26 | .Where(t => !t.IsCompilerGenerated()) 27 | .Where(t => !t.IsNestedPrivate); 28 | } 29 | 30 | public static IEnumerable Implements(this Type type) 31 | { 32 | return 33 | Once(type.BaseType) 34 | .Concat(type.GetInterfaces()) 35 | .Select(baseType => new Implements(type, baseType)); 36 | } 37 | 38 | public static IEnumerable Calls(this Type type) 39 | { 40 | return 41 | type 42 | .Methods() 43 | .SelectMany(method => method.MethodCalls()) 44 | .Select(methodCall => new MethodCall(type, methodCall.ReflectedType, methodCall)) 45 | .Where(call => call.Target != type); 46 | } 47 | 48 | public static IEnumerable Uses(this Type type) 49 | { 50 | IEnumerable fieldUses = 51 | type 52 | .Fields() 53 | .Select(field => field.FieldType) 54 | .SelectMany(x => x.Unroll()); 55 | 56 | IEnumerable methodUses = 57 | type 58 | .Methods() 59 | .SelectMany(method => method.UsedTypes()); 60 | 61 | return 62 | fieldUses 63 | .Concat(methodUses) 64 | .Select(to => new Uses(type, to)) 65 | .Where(uses => uses.Target != type); 66 | } 67 | 68 | public static IEnumerable Contains(this Type type) 69 | { 70 | return 71 | type 72 | .GetNestedTypes() 73 | .Select(nested => new Contains(type, nested)) 74 | .Where(contains => contains.Target != type); 75 | } 76 | 77 | private static IEnumerable MethodCalls(this MethodInfo methodInfo) 78 | { 79 | return 80 | MethodBodyInfo 81 | .Create(methodInfo) 82 | .Calls(); 83 | } 84 | 85 | private static IEnumerable Once(T element) where T : class 86 | { 87 | return 88 | element == null 89 | ? Enumerable.Empty() 90 | : Enumerable.Repeat(element, 1); 91 | } 92 | 93 | private static IEnumerable Methods(this Type type) 94 | { 95 | const BindingFlags flags = 96 | BindingFlags.DeclaredOnly | 97 | BindingFlags.Instance | 98 | BindingFlags.Static | 99 | BindingFlags.Public | 100 | BindingFlags.NonPublic; 101 | 102 | return type.GetMethods(flags); 103 | } 104 | 105 | private static IEnumerable Fields(this Type type) 106 | { 107 | const BindingFlags flags = 108 | BindingFlags.Instance | 109 | BindingFlags.Static | 110 | BindingFlags.Public | 111 | BindingFlags.NonPublic; 112 | 113 | return type.GetFields(flags); 114 | } 115 | 116 | private static IEnumerable Unroll(this Type type) 117 | { 118 | return type.IsConstructedGenericType 119 | ? Once(type.GetGenericTypeDefinition()).Concat(type.GenericTypeArguments) 120 | : Once(type); 121 | } 122 | 123 | private static IEnumerable UsedTypes(this MethodInfo method) 124 | { 125 | IEnumerable paramTypes = method 126 | .GetParameters() 127 | .SelectMany(param => param.ParameterType.Unroll()); 128 | 129 | Type[] genericArguments = method 130 | .GetGenericArguments(); 131 | 132 | return 133 | Once(method.ReturnType) 134 | .SelectMany(returnType => returnType.Unroll()) 135 | .Concat(paramTypes) 136 | .Concat(genericArguments); 137 | } 138 | 139 | private static IEnumerable Calls(this MethodBodyInfo methodBody) 140 | { 141 | return methodBody 142 | .Instructions 143 | .Select(instr => instr as InlineMethodInstruction) 144 | .Where(instr => instr != null) 145 | .Select(instr => instr.Method) 146 | .Where(call => !call.IsPrivate); 147 | } 148 | 149 | private static bool IsCompilerGenerated(this Type type) 150 | { 151 | return type.GetCustomAttribute() != null; 152 | } 153 | } 154 | } -------------------------------------------------------------------------------- /codevis/codevis.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {3CBA0E73-9F7B-4F72-9FBB-44D123B37806} 8 | Exe 9 | Properties 10 | Gma.CodeVisuals.Generator 11 | codevis 12 | v4.5 13 | 512 14 | ..\ 15 | true 16 | 17 | 18 | AnyCPU 19 | true 20 | full 21 | false 22 | bin\Debug\ 23 | DEBUG;TRACE 24 | prompt 25 | 4 26 | 27 | 28 | AnyCPU 29 | pdbonly 30 | true 31 | bin\Release\ 32 | TRACE 33 | prompt 34 | 4 35 | 36 | 37 | graph_light.ico 38 | 39 | 40 | 41 | ..\packages\CommandLineParser.1.9.71\lib\net45\CommandLine.dll 42 | 43 | 44 | ..\packages\Depender.Parser\lib\Depender.Parser.dll 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | Code 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | {7416f52d-821a-4392-8baf-a2f705d099e2} 86 | Gma.CodeVisuals.WebApi 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | copy /Y $(TargetDir)\*.dll $(SolutionDir)\xcopy\ 96 | copy /Y $(TargetDir)\$(TargetName)$(TargetExt) $(SolutionDir)\xcopy\ 97 | 98 | 105 | -------------------------------------------------------------------------------- /Gma.CodeGravity.Tests/Gma.CodeVisuals.DependencyForceGraph.Tests.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Debug 5 | AnyCPU 6 | {8AA40642-7259-45BC-B96D-A0EE4B6CC68E} 7 | Library 8 | Properties 9 | Gma.CodeGravity.Tests 10 | Gma.CodeGravity.Tests 11 | v4.5 12 | 512 13 | {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 14 | 10.0 15 | $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) 16 | $(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages 17 | False 18 | UnitTest 19 | ..\ 20 | true 21 | 22 | 23 | true 24 | full 25 | false 26 | bin\Debug\ 27 | DEBUG;TRACE 28 | prompt 29 | 4 30 | 0169 31 | 32 | 33 | pdbonly 34 | true 35 | bin\Release\ 36 | TRACE 37 | prompt 38 | 4 39 | 40 | 41 | 42 | ..\packages\NUnit.2.6.3\lib\nunit.framework.dll 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | {3cba0e73-9f7b-4f72-9fbb-44d123b37806} 78 | codevis 79 | 80 | 81 | 82 | 83 | 84 | 85 | False 86 | 87 | 88 | False 89 | 90 | 91 | False 92 | 93 | 94 | False 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 109 | -------------------------------------------------------------------------------- /packages/Depender.Parser/src/Depender.Parser/ReadableILStringVisitor.cs: -------------------------------------------------------------------------------- 1 | // Type: ClrTest.Reflection.ReadableILStringVisitor 2 | // Assembly: Depender.Parser, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null 3 | // MVID: 7BFB306E-D2F0-493B-8C2F-5C3CEA04F731 4 | // Assembly location: D:\temp\NSplit\Depender\Depender.Parser.dll 5 | 6 | using System; 7 | 8 | namespace ClrTest.Reflection 9 | { 10 | public class ReadableILStringVisitor : ILInstructionVisitor 11 | { 12 | protected IFormatProvider formatProvider; 13 | protected IILStringCollector collector; 14 | 15 | public ReadableILStringVisitor(IILStringCollector collector) 16 | : this(collector, (IFormatProvider) DefaultFormatProvider.Instance) 17 | { 18 | } 19 | 20 | public ReadableILStringVisitor(IILStringCollector collector, IFormatProvider formatProvider) 21 | { 22 | this.formatProvider = formatProvider; 23 | this.collector = collector; 24 | } 25 | 26 | public override void VisitInlineBrTargetInstruction(InlineBrTargetInstruction inlineBrTargetInstruction) 27 | { 28 | this.collector.Process((ILInstruction) inlineBrTargetInstruction, this.formatProvider.Label(inlineBrTargetInstruction.TargetOffset)); 29 | } 30 | 31 | public override void VisitInlineFieldInstruction(InlineFieldInstruction inlineFieldInstruction) 32 | { 33 | string operandString; 34 | try 35 | { 36 | operandString = (string) (object) inlineFieldInstruction.Field + (object) "/" + (string) (object) inlineFieldInstruction.Field.DeclaringType; 37 | } 38 | catch (Exception ex) 39 | { 40 | operandString = "!" + ex.Message + "!"; 41 | } 42 | this.collector.Process((ILInstruction) inlineFieldInstruction, operandString); 43 | } 44 | 45 | public override void VisitInlineIInstruction(InlineIInstruction inlineIInstruction) 46 | { 47 | this.collector.Process((ILInstruction) inlineIInstruction, inlineIInstruction.Int32.ToString()); 48 | } 49 | 50 | public override void VisitInlineI8Instruction(InlineI8Instruction inlineI8Instruction) 51 | { 52 | this.collector.Process((ILInstruction) inlineI8Instruction, inlineI8Instruction.Int64.ToString()); 53 | } 54 | 55 | public override void VisitInlineMethodInstruction(InlineMethodInstruction inlineMethodInstruction) 56 | { 57 | string operandString; 58 | try 59 | { 60 | operandString = (string) (object) inlineMethodInstruction.Method + (object) "/" + (string) (object) inlineMethodInstruction.Method.DeclaringType; 61 | } 62 | catch (Exception ex) 63 | { 64 | operandString = "!" + ex.Message + "!"; 65 | } 66 | this.collector.Process((ILInstruction) inlineMethodInstruction, operandString); 67 | } 68 | 69 | public override void VisitInlineNoneInstruction(InlineNoneInstruction inlineNoneInstruction) 70 | { 71 | this.collector.Process((ILInstruction) inlineNoneInstruction, string.Empty); 72 | } 73 | 74 | public override void VisitInlineRInstruction(InlineRInstruction inlineRInstruction) 75 | { 76 | this.collector.Process((ILInstruction) inlineRInstruction, inlineRInstruction.Double.ToString()); 77 | } 78 | 79 | public override void VisitInlineSigInstruction(InlineSigInstruction inlineSigInstruction) 80 | { 81 | this.collector.Process((ILInstruction) inlineSigInstruction, this.formatProvider.SigByteArrayToString(inlineSigInstruction.Signature)); 82 | } 83 | 84 | public override void VisitInlineStringInstruction(InlineStringInstruction inlineStringInstruction) 85 | { 86 | this.collector.Process((ILInstruction) inlineStringInstruction, this.formatProvider.EscapedString(inlineStringInstruction.String)); 87 | } 88 | 89 | public override void VisitInlineSwitchInstruction(InlineSwitchInstruction inlineSwitchInstruction) 90 | { 91 | this.collector.Process((ILInstruction) inlineSwitchInstruction, this.formatProvider.MultipleLabels(inlineSwitchInstruction.TargetOffsets)); 92 | } 93 | 94 | public override void VisitInlineTokInstruction(InlineTokInstruction inlineTokInstruction) 95 | { 96 | string operandString; 97 | try 98 | { 99 | operandString = (string) (object) inlineTokInstruction.Member + (object) "/" + (string) (object) inlineTokInstruction.Member.DeclaringType; 100 | } 101 | catch (Exception ex) 102 | { 103 | operandString = "!" + ex.Message + "!"; 104 | } 105 | this.collector.Process((ILInstruction) inlineTokInstruction, operandString); 106 | } 107 | 108 | public override void VisitInlineTypeInstruction(InlineTypeInstruction inlineTypeInstruction) 109 | { 110 | string operandString; 111 | try 112 | { 113 | operandString = inlineTypeInstruction.Type.Name; 114 | } 115 | catch (Exception ex) 116 | { 117 | operandString = "!" + ex.Message + "!"; 118 | } 119 | this.collector.Process((ILInstruction) inlineTypeInstruction, operandString); 120 | } 121 | 122 | public override void VisitInlineVarInstruction(InlineVarInstruction inlineVarInstruction) 123 | { 124 | this.collector.Process((ILInstruction) inlineVarInstruction, this.formatProvider.Argument((int) inlineVarInstruction.Ordinal)); 125 | } 126 | 127 | public override void VisitShortInlineBrTargetInstruction(ShortInlineBrTargetInstruction shortInlineBrTargetInstruction) 128 | { 129 | this.collector.Process((ILInstruction) shortInlineBrTargetInstruction, this.formatProvider.Label(shortInlineBrTargetInstruction.TargetOffset)); 130 | } 131 | 132 | public override void VisitShortInlineIInstruction(ShortInlineIInstruction shortInlineIInstruction) 133 | { 134 | this.collector.Process((ILInstruction) shortInlineIInstruction, shortInlineIInstruction.Byte.ToString()); 135 | } 136 | 137 | public override void VisitShortInlineRInstruction(ShortInlineRInstruction shortInlineRInstruction) 138 | { 139 | this.collector.Process((ILInstruction) shortInlineRInstruction, shortInlineRInstruction.Single.ToString()); 140 | } 141 | 142 | public override void VisitShortInlineVarInstruction(ShortInlineVarInstruction shortInlineVarInstruction) 143 | { 144 | this.collector.Process((ILInstruction) shortInlineVarInstruction, this.formatProvider.Argument((int) shortInlineVarInstruction.Ordinal)); 145 | } 146 | } 147 | } 148 | -------------------------------------------------------------------------------- /Gma.CodeVisuals.WebApi/html/js/main.js: -------------------------------------------------------------------------------- 1 | // This code is distributed under MIT license. 2 | // Copyright (c) 2014 George Mamaladze, Florian Greinacher 3 | // See license.txt or http://opensource.org/licenses/mit-license.php 4 | var node; 5 | var link; 6 | var root; 7 | var rawLinks = []; 8 | var verticesById = []; 9 | 10 | var toolTip = d3.select(document.getElementById("toolTip")); 11 | var vis = d3.select("#viewport").append("svg:svg"); 12 | window.onresize = resize; 13 | 14 | var force = d3.layout 15 | .force() 16 | .charge(-30) 17 | .linkStrength(.3) 18 | .linkDistance(function (link) { return 2 * (link.source.getRadius() + link.target.getRadius()); }) 19 | .on("tick", tick); 20 | 21 | function get(name) { 22 | if (name = (new RegExp('[?&]' + encodeURIComponent(name) + '=([^&]*)')).exec(location.search)) 23 | return decodeURIComponent(name[1]); 24 | else return ""; 25 | } 26 | 27 | d3.json("api/dependencies/graph?name=" + get("name"), function(json) { 28 | 29 | root = new Vertex(json.tree); 30 | root.fixed = true; 31 | root.selected = []; 32 | 33 | var vertices = root.subtree(); 34 | assignColorsToTop20(vertices); 35 | 36 | verticesById = vertices.indexById(); 37 | 38 | new Tree("#typetree", json.tree) 39 | .onOpen(function(id, deep) { 40 | var vertex = verticesById[id]; 41 | vertex.toggle(true, deep); 42 | update(); 43 | }) 44 | .onClose(function(id, deep) { 45 | var vertex = verticesById[id]; 46 | vertex.toggle(false, deep); 47 | update(); 48 | }) 49 | .onSelect(function(ids) { 50 | root.selected = ids; 51 | update(); 52 | }); 53 | 54 | rawLinks = json.links; 55 | resize(); 56 | update(); 57 | }); 58 | 59 | 60 | function assignColorsToTop20(vertices) { 61 | var top20 = vertices 62 | .sort(function(a, b) { 63 | var diff = b.size - a.size; 64 | if (diff == 0) return b.children; 65 | return diff; 66 | }) 67 | .slice(0, 20); 68 | 69 | var colors20 = d3.scale.category20(); 70 | 71 | for (var i = 0; i < top20.length; i++) { 72 | if (top20[i].size != 1) 73 | top20[i].color = colors20(i); 74 | } 75 | } 76 | 77 | 78 | function getLinks(visibleNodes) { 79 | 80 | var links = []; 81 | var matrix = []; 82 | 83 | rawLinks.forEach(function(l) { 84 | 85 | function getVisibleSelfOrParent(id) { 86 | var node = visibleNodes[id]; 87 | if (node) return node; 88 | node = verticesById[id]; 89 | var parent = node.parent; 90 | if (parent) return getVisibleSelfOrParent(parent.id); 91 | return null; 92 | } 93 | 94 | var source = getVisibleSelfOrParent(l.source, 0); 95 | var target = getVisibleSelfOrParent(l.target, 0); 96 | 97 | if (!source || !target) return; 98 | if (!matrix[source.id]) matrix[source.id] = []; 99 | if (!matrix[source.id][target.id]) { 100 | matrix[source.id][target.id] = true; 101 | links.push({ source: source, target: target }); 102 | } 103 | }); 104 | return links; 105 | } 106 | 107 | function update() { 108 | var nodes = root.leafsDeep(); 109 | var links = getLinks(nodes.indexById()); 110 | 111 | force 112 | .nodes(nodes) 113 | .links(links) 114 | .start(); 115 | 116 | link = vis 117 | .selectAll("line.link") 118 | .data(links); 119 | 120 | link.enter().insert("svg:line", ".node") 121 | .attr("class", "link") 122 | .attr("x1", function(d) { return d.source.x; }) 123 | .attr("y1", function(d) { return d.source.y; }) 124 | .attr("x2", function(d) { return d.target.x; }) 125 | .attr("y2", function(d) { return d.target.y; }); 126 | 127 | link.exit().remove(); 128 | 129 | node = vis.selectAll("circle.node") 130 | .data(nodes, function(d) { return d.id; }) 131 | .style("fill", function(d) { return d.getColor(); }); 132 | 133 | node.exit().remove(); 134 | 135 | node.enter() 136 | .append("svg:circle") 137 | .attr("cx", function(d) { return d.x; }) 138 | .attr("cy", function(d) { return d.y; }) 139 | .attr("class", "node") 140 | .attr("r", function(d) { return d.getRadius(); }) 141 | .style("fill", function(d) { return d.getColor(); }) 142 | .style("stroke", function(d) { return root.selected[d.id] ? "#111" : "#fff"; }) 143 | .on("click", click) 144 | .on("mouseover", vertexMouseOver) 145 | .on("mouseout", vertexMouseOut) 146 | .call(force.drag); 147 | } 148 | 149 | function tick() { 150 | 151 | link.attr("x1", function(d) { return d.source.x; }) 152 | .attr("y1", function(d) { return d.source.y; }) 153 | .attr("x2", function(d) { return d.target.x; }) 154 | .attr("y2", function(d) { return d.target.y; }); 155 | 156 | node.attr("cx", function(d) { return d.x; }) 157 | .attr("cy", function(d) { return d.y; }) 158 | .style("stroke", function(d) { return root.selected[d.id] ? "#111" : "#fff"; }); 159 | } 160 | 161 | function vertexMouseOver(d) { 162 | panzoom.panzoom("option", "disablePan", true); 163 | showText(d); 164 | var tree = $('#typetree').jstree(true); 165 | tree.select_node(d, true, false); 166 | } 167 | 168 | function vertexMouseOut(d) { 169 | var tree = $('#typetree').jstree(true); 170 | tree.deselect_node(d, true, false); 171 | hideText(); 172 | panzoom.panzoom("option", "disablePan", false); 173 | } 174 | 175 | function showText(d) { 176 | toolTip 177 | .transition() 178 | .duration(200) 179 | .style("opacity", ".9") 180 | .style("left", (d3.event.pageX + 35) + "px") 181 | .style("top", (d3.event.pageY - 35) + "px"); 182 | 183 | toolTip.select("#toolTipHead") 184 | .text(d.text); 185 | 186 | toolTip.select("#toolTipBody") 187 | .text(d.fullName()); 188 | } 189 | 190 | function hideText() { 191 | toolTip 192 | .transition() 193 | .duration(500) 194 | .style("opacity", "0") 195 | .transition(); 196 | } 197 | 198 | function click(d) { 199 | if (d3.event.defaultPrevented) return; 200 | d.toggle(!d.isExpanded, false); 201 | update(); 202 | } 203 | 204 | function resize() { 205 | var viewport = $("#viewport")[0]; 206 | var w = viewport.clientWidth; 207 | var h = viewport.clientHeight; 208 | root.x = w / 2; 209 | root.y = h / 2; 210 | vis 211 | .attr("width", w) 212 | .attr("height", h); 213 | 214 | force 215 | .size([w, h]) 216 | .resume(); 217 | } 218 | 219 | var panzoom; 220 | $(document).ready(function() { 221 | panzoom = $("#viewport svg").panzoom(); 222 | panzoom.parent().on('mousewheel.focal', function(e) { 223 | e.preventDefault(); 224 | var delta = e.delta || e.originalEvent.wheelDelta; 225 | var zoomOut = delta ? delta < 0 : e.originalEvent.deltaY > 0; 226 | panzoom.panzoom('zoom', zoomOut, { 227 | increment: 0.1, 228 | focal: e 229 | }); 230 | }); 231 | }); -------------------------------------------------------------------------------- /.nuget/NuGet.targets: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | $(MSBuildProjectDirectory)\..\ 5 | 6 | 7 | false 8 | 9 | 10 | false 11 | 12 | 13 | true 14 | 15 | 16 | false 17 | 18 | 19 | 20 | 21 | 22 | 26 | 27 | 28 | 29 | 30 | $([System.IO.Path]::Combine($(SolutionDir), ".nuget")) 31 | $([System.IO.Path]::Combine($(ProjectDir), "packages.config")) 32 | 33 | 34 | 35 | 36 | $(SolutionDir).nuget 37 | packages.config 38 | 39 | 40 | 41 | 42 | $(NuGetToolsPath)\NuGet.exe 43 | @(PackageSource) 44 | 45 | "$(NuGetExePath)" 46 | mono --runtime=v4.0.30319 $(NuGetExePath) 47 | 48 | $(TargetDir.Trim('\\')) 49 | 50 | -RequireConsent 51 | -NonInteractive 52 | 53 | "$(SolutionDir) " 54 | "$(SolutionDir)" 55 | 56 | 57 | $(NuGetCommand) install "$(PackagesConfig)" -source "$(PackageSources)" $(NonInteractiveSwitch) $(RequireConsentSwitch) -solutionDir $(PaddedSolutionDir) 58 | $(NuGetCommand) pack "$(ProjectPath)" -Properties "Configuration=$(Configuration);Platform=$(Platform)" $(NonInteractiveSwitch) -OutputDirectory "$(PackageOutputDir)" -symbols 59 | 60 | 61 | 62 | RestorePackages; 63 | $(BuildDependsOn); 64 | 65 | 66 | 67 | 68 | $(BuildDependsOn); 69 | BuildPackage; 70 | 71 | 72 | 73 | 74 | 75 | 76 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 91 | 92 | 95 | 96 | 97 | 98 | 100 | 101 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 133 | 134 | 135 | 136 | -------------------------------------------------------------------------------- /Gma.CodeVisuals.WebApi/html/js/lib/jquery.ui.touch.js: -------------------------------------------------------------------------------- 1 | /** 2 | * jQuery.UI.iPad plugin 3 | * Copyright (c) 2010 Stephen von Takach 4 | * licensed under MIT. 5 | * Date: 27/8/2010 6 | * 7 | * Project Home: 8 | * http://code.google.com/p/jquery-ui-for-ipad-and-iphone/ 9 | * 10 | * Modified: 19/01/2012 11 | * Organized as a proper plugin and added addTouch() 12 | */ 13 | (function ($) { 14 | var lastTap = null, // Holds last tapped element (so we can compare for double tap) 15 | tapValid = false, // Are we still in the .6 second window where a double tap can occur 16 | tapTimeout = null, // The timeout reference 17 | rightClickPending = false, // Is a right click still feasible 18 | rightClickEvent = null, // the original event 19 | holdTimeout = null, // timeout reference 20 | cancelMouseUp = false, // prevents a click from occurring as we want the context menu 21 | currentDOMElement = null; // the last DOM element that was seen during a drag. 22 | 23 | function cancelTap() { 24 | tapValid = false; 25 | } 26 | 27 | function cancelHold() { 28 | if (rightClickPending) { 29 | window.clearTimeout(holdTimeout); 30 | rightClickPending = false; 31 | rightClickEvent = null; 32 | } 33 | } 34 | 35 | function startHold(event) { 36 | if (rightClickPending) { 37 | return; 38 | } 39 | rightClickPending = true; // We could be performing a right click 40 | rightClickEvent = (event.changedTouches)[0]; 41 | holdTimeout = window.setTimeout(doRightClick, 800); 42 | } 43 | 44 | function doRightClick() { 45 | rightClickPending = false; 46 | // We need to mouse up (as we were down) 47 | var first = rightClickEvent, 48 | simulatedEvent = document.createEvent("MouseEvent"); 49 | simulatedEvent.initMouseEvent("mouseup", true, true, window, 1, first.screenX, first.screenY, first.clientX, first.clientY, false, false, false, false, 0, null); 50 | first.target.dispatchEvent(simulatedEvent); 51 | 52 | // Emulate a right click 53 | simulatedEvent = document.createEvent("MouseEvent"); 54 | simulatedEvent.initMouseEvent("mousedown", true, true, window, 1, first.screenX, first.screenY, first.clientX, first.clientY, false, false, false, false, 2, null); 55 | first.target.dispatchEvent(simulatedEvent); 56 | 57 | // Show a context menu 58 | simulatedEvent = document.createEvent("MouseEvent"); 59 | simulatedEvent.initMouseEvent("contextmenu", true, true, window, 1, first.screenX + 50, first.screenY + 5, first.clientX + 50, first.clientY + 5, false, false, false, false, 2, null); 60 | first.target.dispatchEvent(simulatedEvent); 61 | 62 | simulatedEvent = document.createEvent("MouseEvent"); 63 | simulatedEvent.initMouseEvent("mouseup", true, true, window, 1, first.screenX + 50, first.screenY + 5, first.clientX + 50, first.clientY + 5, false, false, false, false, 2, null); 64 | first.target.dispatchEvent(simulatedEvent); 65 | 66 | cancelMouseUp = true; 67 | rightClickEvent = null; // Release memory 68 | } 69 | 70 | 71 | // mouse over event then mouse down 72 | function iPadTouchStart(event) { 73 | var touches = event.changedTouches, 74 | first = touches[0], 75 | type = "mouseover", 76 | simulatedEvent = document.createEvent("MouseEvent"); 77 | 78 | // Mouse over first - I have live events attached on mouse over 79 | simulatedEvent.initMouseEvent(type, true, true, window, 1, first.screenX, first.screenY, first.clientX, first.clientY, false, false, false, false, 0, null); 80 | first.target.dispatchEvent(simulatedEvent); 81 | 82 | type = "mousedown"; 83 | simulatedEvent = document.createEvent("MouseEvent"); 84 | 85 | simulatedEvent.initMouseEvent(type, true, true, window, 1, first.screenX, first.screenY, first.clientX, first.clientY, false, false, false, false, 0, null); 86 | first.target.dispatchEvent(simulatedEvent); 87 | 88 | if (!tapValid) { 89 | lastTap = first.target; 90 | tapValid = true; 91 | tapTimeout = window.setTimeout(cancelTap, 600); 92 | startHold(event); 93 | } else { 94 | window.clearTimeout(tapTimeout); 95 | // If a double tap is still a possibility and the elements are the same then perform a double click 96 | if (first.target == lastTap) { 97 | lastTap = null; 98 | tapValid = false; 99 | 100 | type = "click"; 101 | simulatedEvent = document.createEvent("MouseEvent"); 102 | 103 | simulatedEvent.initMouseEvent(type, true, true, window, 1, first.screenX, first.screenY, first.clientX, first.clientY, false, false, false, false, 0, null); 104 | first.target.dispatchEvent(simulatedEvent); 105 | 106 | type = "dblclick"; 107 | simulatedEvent = document.createEvent("MouseEvent"); 108 | 109 | simulatedEvent.initMouseEvent(type, true, true, window, 1, first.screenX, first.screenY, first.clientX, first.clientY, false, false, false, false, 0, null); 110 | first.target.dispatchEvent(simulatedEvent); 111 | } else { 112 | lastTap = first.target; 113 | tapValid = true; 114 | tapTimeout = window.setTimeout(cancelTap, 600); 115 | startHold(event); 116 | } 117 | } 118 | } 119 | 120 | function getDOMElementFromEvent(event) { 121 | if (event.targetTouches && event.targetTouches[0]) { 122 | return document.elementFromPoint(event.targetTouches[0].pageX - window.pageXOffset, event.targetTouches[0].pageY - window.pageYOffset); 123 | } 124 | return null; 125 | } 126 | 127 | function iPadTouchHandler(event) { 128 | var type = "", 129 | button = 0; /*left*/ 130 | if (event.touches.length > 1) { 131 | return; 132 | } 133 | switch (event.type) { 134 | case "touchstart": 135 | if ($(event.changedTouches[0].target).is("select")) { 136 | return; 137 | } 138 | iPadTouchStart(event); /*We need to trigger two events here to support one touch drag and drop*/ 139 | event.preventDefault(); 140 | currentDOMElement = getDOMElementFromEvent(event); 141 | return false; 142 | 143 | case "touchmove": 144 | cancelHold(); 145 | type = "mousemove"; 146 | event.preventDefault(); 147 | 148 | currentDOMElement = getDOMElementFromEvent(event); 149 | break; 150 | 151 | case "touchend": 152 | if (cancelMouseUp) { 153 | cancelMouseUp = false; 154 | event.preventDefault(); 155 | return false; 156 | } 157 | cancelHold(); 158 | type = "mouseup"; 159 | break; 160 | 161 | default: 162 | return; 163 | } 164 | var touches = event.changedTouches, 165 | first = touches[0], 166 | simulatedEvent = document.createEvent("MouseEvent"); 167 | simulatedEvent.initMouseEvent(type, true, true, window, 1, first.screenX, first.screenY, first.clientX, first.clientY,false, false, false, false, button, null); 168 | currentDOMElement.dispatchEvent(simulatedEvent); 169 | if (type == "mouseup" && tapValid && first.target == lastTap) { // This actually emulates the ipad's default behavior (which we prevented) 170 | simulatedEvent = document.createEvent("MouseEvent"); // This check avoids click being emulated on a double tap 171 | simulatedEvent.initMouseEvent("click", true, true, window, 1, first.screenX, first.screenY, first.clientX, first.clientY,false, false, false, false, button, null); 172 | currentDOMElement.dispatchEvent(simulatedEvent); 173 | } 174 | } 175 | 176 | $.extend($.support, { 177 | touch: "ontouchend" in document 178 | }); 179 | 180 | $.fn.addTouch = function () { 181 | if ($.support.touch) { 182 | this.each(function (i, el) { 183 | el.addEventListener("touchstart", iPadTouchHandler, false); 184 | el.addEventListener("touchmove", iPadTouchHandler, false); 185 | el.addEventListener("touchend", iPadTouchHandler, false); 186 | el.addEventListener("touchcancel", iPadTouchHandler, false); 187 | }); 188 | } 189 | return this; 190 | }; 191 | 192 | })(jQuery); -------------------------------------------------------------------------------- /packages/Depender.Parser/src/Depender.Parser/ILReader.cs: -------------------------------------------------------------------------------- 1 | // Type: ClrTest.Reflection.ILReader 2 | // Assembly: Depender.Parser, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null 3 | // MVID: 7BFB306E-D2F0-493B-8C2F-5C3CEA04F731 4 | // Assembly location: D:\temp\NSplit\Depender\Depender.Parser.dll 5 | 6 | using System; 7 | using System.Collections; 8 | using System.Collections.Generic; 9 | using System.Reflection; 10 | using System.Reflection.Emit; 11 | 12 | namespace ClrTest.Reflection 13 | { 14 | public sealed class ILReader : IEnumerable, IEnumerable 15 | { 16 | private static Type s_runtimeMethodInfoType = Type.GetType("System.Reflection.RuntimeMethodInfo"); 17 | private static Type s_runtimeConstructorInfoType = Type.GetType("System.Reflection.RuntimeConstructorInfo"); 18 | private static OpCode[] s_OneByteOpCodes = new OpCode[256]; 19 | private static OpCode[] s_TwoByteOpCodes = new OpCode[256]; 20 | private int m_position; 21 | private ITokenResolver m_resolver; 22 | private IILProvider m_ilProvider; 23 | private byte[] m_byteArray; 24 | 25 | static ILReader() 26 | { 27 | foreach (FieldInfo fieldInfo in typeof (OpCodes).GetFields(BindingFlags.Static | BindingFlags.Public)) 28 | { 29 | OpCode opCode = (OpCode) fieldInfo.GetValue((object) null); 30 | ushort num = (ushort) opCode.Value; 31 | if ((int) num < 256) 32 | ILReader.s_OneByteOpCodes[(int) num] = opCode; 33 | else if (((int) num & 65280) == 65024) 34 | ILReader.s_TwoByteOpCodes[(int) num & (int) byte.MaxValue] = opCode; 35 | } 36 | } 37 | 38 | public ILReader(MethodBase method) 39 | { 40 | if (method == null) 41 | throw new ArgumentNullException("method"); 42 | Type type = method.GetType(); 43 | if (type != ILReader.s_runtimeMethodInfoType && type != ILReader.s_runtimeConstructorInfoType) 44 | throw new ArgumentException("method must be RuntimeMethodInfo or RuntimeConstructorInfo for this constructor."); 45 | this.m_ilProvider = (IILProvider) new MethodBaseILProvider(method); 46 | this.m_resolver = (ITokenResolver) new ModuleScopeTokenResolver(method); 47 | this.m_byteArray = this.m_ilProvider.GetByteArray(); 48 | this.m_position = 0; 49 | } 50 | 51 | public ILReader(IILProvider ilProvider, ITokenResolver tokenResolver) 52 | { 53 | if (ilProvider == null) 54 | throw new ArgumentNullException("ilProvider"); 55 | this.m_resolver = tokenResolver; 56 | this.m_ilProvider = ilProvider; 57 | this.m_byteArray = this.m_ilProvider.GetByteArray(); 58 | this.m_position = 0; 59 | } 60 | 61 | public IEnumerator GetEnumerator() 62 | { 63 | while (this.m_position < this.m_byteArray.Length) 64 | yield return this.Next(); 65 | this.m_position = 0; 66 | } 67 | 68 | IEnumerator IEnumerable.GetEnumerator() 69 | { 70 | return (IEnumerator) this.GetEnumerator(); 71 | } 72 | 73 | private ILInstruction Next() 74 | { 75 | int offset = this.m_position; 76 | OpCode opCode1 = OpCodes.Nop; 77 | byte num1 = this.ReadByte(); 78 | OpCode opCode2; 79 | if ((int) num1 != 254) 80 | { 81 | opCode2 = ILReader.s_OneByteOpCodes[(int) num1]; 82 | } 83 | else 84 | { 85 | byte num2 = this.ReadByte(); 86 | opCode2 = ILReader.s_TwoByteOpCodes[(int) num2]; 87 | } 88 | switch (opCode2.OperandType) 89 | { 90 | case OperandType.InlineBrTarget: 91 | int delta1 = this.ReadInt32(); 92 | return (ILInstruction) new InlineBrTargetInstruction(offset, opCode2, delta1); 93 | case OperandType.InlineField: 94 | int token1 = this.ReadInt32(); 95 | return (ILInstruction) new InlineFieldInstruction(this.m_resolver, offset, opCode2, token1); 96 | case OperandType.InlineI: 97 | int num3 = this.ReadInt32(); 98 | return (ILInstruction) new InlineIInstruction(offset, opCode2, num3); 99 | case OperandType.InlineI8: 100 | long num4 = this.ReadInt64(); 101 | return (ILInstruction) new InlineI8Instruction(offset, opCode2, num4); 102 | case OperandType.InlineMethod: 103 | int token2 = this.ReadInt32(); 104 | return (ILInstruction) new InlineMethodInstruction(offset, opCode2, token2, this.m_resolver); 105 | case OperandType.InlineNone: 106 | return (ILInstruction) new InlineNoneInstruction(offset, opCode2); 107 | case OperandType.InlineR: 108 | double num5 = this.ReadDouble(); 109 | return (ILInstruction) new InlineRInstruction(offset, opCode2, num5); 110 | case OperandType.InlineSig: 111 | int token3 = this.ReadInt32(); 112 | return (ILInstruction) new InlineSigInstruction(offset, opCode2, token3, this.m_resolver); 113 | case OperandType.InlineString: 114 | int token4 = this.ReadInt32(); 115 | return (ILInstruction) new InlineStringInstruction(offset, opCode2, token4, this.m_resolver); 116 | case OperandType.InlineSwitch: 117 | int length = this.ReadInt32(); 118 | int[] deltas = new int[length]; 119 | for (int index = 0; index < length; ++index) 120 | deltas[index] = this.ReadInt32(); 121 | return (ILInstruction) new InlineSwitchInstruction(offset, opCode2, deltas); 122 | case OperandType.InlineTok: 123 | int token5 = this.ReadInt32(); 124 | return (ILInstruction) new InlineTokInstruction(offset, opCode2, token5, this.m_resolver); 125 | case OperandType.InlineType: 126 | int token6 = this.ReadInt32(); 127 | return (ILInstruction) new InlineTypeInstruction(offset, opCode2, token6, this.m_resolver); 128 | case OperandType.InlineVar: 129 | ushort ordinal1 = this.ReadUInt16(); 130 | return (ILInstruction) new InlineVarInstruction(offset, opCode2, ordinal1); 131 | case OperandType.ShortInlineBrTarget: 132 | sbyte delta2 = this.ReadSByte(); 133 | return (ILInstruction) new ShortInlineBrTargetInstruction(offset, opCode2, delta2); 134 | case OperandType.ShortInlineI: 135 | byte num6 = this.ReadByte(); 136 | return (ILInstruction) new ShortInlineIInstruction(offset, opCode2, num6); 137 | case OperandType.ShortInlineR: 138 | float num7 = this.ReadSingle(); 139 | return (ILInstruction) new ShortInlineRInstruction(offset, opCode2, num7); 140 | case OperandType.ShortInlineVar: 141 | byte ordinal2 = this.ReadByte(); 142 | return (ILInstruction) new ShortInlineVarInstruction(offset, opCode2, ordinal2); 143 | default: 144 | throw new BadImageFormatException("unexpected OperandType " + (object) opCode2.OperandType); 145 | } 146 | } 147 | 148 | public void Accept(ILInstructionVisitor visitor) 149 | { 150 | if (visitor == null) 151 | throw new ArgumentNullException("argument 'visitor' can not be null"); 152 | foreach (ILInstruction ilInstruction in this) 153 | ilInstruction.Accept(visitor); 154 | } 155 | 156 | private byte ReadByte() 157 | { 158 | return this.m_byteArray[this.m_position++]; 159 | } 160 | 161 | private sbyte ReadSByte() 162 | { 163 | return (sbyte) this.ReadByte(); 164 | } 165 | 166 | private ushort ReadUInt16() 167 | { 168 | int startIndex = this.m_position; 169 | this.m_position += 2; 170 | return BitConverter.ToUInt16(this.m_byteArray, startIndex); 171 | } 172 | 173 | private uint ReadUInt32() 174 | { 175 | int startIndex = this.m_position; 176 | this.m_position += 4; 177 | return BitConverter.ToUInt32(this.m_byteArray, startIndex); 178 | } 179 | 180 | private ulong ReadUInt64() 181 | { 182 | int startIndex = this.m_position; 183 | this.m_position += 8; 184 | return BitConverter.ToUInt64(this.m_byteArray, startIndex); 185 | } 186 | 187 | private int ReadInt32() 188 | { 189 | int startIndex = this.m_position; 190 | this.m_position += 4; 191 | return BitConverter.ToInt32(this.m_byteArray, startIndex); 192 | } 193 | 194 | private long ReadInt64() 195 | { 196 | int startIndex = this.m_position; 197 | this.m_position += 8; 198 | return BitConverter.ToInt64(this.m_byteArray, startIndex); 199 | } 200 | 201 | private float ReadSingle() 202 | { 203 | int startIndex = this.m_position; 204 | this.m_position += 4; 205 | return BitConverter.ToSingle(this.m_byteArray, startIndex); 206 | } 207 | 208 | private double ReadDouble() 209 | { 210 | int startIndex = this.m_position; 211 | this.m_position += 8; 212 | return BitConverter.ToDouble(this.m_byteArray, startIndex); 213 | } 214 | } 215 | } 216 | -------------------------------------------------------------------------------- /Gma.CodeVisuals.WebApi/Gma.CodeVisuals.WebApi.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {7416F52D-821A-4392-8BAF-A2F705D099E2} 8 | Exe 9 | Properties 10 | Gma.CodeVisuals.WebApi 11 | Gma.CodeVisuals.WebApi 12 | v4.5 13 | 512 14 | ..\ 15 | true 16 | 17 | 18 | AnyCPU 19 | true 20 | full 21 | false 22 | bin\Debug\ 23 | DEBUG;TRACE 24 | prompt 25 | 4 26 | 27 | 28 | AnyCPU 29 | pdbonly 30 | true 31 | bin\Release\ 32 | TRACE 33 | prompt 34 | 4 35 | 36 | 37 | 38 | graph.ico 39 | 40 | 41 | 42 | ..\packages\AutoMapper.3.1.1\lib\net40\AutoMapper.dll 43 | 44 | 45 | ..\packages\Newtonsoft.Json.5.0.8\lib\net40\Newtonsoft.Json.dll 46 | 47 | 48 | 49 | 50 | 51 | False 52 | ..\Depender.Parser\packages\Microsoft.AspNet.WebApi.Client.5.1.0\lib\net45\System.Net.Http.Formatting.dll 53 | 54 | 55 | 56 | 57 | False 58 | ..\Depender.Parser\packages\Microsoft.AspNet.WebApi.Core.5.1.0\lib\net45\System.Web.Http.dll 59 | 60 | 61 | False 62 | ..\Depender.Parser\packages\Microsoft.AspNet.WebApi.SelfHost.5.1.0\lib\net45\System.Web.Http.SelfHost.dll 63 | 64 | 65 | 66 | 67 | 68 | Code 69 | 70 | 71 | Code 72 | 73 | 74 | Code 75 | 76 | 77 | 78 | 79 | 80 | PreserveNewest 81 | 82 | 83 | 84 | 85 | 86 | PreserveNewest 87 | 88 | 89 | PreserveNewest 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | PreserveNewest 98 | 99 | 100 | 101 | 102 | PreserveNewest 103 | 104 | 105 | PreserveNewest 106 | 107 | 108 | PreserveNewest 109 | 110 | 111 | PreserveNewest 112 | 113 | 114 | 115 | 116 | PreserveNewest 117 | 118 | 119 | PreserveNewest 120 | 121 | 122 | PreserveNewest 123 | 124 | 125 | PreserveNewest 126 | 127 | 128 | PreserveNewest 129 | 130 | 131 | PreserveNewest 132 | 133 | 134 | PreserveNewest 135 | 136 | 137 | 138 | 139 | PreserveNewest 140 | 141 | 142 | 143 | 144 | PreserveNewest 145 | 146 | 147 | PreserveNewest 148 | 149 | 150 | PreserveNewest 151 | 152 | 153 | PreserveNewest 154 | 155 | 156 | 157 | 158 | 159 | PreserveNewest 160 | 161 | 162 | PreserveNewest 163 | 164 | 165 | PreserveNewest 166 | 167 | 168 | 169 | 170 | 171 | @echo on 172 | if not exist $(SolutionDir)\xcopy md $(SolutionDir)\xcopy 173 | copy /Y $(TargetDir)\*.dll $(SolutionDir)\xcopy\ 174 | copy /Y $(TargetDir)\$(TargetName)$(TargetExt) $(SolutionDir)\xcopy\ 175 | copy /Y $(TargetDir)\*.html $(SolutionDir)\xcopy\ 176 | copy /Y $(TargetDir)\*.bat $(SolutionDir)\xcopy\ 177 | if not exist $(SolutionDir)\xcopy\html md $(SolutionDir)\xcopy\html 178 | xcopy /E /Y $(TargetDir)\html $(SolutionDir)\xcopy\html 179 | if not exist $(SolutionDir)\xcopy\_DependencyForceGraphs md $(SolutionDir)\xcopy\_DependencyForceGraphs 180 | xcopy /E /Y $(TargetDir)\_DependencyForceGraphs $(SolutionDir)\xcopy\_DependencyForceGraphs 181 | 182 | 189 | --------------------------------------------------------------------------------