Initial Commit
This commit is contained in:
commit
861b7b8aa1
19
Readme.md
Normal file
19
Readme.md
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
# LiteServer Package Generator
|
||||||
|
|
||||||
|
客户端整合包自动生成器
|
||||||
|
|
||||||
|
## 要求
|
||||||
|
|
||||||
|
系统部件: echo cp rm zip
|
||||||
|
|
||||||
|
## 使用方法
|
||||||
|
|
||||||
|
放置在任何目录均可. 该目录下需要一下两个文件夹
|
||||||
|
|
||||||
|
> LiteServer_Client_FullPackage_Base
|
||||||
|
>
|
||||||
|
> 这个文件夹内包含MC游戏本体.
|
||||||
|
>
|
||||||
|
> LiteServer_Client_Mods
|
||||||
|
>
|
||||||
|
> 这个文件夹内包含客户端包含的Mod文件
|
80
main.cpp
Normal file
80
main.cpp
Normal file
|
@ -0,0 +1,80 @@
|
||||||
|
#include <cstdio>
|
||||||
|
#include <cstdlib>
|
||||||
|
#include <cstring>
|
||||||
|
#include <cpplib/cpplib#time>
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
char VERSION_STAMP[64];
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
/// Check exist
|
||||||
|
FILE* fp=fopen("service_running.log","r");
|
||||||
|
if(fp!=NULL)
|
||||||
|
{
|
||||||
|
printf("Only 1 Package Generator can be running in this directory at the same time.\n");
|
||||||
|
fclose(fp);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
system("echo Service is running > service_running.log");
|
||||||
|
|
||||||
|
s_time s=whattime();
|
||||||
|
sprintf(VERSION_STAMP,"%02d%02d%02d_%02d%02d%02d",s.year,s.mon,s.day,s.hour,s.min,s.sec);
|
||||||
|
|
||||||
|
printf("Version Stamp(AutoGenerated): %s\n",VERSION_STAMP);
|
||||||
|
char buffer[256];
|
||||||
|
memset(buffer,0,256);
|
||||||
|
sprintf(buffer,"LiteServer_Client_FullPackage_%s",VERSION_STAMP);
|
||||||
|
|
||||||
|
char cmd[1024];
|
||||||
|
memset(cmd,0,1024);
|
||||||
|
|
||||||
|
printf("Copying files...\n");
|
||||||
|
sprintf(cmd,"cp -r LiteServer_Client_FullPackage_Base %s",buffer);
|
||||||
|
system(cmd);
|
||||||
|
|
||||||
|
printf("Copying mods...\n");
|
||||||
|
sprintf(cmd,"cp -r LiteServer_Client_Mods\\* %s\\.minecraft\\mods",buffer);
|
||||||
|
system(cmd);
|
||||||
|
|
||||||
|
printf("Creating Readme...\n");
|
||||||
|
do
|
||||||
|
{
|
||||||
|
char fname[128];
|
||||||
|
memset(fname,0,128);
|
||||||
|
sprintf(fname,"%s\\Readme.txt",buffer);
|
||||||
|
FILE* fp=fopen(fname,"w");
|
||||||
|
if(fp)
|
||||||
|
{
|
||||||
|
fprintf(fp,
|
||||||
|
"===============================================\n"
|
||||||
|
"本安装包由LiteServer Package Generator自动生成.\n"
|
||||||
|
"作者: Kiritow.\n"
|
||||||
|
"生成日期: %d年%d月%d日 %02d:%02d:%02d\n"
|
||||||
|
"===============================================\n"
|
||||||
|
"欢迎加入LiteServer 群号: 693401480\n"
|
||||||
|
"玩的开心~",
|
||||||
|
s.year,s.mon,s.day,s.hour,s.min,s.sec);
|
||||||
|
fclose(fp);
|
||||||
|
printf("Readme generated.\n");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
printf("Failed to create readme.\n");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}while(0);
|
||||||
|
|
||||||
|
printf("Creating Package...\n");
|
||||||
|
sprintf(cmd,"zip -q -r -9 %s.zip %s\n",buffer,buffer);
|
||||||
|
system(cmd);
|
||||||
|
|
||||||
|
printf("Cleaning up...\n");
|
||||||
|
sprintf(cmd,"rm -rf %s",buffer);
|
||||||
|
system(cmd);
|
||||||
|
system("rm service_running.log");
|
||||||
|
|
||||||
|
printf("Finished.\n");
|
||||||
|
return 0;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user