Commit 57dc146e authored by jan.koester's avatar jan.koester
Browse files

test

parent 7fd52b4c
Loading
Loading
Loading
Loading
+26 −16
Changes for plugins/nodeinfo/nodeinfo.cpp: 26 added lines, 16 removed lines.
Original line number Diff line number Diff line
@@ -60,7 +60,30 @@ namespace blogi {
    class NodeInfo : public PluginApi {
    public:
        NodeInfo(){
#ifndef Windows
            std::ifstream osr(RELEASEFILE);
            std::string osline;

            if(osr.is_open()){
                while( getline (osr,osline) ){
                    auto deli=osline.find('=');
                    if(osline.substr(0,deli)=="NAME"){
                        deli+=2;
                        _DistName=osline.substr(deli,osline.size()-deli-1);
                        continue;
                    }
                    size_t sts=osline.find('\"',deli);
                    size_t ets=osline.find('\"',++sts);
                    if(osline.substr(0,deli)=="VERSION"){
                        deli+=2;
                        _DistEntry=osline.substr(deli,osline.size()-deli-1);
                        continue;
                    }
                }
            }
#endif
        }

        const char* getName(){
            return "nodeinfo";
        }
@@ -125,22 +148,7 @@ namespace blogi {
            htmltable << libhtmlpp::HtmlTable::Row() << "Operating system:" << (sysicohtml << usysinfo.sysname);
            htmltable << libhtmlpp::HtmlTable::Row() << "Release Version :" << usysinfo.release;
            htmltable << libhtmlpp::HtmlTable::Row() << "Hardware        :" << usysinfo.machine;

            std::fstream osr(RELEASEFILE,std::ios::in);
            std::string osline;

            if(osr.is_open()){
                while ( getline (osr,osline) ){
                    std::string name,entry;
                    int deli=osline.find('=');
                    name=osline.substr(0,deli);
                    size_t sts=osline.find('\"',deli);
                    size_t ets=osline.find('\"',++sts);
                    if(sts!=std::string::npos && ets!=std::string::npos)
                        entry=osline.substr(sts,ets-sts);
                    htmltable << libhtmlpp::HtmlTable::Row() << name.c_str() << entry.c_str();
                }
            }
            htmltable << libhtmlpp::HtmlTable::Row() <<  _DistName << _DistEntry;
#else
            OSVERSIONINFOW info;
            memset(&info, 0, sizeof(OSVERSIONINFOW));
@@ -200,6 +208,8 @@ namespace blogi {
            return true;

        }
private:
        std::string _DistName,_DistEntry;
    };
};