Full Code of secretGeek/dod for AI

master ee90397ecdc3 cached
23 files
49.6 KB
14.0k tokens
17 symbols
1 requests
Download .txt
Repository: secretGeek/dod
Branch: master
Commit: ee90397ecdc3
Files: 23
Total size: 49.6 KB

Directory structure:
gitextract_7mm5_scu/

├── Controllers/
│   ├── Home/
│   │   └── Index.bat
│   ├── _actionMissing.bat
│   └── _controllerMissing.bat
├── Default.aspx
├── Default.aspx.cs
├── DosOnDope.csproj
├── Global.asax
├── Global.asax.cs
├── LICENSE
├── Models/
│   └── split.vbs
├── Properties/
│   └── AssemblyInfo.cs
├── README.md
├── Views/
│   └── Shared/
│       └── _header.bat
├── Web.config
├── docs/
│   ├── GettingStarted.md
│   └── HowDoesItWork.md
├── dope.bat
└── h/
    ├── ToLower.cmd
    ├── a.bat
    ├── h1.bat
    ├── h2.bat
    ├── h3.bat
    └── p.bat

================================================
FILE CONTENTS
================================================

================================================
FILE: Controllers/Home/Index.bat
================================================
@echo off
call ..\..\Views\Shared\_header DoD Congratulations
call ..\..\h\h1 Congratulations
echo [p]You've put [strong]DOS on DOPE[/strong][/p]
echo.
echo [p]Available controllers...[/p]
echo [blockquote]
echo [ul]   
pushd %cd%
cd ..
   FOR /F "delims=~" %%A IN (' DIR /B/a:d') DO (
      echo [li][a href='%%A/']%%A[/a][/li]
   )
echo [/ul]
echo [/blockquote]
echo [p]To Add a controller, navigate to:[/p]
echo [blockquote][pre]%cd%] [/pre][/blockquote]
popd

echo [p]and type:[/p]

echo [blockquote][pre]Dope Controller [em]ControllerName[/em][/pre][/blockquote]
echo.
echo [p]To change this default controller, edit:[/p]
echo [blockquote][pre]"%cd%\Index.bat"[/pre][/blockquote]

echo [p]To create new actions, add batchfiles to this folder, e.g. [/p]
echo [blockquote][pre]%cd%]Copy con About.bat
echo echo [[p]]Hello world![[/p]]
echo [[ctrl-Z]][/pre][/blockquote]




================================================
FILE: Controllers/_actionMissing.bat
================================================
@echo off
call ..\Views\Shared\_header Action Missing
call ..\h\h1 Action Missing
echo [p]Controller = %1[/p]
echo [p]Action = %2[/p]
echo [p]Parameters = %*[/p]
echo [p]Available Actions to GET for this controller...[p]
echo [blockquote][pre]
echo [OL]
   FOR /F "delims=~" %%A IN (' DIR %1\*.bat /B/a:-d') DO (
       echo [A href='%%~nA']%%~nA[/A]
   )
echo [/OL]
echo [/blockquote][/pre]

echo [p]Available Actions to POST for this controller...[p]
echo [blockquote][pre]
echo [OL]
   FOR /F "delims=~" %%A IN (' DIR %1\*.cmd /B/a:-d') DO (
       echo [A href='%%~nA']%%~nA[/A]
   )
echo [/OL]
echo [/blockquote][/pre]

exit 44

================================================
FILE: Controllers/_controllerMissing.bat
================================================
@echo off
call ..\Views\Shared\_header Controller Missing
call ..\h\h1 Controller Missing
echo [p]Controller = %1[/p]
echo [p]Action = %2[/p]
echo [p]Parameters = %*[/p]
echo [p]Available controllers...[/p]
echo [blockquote][pre]
echo [OL]
   FOR /F "delims=~" %%A IN (' DIR /B/a:d') DO (
       echo [A href='%%A/']%%A[/A]
   )
echo [/OL]
echo [/blockquote][/pre]

exit 44

================================================
FILE: Default.aspx
================================================
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="DosOnDope._Default" %>

<%-- Please do not delete this file. It is used to ensure that ASP.NET MVC is activated by IIS when a user makes a "/" request to the server. --%>


================================================
FILE: Default.aspx.cs
================================================
using System.Web;
using System.Web.Mvc;
using System.Web.UI;

namespace DosOnDope
{
    public partial class _Default : Page
    {
        public void Page_Load(object sender, System.EventArgs e)
        {
            HttpContext.Current.RewritePath(Request.ApplicationPath, false);
            IHttpHandler httpHandler = new MvcHttpHandler();
            httpHandler.ProcessRequest(HttpContext.Current);
        }
    }
}


