initial commit

master
Avril 4 years ago
commit 00aaf4da36
Signed by: flanchan
GPG Key ID: 284488987C31F630

362
.gitignore vendored

@ -0,0 +1,362 @@
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
# User-specific files
*.rsuser
*.suo
*.user
*.userosscache
*.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Mono auto generated files
mono_crash.*
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
[Ww][Ii][Nn]32/
[Aa][Rr][Mm]/
[Aa][Rr][Mm]64/
bld/
[Bb]in/
[Oo]bj/
[Ll]og/
[Ll]ogs/
# Visual Studio 2015/2017 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/
# Visual Studio 2017 auto generated files
Generated\ Files/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# NUnit
*.VisualState.xml
TestResult.xml
nunit-*.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
# Benchmark Results
BenchmarkDotNet.Artifacts/
# .NET Core
project.lock.json
project.fragment.lock.json
artifacts/
# ASP.NET Scaffolding
ScaffoldingReadMe.txt
# StyleCop
StyleCopReport.xml
# Files built by Visual Studio
*_i.c
*_p.c
*_h.h
*.ilk
*.meta
*.obj
*.iobj
*.pch
*.pdb
*.ipdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*_wpftmp.csproj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
*.VC.db
*.VC.VC.opendb
# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap
# Visual Studio Trace Files
*.e2e
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# AxoCover is a Code Coverage Tool
.axoCover/*
!.axoCover/settings.json
# Coverlet is a free, cross platform Code Coverage Tool
coverage*.json
coverage*.xml
coverage*.info
# Visual Studio code coverage results
*.coverage
*.coveragexml
# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# Note: Comment the next line if you want to checkin your web deploy settings,
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj
# Microsoft Azure Web App publish settings. Comment the next line if you want to
# checkin your Azure Web App publish settings, but sensitive information contained
# in these scripts will be unencrypted
PublishScripts/
# NuGet Packages
*.nupkg
# NuGet Symbol Packages
*.snupkg
# The packages folder can be ignored because of Package Restore
**/[Pp]ackages/*
# except build/, which is used as an MSBuild target.
!**/[Pp]ackages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/[Pp]ackages/repositories.config
# NuGet v3's project.json files produces more ignorable files
*.nuget.props
*.nuget.targets
# Microsoft Azure Build Output
csx/
*.build.csdef
# Microsoft Azure Emulator
ecf/
rcf/
# Windows Store app package directories and files
AppPackages/
BundleArtifacts/
Package.StoreAssociation.xml
_pkginfo.txt
*.appx
*.appxbundle
*.appxupload
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!?*.[Cc]ache/
# Others
ClientBin/
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.jfm
*.pfx
*.publishsettings
orleans.codegen.cs
# Including strong name files can present a security risk
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
#*.snk
# Since there are multiple workflows, uncomment next line to ignore bower_components
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
#bower_components/
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
ServiceFabricBackup/
*.rptproj.bak
# SQL Server files
*.mdf
*.ldf
*.ndf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
*.rptproj.rsuser
*- [Bb]ackup.rdl
*- [Bb]ackup ([0-9]).rdl
*- [Bb]ackup ([0-9][0-9]).rdl
# Microsoft Fakes
FakesAssemblies/
# GhostDoc plugin setting file
*.GhostDoc.xml
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
node_modules/
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
*.vbw
# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions
# Paket dependency manager
.paket/paket.exe
paket-files/
# FAKE - F# Make
.fake/
# CodeRush personal settings
.cr/personal
# Python Tools for Visual Studio (PTVS)
__pycache__/
*.pyc
# Cake - Uncomment if you are using it
# tools/**
# !tools/packages.config
# Tabs Studio
*.tss
# Telerik's JustMock configuration file
*.jmconfig
# BizTalk build output
*.btp.cs
*.btm.cs
*.odx.cs
*.xsd.cs
# OpenCover UI analysis results
OpenCover/
# Azure Stream Analytics local run output
ASALocalRun/
# MSBuild Binary and Structured Log
*.binlog
# NVidia Nsight GPU debugger configuration file
*.nvuser
# MFractors (Xamarin productivity tool) working folder
.mfractor/
# Local History for Visual Studio
.localhistory/
# BeatPulse healthcheck temp database
healthchecksdb
# Backup folder for Package Reference Convert tool in Visual Studio 2017
MigrationBackup/
# Ionide (cross platform F# VS Code tools) working folder
.ionide/
# Fody - auto-generated XML schema
FodyWeavers.xsd

