Amelioration Webserver
This commit is contained in:
parent
3e73515f0d
commit
636106176a
2 changed files with 61 additions and 30 deletions
|
|
@ -40,10 +40,28 @@ namespace DMX2
|
|||
Console.WriteLine (context.Request.RawUrl);
|
||||
|
||||
string responseString = GetResponse (context);
|
||||
// TODO : gerer autrement les resources
|
||||
// Pour les resources, on les renvoie si elles existent
|
||||
if (context.Request.Url.LocalPath.StartsWith ("/res/")) {
|
||||
string res = context.Request.Url.LocalPath.Remove(0,5).Replace('/','.');
|
||||
if(resources.Contains(res))
|
||||
using (System.IO.Stream stream = System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream(res))
|
||||
|
||||
{
|
||||
byte[] buff = new byte[1024]; int l;
|
||||
while( (l=stream.Read(buff,0,buff.Length))>0){
|
||||
context.Response.OutputStream.Write(buff,0,l);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
byte[] buffer = System.Text.Encoding.UTF8.GetBytes (responseString);
|
||||
context.Response.ContentLength64 = buffer.Length;
|
||||
context.Response.OutputStream.Write (buffer, 0, buffer.Length);
|
||||
|
||||
}
|
||||
context.Response.OutputStream.Close ();
|
||||
}
|
||||
} catch {
|
||||
|
|
@ -57,15 +75,6 @@ namespace DMX2
|
|||
// Pas de conduite chargée, on renvoi un simple message
|
||||
if (Conduite.Courante == null) return "<html><body>Pas de conduite</body></html>";
|
||||
|
||||
// Pour les resources, on les renvoie si elles existent
|
||||
if (req.Url.LocalPath.StartsWith ("/res/")) {
|
||||
string res = req.Url.LocalPath.Remove(0,5).Replace('/','.');
|
||||
if(resources.Contains(res))
|
||||
using (System.IO.Stream stream = System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream(res))
|
||||
using (System.IO.TextReader reader = new System.IO.StreamReader(stream))
|
||||
return reader.ReadToEnd();
|
||||
else return "";
|
||||
}
|
||||
|
||||
int circuit, univ, dimmer, val;
|
||||
|
||||
|
|
|
|||
|
|
@ -11,14 +11,32 @@
|
|||
A=Math.min(A,512);
|
||||
A=Math.max(A,1);
|
||||
this.dimmer.value=A;
|
||||
B=$( "#slider").slider( "value" );
|
||||
trans1(form.univ.value,form.dimmer.value,B);
|
||||
}
|
||||
|
||||
function hop2(code)
|
||||
{
|
||||
A=parseInt(this.circuit.value)+parseInt(code);
|
||||
A=Math.max(A,1);
|
||||
this.circuit.value=A;
|
||||
B=$( "#slider2").slider( "value" );
|
||||
trans2(form2.circuit.value,B);
|
||||
}
|
||||
|
||||
function Balckout()
|
||||
{
|
||||
$( "#slider2").slider( "value",0 );
|
||||
//B=$( "#slider2").slider( "value" );
|
||||
//trans2(form2.circuit.value,B);
|
||||
}
|
||||
|
||||
function Full()
|
||||
{
|
||||
$( "#slider2").slider( "value",255 );
|
||||
//B=$( "#slider2").slider( "value" );
|
||||
//trans2(form2.circuit.value,B);
|
||||
}
|
||||
|
||||
function remplir()
|
||||
{
|
||||
|
|
@ -44,6 +62,7 @@
|
|||
B=$( "#slider").slider( "value" );
|
||||
trans1(form.univ.value,form.dimmer.value,B);
|
||||
}
|
||||
|
||||
function refreshSwatch2()
|
||||
{
|
||||
B=$( "#slider2").slider( "value" );
|
||||
|
|
@ -78,7 +97,7 @@
|
|||
<span id="toto">
|
||||
<div id="univers">
|
||||
<form name="form">
|
||||
<table border="1">
|
||||
<table border="0">
|
||||
<tr>
|
||||
<th>
|
||||
<label>Univers</label>
|
||||
|
|
@ -98,7 +117,7 @@
|
|||
</tr><tr>
|
||||
<td><input type="button" value="C-" Onclick="hop('-100')"><input type="button" value="D-" Onclick="hop('-10')">
|
||||
<input type="button" value="U-" Onclick="hop('-1')"></td>
|
||||
</tr><tr>
|
||||
</tr><tr><td> </td></tr><tr>
|
||||
<td colspan="2">
|
||||
<div id="slider"></div>
|
||||
<td>
|
||||
|
|
@ -109,7 +128,7 @@
|
|||
<div id="circuits">
|
||||
|
||||
<form name="form2">
|
||||
<table border="1">
|
||||
<table border="0">
|
||||
<tr>
|
||||
<th rowspan="3" >
|
||||
<label>Circuit</label>
|
||||
|
|
@ -121,11 +140,14 @@
|
|||
</tr><tr>
|
||||
<td><input type="button" value="C-" Onclick="hop2('-100')"><input type="button" value="D-" Onclick="hop2('-10')">
|
||||
<input type="button" value="U-" Onclick="hop2('-1')" >
|
||||
</tr><tr>
|
||||
</tr><tr><td> </td> </tr><tr>
|
||||
<td colspan="2">
|
||||
<div id="slider2"></div>
|
||||
<td>
|
||||
</tr>
|
||||
<tr><td align="left"><input type="button" value="Blackout" Onclick="Balckout()"></td>
|
||||
|
||||
<td align="right"><input type="button" value="Full" Onclick="Full()"></td></tr>
|
||||
</table>
|
||||
<script>remplir();</script>
|
||||
</form>
|
||||
|
|
|
|||
Loading…
Reference in a new issue