Added editorconfig file, changed reprecated references to {parm} to $parm

This commit is contained in:
Peter Villadsen 2021-06-27 19:00:02 -07:00
Родитель afe75337aa
Коммит 71d2dbecac
10 изменённых файлов: 147 добавлений и 118 удалений

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

Просмотреть файл

@ -1,5 +1,5 @@
<Query Kind="Program">
<Reference Relative="..\..\BaseXInterface\bin\Debug\BaseXInterface.dll">C:\Users\pvillads\source\repos\SocrateX\Explorer\BaseXInterface\bin\Debug\BaseXInterface.dll</Reference>
<Reference Relative="..\..\BaseXInterface\bin\Debug\BaseXInterface.dll">C:\Users\pvillads\Desktop\Dynamics365FO-AppChecker\tools\BaseXInterface\bin\Debug\BaseXInterface.dll</Reference>
<Reference>&lt;RuntimeDirectory&gt;\WPF\PresentationCore.dll</Reference>
<Reference>&lt;RuntimeDirectory&gt;\WPF\PresentationFramework.dll</Reference>
<Reference>&lt;RuntimeDirectory&gt;\System.Xaml.dll</Reference>
@ -8,10 +8,10 @@
<Namespace>OxyPlot</Namespace>
<Namespace>OxyPlot.Axes</Namespace>
<Namespace>OxyPlot.Series</Namespace>
<Namespace>System.Xml.Linq</Namespace>
</Query>
void Main()
[STAThread]
async void Main()
{
var query = @"(: Calculates the visibility of all methods on classes and tables. :)
let $results :=
@ -20,11 +20,11 @@ let $results :=
for $c in /Class | /Table
let $allMethods := count($c/Method)
let $privateMethods := count($c/Method[@IsPrivate = 'True'])
let $protectedMethods := count($c/Method[@IsProtected = 'True'])
let $publicMethods := count($c/Method[@IsPublic = 'True'])
let $internalMethods := count($c/Method[@IsInternal = 'True'])
let $undecoratedMethods := count($c/Method[@IsInternal='False' and @IsPrivate='False' and @IsProtected='False' and @IsPublic='False'])
let $privateMethods := count($c/Method[@IsPrivate = 'true'])
let $protectedMethods := count($c/Method[@IsProtected = 'true'])
let $publicMethods := count($c/Method[@IsPublic = 'true'])
let $internalMethods := count($c/Method[@IsInternal = 'true'])
let $undecoratedMethods := count($c/Method[@IsInternal='false' and @IsPrivate='false' and @IsProtected='false' and @IsPublic='false'])
return <Result Artifact='{$c/@Artifact}'
PrivateMethodCount='{$privateMethods}'
@ -43,13 +43,13 @@ return <Totals
InternalMethodCount='{sum($results/Result/@InternalMethodCount)}' />";
XDocument sv;
using (var session = s.GetSession("ApplicationFoundation"))
using (var session = await s.GetSessionAsync ("ApplicationFoundation"))
{
var queryResult = session.Execute("xquery " + query);
sv = XDocument.Parse(queryResult, LoadOptions.SetLineInfo);
}
// sv.Dump();
sv.Dump();
var model = new PlotModel();
model.Title = "Method Visibility over all classes and tables.";
@ -73,14 +73,28 @@ return <Totals
series.Slices.Add(publicSlice);
series.Slices.Add(undecoratedSlice);
series.Slices.Add(internalSlice);
var view = new OxyPlot.Wpf.PlotView() { Model = model };
var pngExporter = new OxyPlot.Wpf.PngExporter { Width = 600, Height = 400, Background = OxyColors.White };
var bitmap = pngExporter.ExportToBitmap(model);
System.Windows.Clipboard.SetImage(bitmap);
Thread newWindowThread = new Thread(new ThreadStart(() =>
{
// create and show the window
var view = new OxyPlot.Wpf.PlotView() { Model = model };
PanelManager.DisplayWpfElement(view, "Method Visibility");
var pngExporter = new OxyPlot.Wpf.PngExporter { Width = 600, Height = 400, Background = OxyColors.White };
var bitmap = pngExporter.ExportToBitmap(model);
System.Windows.Clipboard.SetImage(bitmap);
// start the Dispatcher processing
System.Windows.Threading.Dispatcher.Run();
PanelManager.DisplayWpfElement(view, "Method Visibility");
}));
newWindowThread.SetApartmentState(ApartmentState.STA);
// make the thread a background thread
newWindowThread.IsBackground = true;
// start the thread
newWindowThread.Start();
Console.ReadLine();
}
static BaseXInterface.BaseXServer s = new BaseXInterface.BaseXServer

