This repository has been archived by the owner on Dec 19, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
107 lines (97 loc) · 4.86 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8'>
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<meta name="description" content="Sharptypeconverter : Convert C# source to Typescript">
<link rel="stylesheet" type="text/css" media="screen" href="stylesheets/stylesheet.css">
<link rel="stylesheet" href="stylesheets/codemirror.css">
<script src="javascripts/jquery-2.1.1.js"></script>
<script src="javascripts/codemirror.js"></script>
<script src="javascripts/mode/clike/clike.js"></script>
<script src="javascripts/mode/javascript/javascript.js"></script>
<title>Sharptypeconverter</title>
</head>
<body>
<!-- HEADER -->
<div id="header_wrap" class="outer">
<header class="inner">
<a id="forkme_banner" href="https://github.com/Lucrasoft/sharptypeconverter">View on GitHub</a>
<h1 id="project_title">Sharptypeconverter</h1>
<h2 id="project_tagline">Convert C# source to Typescript</h2>
<section id="downloads">
<a class="zip_download_link" href="https://github.com/Lucrasoft/sharptypeconverter/zipball/master">Download this project as a .zip file</a>
<a class="tar_download_link" href="https://github.com/Lucrasoft/sharptypeconverter/tarball/master">Download this project as a tar.gz file</a>
</section>
</header>
</div>
<!-- MAIN CONTENT -->
<div id="main_content_wrap" class="outer">
<section id="main_content" class="inner">
<p>
Sharptypeconverter is a project that tries to convert c# code to typescript code by parsing the c# to a syntax tree and emitting it as typescript
<p>
<p>
For now the project helps with the conversion as much as possible, but doesn't output 100% working code.
<p>
<p>
For a working example paste your c# code in the put textarea and press convert.
Only works for complete c# files including namespaces that build properly.
<br/>
<select id="demolist" onchange="loadFileContent(this.options[this.selectedIndex].value)">
<option value="#">Example Codes ...</option>
<option value="Examples/FieldTest.html">Fields</option>
<option value="Examples/MethodTest.html">Methods</option>
<option value="Examples/BlockStatementTest.html">Block Statements</option>
<option value="Examples/PropertyTest.html">Properties</option>
</select>
</p>
</section>
<!--<textarea id="inputArea" style="margin-left:1%; width:48%; height:300px; "></textarea>-->
<div style="margin-left:1%; width:48%; float:left ">
<textarea id="inputArea"></textarea>
</div>
<div style="width:49%; float:left">
<textarea id="outputArea" style="width:100%;"></textarea>
</div>
<div style="text-align: center">
<button onclick="convert()">convert</button>
</div>
<!-- FOOTER -->
<div id="footer_wrap" class="outer">
<footer class="inner">
<p class="copyright">Sharptypeconverter maintained by <a href="https://github.com/Lucrasoft">Lucrasoft</a></p>
<p>Published with <a href="http://pages.github.com">GitHub Pages</a></p>
</footer>
</div>
<script>
var inputEditor = CodeMirror.fromTextArea(document.getElementById("inputArea"), {
lineNumbers: true,
mode: "text/x-csharp",
matchBrackets: true
});
var outputEditor = CodeMirror.fromTextArea(document.getElementById("outputArea"), {
lineNumbers: true,
mode: "application/typescript",
matchBrackets: true
});
function convert() {
var data = "=" + inputEditor.getValue();
$.ajax({
type: "POST",
url: "http://sharptypeconverter.lucrasoft.nl/api/convert",
data: data,
}).then(function (result) {
outputEditor.setValue(result);
},function(error) {
outputEditor.setValue("could not convert code");
});
}
function loadFileContent(url) {
$.get(url, function (result) {
inputEditor.setValue(result);
});
}
</script>
</body>
</html>