OSDN Git Service

version 1.00 master
authorT's-Neko <ts-neko@sage-p.com>
Sun, 11 Dec 2016 10:32:58 +0000 (19:32 +0900)
committerT's-Neko <ts-neko@sage-p.com>
Sun, 11 Dec 2016 10:32:58 +0000 (19:32 +0900)
README (日本語).txt [new file with mode: 0644]
README.txt [new file with mode: 0644]
cs_script/Test.txt [new file with mode: 0644]
cs_script/cs-script [new file with mode: 0644]
cs_script/cs_script.bat [new file with mode: 0644]
cs_script/cs_script.png [new file with mode: 0644]
cs_script/cs_script_project.zip [new file with mode: 0644]
cs_script/err.cs [new file with mode: 0644]
cs_script/new.cs [new file with mode: 0644]

diff --git a/README (日本語).txt b/README (日本語).txt
new file mode 100644 (file)
index 0000000..bbd3c31
--- /dev/null
@@ -0,0 +1,56 @@
+=== C# script batch 1.00 ===\r
+\r
+C# \8c¾\8cê\82ð\83X\83N\83\8a\83v\83g\82Ì\82æ\82¤\82É\82·\82®\82É\8eÀ\8ds\82·\82é\83o\83b\83\83t\83@\83C\83\8b\82Å\82·\81B\r
+Windows 7/10 \82Å\83v\83\8a\83C\83\93\83X\83g\81[\83\8b\82³\82ê\82Ä\82¢\82é C# \83R\83\93\83p\83C\83\89\81[\82ð\8eg\82Á\82Ä\8eÀ\8ds\82µ\82Ü\82·\81B\r
+bash (Ubuntu Linux) \82Å\82Í\81Amono \82ð\83C\83\93\83X\83g\81[\83\8b\82µ\82Ä\82­\82¾\82³\82¢\81B\r
+\r
+\r
+C# (.cs) \82Ì\83T\83\93\83v\83\8b\81F Hello, world! \82Æ\95\\8e¦\82µ\82Ü\82·\81B\r
+---------------------------------------------------------\r
+using  s = System;  // Alias "s::"\r
+\r
+class MainClass\r
+{\r
+       static void  Main()\r
+       {\r
+               s::Console.WriteLine( "Hello, world!" );\r
+       }\r
+}\r
+---------------------------------------------------------\r
+\r
+.cs \83t\83@\83C\83\8b\82ð\83_\83u\83\8b\83N\83\8a\83b\83N\82µ\82Ä\81Acs_script.bat \82Å\8aJ\82­\82æ\82¤\82É\90Ý\92è\82µ\82Ä\82­\82¾\82³\82¢\81B\r
+\83o\83b\83`\83t\83@\83C\83\8b\82â WSH (VBScript/JScript) \82Æ\93¯\97l\82É C# \82ð\8eÀ\8ds\82Å\82«\82é\82æ\82¤\82É\82È\82è\82Ü\82·\81B\r
+\90Ý\92è\82µ\82È\82­\82Ä\82à\81A.cs \83t\83@\83C\83\8b\82ð cs_script.bat \82É\83h\83\89\83b\83O\81\95\83h\83\8d\83b\83v\82·\82ê\82Î\8eÀ\8ds\82Å\82«\82Ü\82·\81B\r
+\r
+\81\9a\88«\88Ó\82Ì\82 \82é .cs \83t\83@\83C\83\8b\82ð\8eÀ\8ds\82µ\82È\82¢\82æ\82¤\92\8d\88Ó\82µ\82Ä\82­\82¾\82³\82¢\81I\r
+\r
+\83R\83}\83\93\83\83v\83\8d\83\93\83v\83g\82©\82ç\8eÀ\8ds\82·\82é\82Æ\82«\82Í\81A/c \83I\83v\83V\83\87\83\93\82ð\95t\82¯\82é\82Æ\8fI\97¹\8e\9e\82É\83L\81[\93ü\97Í\82ð\r
+\91Ò\82½\82È\82­\82È\82è\82Ü\82·\81B\r
+\97á\81F\r
+---------------------------------------------------------\r
+cs_script.bat  new.cs  /c  Parameter1\r
+---------------------------------------------------------\r
+\r
+bash \82©\82ç\8eÀ\8ds\82·\82é\82Æ\82«\82Í\81Acs-script \82©\82ç\8eÀ\8ds\82µ\82Ü\82·\81B\r
+\97á\81F\r
+---------------------------------------------------------\r
+./cs-script  new.cs  Parameter1\r
+---------------------------------------------------------\r
+\r
+.cs \83t\83@\83C\83\8b\82É\81A// Debug=on \82Ì\8bL\8fq\82ª\82 \82é\82Æ\81A\83f\83o\83b\83K\81[\82ð\8bN\93®\82µ\82Ü\82·\81B\r
+\82½\82¾\82µ\81AVisual Studio Express 2015 for Windows Desktop \82È\82Ç\82ª\83C\83\93\83X\83g\81[\83\8b\82³\82ê\82Ä\82¢\82Ä\81A\r
+\83\86\81[\83U\81[\82Ì\83h\83L\83\85\83\81\83\93\83\83t\83H\83\8b\83_\81[\82Ì Visual Studio 2015\Projects\cs_script \82É\r
+cs_script_project.zip \82Ì\93à\97e\82ª\93W\8aJ\82³\82ê\82Ä\82¢\82é\95K\97v\82ª\82 \82è\82Ü\82·\81B\r
+\r
+bash \8aÂ\8b«\82Í\81A\83f\83o\83b\83K\81[\82É\91Î\89\9e\82µ\82Ä\82¢\82Ü\82¹\82ñ\81B\r
+\r
+C# \83R\83\93\83p\83C\83\89\81[\82Ì\83o\81[\83W\83\87\83\93\82â\81A\83f\83o\83b\83O\97p\83v\83\8d\83W\83F\83N\83g\82ð\82ð\95Ï\8dX\82·\82é\82Æ\82«\82Í\81A\r
+cs_script.bat \82ð\95Ò\8fW\82µ\82Ä\82­\82¾\82³\82¢\81B\r
+\r
+\r
+cs_script ver 1.00\r
+cs_script is provided under 3-clause BSD license.\r
+Copyright (C) 2016 Sofrware Design Gallery "Sage Plaisir 21" All Rights Reserved.\r
+\r
+\83\\83t\83g\83E\83F\83A\83f\83U\83C\83\93\8aÙ Sage Plaisir 21  http://www.sage-p.com/\r
+\r
diff --git a/README.txt b/README.txt
new file mode 100644 (file)
index 0000000..2bd7e7c
--- /dev/null
@@ -0,0 +1,55 @@
+=== C# script batch 1.00 ===\r
+\r
+This is batch file to execute immediately C# language like scirpt.\r
+It uses C# compiler preinstalled on Windows 7/10.\r
+Please install mono on bash (Ubuntu Linux).\r
+\r
+\r
+Example of C# (.cs) : Shows "Hello, world!".\r
+---------------------------------------------------------\r
+using  s = System;  // Alias "s::"\r
+\r
+class MainClass\r
+{\r
+       static void  Main()\r
+       {\r
+               s::Console.WriteLine( "Hello, world!" );\r
+       }\r
+}\r
+---------------------------------------------------------\r
+\r
+Please set up to open by cs_script.bat, if .cs file was double clicked.\r
+You can execute C# like batch file and WSH (VBScript/JScript).\r
+You can execute by drag and drop .cs file on cs_script.bat, even if you did not set up.\r
+\r
+*** Attention: Don't execute malicious .cs file!\r
+\r
+On command promt, the batch file does not wait for any key input at the end of\r
+.cs file, if command line was specified with /c option.\r
+Example:\r
+---------------------------------------------------------\r
+cs_script.bat  new.cs  /c  Parameter1\r
+---------------------------------------------------------\r
+\r
+On bash, please specify with "cs-script" in your shell.\r
+Example:\r
+---------------------------------------------------------\r
+./cs-script  new.cs  Parameter1\r
+---------------------------------------------------------\r
+\r
+You can connect with debugger, if "// Debug=on" was written in .cs file.\r
+But it is necessary to be installed Visual Studio Express 2015 for Windows Desktop\r
+and so on and be extracted content in cs_script_project.zip\r
+at "Visual Studio 2015\Projects\cs_script" in user document folder.\r
+\r
+On bash, connecting with debugger is not suppored.\r
+\r
+Please edit cs_script.bat, if you change version of C# compiler and\r
+the project for debugging.\r
+\r
+\r
+cs_script ver 1.00\r
+cs_script is provided under 3-clause BSD license.\r
+Copyright (C) 2016 Sofrware Design Gallery "Sage Plaisir 21" All Rights Reserved.\r
+http://www.sage-p.com/\r
+\r
diff --git a/cs_script/Test.txt b/cs_script/Test.txt
new file mode 100644 (file)
index 0000000..debfc2f
--- /dev/null
@@ -0,0 +1,23 @@
+===========================================================================\r
+Title: cs_script.bat on Windows Command Line\r
+\r
+- cs_script.bat  new.cs  /c\r
+- cs_script.bat  new.cs  /c  Parameter1\r
+- cs_script.bat  err.cs  /c\r
+\r
+\r
+===========================================================================\r
+Title: cs_script.bat on Windows Explorer\r
+\r
+- Double click  new.cs\r
+- Double click  err.cs\r
+\r
+\r
+===========================================================================\r
+Title: cs_script.sh on bash\r
+\r
+- ./cs-script  new.cs\r
+- ./cs-script  new.cs  Parameter1\r
+- ./cs-script  err.cs\r
+\r
+\r
diff --git a/cs_script/cs-script b/cs_script/cs-script
new file mode 100644 (file)
index 0000000..3953eb7
--- /dev/null
@@ -0,0 +1,14 @@
+#!/bin/bash
+cs=$1
+exe=${0%/*}/Program.exe
+if [ -e "$exe" ];then
+       rm $exe
+fi
+
+mcs $cs -out:$exe
+
+if [ -e "$exe" ];then
+       shift
+
+       mono $exe $*
+fi
diff --git a/cs_script/cs_script.bat b/cs_script/cs_script.bat
new file mode 100644 (file)
index 0000000..1b6b53e
--- /dev/null
@@ -0,0 +1,58 @@
+@echo off\r
+\r
+set csc=%windir%\Microsoft.NET\Framework\v4.0.30319\csc\r
+set projects=%USERPROFILE%\Documents\Visual Studio 2015\Projects\r
+\r
+if not exist "%~1" ( echo Please drag and drop cs file. & pause & goto :eof )\r
+\r
+find "Debug=on" "%~1" > nul\r
+if errorlevel 1 ( goto :no_debug )\r
+\r
+:debug\r
+       if exist "%projects%\cs_script_now" ( rmdir /S /Q  "%projects%\cs_script_now" )\r
+       mkdir  "%projects%\cs_script_now"\r
+       xcopy /E /Y /Q  "%projects%\cs_script"  "%projects%\cs_script_now" > nul\r
+       @echo on\r
+       copy  "%~1"  "%projects%\cs_script_now\Program.cs" > nul\r
+       @echo off\r
+       echo.\r
+       echo C# \83X\83N\83\8a\83v\83g\82ð\83f\83o\83b\83O\97p\83v\83\8d\83W\83F\83N\83g\82É\83R\83s\81[\82µ\82Ü\82µ\82½\81B\r
+       start "" "%projects%\cs_script_now\ConsoleApplication1.sln"\r
+       echo.\r
+       echo \83f\83o\83b\83K\81[\82ð\8bN\93®\92\86\82Å\82· ...\r
+       echo \8bN\93®\82µ\82½\82ç\81A\95\\8e¦ ^>^> \83\\83\8a\83\85\81[\83V\83\87\83\93 \83G\83N\83X\83v\83\8d\81[\83\89\81[ ^>^> Program.cs \82ð\91I\82ñ\82Å\82­\82¾\82³\82¢\81B\r
+       echo \83f\83o\83b\83K\81[\82ð\95Â\82\82½\82ç\91±\8ds\82µ\82Ä\82­\82¾\82³\82¢\81B\83f\83o\83b\83O\97p\83v\83\8d\83W\83F\83N\83g\82Å\95Ò\8fW\82µ\82½\93à\97e\82ð\8c³\82Ì\8fê\8f\8a\82É\83R\83s\81[\82µ\82Ü\82·\81B\r
+       pause\r
+       @echo on\r
+       copy  "%projects%\cs_script_now\Program.cs"  "%~1"\r
+       @echo off\r
+       echo.\r
+       echo \82±\82Ì\83E\83B\83\93\83h\83E\82Í\95Â\82\82é\82±\82Æ\82ª\82Å\82«\82Ü\82·\81B\r
+       pause > nul\r
+\r
+goto :eof\r
+\r
+: no_debug\r
+       if exist "%projects%\cs_script_now" ( rmdir /S /Q  "%projects%\cs_script_now" )\r
+       mkdir  "%projects%\cs_script_now" > nul\r
+       copy  "%~1"  "%projects%\cs_script_now\Program.cs" > nul\r
+       pushd  "%projects%\cs_script_now"\r
+       "%csc%"  /nologo  "Program.cs" > "%projects%\cs_script_now\build.log"\r
+       popd\r
+\r
+       shift & shift\r
+       set is_cmd=0\r
+       if "%~0" == "/c" ( set is_cmd=1 & shift )\r
+       if exist "%projects%\cs_script_now\Program.exe" (\r
+               "%projects%\cs_script_now\Program.exe"  %0 %1 %2 %3 %4 %5 %6 %7 %8 %9\r
+               if "%is_cmd%" == "0" (\r
+                       echo.\r
+                       echo \82±\82Ì\83E\83B\83\93\83h\83E\82Í\95Â\82\82é\82±\82Æ\82ª\82Å\82«\82Ü\82·\81B\r
+               )\r
+       ) else (\r
+               type  "%projects%\cs_script_now\build.log"\r
+               echo \83R\83\93\83p\83C\83\8b \83G\83\89\81[\82ª\94­\90\82µ\82Ü\82µ\82½\81B\r
+       )\r
+       if "%is_cmd%" == "0" ( pause > nul )\r
+\r
+goto :eof\r
diff --git a/cs_script/cs_script.png b/cs_script/cs_script.png
new file mode 100644 (file)
index 0000000..4368ed7
Binary files /dev/null and b/cs_script/cs_script.png differ
diff --git a/cs_script/cs_script_project.zip b/cs_script/cs_script_project.zip
new file mode 100644 (file)
index 0000000..8f4d817
Binary files /dev/null and b/cs_script/cs_script_project.zip differ
diff --git a/cs_script/err.cs b/cs_script/err.cs
new file mode 100644 (file)
index 0000000..687eaba
--- /dev/null
@@ -0,0 +1,9 @@
+class MainClass\r
+{\r
+       static void  Main()\r
+       {\r
+               Error\r
+       }\r
+}\r
+\r
+\r
diff --git a/cs_script/new.cs b/cs_script/new.cs
new file mode 100644 (file)
index 0000000..836856f
--- /dev/null
@@ -0,0 +1,17 @@
+// Debug=off\r
+using  s = System;  // Alias "s::"\r
+\r
+class MainClass\r
+{\r
+       static void  Main()\r
+       {\r
+               s::Console.WriteLine( "Hello, world!" );\r
+\r
+               // Show a parameter of exe.\r
+               if ( s::Environment.GetCommandLineArgs().Length >= 2 ) {\r
+                       s::Console.WriteLine( s::Environment.GetCommandLineArgs()[1] );\r
+               }\r
+       }\r
+}\r
+\r
+\r