================================================
FILE: DosOnDope.csproj
================================================
<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProductVersion>9.0.21022</ProductVersion>
    <SchemaVersion>2.0</SchemaVersion>
    <ProjectGuid>{80FA3DFC-363C-4B35-AAA5-0FD3C17B8ECB}</ProjectGuid>
    <ProjectTypeGuids>{603c0e0b-db56-11dc-be95-000d561079b0};{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
    <OutputType>Library</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>DosOnDope</RootNamespace>
    <AssemblyName>DosOnDope</AssemblyName>
    <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
    <MvcBuildViews>false</MvcBuildViews>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <OutputPath>bin\</OutputPath>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <OutputPath>bin\</OutputPath>
    <DefineConstants>TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="System" />
    <Reference Include="System.Core">
      <RequiredTargetFramework>3.5</RequiredTargetFramework>
    </Reference>
    <Reference Include="System.Web.Abstractions">
      <RequiredTargetFramework>3.5</RequiredTargetFramework>
    </Reference>
    <Reference Include="System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
    <Reference Include="System.Web.Routing, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
      <SpecificVersion>False</SpecificVersion>
      <HintPath>..\..\..\..\Program Files\Microsoft ASP.NET\ASP.NET MVC RC\Assemblies\System.Web.Routing.dll</HintPath>
      <RequiredTargetFramework>3.5</RequiredTargetFramework>
    </Reference>
    <Reference Include="System.Web" />
    <Reference Include="System.Web.Services" />
  </ItemGroup>
  <ItemGroup>
    <Compile Include="Default.aspx.cs">
      <DependentUpon>Default.aspx</DependentUpon>
      <SubType>ASPXCodeBehind</SubType>
    </Compile>
    <Compile Include="Global.asax.cs">
      <DependentUpon>Global.asax</DependentUpon>
    </Compile>
    <Compile Include="Properties\AssemblyInfo.cs" />
  </ItemGroup>
  <ItemGroup>
    <Content Include="Content\Logo.png" />
    <Content Include="Default.aspx" />
    <Content Include="favicon.ico" />
    <Content Include="Global.asax" />
    <Content Include="Web.config" />
  </ItemGroup>
  <ItemGroup>
    <None Include="Controllers\Blog\add.bat" />
    <None Include="Controllers\Blog\add.cmd" />
    <None Include="Controllers\Blog\Index.bat" />
    <None Include="Controllers\Blog\view.bat" />
    <Content Include="Content\li.png" />
    <Content Include="Controllers\Home\Index.bat" />
    <Content Include="Controllers\_actionMissing.bat" />
    <Content Include="Controllers\_controllerMissing.bat" />
    <Content Include="dope.bat" />
    <Content Include="h\a.bat" />
    <Content Include="h\h1.bat" />
    <Content Include="h\h2.bat" />
    <Content Include="h\h3.bat" />
    <Content Include="h\p.bat" />
    <None Include="Models\Posts.csv" />
    <Content Include="Models\split.vbs" />
    <Content Include="Views\Shared\_header.bat" />
  </ItemGroup>
  <ItemGroup>
    <Folder Include="Views\Home\" />
  </ItemGroup>
  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
  <Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v9.0\WebApplications\Microsoft.WebApplication.targets" />
  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
       Other similar extension points exist, see Microsoft.Common.targets.
  <Target Name="BeforeBuild">
  </Target> -->
  <Target Name="AfterBuild" Condition="'$(MvcBuildViews)'=='true'">
    <AspNetCompiler VirtualPath="temp" PhysicalPath="$(ProjectDir)\..\$(ProjectName)" />
  </Target>
  <ProjectExtensions>
    <VisualStudio>
      <FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
        <WebProjectProperties>
          <UseIIS>False</UseIIS>
          <AutoAssignPort>True</AutoAssignPort>
          <DevelopmentServerPort>11835</DevelopmentServerPort>
          <DevelopmentServerVPath>/</DevelopmentServerVPath>
          <IISUrl>
          </IISUrl>
          <NTLMAuthentication>False</NTLMAuthentication>
          <SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile>
        </WebProjectProperties>
      </FlavorProperties>
    </VisualStudio>
  </ProjectExtensions>
</Project>

================================================
FILE: Global.asax
================================================
<%@ Application Codebehind="Global.asax.cs" Inherits="DosOnDope.MvcApplication" Language="C#" %>


================================================
FILE: Global.asax.cs
================================================
using System;
using System.Diagnostics;
using System.IO;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;

namespace DosOnDope
{
    public class MvcApplication : System.Web.HttpApplication
    {
        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
            routes.IgnoreRoute("favicon.ico");
            routes.IgnoreRoute("Content/{*pathInfo}");

            routes.Add(new Route("{controller}/{action}/{*id}", new DosOnDopeRouteHandler())
            {
                Defaults = new RouteValueDictionary(new
                {
                    controller = "Home",
                    action = "Index",
                    id = ""
                })
            });
        }

        protected void Application_Start()
        {
            RegisterRoutes(RouteTable.Routes);
        }
    }

    public class DosOnDopeRouteHandler : IRouteHandler
    {
        public IHttpHandler GetHttpHandler(RequestContext requestContext)
        {
            return new DosOnDopeHttpHandler(requestContext);
        }
    }

    public class DosOnDopeHttpHandler : IHttpHandler
    {
        public RequestContext requestContext { get; set; }
        public DosOnDopeHttpHandler(RequestContext requestContext)
        {
            this.requestContext = requestContext;
        }
        
        public bool IsReusable {get { return false; } }

        public void ProcessRequest(HttpContext context)
        {
            var controller = this.requestContext.RouteData.Values["controller"] as string;
            var action = this.requestContext.RouteData.Values["action"] as string;
            string[] args = { this.requestContext.RouteData.Values["id"] as string };
            int httpStatus;
            if (context.Request.RequestType == "POST")
            {
                var result = Execute(controller, action, context.Request.Form.ToString().Split('&'), out httpStatus, true);
                if (httpStatus == 301)
                    context.Response.Redirect(result.Trim("\r\n".ToCharArray()));
                else
                    context.Response.Write(result);                
            }
            else
            {
                context.Response.Write(Execute(controller, action, args, out httpStatus, false ));      
            }
            context.Response.StatusCode = httpStatus;
        }

        public string Execute(string controllerName, string actionName, string[] newArgs, out int httpStatus, bool isPost)
        {
            var controllerPath = Path.Combine(requestContext.HttpContext.Server.MapPath("~/Controllers"), controllerName);

            if (!Directory.Exists(controllerPath))
            {
                return ControllerNotFound(controllerName, actionName, newArgs, out httpStatus, isPost);
            }

            var actionFileName = Path.Combine(controllerPath, actionName + ".bat");

            if (!File.Exists(actionFileName))
            {
                return ActionNotFound(controllerName, actionName, newArgs, out httpStatus, isPost);
            }
            
            return Execute(controllerPath, actionName, Join(" ", newArgs), out httpStatus, isPost);
        }

        private string Execute(string path, string file, string args, out int httpStatus, bool isPost)
        {
            var errorLevel = 50;
            var result = string.Empty;

            using (var proc = new Process())
            {
                proc.EnableRaisingEvents = false;

                proc.StartInfo.FileName = Path.Combine(path, file + (isPost? ".cmd" : ".bat"));
                if (args != null)
                {
                    proc.StartInfo.Arguments = args;
                }
                proc.StartInfo.WorkingDirectory = path;
                proc.StartInfo.UseShellExecute = false;
                proc.StartInfo.CreateNoWindow = true;// false;
                proc.StartInfo.RedirectStandardOutput = true;
                proc.Start();
                string output = proc.StandardOutput.ReadToEnd();
                result = Dope(output);
                proc.WaitForExit();
                errorLevel = proc.ExitCode;
            }
            httpStatus = ConvertErrorlevelToHttpStatus(errorLevel);
            return result;
        }

        private string ActionNotFound(string controllerName, string actionName, string[] newArgs, out int httpStatus, bool isPost)
        {
            var controllerPath = Path.Combine(requestContext.HttpContext.Server.MapPath("~/Controllers"), controllerName);

            if (!File.Exists(Path.Combine(controllerPath, "_actionMissing" + ".bat")))
            {
                controllerPath = requestContext.HttpContext.Server.MapPath("~/Controllers");
            }

            return Execute(controllerPath, "_ActionMissing", controllerName + " " + actionName + " " + Join(" ", newArgs), out httpStatus, false);
        }

        private string ControllerNotFound(string controllerName, string actionName, string[] newArgs, out int httpStatus, bool isPost)
        {
            var controllerPath = requestContext.HttpContext.Server.MapPath("~/Controllers");
            return Execute(controllerPath, "_ControllerMissing", controllerName + " " + actionName + " " + Join(" ", newArgs), out httpStatus, false);
        }


        private int ConvertErrorlevelToHttpStatus(int errorLevel)
        {
            if (errorLevel == 0) return 200;
            return ((errorLevel / 10) * 100) + (errorLevel % 10);
        }


        private string Join(string separator, params string[] strings)
        {
            if (strings == null) return string.Empty;
            return string.Join(separator, strings);
        }

        /// <summary>
        /// Dopes the input.
        /// i.e:
        ///   Turns square brackets into angle brackets
        ///   Turns pluses into spaces.
        ///   Escapes angle brackets
        ///   Turns escaped square brackets into regular square brackets
        ///   Turns url encoded CR/LF into spaces
        /// </summary>
        /// <param name="undoped">The undoped.</param>
        /// <returns></returns>
        private string Dope(string undoped)
        {
            if (undoped.IndexOf("[[") >= 0 || undoped.IndexOf("]]") >= 0)
            {
                var gOpen = Guid.NewGuid().ToString();
                var gClose = Guid.NewGuid().ToString();
                undoped = undoped.Replace("[[", gOpen).Replace("]]", gClose);
                undoped = Dope(undoped);
                return undoped.Replace(gOpen, "[").Replace(gClose, "]");
            }
            return undoped.Replace("<","&lt").Replace(">","&gt;").Replace("[", "<").Replace("]", ">").Replace("+"," ").Replace("%0d"," ").Replace("%0a"," ");
        }
    }
}

