LinePutScript 1.8.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package LinePutScript --version 1.8.1                
NuGet\Install-Package LinePutScript -Version 1.8.1                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="LinePutScript" Version="1.8.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add LinePutScript --version 1.8.1                
#r "nuget: LinePutScript, 1.8.1"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install LinePutScript as a Cake Addin
#addin nuget:?package=LinePutScript&version=1.8.1

// Install LinePutScript as a Cake Tool
#tool nuget:?package=LinePutScript&version=1.8.1                

LinePutScript

<img src="https://raw.githubusercontent.com/LorisYounger/LinePutScript/master/Lineput.png" alt="Lineput" height="150px" />

LinePutScript是一种数据交换格式定义行读取结构和描述其内容的标准语言

可以应用于 保存 设置,资源,模板文件 等各种场景

类似于XML或Json但是比XML和Json更易于使用(理论上)

本类库可以更轻松的创建,修改,保存LinePutScript

提供开源源代码 可以自行修改支持更多功能

项目文件解释

LinePutScript

一个LPS基本操作类,是所有LPS的根引用 如需操作lps文件,请使用这个文件

'LinePutScript.Core' 为.net Core版本

如何使用:

安装

  1. 通过Parckage Manager

LinePutScript

Install-Package LinePutScript
  1. 通过nuget.org

    LinePutScript

  2. 下载nuget包

    Nuget文件夹

关于LinePutScript语言

LinePutScript是一个最高4层*的数据储存语言 *最新1.4版本支持第四层,更多层次也可以使用套娃添加,但是较为繁琐

LineputScript由Line组成, Line由sub组成 sub为 subname#subinfo

这是一个基础的LineputScript文件

line1name#line1info:|sub1name#sub1info:|sub2name#sub2info:|text
line2name#line2info:|money#100:|goods#item1,item2,item3:|

通过C# 读取信息如下

LpsDocument tmp = new LpsDocument("line1...item3:|");
tmp.First().ToString(); //line1name#line1info:|sub1name#sub1info:|sub2name#sub2info:|text
tmp.First().First().ToString();//line1name#line1info:|
tmp["line1name"]["sub1name"].Info; //sub1info
tmp[0].Text;//text
tmp[1][(gint)"money"];//100
tmp[1]["good"].GetInfos()[1];//item2

符号定义

分隔名称Name和信息Info

😐

分隔 SubSubLineSub

:\n|

lps文件支持多行并插入换行 例如

详细文档:| 这是一份文件:
| 文件内容为空

详细文档:| 这是一份文件\n 文件内容为空

表达效果相同

:\n:

lps文件支持多行 例如

详细文档:| 这是一份文件:
: 文件内容为空

详细文档:| 这是一份文件 文件内容为空

表达效果相同

使用方法

案例:储存游戏设置
读取LPS文件
//读取LPS文件
LpsDocument Save = new LpsDocument(File.ReadAllText("GAMEPATH\\save1.lps"));
//或创建新LPS文件
Save = new LpsDocument();
获取和修改数据

案例要求:

  • 储存金钱值为10000
  • 添加类型电脑并储存电脑名字为 "我的电脑"
  • 读取金钱值并加上500

方法1 (lps1.0) -- 早期版本lps 繁琐操作

Save.AddLine(new Line("money","10000"));//添加行 money 10000
Save.AddLine(new Line("computer",""));//添加行 compuer
Save.FindLine("computer").Add(new Sub("name","我的电脑")); //在computer行下面添加子类name和信息我的电脑

int Money = Convert.ToInt32((Save.FindLine("money").info)); //获得money储存的值
Save.FindLine("money").info = (Money + 500).ToString();//储存 money+500

方法2 (lps1.1) -- 上上版本lps 半繁琐操作

Save.AddLine("money").InfoToInt = 10000; //添加行 money 10000
Save.FindorAddLine("computer").FindorAddLine("name").Info = "我的电脑";//查找行computer, 如果没找到,则创建一个新的. 在该computer行下查找或创建子类name,并修改其信息为 我的电脑

Save.FindorAddLine("money").InfoToInt += 500;//给money+500

方法3 (lps1.2) -- 上版本lps 半繁琐操作

Save.AddLine("money").InfoToInt = 10000;
Save.FindorAddLine("computer").FindorAddLine("name").Info = "我的电脑";

Save["money"].InfoToInt += 500;//给money+500

方法4 (lps1.2+) -- 上版本lps后期 普通操作

Save.SetInt("money",10000);//设置 money 行 值(int)为10000

Save["computer"].SetString("name","我的电脑");
// 或这样 (对于string来说更方便)
Save["computer"]["name"].Info = "我的电脑";

Save.SetInt("money",Save.GetInt("money")+500);//给money+500

方法5 (lps1.3) -- 最新版本lps 高级操作

Save[(gint)"money"] = 10000; //设置 money 行 值(int)为10000
Save["computer"][(gstr)"name"] = "我的电脑";

Save[(gint)"money"] += 500;

方法6 (lps1.8) -- 最新版本lps 无需操作

//储存数据的类
public class SaveData{
    [Line]
    public int money = 10000;//设置 money 值(int)为10000
    public class Computer{
        [Line]
        public string name = "电脑默认名字";
    }
    [Line]
    public Computer computer = new Computer(){name = "我的电脑"};
}
//读取游戏数据
SaveData data = LPSConvert.DeserializeObject<SaveData>(Save);
data.money += 500;
//储存游戏数据
Save = LPSConvert.SerializeObject(data);
储存LPS文件
//写入LPS源文件
File.WriteAllText("GAMEPATH\\save1.lps",Save.ToString());
储存的LPS文件样式如下
money#10500:|
computer:|name#我的电脑:|

