Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions client/c#/AcademyMG/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Auto detect text files and perform LF normalization
* text=auto

# Custom for Visual Studio
*.cs diff=csharp

# Standard to msysgit
*.doc diff=astextplain
*.DOC diff=astextplain
*.docx diff=astextplain
*.DOCX diff=astextplain
*.dot diff=astextplain
*.DOT diff=astextplain
*.pdf diff=astextplain
*.PDF diff=astextplain
*.rtf diff=astextplain
*.RTF diff=astextplain
82 changes: 82 additions & 0 deletions client/c#/AcademyMG/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# Windows image file caches
Thumbs.db

# Folder config file
Desktop.ini

## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.

# User-specific files
*.suo
*.user
*.userprefs

.vs/

# Build results
bin/[Dd]ebug/
bin/[Rr]elease/
*_i.c
*_p.c
*.ilk
*.meta
*.obj
*.pch
bin/**/*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.vspscc
.builds

# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opensdf
*.sdf

*.ide/


*.lock.json
*.nuget.props
*.nuget.targets

# Visual Studio profiler
*.psess
*.vsp

# ReSharper is a .NET coding add-in
_ReSharper*

# Click-Once directory
publish

# Others
[Bb]in
[Oo]bj
sql
TestResults
*.Cache
ClientBin
stylecop.*
~$*
*.dbmdl
.DS_Store
Generated_Code #added for RIA/Silverlight projects

# Custom

# packages
Release/
packages/

*.userprefs
Refit-Tests/test-results
50 changes: 50 additions & 0 deletions client/c#/AcademyMG/CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Contributor Code of Conduct

As contributors and maintainers of this project, and in the interest of
fostering an open and welcoming community, we pledge to respect all people who
contribute through reporting issues, posting feature requests, updating
documentation, submitting pull requests or patches, and other activities.

We are committed to making participation in this project a harassment-free
experience for everyone, regardless of level of experience, gender, gender
identity and expression, sexual orientation, disability, personal appearance,
body size, race, ethnicity, age, religion, or nationality.

Examples of unacceptable behavior by participants include:

* The use of sexualized language or imagery
* Personal attacks
* Trolling or insulting/derogatory comments
* Public or private harassment
* Publishing other's private information, such as physical or electronic
addresses, without explicit permission
* Other unethical or unprofessional conduct

Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.

By adopting this Code of Conduct, project maintainers commit themselves to
fairly and consistently applying these principles to every aspect of managing
this project. Project maintainers who do not follow or enforce the Code of
Conduct may be permanently removed from the project team.

This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community.

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting a project maintainer at paul@paulbetts.org. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. Maintainers are
obligated to maintain confidentiality with regard to the reporter of an
incident.


