diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2ecc697 --- /dev/null +++ b/.gitignore @@ -0,0 +1,39 @@ +*.sdf +*.suo +*.ipch +*.opensdf +/Universal/x64 +/Universal/x86 +/Universal/SloongLua/Debug +/Universal/SloongLua/x86 +/Universal/CtrlTest/x64 +/Universal/CtrlTest/x86 +/Universal/UnitTest/x64 +/Universal/UnitTest/x86 +/Universal/Universal/x86 +/Universal/Universal/x64 +/SloongMath/SloongMath/Debug +/SloongMath/SloongMath/x64/Debug +/SloongMath/UnitTest/x64/Debug +/SloongMath/x64/Debug +/SloongGraphics/SloongGraphics/Debug +/SloongMath/SloongMath/x64/Release +/SloongMath/SloongMath/x86/Release +/SloongMath/x64/Release +/SloongMath/x86/Release +/SloongGraphics/Debug +/Universal/SloongLua/x64/Debug +*.tlog +ipch +Debug +Release +tlog +*.user +*.o +*.log +*.db +/.vs/ +libuniv_* +.vscode/launch.json +build/debug +build/release diff --git a/ChangeLog.md b/ChangeLog.md new file mode 100644 index 0000000..eb5967a --- /dev/null +++ b/ChangeLog.md @@ -0,0 +1,31 @@ +# 更新历史 +*** + +### 未发布 +#### 新增特性 +* [#42 ](https://git.sloong.com/public/sloongnet/issues/42)GetThumbImage返回值问题 +* [#43 ](https://git.sloong.com/public/sloongnet/issues/42)MD5校验失败后添加相关信息以便定位问题 +#### 功能改进 +* [#40 ](https://git.sloong.com/public/sloongnet/issues/40)优先级标志位使用char型的数字优先级 +### v2.2.3 @ 2016-06-11 +#### BUG修复 +* 修复每条log前都输出了文件未打开提示信息 [#7](https://git.sloong.com/public/library/issues/7) +#### 功能改进 +* debug模式下,日志立即写入到文件中 [#8](https://git.sloong.com/public/library/issues/8) +#### 新增特性 +* log系统增加flush函数 [#9](https://git.sloong.com/public/library/issues/9) +### v2.2.2 @2016-05-05 +#### BUG修复 +* 修复在linux下folder设置无效的问题 [#6](https://git.sloong.com/public/library/issues/6) +#### 功能改进 +* 提升log模块在windows系统下的资源占用和效率提升 [#5](https://git.sloong.com/public/library/issues/5) +### v2.2.1 @ 2016-04-21 +#### 新增特性 +* log模块支持自定义的信息类型字段 [#4](https://git.sloong.com/public/library/issues/4) +* lua模块增加int类型的push和get [#3](https://git.sloong.com/public/library/issues/3) +### v2.1.1 @ 2016-04-01 +#### 新增特性 +* 日志系统增加启动和停止控制函数 [#2](https://git.sloong.com/public/library/issues/2) +* 配合sloongnet增加了新的RunFunction函数 [#1](https://git.sloong.com/public/library/issues/1) +### v2.0.1 @ 2016-02-17 +#### 由TFS迁移到GIT的第一个版本. diff --git a/README.md b/README.md new file mode 100644 index 0000000..1b5b5cc --- /dev/null +++ b/README.md @@ -0,0 +1,28 @@ +# Library - power by sloong.com +开源的通用库,封装了一些常用函数。加快开发速度和效率 + +*** +## Language +[English](https://github.com/soaringloong/sloongnet/blob/develop/README_EN.md) + +## 概述 +* 基于C++编写 +* 支持Windows和Linux系统 + + +## 功能特性 +* 对std::string进行便捷封装 +* 对常用函数增加Windows和Linux自动兼容 + +## 更新历史 +[点击查看](https://git.sloong.com/public/library/src/master/ChangeLog.md) + +## 联系我们 +如果有任何问题,请联系我们。 + +* [Email](wcb@sloong.com) + +* Develop Request +``` +sudo apt installl make gcc g++ libboost-dev libssl-dev liblua5.3-dev +``` \ No newline at end of file diff --git a/build/build.sh b/build/build.sh new file mode 100644 index 0000000..d0e2192 --- /dev/null +++ b/build/build.sh @@ -0,0 +1,107 @@ +#!/bin/bash +# +#echo '$0: '$0 +#echo "pwd: "`pwd` +#echo "scriptPath1: "$(cd `dirname $0`; pwd) +#echo "scriptPath2: "$(dirname $(readlink -f $0)) + +#WORKFOLDER=`pwd` +#echo "Workfolder: "$WORKFOLDER + + +show_help(){ + echo -e "build.sh [operation] +operation: + -r: to build release version + -d: to build debug version + -rz: build release to tar.gz + -dz: build debug to tar.gz + -i: build debug and install" +} + + +SCRIPTFOLDER=$(dirname $(readlink -f $0)) +#echo "ScriptFolder: "$SCRIPTFOLDER +# cd to current file folder +cd $SCRIPTFOLDER + +# default value is debug +VERSION_STR=$(cat $SCRIPTFOLDER/../version) +PROJECT=libuniv +MAKEFLAG=debug +CMAKE_FILE_PATH=$SCRIPTFOLDER/../univ +OUTPATH=$SCRIPTFOLDER/$MAKEFLAG/v$VERSION_STR + +clean(){ + rm -rdf $MAKEFLAG +} + +build(){ + if [ ! -d $MAKEFLAG ];then + mkdir $MAKEFLAG + fi + cd $MAKEFLAG + cmake -DCMAKE_BUILD_TYPE=$MAKEFLAG $CMAKE_FILE_PATH + make + cd ../ + copy_file +} + +copy_file(){ + rm -rdf $OUTPATH + mkdir -p $OUTPATH + cp -f $SCRIPTFOLDER/$MAKEFLAG/libuniv.so $OUTPATH/libuniv.so + mkdir -p $OUTPATH/include/univ/ + cp -f $SCRIPTFOLDER/../univ/*.h $OUTPATH/include/univ/ + cp -f $SCRIPTFOLDER/install.sh $OUTPATH/install.sh +} + +build_debug(){ + MAKEFLAG=debug + clean + build +} + +build_release(){ + MAKEFLAG=release + clean + build +} + +zip(){ + ZIPOUTPUTPATH=$SCRIPTFOLDER/libuniv_v$VERSION_STR.tar.gz + cd $OUTPATH/ + tar -czf $ZIPOUTPUTPATH ./* +} + + +install(){ + cd $OUTPATH + sudo ./install.sh +} + +# -eq 等于, +# -ne 不等于 +# -gt 大于, +# -ge 大于等于, +# -lt 小于, +# -le 小于等于 +if [ $# -eq 0 ]; then + build + exit +fi + +if [ $# -ge 1 ]; then + case $1 in + -r) build_release;; + -d) build_debug;; + -rz) + build_release + zip;; + -dz) + build_debug + zip;; + -i) install;; + * ) show_help;; + esac +fi diff --git a/build/environment.sh b/build/environment.sh new file mode 100644 index 0000000..60647a2 --- /dev/null +++ b/build/environment.sh @@ -0,0 +1 @@ +sudo apt install -y make cmake gcc g++ libboost-dev libboost-serialization1.65 libssl-dev liblua5.3-dev \ No newline at end of file diff --git a/build/install.sh b/build/install.sh new file mode 100644 index 0000000..e480f35 --- /dev/null +++ b/build/install.sh @@ -0,0 +1,6 @@ + +cp sloong.conf /etc/ld.so.conf.d/sloong.conf +mkdir -p /usr/local/include/univ +mkdir -p /usr/local/lib/sloong +cp -f include/univ/*.h /usr/local/include/univ/ +cp -f libuniv.so /usr/local/lib/sloong/ diff --git a/library.sln b/library.sln new file mode 100644 index 0000000..e878328 --- /dev/null +++ b/library.sln @@ -0,0 +1,73 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.28803.202 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "univ", "univ\univ.vcxproj", "{A3A8387F-9C65-4C46-8C0F-8B3B9CA4C4F5}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "graphics", "graphics\SloongGraphics.vcxproj", "{78DBD20E-C94A-4221-ADA0-289D19ECD733}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "math", "math\SLoongMath.vcxproj", "{2C099C1F-DEDC-4EE9-9C9D-1A4EB763BBAE}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test", "test\test.vcxproj", "{492611B4-E51E-4F58-A631-406BA1BD0465}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Debug|x64 = Debug|x64 + Release|Win32 = Release|Win32 + Release|x64 = Release|x64 + UnitTest|Win32 = UnitTest|Win32 + UnitTest|x64 = UnitTest|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {A3A8387F-9C65-4C46-8C0F-8B3B9CA4C4F5}.Debug|Win32.ActiveCfg = Debug|Win32 + {A3A8387F-9C65-4C46-8C0F-8B3B9CA4C4F5}.Debug|Win32.Build.0 = Debug|Win32 + {A3A8387F-9C65-4C46-8C0F-8B3B9CA4C4F5}.Debug|x64.ActiveCfg = Debug|x64 + {A3A8387F-9C65-4C46-8C0F-8B3B9CA4C4F5}.Debug|x64.Build.0 = Debug|x64 + {A3A8387F-9C65-4C46-8C0F-8B3B9CA4C4F5}.Release|Win32.ActiveCfg = Release|x64 + {A3A8387F-9C65-4C46-8C0F-8B3B9CA4C4F5}.Release|x64.ActiveCfg = Release|x64 + {A3A8387F-9C65-4C46-8C0F-8B3B9CA4C4F5}.Release|x64.Build.0 = Release|x64 + {A3A8387F-9C65-4C46-8C0F-8B3B9CA4C4F5}.UnitTest|Win32.ActiveCfg = Release|x64 + {A3A8387F-9C65-4C46-8C0F-8B3B9CA4C4F5}.UnitTest|x64.ActiveCfg = Release|x64 + {A3A8387F-9C65-4C46-8C0F-8B3B9CA4C4F5}.UnitTest|x64.Build.0 = Release|x64 + {78DBD20E-C94A-4221-ADA0-289D19ECD733}.Debug|Win32.ActiveCfg = Debug|Win32 + {78DBD20E-C94A-4221-ADA0-289D19ECD733}.Debug|Win32.Build.0 = Debug|Win32 + {78DBD20E-C94A-4221-ADA0-289D19ECD733}.Debug|x64.ActiveCfg = Debug|x64 + {78DBD20E-C94A-4221-ADA0-289D19ECD733}.Debug|x64.Build.0 = Debug|x64 + {78DBD20E-C94A-4221-ADA0-289D19ECD733}.Release|Win32.ActiveCfg = Release|x64 + {78DBD20E-C94A-4221-ADA0-289D19ECD733}.Release|x64.ActiveCfg = Release|x64 + {78DBD20E-C94A-4221-ADA0-289D19ECD733}.Release|x64.Build.0 = Release|x64 + {78DBD20E-C94A-4221-ADA0-289D19ECD733}.UnitTest|Win32.ActiveCfg = Release|x64 + {78DBD20E-C94A-4221-ADA0-289D19ECD733}.UnitTest|x64.ActiveCfg = Release|x64 + {78DBD20E-C94A-4221-ADA0-289D19ECD733}.UnitTest|x64.Build.0 = Release|x64 + {2C099C1F-DEDC-4EE9-9C9D-1A4EB763BBAE}.Debug|Win32.ActiveCfg = Debug|Win32 + {2C099C1F-DEDC-4EE9-9C9D-1A4EB763BBAE}.Debug|Win32.Build.0 = Debug|Win32 + {2C099C1F-DEDC-4EE9-9C9D-1A4EB763BBAE}.Debug|x64.ActiveCfg = Debug|x64 + {2C099C1F-DEDC-4EE9-9C9D-1A4EB763BBAE}.Debug|x64.Build.0 = Debug|x64 + {2C099C1F-DEDC-4EE9-9C9D-1A4EB763BBAE}.Release|Win32.ActiveCfg = Release|x64 + {2C099C1F-DEDC-4EE9-9C9D-1A4EB763BBAE}.Release|x64.ActiveCfg = Release|x64 + {2C099C1F-DEDC-4EE9-9C9D-1A4EB763BBAE}.Release|x64.Build.0 = Release|x64 + {2C099C1F-DEDC-4EE9-9C9D-1A4EB763BBAE}.UnitTest|Win32.ActiveCfg = Release|x64 + {2C099C1F-DEDC-4EE9-9C9D-1A4EB763BBAE}.UnitTest|x64.ActiveCfg = Release|x64 + {2C099C1F-DEDC-4EE9-9C9D-1A4EB763BBAE}.UnitTest|x64.Build.0 = Release|x64 + {492611B4-E51E-4F58-A631-406BA1BD0465}.Debug|Win32.ActiveCfg = Debug|Win32 + {492611B4-E51E-4F58-A631-406BA1BD0465}.Debug|Win32.Build.0 = Debug|Win32 + {492611B4-E51E-4F58-A631-406BA1BD0465}.Debug|x64.ActiveCfg = Debug|x64 + {492611B4-E51E-4F58-A631-406BA1BD0465}.Debug|x64.Build.0 = Debug|x64 + {492611B4-E51E-4F58-A631-406BA1BD0465}.Release|Win32.ActiveCfg = Release|Win32 + {492611B4-E51E-4F58-A631-406BA1BD0465}.Release|Win32.Build.0 = Release|Win32 + {492611B4-E51E-4F58-A631-406BA1BD0465}.Release|x64.ActiveCfg = Release|x64 + {492611B4-E51E-4F58-A631-406BA1BD0465}.Release|x64.Build.0 = Release|x64 + {492611B4-E51E-4F58-A631-406BA1BD0465}.UnitTest|Win32.ActiveCfg = Release|Win32 + {492611B4-E51E-4F58-A631-406BA1BD0465}.UnitTest|Win32.Build.0 = Release|Win32 + {492611B4-E51E-4F58-A631-406BA1BD0465}.UnitTest|x64.ActiveCfg = Release|x64 + {492611B4-E51E-4F58-A631-406BA1BD0465}.UnitTest|x64.Build.0 = Release|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {2C10D331-CB50-4EDC-8CBB-6B7BDBF72B38} + EndGlobalSection +EndGlobal diff --git a/sloong.conf b/sloong.conf deleted file mode 100644 index 50cae58..0000000 --- a/sloong.conf +++ /dev/null @@ -1 +0,0 @@ -/usr/local/lib/sloong diff --git a/univ.creator b/univ.creator deleted file mode 100644 index c03804d..0000000 --- a/univ.creator +++ /dev/null @@ -1 +0,0 @@ -[General] diff --git a/Base64.cpp b/univ/Base64.cpp similarity index 100% rename from Base64.cpp rename to univ/Base64.cpp diff --git a/Base64.h b/univ/Base64.h similarity index 100% rename from Base64.h rename to univ/Base64.h diff --git a/CMakeLists.txt b/univ/CMakeLists.txt similarity index 100% rename from CMakeLists.txt rename to univ/CMakeLists.txt diff --git a/DES.cpp b/univ/DES.cpp similarity index 100% rename from DES.cpp rename to univ/DES.cpp diff --git a/DES.h b/univ/DES.h similarity index 100% rename from DES.h rename to univ/DES.h diff --git a/Lunar.h b/univ/Lunar.h similarity index 100% rename from Lunar.h rename to univ/Lunar.h diff --git a/blowfish.cpp b/univ/blowfish.cpp similarity index 100% rename from blowfish.cpp rename to univ/blowfish.cpp diff --git a/blowfish.h b/univ/blowfish.h similarity index 100% rename from blowfish.h rename to univ/blowfish.h diff --git a/defines.h b/univ/defines.h similarity index 100% rename from defines.h rename to univ/defines.h diff --git a/dllmain.cpp b/univ/dllmain.cpp similarity index 100% rename from dllmain.cpp rename to univ/dllmain.cpp diff --git a/exception.cpp b/univ/exception.cpp similarity index 100% rename from exception.cpp rename to univ/exception.cpp diff --git a/exception.h b/univ/exception.h similarity index 100% rename from exception.h rename to univ/exception.h diff --git a/hash.cpp b/univ/hash.cpp similarity index 100% rename from hash.cpp rename to univ/hash.cpp diff --git a/hash.h b/univ/hash.h similarity index 100% rename from hash.h rename to univ/hash.h diff --git a/log.cpp b/univ/log.cpp similarity index 100% rename from log.cpp rename to univ/log.cpp diff --git a/log.h b/univ/log.h similarity index 100% rename from log.h rename to univ/log.h diff --git a/lua.cpp b/univ/lua.cpp similarity index 100% rename from lua.cpp rename to univ/lua.cpp diff --git a/lua.h b/univ/lua.h similarity index 100% rename from lua.h rename to univ/lua.h diff --git a/luapacket.cpp b/univ/luapacket.cpp similarity index 100% rename from luapacket.cpp rename to univ/luapacket.cpp diff --git a/luapacket.h b/univ/luapacket.h similarity index 100% rename from luapacket.h rename to univ/luapacket.h diff --git a/resource.h b/univ/resource.h similarity index 100% rename from resource.h rename to univ/resource.h diff --git a/stdafx.cpp b/univ/stdafx.cpp similarity index 100% rename from stdafx.cpp rename to univ/stdafx.cpp diff --git a/stdafx.h b/univ/stdafx.h similarity index 100% rename from stdafx.h rename to univ/stdafx.h diff --git a/targetver.h b/univ/targetver.h similarity index 100% rename from targetver.h rename to univ/targetver.h diff --git a/threadpool.cpp b/univ/threadpool.cpp similarity index 100% rename from threadpool.cpp rename to univ/threadpool.cpp diff --git a/threadpool.h b/univ/threadpool.h similarity index 100% rename from threadpool.h rename to univ/threadpool.h diff --git a/univ.config b/univ/univ.config similarity index 100% rename from univ.config rename to univ/univ.config diff --git a/univ.cpp b/univ/univ.cpp similarity index 100% rename from univ.cpp rename to univ/univ.cpp diff --git a/univ.files b/univ/univ.files similarity index 100% rename from univ.files rename to univ/univ.files diff --git a/univ.h b/univ/univ.h similarity index 100% rename from univ.h rename to univ/univ.h diff --git a/univ.includes b/univ/univ.includes similarity index 100% rename from univ.includes rename to univ/univ.includes diff --git a/univ.vcxproj b/univ/univ.vcxproj similarity index 100% rename from univ.vcxproj rename to univ/univ.vcxproj diff --git a/univ.vcxproj.filters b/univ/univ.vcxproj.filters similarity index 100% rename from univ.vcxproj.filters rename to univ/univ.vcxproj.filters diff --git a/version.h b/univ/version.h similarity index 100% rename from version.h rename to univ/version.h diff --git a/version b/version new file mode 100644 index 0000000..9ad49ed --- /dev/null +++ b/version @@ -0,0 +1 @@ +2.5.2.255 diff --git a/version.sh b/version.sh new file mode 100644 index 0000000..d863e48 --- /dev/null +++ b/version.sh @@ -0,0 +1,32 @@ +#!/bin/bash +# +# the version resource text file +VER_FILE_PATH=univ/version.h +# the version file +VER_PATH=version +# the version template file +VER_TEMPLATE_PATH=version.template +# remove old version file +rm -f $VER_FILE_PATH +rm -f $VER_PATH +# get git version +_GIT_VERSION_VALUE=`git rev-list --all | wc -l` +# build version text with template file. set text 'GET_VERSION' to value of git version. +VER_TEXT=$(cat $VER_TEMPLATE_PATH | sed "s/GIT_VERSION/$_GIT_VERSION_VALUE/g") +echo "$VER_TEXT" > $VER_FILE_PATH + +for i in `cat $VER_TEMPLATE_PATH` +do + case $i in + L*"GIT_VERSION"*) VER_TEXT=$i;; + esac +done +# build version file +VER_TEXT=${VER_TEXT/GIT_VERSION/$_GIT_VERSION_VALUE} +VER_TEXT=${VER_TEXT#*\"} +VER_TEXT=${VER_TEXT%\"*} + +echo $VER_TEXT > $VER_PATH +# update version to git +git add $VER_FILE_PATH +git add $VER_PATH \ No newline at end of file diff --git a/version.template b/version.template new file mode 100644 index 0000000..3332c35 --- /dev/null +++ b/version.template @@ -0,0 +1,24 @@ +#ifndef VERSION_H +#define VERSION_H + + +// Version +#define VERSION_NUMBER 2,5,2,GIT_VERSION +#define VERSION_FILEVERSION L"2.5.2.GIT_VERSION" +#define VERSION_BUILDTIME L"2020/01/21" + +#ifdef _DEBUG +#define VERSION_PRODUCTVERSION L"Ver.2.5 for Debug" +#define VERSION_FILEDESCRIPTION L"Sloong Universal Debug Libaray" +#define VERSION_PRODUCTNAME L"Sloong Universal Debug Libaray" +#else +#define VERSION_PRODUCTVERSION L"Ver.2.5") +#define VERSION_FILEDESCRIPTION L"Sloong Universal Libaray" +#define VERSION_PRODUCTNAME L"Sloong Universal Libaray" +#endif // _DEBUG +#define VERSION_INTERNALNAME L"Universal.dll") +#define VERSION_COMPANYNAME L"Sloong, Inc.") +#define VERSION_LEGALCOPYRIGHT L"Copyright (C) 2014-2020 Sloong, Inc." + + +#endif // !VERSION_H