其他

更多用法及参数参见对象管理器

Product Compatible and additional computed target framework versions.
.NET net5.0 is compatible.  net5.0-windows was computed.  net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.2 is compatible.  netcoreapp3.0 was computed.  netcoreapp3.1 is compatible. 
.NET Framework net462 is compatible.  net463 was computed.  net47 was computed.  net471 was computed.  net472 is compatible.  net48 is compatible.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETCoreApp 2.2

    • No dependencies.
  • .NETCoreApp 3.1

    • No dependencies.
  • .NETFramework 4.6.2

    • No dependencies.
  • .NETFramework 4.7.2

    • No dependencies.
  • .NETFramework 4.8

    • No dependencies.
  • net5.0

    • No dependencies.
  • net6.0

    • No dependencies.

NuGet packages (5)

Showing the top 5 NuGet packages that depend on LinePutScript:

Package Downloads
VPet-Simulator.Core

虚拟桌宠模拟器 一个开源的桌宠软件, 可以内置到任何WPF应用程序

LinePutScript.Localization.WPF

WPF本地化类库, 支持文本和数值(不同语言的控件位置大小) 支持翻译接口(用于网络翻译等) 支持自动生成所需翻译文档

SoftwareVersion.Client

检查更新版本并提示用户升级或校对激活码确保激活码有效并对用户开放更多功能 *需要SoftwareVerisonManager配合

LinePutScript.SQLHelper

使用LineputScript的SQL帮助类

LinePutScript.LinePut

LinePut是使用LinePutScript描述富文本的一种格式 这个类帮助转换LinePut为XAML FlowDocument

GitHub repositories (1)

Showing the top 1 popular GitHub repositories that depend on LinePutScript:

Repository Stars
LorisYounger/VPet
虚拟桌宠模拟器 一个开源的桌宠软件, 可以内置到任何WPF应用程序
Version Downloads Last updated
1.11.8 506 8/8/2024
1.11.7 256 6/26/2024
1.11.6 891 3/20/2024
1.11.5 142 3/18/2024
1.11.4 120 3/17/2024
1.11.3 112 3/11/2024
1.11.2 126 3/9/2024
1.11.1 138 3/1/2024
1.11.0 136 3/1/2024 1.11.0 is deprecated because it has critical bugs.
1.10.2 446 2/2/2024
1.10.1 127 2/1/2024 1.10.1 is deprecated because it is no longer maintained and has critical bugs.
1.9.2 2,994 8/8/2023
1.9.1 203 8/7/2023 1.9.1 is deprecated because it is no longer maintained and has critical bugs.
1.9.0 209 8/7/2023 1.9.0 is deprecated because it is no longer maintained and has critical bugs.
1.8.3 310 7/3/2023
1.8.2 463 6/5/2023 1.8.2 is deprecated because it is no longer maintained and has critical bugs.
1.8.1 224 6/3/2023 1.8.1 is deprecated because it is no longer maintained and has critical bugs.
1.8.0 359 5/8/2023 1.8.0 is deprecated because it is no longer maintained and has critical bugs.
1.6.1 718 12/2/2022
1.6.0 409 11/22/2022 1.6.0 is deprecated because it is no longer maintained and has critical bugs.
1.5.4 503 9/22/2022
1.5.3 482 9/21/2022 1.5.3 is deprecated because it is no longer maintained and has critical bugs.
1.5.2 465 9/21/2022 1.5.2 is deprecated because it is no longer maintained and has critical bugs.
1.5.1 471 9/21/2022 1.5.1 is deprecated because it is no longer maintained and has critical bugs.
1.5.0 478 9/21/2022 1.5.0 is deprecated because it is no longer maintained and has critical bugs.
1.4.3 442 9/1/2022
1.4.2 501 8/25/2022 1.4.2 is deprecated because it is no longer maintained.
1.4.1 478 8/23/2022 1.4.1 is deprecated because it is no longer maintained and has critical bugs.
1.3.5 543 5/11/2022
1.3.4 636 2/1/2022 1.3.4 is deprecated because it is no longer maintained.
1.3.3 522 1/25/2022 1.3.3 is deprecated because it is no longer maintained.
1.3.2 552 1/2/2022 1.3.2 is deprecated because it is no longer maintained.
1.3.1 625 11/30/2021 1.3.1 is deprecated because it is no longer maintained.
1.2.3 1,526 11/28/2021
1.2.2 543 11/28/2021 1.2.2 is deprecated because it is no longer maintained.
1.2.1 593 10/14/2021 1.2.1 is deprecated because it is no longer maintained.
1.2.0 590 10/8/2021 1.2.0 is deprecated because it is no longer maintained.
1.1.7 1,530 9/1/2021
1.1.6 616 4/20/2021 1.1.6 is deprecated because it is no longer maintained.
1.1.5 691 3/16/2021 1.1.5 is deprecated because it is no longer maintained.
1.1.4 822 8/30/2020 1.1.4 is deprecated because it is no longer maintained.
1.1.3 927 8/26/2020 1.1.3 is deprecated because it is no longer maintained.
1.1.2 799 8/18/2020 1.1.2 is deprecated because it is no longer maintained.
1.1.1 925 8/18/2020 1.1.1 is deprecated because it is no longer maintained.
1.1.0 812 8/18/2020 1.1.0 is deprecated because it is no longer maintained.

1.8.1: 新增LPS相关转换类, 修复字典, 更好的nullable兼容性
1.8.0: 现已支持直接转换自己的类为LPS文档
储存数据更方便