@ -0,0 +1,31 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.29609.76
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "libsex", "libsex\libsex.csproj", "{163D3AE6-B930-41F5-BCB6-E11E42EF495B}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "test", "test\test.csproj", "{52FACECB-29A6-4205-96E1-8DD964B7E9CB}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{163D3AE6-B930-41F5-BCB6-E11E42EF495B}.Debug|Any CPU.ActiveCfg = Release|Any CPU
{163D3AE6-B930-41F5-BCB6-E11E42EF495B}.Debug|Any CPU.Build.0 = Release|Any CPU
{163D3AE6-B930-41F5-BCB6-E11E42EF495B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{163D3AE6-B930-41F5-BCB6-E11E42EF495B}.Release|Any CPU.Build.0 = Release|Any CPU
{52FACECB-29A6-4205-96E1-8DD964B7E9CB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{52FACECB-29A6-4205-96E1-8DD964B7E9CB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{52FACECB-29A6-4205-96E1-8DD964B7E9CB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{52FACECB-29A6-4205-96E1-8DD964B7E9CB}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {02ABDF0E-E764-4C26-82F3-CF957EBBCC42}
EndGlobalSection
EndGlobal

@ -0,0 +1,411 @@
using System;
using System.Collections;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Threading;
namespace libsex
{
[Serializable]
public class SExpression : IList<object>
{
private readonly List<object> inter = new List<object>();
public SExpression()
{
}
public static SExpression Concat(params SExpression[] sexs)
{
var sex = new SExpression();
sex.inter.AddRange(sexs);
return sex;
}
public object Car()
=> inter.Count < 1 ? null : inter[0];
public SExpression Cdr()
{
if (inter.Count < 2) return new SExpression();
else return new SExpression(inter.Skip(1));
}
public SExpression IPWhere(Func<object,bool> predicate)
{
var add = inter.Where(predicate).ToArray();
inter.Clear();
inter.AddRange(add);
return this;
}
public SExpression IPSelect(Func<object,object> transform)
{
var add = inter.Select(transform).ToArray();
inter.Clear();
inter.AddRange(add);
return this;
}
public SExpression Take(Func<object, bool> transform)
{
SExpression sexpr = new SExpression();
foreach (var obj in inter.ToArray())
{
if (transform(obj))
{
sexpr.Add(obj);
inter.Remove(obj);
}
}
return sexpr;
}
public string CarString() => Car() as string;
public SExpression CarExpr() => Car() switch { SExpression sex => sex, IEnumerable<object> ie => new SExpression(ie), _ => null };
public T Car<T>(T or = default) => Car() is T t ? t : or;
public SExpression(params object[] initial)
{
inter.AddRange(initial);
}
public object[] Slice(int start,int length)
{
object[] slice = new object[length];
inter.CopyTo(start, slice, 0, length);
return slice;
}
public object Path(params int[] indecies)
{
IList<object> elements = this.inter;
for (int i = 0; i < indecies.Length; i++)
{
int index = indecies[i];
if (index < 0 || index >= elements.Count) throw new IndexOutOfRangeException("Index " + i + " (" + index + ") was out of bounds.");
else
{
if (elements[index] is IList<object> il)
{
elements = il;
}
else return elements[index];
}
}
return elements;
}
public SExpression(IEnumerable<object> from)
{
inter.AddRange(from);
}
public override string ToString()
{
StringBuilder sb = new StringBuilder();
//sb.Append("(");
foreach (var item in inter)
{
if (item is SExpression se)
sb.Append("(" + se.ToString() + ")");
else if (item is string str)
sb.Append(escape(str));
else if (item is IEnumerable<object> il)
sb.Append("(" + new SExpression(il).ToString() + ")");
else if (item is IEnumerable li)
{
SExpression sex = new SExpression();
foreach (var o in li)
{
sex.inter.Add(o);
}
sb.Append("(" + sex.ToString() + ")");
}
else sb.Append(escape(item.ToString()));
sb.Append(" ");
}
return sb.ToString().Trim();// + ")";
}
public SExpression FlattenTopLevel(bool full=false)
{
if (full) while (inter.Count == 1 && inter[0] is SExpression se)
{
inter.Clear();
inter.AddRange(se.inter);
}
else if (inter.Count == 1 && inter[0] is SExpression se)
{
inter.Clear();
inter.AddRange(se.inter);
}
return this;
}
private static readonly System.Text.RegularExpressions.Regex escape_re = new System.Text.RegularExpressions.Regex(@"[\s\(\)]", System.Text.RegularExpressions.RegexOptions.Compiled);
private string escape(string str)
{
str = str.Replace("\\", "\\\\");
str = str.Replace("\"", "\\\"");
if (escape_re.IsMatch(str)) return $"\"{str}\"";
else return str;
}
#region IList
public object this[int index] { get => inter[index]; set => inter[index] = value; }
public int Count => inter.Count;
public bool IsReadOnly => false;
public void Add(object item)
{
inter.Add(item);
}
public void Clear()
{
inter.Clear();
}
public bool Contains(object item)
{
return inter.Contains(item);
}
public void CopyTo(object[] array, int arrayIndex)
{
inter.CopyTo(array, arrayIndex);
}
public IEnumerator<object> GetEnumerator()
{
return inter.GetEnumerator();
}
public int IndexOf(object item)
{
return inter.IndexOf(item);
}
public void Insert(int index, object item)
{
inter.Insert(index, item);
}
public bool Remove(object item)
{
return inter.Remove(item);
}
public void RemoveAt(int index)
{
inter.RemoveAt(index);
}
IEnumerator IEnumerable.GetEnumerator()
{
return (inter as IEnumerable).GetEnumerator();
}
#endregion
private static async Task<SExpression> parse(AsyncConsumer<char> input)
{
SExpression main = new SExpression();
var (isEscaped, isStringed) = (false, false);
StringBuilder token = new StringBuilder();
void addToken()
{
if (token.Length > 0)
main.inter.Add(token.ToString());
token.Clear();
}
(char, bool) ok;
while ((ok = await input.TryTake()).Item2)
{
var letter = ok.Item1;
if (isEscaped)
{
token.Append(letter);
isEscaped = false;
}
else if (letter == '\\')
{
isEscaped = true;
}
else if (isStringed)
{
if (letter == '"') isStringed = false;
else token.Append(letter);
}
else if (letter == '(')
{
addToken();
main.inter.Add(await parse(input));
}
else if (letter == ')')
{
addToken();
return main;
}
else if (letter == ' ' || letter == '\t' || letter == '\n' || letter == '\r' || letter == '\f')
{
addToken();
}
else if (letter == '"')
{
isStringed = true;
}
else token.Append(letter);
}
addToken();
return main;
}
private static async IAsyncEnumerable<char> preprocess(IAsyncEnumerable<char> input)
{
var (isEscaped, isStringed, isCommented) = (false, false, false);
await foreach (var letter in input)
{
if (isEscaped)
{
yield return letter;
isEscaped = false;
}
else if (letter == '\\')
{
isEscaped = true;
yield return letter;
}
else if (isStringed)
{
yield return letter;
if (letter == '"') isStringed = false;
}
else if (isCommented)
{
if (letter == '\n' || letter == '\r' || letter == '\f')
{
yield return '\n';
isCommented = false;
}
}
else if (letter == '"')
{
isStringed = true;
yield return letter;
}
else if (letter == ';')
{
isCommented = true;
}
else if (letter == '\t')
{
yield return ' ';
}
else yield return letter;
}
}
public static async Task<SExpression> ParseAsync(IAsyncEnumerable<char> str)
{
AsyncConsumer<char> s;
var res = await parse(s = new AsyncConsumer<char>(preprocess(str)));
await s.DisposeAsync();
return res;
}
public static async IAsyncEnumerable<SExpression> ParseMultipleAsync(IAsyncEnumerable<char> str, [EnumeratorCancellation] CancellationToken token = default)
{
str = preprocess(str);
await using var consumer = new AsyncConsumer<char>(str);
(char, bool) cur = default;
while ((await consumer.TryTake(token)).Item2)
{
if(cur.Item1 == '(')
{
yield return await parse(consumer);
}
}
}
public static SExpression Parse(IEnumerable<char> str)
{
async IAsyncEnumerable<char> interop()
{
await Task.Yield();
foreach (var s in str) yield return s;
}
try
{
var awaiter = ParseAsync(interop());
awaiter.Wait();
if (awaiter.IsFaulted) throw awaiter.Exception;
return awaiter.Result;
}
catch (Exception ex) { throw ex; }
}
}
class AsyncConsumer<T> : IAsyncDisposable
{
readonly IAsyncEnumerator<T> e;
public AsyncConsumer(IAsyncEnumerable<T> input)
{
e = input.GetAsyncEnumerator();
}
public async ValueTask DisposeAsync()
{
await e.DisposeAsync();
}
public async ValueTask<(T, bool)> TryTake(CancellationToken token)
{
if (token == default) return await TryTake();
TaskCompletionSource<bool> cancel = new TaskCompletionSource<bool>();
using var _c = token.Register(() => cancel.SetResult(false));
var res = e.MoveNextAsync().AsTask();
if (await Task.WhenAny(res, cancel.Task) == res)
{
var ok = res.Result;
if (ok)
{
return (e.Current, true);
}
else return (default, false);
}
else
throw new OperationCanceledException();
}
public async ValueTask<(T, bool)> TryTake()
{
var ok = await e.MoveNextAsync();
if (ok)
{
return (e.Current, true);
}
else return (default, false);
}
}
}

@ -0,0 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
</PropertyGroup>
</Project>

@ -0,0 +1,29 @@
using System;
using libsex;
namespace test
{
class Program
{
static void Main(string[] args)
{
SExpression sex = SExpression.Parse(global::test.Properties.Resources.Example);
string sex1Str = sex.ToString();
var sex2 = SExpression.Parse(sex1Str);
string sex2Str = sex2.ToString();
Console.WriteLine(sex1Str);
Console.WriteLine(sex2Str);
Console.WriteLine("----");
Console.WriteLine(sex1Str == sex2Str);
Console.WriteLine(sex.Path(0, 1, 0));
Console.ReadKey();
}
}
}

@ -0,0 +1,92 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace test.Properties {
using System;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("test.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
/// <summary>
/// Looks up a localized string similar to ;; ISS3 config template
///(progn
/// (native cfg)
/// (native perm)
///
/// (defparameter *all* &apos;(listing images encrypted-listing encrypted-images add edit super))
///
/// (defconf
/// (database (prompt &quot;Enter pathname&quot; :string))
/// (port (prompt &quot;Enter port&quot; :integer))
/// (allow
/// &apos;(&quot;127.0.0.1&quot;
/// &quot;127.0.0.0/8&quot;
/// &quot;0.0.0.0/0&quot;))
/// (deny
/// &apos;(&quot;123.123.123.0/24&quot;))
/// (password nil)
/// (welcome &quot;ISS v3 server.&quot;)
/// (key 123456789ABCDEFF)
/// (permissions ;;You can also set file like (permissions &quot;file.lisp&quot;)
/// [rest of string was truncated]&quot;;.
/// </summary>
internal static string Example {
get {
return ResourceManager.GetString("Example", resourceCulture);
}
}
}
}

@ -0,0 +1,124 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="Example" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Example.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252</value>
</data>
</root>

@ -0,0 +1,28 @@
;; ISS3 config template
(progn
(native cfg)
(native perm)
(defparameter *all* '(listing images encrypted-listing encrypted-images add edit super))
(defconf
(database (prompt "Enter (pathname" :string))
(port (prompt "Enter port" :integer))
(allow
'("127.0.0.1"
"127.0.0.0/8"
"0.0.0.0/0"))
(deny
'("123.123.123.0/24"))
(password nil)
(welcome "ISS v3 server.")
(key 123456789ABCDEFF)
(permissions ;;You can also set file like (permissions "file.lisp")
(defperm
(:default '(listing images)) ;;default
(permission-entry :name "entry 1" :public-key 123456789ABCDEFF :level *all*)
(permission-entry :name "entry 2" :password (sha1 "this is password") :level '(listing images encrypted-listing encrypted-images))
(permission-entry :name "entry 2.5" :password 123456789ABCDEFF :level '(listing images encrypted-listing encrypted-images))
(permission-entry :name "entry 3" :public-key (keyfile "filename") :level *all*)
(permission-entry :name "entry 3.5" :public-key (keyfile "filename" base64) :level *all*) ;;call base64() on file
(permission-entry :name "entry 4" :public-key (base64 "insert thing here") :level *all*)))))

@ -0,0 +1,27 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\libsex\libsex.csproj" />
</ItemGroup>
<ItemGroup>
<Compile Update="Properties\Resources.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Update="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>
</Project>
Loading…
Cancel
Save