QIQI.EProjectFile 1.3.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package QIQI.EProjectFile --version 1.3.0
NuGet\Install-Package QIQI.EProjectFile -Version 1.3.0
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="QIQI.EProjectFile" Version="1.3.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add QIQI.EProjectFile --version 1.3.0
#r "nuget: QIQI.EProjectFile, 1.3.0"
#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 QIQI.EProjectFile as a Cake Addin
#addin nuget:?package=QIQI.EProjectFile&version=1.3.0

// Install QIQI.EProjectFile as a Cake Tool
#tool nuget:?package=QIQI.EProjectFile&version=1.3.0

Only Chinese document is available.

EProjectFile

一个用于编辑易语言项目文件的第三方库(C#)
NuGet CodeFactor
命名空间:QIQI.EProjectFile

安装

Package Manager Install-Package QIQI.EProjectFile
.NET CLI dotnet add package QIQI.EProjectFile
使用VS的NuGet包管理器(GUI)搜索 QIQI.EProjectFile
支持:.NET Framework 4.0或更高/.NET Core 2.0或更高

声明

  1. 仅供学习与交流使用
  2. 本项目属于实验性项目,所有API随时变更
  3. 本项目随时终止,不做任何可用承诺
  4. 对于使用本项目造成的一切损失,概不负责
  5. 本项目可能造成被操作文件的数据丢失,请提前备份
  6. 禁止用于非法用途,包括但不限于:破解他人软件
  7. 本项目目前处于起步阶段,基本只提供底层解析/生成支持,功能极不完善

交流

一般bug请用Github的Issues模块反馈
如果您希望对本项目做出贡献,请使用标准GitHub工作流:Fork + Pull request
进一步的快速讨论:请加入QQ群605310933 (注意不要在群中反馈bug,这很可能导致反馈没有被记录。聊天消息较Issues模块比较混乱)

编译

使用NuGet安装缺失包,然后一般编译即可
注意:必须VS2017或更高版本,使用了最新语言特性 (不过运行环境.NET Framework 4.0即可,支持XP)

例程

using QIQI.EProjectFile;
using QIQI.EProjectFile.Expressions;
using QIQI.EProjectFile.Statements;
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;


private static T[] AddArrayElement<T>(T[] array, T element)
{
	var newArray = new T[array.Length + 1];
	Array.Copy(array, newArray, array.Length);
	newArray[array.Length] = element;
	return newArray;
}
		
// 添加Tag子程序(如果不存在),然后在每个子程序的开头加上:Tag(<子程序名>)
var projectFile = new EProjectFile();
projectFile.Load(File.OpenRead(fileName));
int tagMethod = 0;
try
{
	tagMethod = Array.Find(projectFile.Code.Methods, x => x.IsStatic && string.Compare(x.Name, "Tag") == 0).Id;
}
catch (Exception)
{
	int tagStaticClass = projectFile.Code.AllocId(EplSystemId.Type_StaticClass);
	tagMethod = projectFile.Code.AllocId(EplSystemId.Type_Method);
	projectFile.Code.Classes = AddArrayElement(projectFile.Code.Classes, new ClassInfo(tagStaticClass)
	{
		Name = "TagMoudle",
		Method = new int[] { tagMethod }
	});
	projectFile.Code.Methods = AddArrayElement(projectFile.Code.Methods, new MethodInfo(tagMethod)
	{
		Name = "Tag",
		Class = tagStaticClass,
		CodeData = new StatementBlock() { new ExpressionStatement() }.ToCodeData(projectFile.Encoding),
		Parameters = new MethodParameterInfo[]
		{
			new MethodParameterInfo(projectFile.Code.AllocId(EplSystemId.Type_Local))
			{
				Name = "Name",
				DataType = EplSystemId.DataType_String
			}
		}
	});
	if (projectFile.EPackageInfo != null)
	{
		projectFile.EPackageInfo.FileNames = AddArrayElement(projectFile.EPackageInfo.FileNames, null);
	}
}
foreach (var method in projectFile.Code.Methods)
{
	if (method.Id != tagMethod)
	{
		StatementBlock block = CodeDataParser.ParseStatementBlock(method.CodeData.ExpressionData, method.CodeData.Encoding);
		{
			if (block[0] is ExpressionStatement exprStat && exprStat.Expression is CallExpression callExpr) 
				if (callExpr.LibraryId == -2 && callExpr.MethodId == tagMethod)
					block.RemoveAt(0);
		}
		block.Insert(0, new ExpressionStatement(new CallExpression(-2, tagMethod, new ParamListExpression() { new StringLiteral(method.Name) }), false, "Added from C# Project \"EProjectFile\""));
		method.CodeData = block.ToCodeData(projectFile.Encoding);
	}
}
projectFile.Save(File.Create(fileName));
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  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.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net40 is compatible.  net403 was computed.  net45 was computed.  net451 was computed.  net452 was computed.  net46 was computed.  net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on QIQI.EProjectFile:

Package Downloads
QIQI.EplOnCpp.Core

EplOnCpp Core

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.9.3 221 11/13/2023
1.9.0 413 10/10/2022
1.8.0 401 8/28/2022
1.7.6 374 8/27/2022
1.7.5 355 8/22/2022
1.7.4 371 8/18/2022
1.7.3 340 8/17/2022
1.7.2 377 8/16/2022
1.7.1 382 8/13/2022
1.7.0 392 8/13/2022
1.6.2 366 8/8/2022
1.6.1 387 8/8/2022
1.6.0 394 8/8/2022
1.5.1 427 7/17/2022
1.5.0 442 7/13/2022
1.4.1 672 7/9/2022
1.4.0 395 7/8/2022
1.3.6 1,259 8/13/2019
1.3.5 543 8/11/2019
1.3.4 556 8/10/2019
1.3.3 990 7/12/2019
1.3.2 649 7/12/2019
1.3.1 638 6/6/2019
1.3.0 774 4/5/2019
1.2.0 788 9/16/2018
1.1.0 821 8/25/2018
1.0.0 852 7/30/2018
1.0.0-rc 669 7/28/2018
1.0.0-beta 792 6/28/2018