================================================
FILE: LICENSE
================================================
The MIT License (MIT)

Copyright (c) 2010-2024 secretGeek

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.


================================================
FILE: Models/split.vbs
================================================
Set objFS = CreateObject("Scripting.FileSystemObject") 
Set objArgs = WScript.Arguments 
str1 = objArgs(0) 
s=Split(str1,"`") 
For i=LBound(s) To UBound(s) 
    WScript.Echo s(i) 
    ' WScript.Echo s(9) ' get the 10th element 
Next 

================================================
FILE: Properties/AssemblyInfo.cs
================================================
using System.Reflection;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following 
// set of mad attributes. Change these attribute values to modify the information
// associated with an assembly. If. You. Dare.
[assembly: AssemblyTitle("DosOnDope")]
[assembly: AssemblyDescription("Built with DosOnDope")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("secretGeek")]
[assembly: AssemblyProduct("DosOnDope")]
[assembly: AssemblyCopyright("Copyright © Leon Bambrick 2010")]
[assembly: AssemblyTrademark("DosOnDope")]
[assembly: AssemblyCulture("")]

// COM is for old people.
[assembly: ComVisible(false)]

// This is my GUID. Mess with it: and I will hurt your face.
[assembly: Guid("667ff6b2-8224-45e2-b13d-0d02685520a3")]

// Version information for an assembly consists of the following five values:
//
//      Major Version
//      Minor Version 
//      Guild Number
//      Karma points
//      Revision
//
// You can specify all the values or you can default the Revision and Build Numbers 
// by using the '*' wild-card. Are you wild? I'm not wild. I program.
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

================================================
FILE: README.md
================================================
# DOS on DOPE

![logo](docs/Dos_on_Dope_Logo.png)


*The last MVC Web framework you'll ever need*

When you've done everything you can with [Ruby On Rails](http://rubyonrails.org/)

When you've reached the limits of *Haskell on a Horse* and *Cobol on Cogs*...

It's time to meet _the MVC Web Framework to end all MVC Web frameworks._

## DOS on DOPE is the modern MVC framework built on the awesome power of batch files.

All of the controllers in DoD are batch files.

All of the views are batch files.

The model is based on batch files. The helper functions are... you guessed it! Beautiful batch files!

