Coder Social home page Coder Social logo

alienfruit / alienfruit.otml Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 0.0 1.71 MB

AlienFruit.Otml is an object tree model language.

License: MIT License

C# 98.05% HTML 1.95%
otml c-sharp dotnet-core dotnet-framework dotnet-standard serialize parser core

alienfruit.otml's Introduction



Quality Gate Status GitHub PRs Welcome

OTML is an object tree model language. It is a language that describes a tree of objects, which is easily readable by both man and machine. It is abstract, flexible and simple. There is no data standardization and no arrays in it. OTML supports comments and stream processing.

OTML targets

  • To be easily understandable to a man
  • To be minimalistic: have a syntax consisting of a minimum set of rules
  • To be as abstract and flexible as possible, allowing to describe as many different data structures as possible
  • To support data stream processing
  • To develop and change easily, have a versioning system
  • Forget about it: {}, this: [] and this: ()

Packages

Package name Package version
AlienFruit.Otml Nuget
AlienfFruit.Otml.Serializer Nuget

Docs

OTML example:

@FooObject
	TestId : 252
	Amount : 226
	Comments : 
		string129
		string93
		string190
	Date : "2020-03-29T16:04:35.4042938"
	StatusId : 253
	IsReadOnly : False
	NextDate : "2020-08-22T08:31:25.9223099"
	Code : Codestring48
	Values : 
		@ItemValue
			Date : "2017-08-21T10:32:51.6801390"
			Number : 15
			SomeStr : AnswerStrstring229
			Id : 30
		@ItemValue
			Date : "2017-12-17T04:07:10.4458521"
			Number : 178
			SomeStr : AnswerStrstring69
			Id : 225
		@ItemValue
			Date : "2017-09-20T03:52:18.1241429"
			Number : 222
			SomeStr : AnswerStrstring145
			Id : 204
	MultilineStringValue : 
		"When an outburst occurs from gas very near the black hole," +
		"the ejected gas collides with material flowing away from the massive stars in winds," +
		"pushing this material backwards and causing it to glow in X-rays." +
		"When the outburst dies down the winds return to normal and the X-rays fade."

Serialization

The next class will be used in examples:

public class Foo
{
	public string Name { get; set; }
	public string StringValue { get; set; }
	public int IntValue { get; set; }
}

Serialization to string:

var fooClass = new Foo
{
	Name = "Name",
	StringValue =  "Value",
	IntValue = 123
};

var serializer = OtmlSerializer.Create();

string result = serializer.Serialize(fooClass);

Serialization to Stream:

var fooClass = new Foo
{
	Name = "Name",
	StringValue =  "Value",
	IntValue = 123
};

var serializer = OtmlSerializer.Create();

using (var stream = File.OpenWrite("C:\\result.otml"))
{
	serializer.Serialize(fooClass, stream);
}

Deserialization

Deserialization from string:

var serializer = OtmlSerializer.Create();

var source =
	"@Foo\n" +
	"\tName: Name\n" +
	"\tStringValue : Value\n" +
	"\tIntValue : 123";

Foo result = serializer.Deserialize<Foo>(source);

Deserialization from Stream:

var source =
	"@Foo\n" +
	"\tName: Name\n" +
	"\tStringValue : Value\n" +
	"\tIntValue : 123";

using (var stream = new MemoryStream(Encoding.UTF8.GetBytes(source)))
{
	Foo result = serializer.Deserialize<Foo>(stream);
}

alienfruit.otml's People

Contributors

alienfruit avatar

Stargazers

gparmigiani avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.