This Code of Conduct is adapted from the [Contributor Covenant][homepage],
version 1.3.0, available at
[http://contributor-covenant.org/version/1/3/0/][version]

[homepage]: http://contributor-covenant.org
[version]: http://contributor-covenant.org/version/1/3/0/
19 changes: 19 additions & 0 deletions client/c#/AcademyMG/COPYING
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Copyright (c) 2012 GitHub

Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
56 changes: 56 additions & 0 deletions client/c#/AcademyMG/GitVersion.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
assembly-versioning-scheme: MajorMinorPatch
mode: ContinuousDeployment
tag-prefix: '[vV]'
continuous-delivery-fallback-tag: ci
next-version: 3.0.0
major-version-bump-message: '\+semver:\s?(breaking|major)'
minor-version-bump-message: '\+semver:\s?(feature|minor)'
patch-version-bump-message: '\+semver:\s?(fix|patch)'
legacy-semver-padding: 3
build-metadata-padding: 3
commits-since-version-source-padding: 3
commit-message-incrementing: Enabled
branches:
master:
mode: ContinuousDeployment
tag: build
increment: Patch
prevent-increment-of-merged-branch-version: true
track-merge-target: false
release:
mode: ContinuousDeployment
tag: rc
increment: Patch
prevent-increment-of-merged-branch-version: true
track-merge-target: false
feature:
mode: ContinuousDeployment
tag: useBranchName
increment: Inherit
prevent-increment-of-merged-branch-version: false
track-merge-target: false
pull-request:
mode: ContinuousDeployment
tag: PullReq
increment: Inherit
prevent-increment-of-merged-branch-version: false
tag-number-pattern: '[/-](?<number>\d+)[-/]'
track-merge-target: false
hotfix:
mode: ContinuousDeployment
tag: beta
increment: Patch
prevent-increment-of-merged-branch-version: false
track-merge-target: false
support:
mode: ContinuousDeployment
tag: ''
increment: Patch
prevent-increment-of-merged-branch-version: true
track-merge-target: false
develop:
mode: ContinuousDeployment
tag: dev
increment: Minor
prevent-increment-of-merged-branch-version: false
track-merge-target: true
6 changes: 6 additions & 0 deletions client/c#/AcademyMG/InterfaceStubGenerator/App.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
</configuration>
115 changes: 115 additions & 0 deletions client/c#/AcademyMG/InterfaceStubGenerator/Diagnostics.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
using Microsoft.CodeAnalysis.CSharp.Syntax;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis;

namespace Refit.Generator
{
public class Diagnostic
{
public string Type { get; private set; }
public string Code { get; private set; }
public string File { get; protected set; }
public int? Line { get; protected set; }
public int? Character { get; protected set; }
public string Message { get; protected set; }

public Diagnostic(string type, string code)
{
Type = type;
Code = code;
}

protected void setLocation(Location location)
{
var line = location.GetMappedLineSpan().StartLinePosition;

File = location.FilePath;
Line = line.Line + 1;
Character = line.Character + 1;
}

public override string ToString()
{
var builder = new StringBuilder();

if (!string.IsNullOrWhiteSpace(File)) {
builder.Append(File);
if (Line.HasValue) {
builder.AppendFormat("({0}", Line);
if (Character.HasValue)
builder.AppendFormat(",{0}", Character);
builder.Append(")");
}
builder.Append(": ");
}
builder.AppendFormat("{0} {1}", Type, Code);
if (!string.IsNullOrWhiteSpace(Message))
builder.AppendFormat(": {0}", Message);

return builder.ToString();
}
}

public class Warning : Diagnostic
{
public Warning(string code) : base("warning", code) { }
}

public class Error : Diagnostic
{
public Error(string code) : base("error", code) { }
}


public class MissingRefitAttributeWarning : Warning
{
public string InterfaceName { get; private set; }
public string MethodName { get; private set; }

public MissingRefitAttributeWarning(InterfaceDeclarationSyntax @interface, MethodDeclarationSyntax method)
: base("RF001")
{
setLocation(method.GetLocation());

InterfaceName = @interface.Identifier.Text;
MethodName = method.Identifier.Text;

Message = string.Format(
"Method {0}.{1} either has no Refit HTTP method attribute or you've used something other than a string literal for the 'path' argument.",
InterfaceName, MethodName);
}
}

public class MultipleRefitMethodSameNameWarning : Warning
{
public string InterfaceName { get; private set; }
public string MethodName { get; private set; }

public MultipleRefitMethodSameNameWarning(InterfaceDeclarationSyntax @interface, MethodDeclarationSyntax method)
: base("RF002")
{
setLocation(method.GetLocation());

InterfaceName = @interface.Identifier.Text;
MethodName = method.Identifier.Text;

Message = string.Format(
"Method {0}.{1} has been declared multiple times. Refit doesn't support overloading.",
InterfaceName, MethodName);
}
}

public class ReadOnlyFileError : Error
{
public ReadOnlyFileError(FileInfo file) : base("RF003")
{
File = file.FullName;
Message = "File is marked as read-only and is not up-to-date.";
}
}
}
Loading