(Okay, I'm no purist. There's a few lines of C# for url routing and batch file execution. Everything else is either a .bat or a .cmd file. With a liberal helping of .csv mixed in.)

# [Getting Started](docs/GettingStarted.md)

_See how to build a site in just seconds!_

## [How Does It Work?](docs/HowDoesItWork.md)

_Look behind the curtain to see how the magic is made_

### [Introduction at secretGeek](http://secretgeek.net/dod_intro)


![you've put dos on dope](docs/Home_dod_congrats.png)



================================================
FILE: Views/Shared/_header.bat
================================================
@echo off
echo [html]
echo [head]
echo [style]body{background-color:#000;color:#C0C0C0;font-family:"fixed sys","Lucida console",monospace}input,textarea{background-color:#222;color:#FFF}h1,h2,h3,h4{font-size:medium}h1{color:white}strong{font-size:medium;color:yellow}pre{font-family:"fixed sys","Lucida console"}em{font-style:normal;color:#808080}ul{list-style-image: url(Content/li.png);}a{text-decoration:none;color:008080}[/style]

IF x"%*"==x""  	GOTO DEFAULT

echo [title]%*[/title]

goto END

:DEFAULT
echo [title]DosOnDope[/title]
goto END

:END
echo [/head]
echo [body]
echo [img src='Content/Logo.png' style='float:right' /]

================================================
FILE: Web.config
================================================
<?xml version="1.0"?>
<!-- 
    Note: As an alternative to hand editing this file you can use the 
    web admin tool to configure settings for your application. Use
    the Website->Asp.Net Configuration option in Visual Studio.
    A full list of settings and comments can be found in 
    machine.config.comments usually located in 
    \Windows\Microsoft.Net\Framework\v2.x\Config 
-->
<configuration>
	<configSections>
		<sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
			<sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
				<section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
				<sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
					<section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="Everywhere"/>
					<section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
					<section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
					<section name="roleService" type="System.Web.Configuration.ScriptingRoleServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
				</sectionGroup>
			</sectionGroup>
		</sectionGroup>
	</configSections>
	<appSettings/>
	<connectionStrings>
		<add name="ApplicationServices" connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=true" providerName="System.Data.SqlClient"/>
	</connectionStrings>
	<system.web>
		<!-- 
            Set compilation debug="true" to insert debugging 
            symbols into the compiled page. Because this 
            affects performance, set this value to true only 
            during development.
    -->
		<compilation debug="true">
			<assemblies>
				<add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
				<add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
				<add assembly="System.Web.Abstractions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
				<add assembly="System.Web.Routing, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
				<add assembly="System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
				<add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
				<add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
				<add assembly="System.Data.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
			</assemblies>
		</compilation>
		<!--
            The <authentication> section enables configuration 
            of the security authentication mode used by 
            ASP.NET to identify an incoming user. 
    -->
		<authentication mode="Forms">
			<forms loginUrl="~/Account/Login"/>
		</authentication>
		<membership>
			<providers>
				<clear/>
				<add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" connectionStringName="ApplicationServices" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" passwordFormat="Hashed" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" passwordStrengthRegularExpression="" applicationName="/"/>
			</providers>
		</membership>
		<profile>
			<providers>
				<clear/>
				<add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" connectionStringName="ApplicationServices" applicationName="/"/>
			</providers>
		</profile>
		<roleManager enabled="false">
			<providers>
				<clear/>
				<add connectionStringName="ApplicationServices" applicationName="/" name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
				<add applicationName="/" name="AspNetWindowsTokenRoleProvider" type="System.Web.Security.WindowsTokenRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
			</providers>
		</roleManager>
		<!--
            The <customErrors> section enables configuration 
            of what to do if/when an unhandled error occurs 
            during the execution of a request. Specifically, 
            it enables developers to configure html error pages 
            to be displayed in place of a error stack trace.

        <customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
            <error statusCode="403" redirect="NoAccess.htm" />
            <error statusCode="404" redirect="FileNotFound.htm" />
        </customErrors>
    -->
		<pages>
			<controls>
				<add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
				<add tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
			</controls>
			<namespaces>
				<add namespace="System.Web.Mvc"/>
				<add namespace="System.Web.Mvc.Ajax"/>
				<add namespace="System.Web.Mvc.Html"/>
				<add namespace="System.Web.Routing"/>
				<add namespace="System.Linq"/>
				<add namespace="System.Collections.Generic"/>
			</namespaces>
		</pages>
		<httpHandlers>
			<remove verb="*" path="*.asmx"/>
			<add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
			<add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
			<add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false"/>
			<add verb="*" path="*.mvc" validate="false" type="System.Web.Mvc.MvcHttpHandler, System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
		</httpHandlers>
		<httpModules>
			<add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
			<add name="UrlRoutingModule" type="System.Web.Routing.UrlRoutingModule, System.Web.Routing, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
		</httpModules>
	</system.web>
	<system.codedom>
		<compilers>
			<compiler language="c#;cs;csharp" extension=".cs" warningLevel="4" type="Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
				<providerOption name="CompilerVersion" value="v3.5"/>
				<providerOption name="WarnAsError" value="false"/>
			</compiler>
			<compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" warningLevel="4" type="Microsoft.VisualBasic.VBCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
				<providerOption name="CompilerVersion" value="v3.5"/>
				<providerOption name="OptionInfer" value="true"/>
				<providerOption name="WarnAsError" value="false"/>
			</compiler>
		</compilers>
	</system.codedom>
	<system.web.extensions/>
	<!-- 
        The system.webServer section is required for running ASP.NET AJAX under Internet
        Information Services 7.0.  It is not necessary for previous version of IIS.
  -->
	<system.webServer>
		<validation validateIntegratedModeConfiguration="false"/>
		<modules runAllManagedModulesForAllRequests="true">
			<remove name="ScriptModule"/>
			<remove name="UrlRoutingModule"/>
			<add name="ScriptModule" preCondition="managedHandler" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
			<add name="UrlRoutingModule" type="System.Web.Routing.UrlRoutingModule, System.Web.Routing, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
		</modules>
		<handlers>
			<remove name="WebServiceHandlerFactory-Integrated"/>
			<remove name="ScriptHandlerFactory"/>
			<remove name="ScriptHandlerFactoryAppServices"/>
			<remove name="ScriptResource"/>
			<remove name="MvcHttpHandler"/>
			<remove name="UrlRoutingHandler"/>
			<add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
			<add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
			<add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
			<add name="MvcHttpHandler" preCondition="integratedMode" verb="*" path="*.mvc" type="System.Web.Mvc.MvcHttpHandler, System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
			<add name="UrlRoutingHandler" preCondition="integratedMode" verb="*" path="UrlRouting.axd" type="System.Web.HttpForbiddenHandler, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
		</handlers>
	</system.webServer>
</configuration>


================================================
FILE: docs/GettingStarted.md
================================================
# Getting started

To get started open a `cmd` window.
If you're not familiar with a `cmd` window, you soon will be. ;-)

Make sure `dope.bat` file is in your `PATH`.
If you're not familiar with your `PATH`, you soon will be.  Wait a second. Read this 'Quick tip,'


## QuickTip: Adding dope to your path
If `dope.bat` is in the folder `C:\DoD` then type this:

    PATH=%PATH%;c:\DoD;

`dope` will then be in your path.


# Create a web application

Okay. Moving on. 
First step, navigate to a folder where you want to create your web application.
e.g.

    C:\>cd Temp
    C:\Temp>

Temp is a great place to do all your work. It implies the kind of permanence that a Dos On Dope project deserves. 

**To create a site called `Blog` we use the 
`dope` command. It's as simple as this:**


    C:\Temp>dope site Blog

Time for another quick tip:

## QuickTip: Help from the Command Line

Issue the `dope` command (i.e. call `dope.bat`) without any parameters, to get help. 

For help with a particular command, try `dope help _commandname_`,
e.g.

    dope help site


# Wrestling with IIS

IIS is a little hard to control from the console, so you'll need to open IIS manager and register your site manually. Read the sidebar about how to do that.

*(If we were using apache, tomcat or webrick we'd be able to do this from the command-line with ease.  If I took this project more seriously, I would have written a custom DOS-based web-server. But then I guess I would've been an even more depraved individual, so for now we're stuck with IIS.)*

 
## QuickTip: Registering Manually with IIS

Add a virtual directory under the `Default Web Site`
Then right click and 'convert to application'
Browse to the newly created application. 


# Did that work??

Let's check in a browser that our new site is built.

![congrats](GettingStarted_dod_congrats.png)

Oops. It worked. We're up and running.

# Exploring our new app

It's generated the complete skeleton of the application. Here's what we see in the console:

![blog](GettingStarted_dope_site_blog_.png)

Let's see what's been created for us. We now have these folders:


    C:\temp\blog>dir /s/a:d/b
    C:\temp\blog\Content
    C:\temp\blog\Controllers
    C:\temp\blog\h
    C:\temp\blog\Models
    C:\temp\blog\Scripts
    C:\temp\blog\Views
    C:\temp\blog\Controllers\Home
    C:\temp\blog\Views\Shared

And these files:

    C:\temp\blog>dir /s/a:-d/b
    C:\temp\blog\Default.aspx
    C:\temp\blog\favicon.ico
    C:\temp\blog\Global.asax
    C:\temp\blog\web.config
    C:\temp\blog\Content\Site.css
    C:\temp\blog\Content\li.png
    C:\temp\blog\Content\Logo.png
    C:\temp\blog\Controllers\_actionMissing.bat
    C:\temp\blog\Controllers\_controllerMissing.bat
    C:\temp\blog\Controllers\Home\Index.bat
    C:\temp\blog\h\a.bat
    C:\temp\blog\h\h1.bat
    C:\temp\blog\h\h2.bat
    C:\temp\blog\h\h3.bat
    C:\temp\blog\h\p.bat
    C:\temp\blog\Models\split.vbs
    C:\temp\blog\Views\Shared\_header.bat

All the files you need for a modern MVC application. Built on batch files.

We have our site, and it shows the starting application. Let's create a new controller action, and see that it renders as expected..

![action](GettingStarted_about_action.png)


# Making it betterer

In this case, our batch file is basically a series of echo statements that write html to the screen. Instead of angle brackets we use square brackets. (This is because DOS uses angle brackets for re-direction.)

We can do a little better than that. 

We can apply a theme by including a 'partial' view, called `_header.bat.`

And we can use helper methods to create clean markup.

![improved](GettingStarted_about_improved.png)


Now, let's create a location for holding our data.

In DoD we embrace the NoSQL movement and jump straight to the data-store of the future: a CSV file.

    C:\temp>CD Blog\Models
    C:\temp\Blog\Models>copy con Posts.csv
    ID`Title`Article
    ^Z


`Posts.csv` is both the model that describes our data, and the store which will contain the data itself.

(We use back-ticks rather than commas, so that there's no need to qualify our data with double-quotes. Back-ticks can never ever appear in real data in the wild, so this is perfectly safe forever.)

Now we can generate actions for administering our Posts. This is similar to the 'scaffolding' feature of Ruby On Rails.

    C:\temp\blog\Models>dope gen Post
    Generating actions for MODEL Post in Controller Home...


Now, if we look in the Home controller we see four batch files that have been created.

    C:\temp\blog\Controllers\Home>dir /b
    add.bat
    add.cmd
    Index.bat
    view.bat

Notice there is an `add.bat` as well as an `add.cmd`. What's the difference? 

# The secret behind DoD... shhh... don't tell anyone.....

**In DosOnDope, `GET` verbs are handled by Batch files (.bat), while `POST` verbs are handled by `.cmd` files.**

Let's see what they look like. We browse to see the add action:

![home add](GettingStarted_dod_home_add.png)

The generator has created a nice page for us, with a name and textbox for every field, so we can create new posts.

We enter some details...

![home adding](GettingStarted_dod_home_adding.png)

...click submit and see what happens.


![home index](GettingStarted_dod_home_index.png)

We're back at the index page. But now it's a list of all the articles. There's only one for now. 

Let's see what it looks like if we've added another article:

![home index](GettingStarted_dod_home_index_2.png)

Behind the scenes when we pressed 'submit' the Http-Post was handled by `add.cmd` which unpacked the form variables and added the details to the file Posts.csv

    C:\temp\blog\Models>type Posts.csv
    ID`Title`Article
    1`Hello Brazil!`Yes, yes, hello indeed!
    2`Let's add a second for good measure`Oh yeah

That's about it. We've demonstrated all the components you need to make wonderful apps. 

Best of luck. I hope dope is good to you.

Now you might want to read about [How does it work?](HowDoesItWork.md)

Are you look for David? David is not here currently. Man.

Maybe go and read some of the stuff at [secretGeek](http://secretGeek.net)




================================================
FILE: docs/HowDoesItWork.md
================================================
# How does it work? 
## How *does* it work!?
## HOW does IT work!?
## (how can it work?)

In DosOnDope all URLs are constructed like this:

`http://YourSite.com/Controller/Action/*id`

Where:

 * `"Controller"` is the name of a **folder** in the Controllers folder.
 * `"Action"` is the name of a **batch file** in the relevant controller folder.
 * `"*id"` is an optional set of **parameters** passed to the batch file.

(Turning a URL into a batch file call is performed by a custom C# router, `DosOnDopeRouteHandler` which hands off to the http handler `DosOnDopeHttpHandler`)

If the subfolder "`Controller`" in the `Controllers` folder is not found, `_controllerMissing.bat` is called.

This is the default `_controllerMissing` batch file included in every DosOnDope application. It sits in the `Controllers` folder. It returns a web page telling you what controllers are available, and you will usually customize it to suit your own purposes.

If there is no batch file matching the name of the `action` that was called, then the `_actionMissing` batch file is executed.

This is the default `_actionMissing` batch file included in every DosOnDope application. It returns a web page telling you what actions are available for the controller you requested. You are free to customize it however you wish.

* If the request is a `GET` method, the handler looks for a `.bat` batch file.
* If the request is a `POST` method, the handler looks for a `.cmd` batch file. 

So for example a `GET` request to `http://YourSite.com/Blog/Add` would cause the handler to execute a batch file located at

	C:\Temp\YourSite\Controllers\Blog\Add.bat

A `POST` to `http://YourSite.com/Blog/Add` would cause the handler to execute a batch file located at:

	C:\Temp\YourSite\Controllers\Blog\Add.cmd

A `GET` to `http://YourSite.com/Blog/View/Yes` would cause the handler to execute a batch file `View.bat` with the parameter "Yes"

	C:\Temp\YourSite\Controllers\Blog\View.bat Yes

So, inside the `View.bat` script, you could say:

	@echo [p]Hello! You said %1.[/p]
Which would be converted into:

	<p>Hello! You said Yes.</p>

And be rendered by a browser as:

> Hello! You said Yes.

(By the way, echoing user input from a URL to the screen is a very safe and wise thing to do. Do that any chance you can.)

Why not read about [Getting started](GettingStarted.md)

Dave's not here currently. Man. etc.

Maybe read the original blog post about this nonsense at [secretGeek: dos on dope](http://secretgeek.net/dod_intro)



================================================
FILE: dope.bat
================================================
@echo off

SET LOCN="%~dp0"

if x'%2'==x'/?' goto COMMAND_HELP
if x'%2'==x'?'goto COMMAND_HELP
if x'%2'==x'-?'goto COMMAND_HELP
if x'%2'==x'--?'goto COMMAND_HELP

if x'%1'==x'' goto UNKNOWN
if '%1'=='site' goto SITE
if '%1'=='controller' goto CONTROLLER
if '%1'=='gen' goto GEN
if '%1'=='help' goto HELP
if '%1'=='?' goto HELP
if '%1'=='/?' goto HELP
if '%1'=='-?' goto HELP
if '%1'=='--?' goto HELP
if '%1'=='SITE' goto SITE
if '%1'=='CONTROLLER' goto CONTROLLER
if '%1'=='GEN' goto GEN
if '%1'=='HELP' goto HELP
if '%1'=='Help' goto HELP

goto UNKNOWN

:COMMAND_HELP
if '%1'=='site' goto HELP_SITE
if '%1'=='controller' goto HELP_CONTROLLER
if '%1'=='model' goto HELP_MODEL
if '%1'=='gen' goto HELP_GEN
if '%1'=='help' goto HELP
if '%1'=='SITE' goto HELP_SITE
if '%1'=='CONTROLLER' goto HELP_CONTROLLER
if '%1'=='MODEL' goto HELP_MODEL
if '%1'=='GEN' goto HELP_GEN
if '%1'=='HELP' goto HELP

ECHO Unknown command %1
GOTO HELP

:HELP_SITE

echo dope SITE [[name]] 
echo   will create a SITE named 'name'
echo   in the current folder.
echo e.g:
echo dope SITE Blog
echo   will create a site named 'Blog'
echo.
echo The site will, by default, include
echo sufficient files (styles, helpers etc)
echo to get you started.
echo.
echo A good next step is to create a controller
echo using the 'dope CONTROLLER' command

goto EXIT
:HELP_CONTROLLER

echo dope CONTROLLER [[name]] 
echo   Create a CONTROLLER named 'name'
echo   in the SITE\Controllers\ folder
echo e.g.
echo dope CONTROLLER About
echo   Creates a controller folder named 'About'
echo   in the current site's 'Controllers' folder
echo   containing a default action, 'Index.bat'
echo   To navigate to the new action goto
echo     http://YourSite/About/
echo   or 
echo     http://YourSite/About/Index
echo.
echo To create more actions, navigate into
echo the newly created folder and create more
echo batch files. No wiring required.
goto EXIT
:HELP_GEN

echo dope GEN [[name]] [[controller]]
echo   Generate actions for the model named 'name'
echo   (singular) in the controller specified.
echo.
echo (The controller name is optional. If no 
echo controller is specified, the default 
echo controller, 'home', will be used.)
echo.
echo Before generating the actions, you need
echo to create the model file.
goto HELP_MODEL


goto EXIT

:HELP_MODEL
echo.
echo A model file is a CSV file in the models
echo folder. The first line of the file is a 
echo lists of fields, separated with backtick `
echo characters, e.g. Emails.csv might contain:
echo ID`FirstName`LastName`Age`Email
echo. 
echo The file name is plural.

goto EXIT
:SITE
echo Creating SITE... %2
if not exist %2 MD %2
echo ...Created Content folder (for CSS and images)
if not exist %2\Content MD %2\Content
echo ...Created Controllers folder (for Controllers)
if not exist %2\Controllers MD %2\Controllers
echo ...Created Controllers\Home folder (Default Controller)
if not exist %2\Controllers\Home MD %2\Controllers\Home
echo ...Created h folder (for html helpers)
if not exist %2\h MD %2\h
echo ...Created Models folder (for Models)
if not exist %2\Models MD %2\Models
echo ...Created Scripts folder (for javascript)
if not exist %2\Scripts MD %2\Scripts
echo ...Created Views folder (for views)
if not exist %2\Views MD %2\Views
echo ...Created Views\Shared folder (for Shared views)
if not exist %2\Views\Shared MD %2\Views\Shared
echo ...Created bin folder 
if not exist %2\bin MD %2\bin

echo ...adding Web.config
Copy %LOCN%Web.config %2%\web.config

echo ...adding Default.aspx
Copy %LOCN%Default.aspx %2%\Default.aspx

echo ...adding Global.asax
Copy %LOCN%Global.asax %2%\Global.asax

echo ...adding logo and favicon
Copy %LOCN%Content\logo.png %2%\Content\logo.png
Copy %LOCN%Content\li.png %2%\Content\li.png
Copy %LOCN%favicon.ico %2%\favicon.ico

echo ...adding partial for header 
Copy %LOCN%Views\Shared\_header.bat %2%\Views\Shared\_header.bat

echo ...adding handlers for 'action missing' and 'controller missing'
Copy %LOCN%Controllers\_actionMissing.bat %2%\Controllers\_actionMissing.bat
Copy %LOCN%Controllers\_controllerMissing.bat %2%\Controllers\_controllerMissing.bat

echo ...adding default action (Index)
Copy %LOCN%Controllers\Home\Index.bat %2%\Controllers\Home\Index.bat

echo ...adding binaries
Copy %LOCN%bin\*.dll %2%\bin\


echo ...adding html helper functions
Copy %LOCN%h\*.bat %2%\h\

echo Registering http://localhost/%2 with webserver

echo SITE created.

goto EXIT

:CONTROLLER

REM First determine our location... tricky!

pushd %cd%

if NOT EXIST ..\Controllers goto NOT_IN_CONTROLLERS
if NOT EXIST ..\Models goto NOT_IN_CONTROLLERS
if NOT EXIST ..\Views goto NOT_IN_CONTROLLERS

cd ..\Controllers

goto Make_Controller

:NOT_IN_CONTROLLERS

if EXIST Controllers goto IN_ROOT
if EXIST Models goto IN_ROOT
if EXIST Views goto IN_ROOT

ECHO This command must be run from the root
ECHO of your website, or from the Controllers
ECHO folder. 
popd 
goto :EOF

goto Make_Controller

:IN_ROOT

cd Controllers
goto Make_Controller

:Make_Controller

echo Creating CONTROLLER %2...
IF NOT EXIST %2 md %2

echo Creating default action (index.bat)...

Copy %LOCN%\Controllers\Home\Index.bat %2%\Index.bat

popd

goto EXIT

:GEN


SET controller=%3
if x%3==x SET controller=Home


echo Generating actions for MODEL %2 in Controller %controller%...

REM First determine our location... tricky!

pushd %cd%

if NOT EXIST ..\..\Controllers goto KeepLooking
if NOT EXIST ..\..\Models goto KeepLooking
if NOT EXIST ..\..\Views goto KeepLooking

cd ..\..\Models

goto Gen_Model

:KeepLooking

if NOT EXIST ..\Controllers goto NOT_IN_MODELS
if NOT EXIST ..\Models goto NOT_IN_MODELS
if NOT EXIST ..\Views goto NOT_IN_MODELS

cd ..\Models

goto Gen_Model

:NOT_IN_MODELS

if EXIST Controllers goto IN_ROOT2
if EXIST Models goto IN_ROOT2
if EXIST Views goto IN_ROOT2

ECHO This command must be run from the root
ECHO of your website, or from the Models
ECHO or Controllers folder

popd 

goto :EOF

goto Gen_Model

:IN_ROOT2

cd Models

goto Gen_Model

:Gen_Model

FOR /F "eol=; tokens=1,* delims=`" %%A in (%2s.csv)  DO (
  (SET FIELDS=%%B)
  GOTO DETAILS
)

:DETAILS

cscript /nologo split.vbs %FIELDS% > "%2s.fields"

echo @echo off > ..\Controllers\%controller%\add.bat
echo call ..\..\Views\Shared\_header New %2 >> ..\Controllers\%controller%\add.bat
echo call ..\..\h\h1 New %2 >> ..\Controllers\%controller%\add.bat
echo echo [form method='POST' action='add'] >> ..\Controllers\%controller%\add.bat
echo echo [input type='hidden' id='title' name='ID' value='%2'][/input] >> ..\Controllers\%controller%\add.bat

SET /A ID=1
SET outy=".."
for /F %%C in (%2s.fields) do (
  echo echo %%C >> ..\Controllers\%controller%\add.bat
  echo echo [br /] >> ..\Controllers\%controller%\add.bat
  echo echo [input type='textbox' id='%%C' name='%%C' value='%2' style='width:350px'][/input] >> ..\Controllers\%controller%\add.bat
  echo echo [br /] >> ..\Controllers\%controller%\add.bat
  SET /A ID=%ID+1
  (SET outy=%outy%+""+%ID%)
)

echo echo [input type='submit' value='submit' /] >> ..\Controllers\%controller%\add.bat
echo echo [/form] >> ..\Controllers\%controller%\add.bat
echo echo [hr /] >> ..\Controllers\%controller%\add.bat
echo echo [a href='index']back[/a] >> ..\Controllers\%controller%\add.bat

echo @echo off > ..\Controllers\%controller%\add.cmd
echo REM Determine the next ID value... >> ..\Controllers\%controller%\add.cmd 
echo SET /A ID=1 >> ..\Controllers\%controller%\add.cmd 
echo FOR /F "eol=; tokens=1,2,3,* skip=1 delims=`" %%%%i in (..\..\Models\Posts.csv) do ( >> ..\Controllers\%controller%\add.cmd 
echo   (SET /A ID=%%ID+1) >> ..\Controllers\%controller%\add.cmd 
echo ) >> ..\Controllers\%controller%\add.cmd 

set rst=%%ID%%
SET /A UPPER=(%ID%-1)*2+1

for /L %%i in (3,2,%UPPER%) do call :Loop2 %%i 

goto :EchoResults
:Loop2
Set RST=%RST%`%%~%1
goto :EOF

:EchoResults
echo ECHO %RST% ^>^> ..\..\Models\%2s.csv >> ..\Controllers\%controller%\add.cmd
echo ECHO View/%%ID%% >> ..\Controllers\%controller%\add.cmd 
echo EXIT 31 >> ..\Controllers\%controller%\add.cmd 

echo @echo off > ..\Controllers\%controller%\view.bat
echo IF x"%%1"==x"" GOTO EMPTY >> ..\Controllers\%controller%\view.bat
echo FOR /F "eol=; tokens=1-20 skip=1 delims=`" %%%%1 in (..\..\Models\%2s.csv) do ( >> ..\Controllers\%controller%\view.bat
echo   IF %%%%1==%%1 ( >> ..\Controllers\%controller%\view.bat
echo     call ..\..\Views\Shared\_header %%%%2 >> ..\Controllers\%controller%\view.bat
echo     call ..\..\h\h1 %%%%2 >> ..\Controllers\%controller%\view.bat
for /L %%i in (3,1,%ID%) do (
echo     ECHO [p]%%%%%%i[/p] >> ..\Controllers\%controller%\view.bat 
)

echo  ) >> ..\Controllers\%controller%\view.bat
echo ) >> ..\Controllers\%controller%\view.bat
echo GOTO EXIT >> ..\Controllers\%controller%\view.bat
echo :EMPTY >> ..\Controllers\%controller%\view.bat
echo     call ..\..\Views\Shared\_header Invalid ID >> ..\Controllers\%controller%\view.bat
echo     call ..\..\h\h1 Invalid ID >> ..\Controllers\%controller%\view.bat
echo GOTO EXIT >> ..\Controllers\%controller%\view.bat
echo :EXIT >> ..\Controllers\%controller%\view.bat
echo ECHO [a href='/%controller%/index']back...[/a] >> ..\Controllers\%controller%\view.bat

echo @echo off > ..\Controllers\%controller%\index.bat
echo call ..\..\Views\Shared\_header %controller% %2s >> ..\Controllers\%controller%\index.bat
echo call ..\..\h\h1 %controller% %2s >> ..\Controllers\%controller%\index.bat
echo echo [blink][em]Built with DOS on Dope[/em][/blink] >> ..\Controllers\%controller%\index.bat
echo FOR /F "eol=; tokens=1-20 skip=1 delims=`" %%%%1 in (..\..\Models\%2s.csv) do ( >> ..\Controllers\%controller%\index.bat

echo   call ..\..\h\h1 %%%%2 >> ..\Controllers\%controller%\index.bat
for /L %%i in (3,1,%ID%) do (
echo   ECHO [p]%%%%%%i[/p] >> ..\Controllers\%controller%\index.bat 
)
echo   ECHO [a href='view/%%%%1']more...[/a] >> ..\Controllers\%controller%\index.bat
echo   ECHO [hr /] >> ..\Controllers\%controller%\index.bat
echo ) >> ..\Controllers\%controller%\index.bat
echo echo. >> ..\Controllers\%controller%\index.bat
echo echo [a href='add']Add[/a] >> ..\Controllers\%controller%\index.bat

popd 

goto EXIT

:HELP


if '%2'=='site' goto HELP_SITE
if '%2'=='controller' goto HELP_CONTROLLER
if '%2'=='model' goto HELP_MODEL
if '%2'=='gen' goto HELP_GEN

echo.
echo *******************
echo *** DOS ON DOPE ***
echo *** The MVC web ***
echo *** frame  work ***
echo *** built    on ***
echo *** batch files ***
echo *******************
echo.
echo Commands are:
echo   dope SITE [[name]] -- to create a SITE named 'name'
echo   dope CONTROLLER [[name]] -- to create a CONTROLLER named 'name'
echo   dope GEN [[name]] -- to generate controllers and action for a model named 'name' (singular)
echo   dope HELP [[command]] -- to request HELP on 'command'

echo ** Always keep Dope in your Path. **

goto exit

:UNKNOWN

echo ERROR: Unknown command. %1
GOTO HELP

goto EXIT

:EXIT

================================================
FILE: h/ToLower.cmd
================================================
@echo off
FOR %%B IN ("%~1") DO (
    FOR /F "delims=~" %%A IN ('ECHO %%B^> ~%%B ^& DIR /L /B ~%%B') DO (
        SET LoCaseText=%%A
        DEL /Q ~%%B
    )
)
ECHO %LoCaseText%

================================================
FILE: h/a.bat
================================================
@echo off
echo [a href='%~1']%~2[/a]


================================================
FILE: h/h1.bat
================================================
@echo off
echo [h1]%*[/h1]


================================================
FILE: h/h2.bat
================================================
@echo off
echo [h2]%*[/h2]


================================================
FILE: h/h3.bat
================================================
@echo off
echo [h3]%*[/h3]


================================================
FILE: h/p.bat
================================================
@echo off
echo [p]%*[/p]
Download .txt
gitextract_7mm5_scu/

├── Controllers/
│   ├── Home/
│   │   └── Index.bat
│   ├── _actionMissing.bat
│   └── _controllerMissing.bat
├── Default.aspx
├── Default.aspx.cs
├── DosOnDope.csproj
├── Global.asax
├── Global.asax.cs
├── LICENSE
├── Models/
│   └── split.vbs
├── Properties/
│   └── AssemblyInfo.cs
├── README.md
├── Views/
│   └── Shared/
│       └── _header.bat
├── Web.config
├── docs/
│   ├── GettingStarted.md
│   └── HowDoesItWork.md
├── dope.bat
└── h/
    ├── ToLower.cmd
    ├── a.bat
    ├── h1.bat
    ├── h2.bat
    ├── h3.bat
    └── p.bat
Download .txt
SYMBOL INDEX (17 symbols across 2 files)

FILE: Default.aspx.cs
  class _Default (line 7) | public partial class _Default : Page
    method Page_Load (line 9) | public void Page_Load(object sender, System.EventArgs e)

FILE: Global.asax.cs
  class MvcApplication (line 10) | public class MvcApplication : System.Web.HttpApplication
    method RegisterRoutes (line 12) | public static void RegisterRoutes(RouteCollection routes)
    method Application_Start (line 29) | protected void Application_Start()
  class DosOnDopeRouteHandler (line 35) | public class DosOnDopeRouteHandler : IRouteHandler
    method GetHttpHandler (line 37) | public IHttpHandler GetHttpHandler(RequestContext requestContext)
  class DosOnDopeHttpHandler (line 43) | public class DosOnDopeHttpHandler : IHttpHandler
    method DosOnDopeHttpHandler (line 46) | public DosOnDopeHttpHandler(RequestContext requestContext)
    method ProcessRequest (line 53) | public void ProcessRequest(HttpContext context)
    method Execute (line 74) | public string Execute(string controllerName, string actionName, string...
    method Execute (line 93) | private string Execute(string path, string file, string args, out int ...
    method ActionNotFound (line 121) | private string ActionNotFound(string controllerName, string actionName...
    method ControllerNotFound (line 133) | private string ControllerNotFound(string controllerName, string action...
    method ConvertErrorlevelToHttpStatus (line 140) | private int ConvertErrorlevelToHttpStatus(int errorLevel)
    method Join (line 147) | private string Join(string separator, params string[] strings)
    method Dope (line 164) | private string Dope(string undoped)
Condensed preview — 23 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (56K chars).
[
  {
    "path": "Controllers/Home/Index.bat",
    "chars": 907,
    "preview": "@echo off\r\ncall ..\\..\\Views\\Shared\\_header DoD Congratulations\r\ncall ..\\..\\h\\h1 Congratulations\r\necho [p]You've put [str"
  },
  {
    "path": "Controllers/_actionMissing.bat",
    "chars": 656,
    "preview": "@echo off\r\ncall ..\\Views\\Shared\\_header Action Missing\r\ncall ..\\h\\h1 Action Missing\r\necho [p]Controller = %1[/p]\r\necho ["
  },
  {
    "path": "Controllers/_controllerMissing.bat",
    "chars": 388,
    "preview": "@echo off\r\ncall ..\\Views\\Shared\\_header Controller Missing\r\ncall ..\\h\\h1 Controller Missing\r\necho [p]Controller = %1[/p]"
  },
  {
    "path": "Default.aspx",
    "chars": 260,
    "preview": "<%@ Page Language=\"C#\" AutoEventWireup=\"true\" CodeBehind=\"Default.aspx.cs\" Inherits=\"DosOnDope._Default\" %>\r\n\r\n<%-- Ple"
  },
  {
    "path": "Default.aspx.cs",
    "chars": 440,
    "preview": "using System.Web;\r\nusing System.Web.Mvc;\r\nusing System.Web.UI;\r\n\r\nnamespace DosOnDope\r\n{\r\n    public partial class _Def"
  },
  {
    "path": "DosOnDope.csproj",
    "chars": 5210,
    "preview": "<Project ToolsVersion=\"3.5\" DefaultTargets=\"Build\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\r\n  <Pro"
  },
  {
    "path": "Global.asax",
    "chars": 99,
    "preview": "<%@ Application Codebehind=\"Global.asax.cs\" Inherits=\"DosOnDope.MvcApplication\" Language=\"C#\" %>\r\n"
  },
  {
    "path": "Global.asax.cs",
    "chars": 7020,
    "preview": "using System;\r\nusing System.Diagnostics;\r\nusing System.IO;\r\nusing System.Web;\r\nusing System.Web.Mvc;\r\nusing System.Web."
  },
  {
    "path": "LICENSE",
    "chars": 1082,
    "preview": "The MIT License (MIT)\n\nCopyright (c) 2010-2024 secretGeek\n\nPermission is hereby granted, free of charge, to any person o"
  },
  {
    "path": "Models/split.vbs",
    "chars": 240,
    "preview": "Set objFS = CreateObject(\"Scripting.FileSystemObject\") \r\nSet objArgs = WScript.Arguments \r\nstr1 = objArgs(0) \r\ns=Split(s"
  },
  {
    "path": "Properties/AssemblyInfo.cs",
    "chars": 1260,
    "preview": "using System.Reflection;\r\nusing System.Runtime.InteropServices;\r\n\r\n// General Information about an assembly is controll"
  },
  {
    "path": "README.md",
    "chars": 1105,
    "preview": "# DOS on DOPE\n\n![logo](docs/Dos_on_Dope_Logo.png)\n\n\n*The last MVC Web framework you'll ever need*\n\nWhen you've done ever"
  },
  {
    "path": "Views/Shared/_header.bat",
    "chars": 651,
    "preview": "@echo off\r\necho [html]\r\necho [head]\r\necho [style]body{background-color:#000;color:#C0C0C0;font-family:\"fixed sys\",\"Lucid"
  },
  {
    "path": "Web.config",
    "chars": 11156,
    "preview": "<?xml version=\"1.0\"?>\r\n<!-- \r\n    Note: As an alternative to hand editing this file you can use the \r\n    web admin tool"
  },
  {
    "path": "docs/GettingStarted.md",
    "chars": 6162,
    "preview": "# Getting started\n\nTo get started open a `cmd` window.\nIf you're not familiar with a `cmd` window, you soon will be. ;-)"
  },
  {
    "path": "docs/HowDoesItWork.md",
    "chars": 2509,
    "preview": "# How does it work? \n## How *does* it work!?\n## HOW does IT work!?\n## (how can it work?)\n\nIn DosOnDope all URLs are cons"
  },
  {
    "path": "dope.bat",
    "chars": 11305,
    "preview": "@echo off\r\n\r\nSET LOCN=\"%~dp0\"\r\n\r\nif x'%2'==x'/?' goto COMMAND_HELP\r\nif x'%2'==x'?'goto COMMAND_HELP\r\nif x'%2'==x'-?'goto"
  },
  {
    "path": "h/ToLower.cmd",
    "chars": 185,
    "preview": "@echo off\r\nFOR %%B IN (\"%~1\") DO (\r\n    FOR /F \"delims=~\" %%A IN ('ECHO %%B^> ~%%B ^& DIR /L /B ~%%B') DO (\r\n        SET"
  },
  {
    "path": "h/a.bat",
    "chars": 39,
    "preview": "@echo off\r\necho [a href='%~1']%~2[/a]\r\n"
  },
  {
    "path": "h/h1.bat",
    "chars": 29,
    "preview": "@echo off\r\necho [h1]%*[/h1]\r\n"
  },
  {
    "path": "h/h2.bat",
    "chars": 29,
    "preview": "@echo off\r\necho [h2]%*[/h2]\r\n"
  },
  {
    "path": "h/h3.bat",
    "chars": 29,
    "preview": "@echo off\r\necho [h3]%*[/h3]\r\n"
  },
  {
    "path": "h/p.bat",
    "chars": 27,
    "preview": "@echo off\r\necho [p]%*[/p]\r\n"
  }
]

About this extraction

This page contains the full source code of the secretGeek/dod GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 23 files (49.6 KB), approximately 14.0k tokens, and a symbol index with 17 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!