Просмотреть файл

@ -1,4 +1,4 @@
[*.{cs,vb}]
# IDE0003: Remove qualification
dotnet_style_qualification_for_field = false
dotnet_style_qualification_for_field = true

Просмотреть файл

@ -121,7 +121,7 @@ namespace SocratexGraphExplorer
{
var id = e["nodeId"].ToObject<long>();
var cypher = "MATCH (c) where id(c) = {id} return c limit 1";
var cypher = "MATCH (c) where id(c) = $id return c limit 1";
this.ViewModel.SelectedNode = id;
var nodeResult = await this.model.ExecuteCypherAsync(cypher, new Dictionary<string, object>() { { "id", id } });
this.ViewModel.UpdatePropertyListView(nodeResult);
@ -131,7 +131,7 @@ namespace SocratexGraphExplorer
{
var id = e["edgeId"].ToObject<long>();
var cypher = "MATCH (c) -[r]- (d) where id(r) = {id} return r limit 1";
var cypher = "MATCH (c) -[r]- (d) where id(r) = $id return r limit 1";
this.ViewModel.SelectedEdge = id;
var edgeResult = await this.model.ExecuteCypherAsync(cypher, new Dictionary<string, object>() { { "id", id } });
this.ViewModel.UpdatePropertyListView(edgeResult);

Просмотреть файл

@ -224,7 +224,7 @@ namespace SocratexGraphExplorer.ViewModels
{
// This is additive to the existing graph
// Find all the nodes from the current node:
var query = "match (n) -[]-> (q) where id(n) = {nodeId} return q";
var query = "match (n) -[]-> (q) where id(n) = $nodeId return q";
var result = await this.model.ExecuteCypherAsync(query, new Dictionary<string, object>() { { "nodeId", this.SelectedNode } });
var outgoing = Model.HarvestNodeIdsFromGraph(result);
@ -248,7 +248,7 @@ namespace SocratexGraphExplorer.ViewModels
// This is additive to the existing graph
// Find all the nodes from the current node:
var query = "match (n) <-[]- (q) where id(n) = {nodeId} return q";
var query = "match (n) <-[]- (q) where id(n) = $nodeId return q";
var result = await this.model.ExecuteCypherAsync(query, new Dictionary<string, object>() { { "nodeId", this.SelectedNode } });
var incoming = Model.HarvestNodeIdsFromGraph(result);
@ -271,7 +271,7 @@ namespace SocratexGraphExplorer.ViewModels
{
// This is additive to the existing graph
// Find all the edges (both incoming and outgoing) from the current node:
var q = "match (f) -[]- (n) where id(n) = {nodeId} return f";
var q = "match (f) -[]- (n) where id(n) = $nodeId return f";
var result = await this.model.ExecuteCypherAsync(q, new Dictionary<string, object>() { { "nodeId", this.SelectedNode } });
var outgoing = Model.HarvestNodeIdsFromGraph(result);
@ -734,10 +734,10 @@ namespace SocratexGraphExplorer.ViewModels
{
if (nodes != null)
{
var query = "match (n) where id(n) in {nodeIds} "
var query = "match (n) where id(n) in $nodeIds "
+ "optional match (n) -[r]- (m) "
+ "where id(n) in {nodeIds} " +
" and id(m) in {nodeIds} " +
+ "where id(n) in $nodeIds " +
" and id(m) in $nodeIds " +
"return n,m,r";
var results = await this.model.ExecuteCypherAsync(query, new Dictionary<string, object>() { { "nodeIds", nodes.ToArray() } });

Просмотреть файл

@ -52,7 +52,7 @@ namespace SocratexGraphExplorer.XppPlugin
var parts = artifact.Split('/');
var toplevelArtifact = "/" + parts[1] + "/" + parts[2] + "/" + parts[3];
var query = "match (p) where p.Artifact={artifact} return p limit 1";
var query = "match (p) where p.Artifact=$artifact return p limit 1";
var c = await model.ExecuteCypherAsync(query, new Dictionary<string, object>() { { "artifact", toplevelArtifact } });
if (c != null)
@ -95,17 +95,17 @@ namespace SocratexGraphExplorer.XppPlugin
private async void ShowDeclaringEntityClicked(object sender, RoutedEventArgs e)
{
await this.model.AddNodesAsync("match p=(c) -[*]-> (n:Method) where id(n) = {nodeId} return p order by length(p) desc limit 1", new Dictionary<string, object>() { { "nodeId", node.Id } });
await this.model.AddNodesAsync("match p=(c) -[*]-> (n:Method) where id(n) = $nodeId return p order by length(p) desc limit 1", new Dictionary<string, object>() { { "nodeId", node.Id } });
}
private async void ShowCallersButtonClicked(object sender, RoutedEventArgs e)
{
await this.model.AddNodesAsync("match (c) -[:CALLS]-> (n) where id(n) = {nodeId} return c", new Dictionary<string, object>() { { "nodeId", node.Id } });
await this.model.AddNodesAsync("match (c) -[:CALLS]-> (n) where id(n) = $nodeId return c", new Dictionary<string, object>() { { "nodeId", node.Id } });
}
private async void ShowCalleesButtonClicked(object sender, RoutedEventArgs e)
{
await this.model.AddNodesAsync("match (c) <-[:CALLS]- (n) where id(n) = {nodeId} return c", new Dictionary<string, object>() { { "nodeId", node.Id } });
await this.model.AddNodesAsync("match (c) <-[:CALLS]- (n) where id(n) = $nodeId return c", new Dictionary<string, object>() { { "nodeId", node.Id } });
}
}
}

Просмотреть файл

@ -53,13 +53,13 @@ namespace SocratexGraphExplorer.XppPlugin
{
this.node = node;
var extendsQuery = "match (c:Class) -[:EXTENDS]-> (q) where id(c) = {nodeId} return q";
var extendsQuery = "match (c:Class) -[:EXTENDS]-> (q) where id(c) = $nodeId return q";
var extendsQueryPromise = model.ExecuteCypherAsync(extendsQuery, new Dictionary<string, object>() { { "nodeId", node.Id } });
var extendedByQuery = "match (c:Class) <-[:EXTENDS]- (q) where id(c) = {nodeId} return count(q) as cnt";
var extendedByQuery = "match (c:Class) <-[:EXTENDS]- (q) where id(c) = $nodeId return count(q) as cnt";
var extendedByQueryPromise = model.ExecuteCypherAsync(extendedByQuery, new Dictionary<string, object>() { { "nodeId", node.Id } });
var implementsCountQuery = "match (c:Class) -[:IMPLEMENTS]-> (i) where id(c)={nodeId} return count(i) as cnt";
var implementsCountQuery = "match (c:Class) -[:IMPLEMENTS]-> (i) where id(c)=$nodeId return count(i) as cnt";
var implementsCountQueryPromise = model.ExecuteCypherAsync(implementsCountQuery, new Dictionary<string, object>() { { "nodeId", node.Id } });
this.Header.Text = string.Format("{0} {1}", node.Labels[0], node.Properties["Name"] as string);
@ -105,32 +105,32 @@ namespace SocratexGraphExplorer.XppPlugin
private async void ShowBaseClass(object sender, RoutedEventArgs e)
{
await this.model.AddNodesAsync("match (c:Class) -[:EXTENDS]-> (q) where id(c) = {nodeId} return q limit 1", new Dictionary<string, object>() { { "nodeId", node.Id } });
await this.model.AddNodesAsync("match (c:Class) -[:EXTENDS]-> (q) where id(c) = $nodeId return q limit 1", new Dictionary<string, object>() { { "nodeId", node.Id } });
}
private async void ShowBaseClasses(object sender, RoutedEventArgs e)
{
await this.model.AddNodesAsync("match (c:Class) -[:EXTENDS*]-> (q) where id(c) = {nodeId} return q", new Dictionary<string, object>() { { "nodeId", node.Id } });
await this.model.AddNodesAsync("match (c:Class) -[:EXTENDS*]-> (q) where id(c) = $nodeId return q", new Dictionary<string, object>() { { "nodeId", node.Id } });
}
private async void ShowDerivedClasses(object sender, RoutedEventArgs e)
{
await this.model.AddNodesAsync("match (c:Class) <-[:EXTENDS]- (q) where id(c) = {nodeId} return q", new Dictionary<string, object>() { { "nodeId", node.Id } });
await this.model.AddNodesAsync("match (c:Class) <-[:EXTENDS]- (q) where id(c) = $nodeId return q", new Dictionary<string, object>() { { "nodeId", node.Id } });
}
private async void ShowImplementedInterfaces(object sender, RoutedEventArgs e)
{
await this.model.AddNodesAsync("match (c:Class) -[:IMPLEMENTS]-> (i) where id(c)={nodeId} return i", new Dictionary<string, object>() { { "nodeId", node.Id } });
await this.model.AddNodesAsync("match (c:Class) -[:IMPLEMENTS]-> (i) where id(c)=$nodeId return i", new Dictionary<string, object>() { { "nodeId", node.Id } });
}
private async void ShowMethods(object sender, RoutedEventArgs e)
{
await this.model.AddNodesAsync("match (c:Class) -[:DECLARES]-> (m:Method) where id(c) = {nodeId} return m", new Dictionary<string, object>() { { "nodeId", node.Id } });
await this.model.AddNodesAsync("match (c:Class) -[:DECLARES]-> (m:Method) where id(c) = $nodeId return m", new Dictionary<string, object>() { { "nodeId", node.Id } });
}
private async void ShowFields(object sender, RoutedEventArgs e)
{
await this.model.AddNodesAsync("match (c:Class) -[:DECLARES]-> (m:ClassMember) where id(c) = {nodeId} return m", new Dictionary<string, object>() { { "nodeId", node.Id } });
await this.model.AddNodesAsync("match (c:Class) -[:DECLARES]-> (m:ClassMember) where id(c) = $nodeId return m", new Dictionary<string, object>() { { "nodeId", node.Id } });
}
}
}

Просмотреть файл

@ -76,21 +76,21 @@ namespace SocratexGraphExplorer.XppPlugin
private void ShowMethods(object sender, RoutedEventArgs e)
{
model.AddNodesAsync(
"match (c:Form) -[:DECLARES]-> (m:Method) where id(c) = {nodeId} return m",
"match (c:Form) -[:DECLARES]-> (m:Method) where id(c) = $nodeId return m",
new Dictionary<string, object>() { { "nodeId", node.Id } });
}
private void ShowControls(object sender, RoutedEventArgs e)
{
model.AddNodesAsync(
"match (c:Form) -[:CONTROL]-> (fc:FormControl) where id(c) = {nodeId} return fc",
"match (c:Form) -[:CONTROL]-> (fc:FormControl) where id(c) = $nodeId return fc",
new Dictionary<string, object>() { { "nodeId", node.Id } });
}
private void ShowDatasources(object sender, RoutedEventArgs e)
{
model.AddNodesAsync(
"match (c:Form) -[:DATASOURCE]-> (fds:FormDataSource) where id(c) = {nodeId} return fds",
"match (c:Form) -[:DATASOURCE]-> (fds:FormDataSource) where id(c) = $nodeId return fds",
new Dictionary<string, object>() { { "nodeId", node.Id } });
}
}

Просмотреть файл

@ -43,11 +43,11 @@ namespace SocratexGraphExplorer.XppPlugin
this.node = node;
var incomingCallsQuery = model.ExecuteCypherAsync(
"match(m1:Method) -[r: CALLS]->(m:Method) where id(m) = {nodeId} return count(r) as methods, sum(r.Count) as count",
"match(m1:Method) -[r: CALLS]->(m:Method) where id(m) = $nodeId return count(r) as methods, sum(r.Count) as count",
new Dictionary<string, object>() { { "nodeId", node.Id } });
var outGoingCallsQuery = model.ExecuteCypherAsync(
"match(m:Method) -[r:CALLS]->(m1:Method) where id(m) = {nodeId} return count(r) as methods, sum(r.Count) as count",
"match(m:Method) -[r:CALLS]->(m1:Method) where id(m) = $nodeId return count(r) as methods, sum(r.Count) as count",
new Dictionary<string, object>() { { "nodeId", node.Id } });
this.Header.Text = string.Format("{0} {1}", node.Labels[0], node.Properties["Name"] as string);
@ -66,7 +66,7 @@ namespace SocratexGraphExplorer.XppPlugin
var parts = artifact.Split('/');
var toplevelArtifact = "/" + parts[1] + "/" + parts[2] + "/" + parts[3];
var query = "match (p) where p.Artifact={artifact} return p limit 1";
var query = "match (p) where p.Artifact=$artifact return p limit 1";
var c = await model.ExecuteCypherAsync(query, new Dictionary<string, object>() { { "artifact", toplevelArtifact } });
if (c != null)
@ -122,17 +122,17 @@ namespace SocratexGraphExplorer.XppPlugin
private async void ShowDeclaringEntityClicked(object sender, RoutedEventArgs e)
{
await this.model.AddNodesAsync("match p=(c) -[*]-> (n:Method) where id(n) = {nodeId} return p order by length(p) desc limit 1", new Dictionary<string, object>() { { "nodeId", node.Id } });
await this.model.AddNodesAsync("match p=(c) -[*]-> (n:Method) where id(n) = $nodeId return p order by length(p) desc limit 1", new Dictionary<string, object>() { { "nodeId", node.Id } });
}
private async void ShowCallersButtonClicked(object sender, RoutedEventArgs e)
{
await this.model.AddNodesAsync("match (c) -[:CALLS]-> (n) where id(n) = {nodeId} return c", new Dictionary<string, object>() { { "nodeId", node.Id } });
await this.model.AddNodesAsync("match (c) -[:CALLS]-> (n) where id(n) = $nodeId return c", new Dictionary<string, object>() { { "nodeId", node.Id } });
}
private async void ShowCalleesButtonClicked(object sender, RoutedEventArgs e)
{
await this.model.AddNodesAsync("match (c) <-[:CALLS]- (n) where id(n) = {nodeId} return c", new Dictionary<string, object>() { { "nodeId", node.Id } });
await this.model.AddNodesAsync("match (c) <-[:CALLS]- (n) where id(n) = $nodeId return c", new Dictionary<string, object>() { { "nodeId", node.Id } });
}
}
}

Просмотреть файл

@ -75,12 +75,12 @@ namespace SocratexGraphExplorer.XppPlugin
private async void ShowMethods(object sender, RoutedEventArgs e)
{
await this.model.AddNodesAsync("match (c:Table) -[:DECLARES]-> (m:Method) where id(c) = {nodeId} return m", new Dictionary<string, object>() { { "nodeId", node.Id } });
await this.model.AddNodesAsync("match (c:Table) -[:DECLARES]-> (m:Method) where id(c) = $nodeId return m", new Dictionary<string, object>() { { "nodeId", node.Id } });
}
private async void ShowFields(object sender, RoutedEventArgs e)
{
await this.model.AddNodesAsync("match (c:Class) -[:DECLARES]-> (m:ClassMember) where id(c) = {nodeId} return m", new Dictionary<string, object>() { { "nodeId", node.Id } });
await this.model.AddNodesAsync("match (c:Class) -[:DECLARES]-> (m:ClassMember) where id(c) = $nodeId return m", new Dictionary<string, object>() { { "nodeId", node.Id } });
}
}
}