{"id":15687039,"url":"https://github.com/lorisyounger/lineputscript","last_synced_at":"2025-05-07T17:05:53.985Z","repository":{"id":59817453,"uuid":"150949970","full_name":"LorisYounger/LinePutScript","owner":"LorisYounger","description":"LinePutScript是一种数据交换格式定义行读取结构和描述其内容的标准语言","archived":false,"fork":false,"pushed_at":"2025-02-09T11:24:09.000Z","size":25195,"stargazers_count":11,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-10T10:50:53.584Z","etag":null,"topics":["data-format","lineputscript","lps","serializeobject"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/LorisYounger.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-09-30T08:55:08.000Z","updated_at":"2025-02-09T11:24:12.000Z","dependencies_parsed_at":"2024-10-23T20:36:12.241Z","dependency_job_id":"70be96b9-c35c-4682-ba99-b10a24f2a50d","html_url":"https://github.com/LorisYounger/LinePutScript","commit_stats":null,"previous_names":[],"tags_count":34,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LorisYounger%2FLinePutScript","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LorisYounger%2FLinePutScript/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LorisYounger%2FLinePutScript/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LorisYounger%2FLinePutScript/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LorisYounger","download_url":"https://codeload.github.com/LorisYounger/LinePutScript/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249833635,"owners_count":21331844,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["data-format","lineputscript","lps","serializeobject"],"created_at":"2024-10-03T17:42:38.127Z","updated_at":"2025-04-20T00:31:26.137Z","avatar_url":"https://github.com/LorisYounger.png","language":"C#","readme":"LinePutScript\n===\n\n\u003cimg src=\"Lineput.png\" alt=\"Lineput\" height=\"150px\" /\u003e\n\nLinePutScript是一种数据交换格式定义行读取结构和描述其内容的标准语言\n\n可以应用于 保存 设置,资源,模板文件 等各种场景\n\n类似于XML或Json但是比XML和Json更易于使用(理论上)\n\n本类库可以更轻松的创建,修改,保存LinePutScript\n\n提供开源源代码 可以自行修改支持更多功能\n\n## 项目文件解释\n\n### LinePutScript\n\n一个LPS基本操作类,是所有LPS的根引用\n如需操作lps文件,请使用这个文件\n\n*'LinePutScript.Core'* 为.net Core版本\n\n## 如何使用:\n\n### 安装\n\n1. 通过Parckage Manager\n\nLinePutScript\n```\nInstall-Package LinePutScript\n```\n\n2. 通过nuget.org\n\n   [LinePutScript](https://www.nuget.org/packages/LinePutScript/)\n\n3. 下载nuget包\n\n   [Nuget文件夹](https://github.com/LorisYounger/LinePutScript/tree/master/nuget)\n\n## 关于LinePutScript语言\n\nLinePutScript是一个最高4层*的数据储存语言\n*最新1.4版本支持第四层,更多层次也可以使用套娃添加,但是较为繁琐\n\nLineputScript由Line组成, Line由sub组成 sub为 `subname#subinfo` \n\n这是一个基础的LineputScript文件\n\n```\nline1name#line1info:|sub1name#sub1info:|sub2name#sub2info:|text\nline2name#line2info:|money#100:|goods#item1,item2,item3:|\n```\n\n通过C# 读取信息如下\n\n```C#\nLpsDocument tmp = new LpsDocument(\"line1...item3:|\");\ntmp.First().ToString(); //line1name#line1info:|sub1name#sub1info:|sub2name#sub2info:|text\ntmp.First().First().ToString();//line1name#line1info:|\ntmp[\"line1name\"][\"sub1name\"].Info; //sub1info\ntmp[0].Text;//text\ntmp[1][(gint)\"money\"];//100\ntmp[1][\"good\"].GetInfos()[1];//item2\n```\n\n### 符号定义\n\n#### \\#\n\n`#`分隔名称`Name`和信息`Info`,  \n~~或者说分割键与值.~~\n\n#### :|\n\n`:|`分隔 `Sub` 与 `Sub` 或 `Line` 与 `Sub`\n\n#### :\\n|\n\nlps文件支持多行并插入换行, 例如\n\n```\n详细文档:| 这是一份文件:\n| 文件内容为空\n```\n\n```\n详细文档:| 这是一份文件\\n 文件内容为空\n```\n\n上方两者表达效果相同\n\n#### :\\n:\n\nlps文件支持多行, 例如\n\n```\n详细文档:| 这是一份文件:\n: 文件内容为空\n```\n\n```\n详细文档:| 这是一份文件 文件内容为空\n```\n\n上方两者表达效果相同\n\n### 使用方法\n\n#### 案例:储存游戏设置\n\n##### 读取LPS文件\n\n```c#\n//读取LPS文件\nLpsDocument Save = new LpsDocument(File.ReadAllText(\"GAMEPATH\\\\save1.lps\"));\n//或创建新LPS文件\nSave = new LpsDocument();\n```\n\n##### 获取和修改数据\n\n案例要求:\n\n* 储存金钱值为10000\n* 添加类型电脑并储存电脑名字为 \"我的电脑\"\n* 读取金钱值并加上500\n\n*方法1 (lps1.0) -- 早期版本lps 繁琐操作*\n\n```C#\nSave.AddLine(new Line(\"money\",\"10000\"));//添加行 money 10000\nSave.AddLine(new Line(\"computer\",\"\"));//添加行 compuer\nSave.FindLine(\"computer\").Add(new Sub(\"name\",\"我的电脑\")); //在computer行下面添加子类name和信息我的电脑\n\nint Money = Convert.ToInt32((Save.FindLine(\"money\").info)); //获得money储存的值\nSave.FindLine(\"money\").info = (Money + 500).ToString();//储存 money+500\n```\n\n*方法2 (lps1.1)  -- 上上版本lps 半繁琐操作*\n\n```c#\nSave.AddLine(\"money\").InfoToInt = 10000; //添加行 money 10000\nSave.FindorAddLine(\"computer\").FindorAddLine(\"name\").Info = \"我的电脑\";//查找行computer, 如果没找到,则创建一个新的. 在该computer行下查找或创建子类name,并修改其信息为 我的电脑\n\nSave.FindorAddLine(\"money\").InfoToInt += 500;//给money+500\n```\n\n*方法3 (lps1.2)  -- 上版本lps 半繁琐操作*\n\n```c#\nSave.AddLine(\"money\").InfoToInt = 10000;\nSave.FindorAddLine(\"computer\").FindorAddLine(\"name\").Info = \"我的电脑\";\n\nSave[\"money\"].InfoToInt += 500;//给money+500\n```\n\n*方法4 (lps1.2+)  -- 上版本lps后期 普通操作*\n\n   ```c#\n   Save.SetInt(\"money\",10000);//设置 money 行 值(int)为10000\n   \n   Save[\"computer\"].SetString(\"name\",\"我的电脑\");\n   // 或这样 (对于string来说更方便)\n   Save[\"computer\"][\"name\"].Info = \"我的电脑\";\n   \n   Save.SetInt(\"money\",Save.GetInt(\"money\")+500);//给money+500\n   ```\n\n*方法5 (lps1.3) -- 最新版本lps 高级操作*\n\n```c#\nSave[(gint)\"money\"] = 10000; //设置 money 行 值(int)为10000\nSave[\"computer\"][(gstr)\"name\"] = \"我的电脑\";\n\nSave[(gint)\"money\"] += 500;\n```\n\n*方法6 (lps1.8) -- 最新版本lps 无需操作*\n\n```C#\n//储存数据的类\npublic class SaveData{\n    [Line]\n    public int money = 10000;//设置 money 值(int)为10000\n    public class Computer{\n        [Line]\n        public string name = \"电脑默认名字\";\n    }\n    [Line]\n    public Computer computer = new Computer(){name = \"我的电脑\"};\n}\n//读取游戏数据\nSaveData data = LPSConvert.DeserializeObject\u003cSaveData\u003e(Save);\ndata.money += 500;\n//储存游戏数据\nSave = LPSConvert.SerializeObject(data);\n```\n\n##### 储存LPS文件\n\n```c#\n//写入LPS源文件\nFile.WriteAllText(\"GAMEPATH\\\\save1.lps\",Save.ToString());\n```\n\n##### 储存的LPS文件样式如下\n\n```lps\nmoney#10500:|\ncomputer:|name#我的电脑:|\n```\n\n### 其他\n\n更多用法及参数参见对象管理器\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Florisyounger%2Flineputscript","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Florisyounger%2Flineputscript","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Florisyounger%2Flineputscript/lists"}