Vector<String> SvnInfo(const String& package) { Vector<String> info; String d = GetFileFolder(PackagePath(package)); if(IsSvnDir2(d)) { String v = Sys("svnversion " + d); if(IsDigit(*v)) info.Add("#define bmSVN_REVISION " + AsCString(TrimBoth(v))); v = Sys("svn info " + d); StringStream in(v); while(!in.IsEof()) { String l = in.GetLine(); if(l.StartsWith("URL: ")) { info.Add("#define bmSVN_URL " + AsCString(TrimBoth(l.Mid(5)))); break; } } } return info; }
String Apk::FindValueInAndroidManifest(const String& badge, const String& tag) const { String out; if(Sys(sdk.AaptPath() + " dump badging " + path + " AndroidManifest.xml", out) == 0) { Vector<String> lines = Split(out, '\n'); for(int i = 0; i < lines.GetCount(); i++) { if(lines[i].Find(badge) >= 0) return FindBadgeTagValue(lines[i], tag); } } return String(); }
Vector<AndroidVirtualDevice> AndroidSDK::FindVirtualDevices() const { Vector<AndroidVirtualDevice> avdes; String out; if(Sys(NormalizeExePath(AndroidPath()) + " list avd", out) == 0) { Vector<String> lines = Split(out, "\n"); AndroidVirtualDevice avd; for(int i = 0; i < lines.GetCount(); i++) { Vector<String> line = Split(lines[i], ":"); if(line.GetCount() == 2) { String tag = line[0]; String data = line[1]; if(data.StartsWith(" ")) data.Remove(0); if(tag.Find("Name") > -1) { if(!avd.GetName().IsEmpty() && avd.GetName() != data) avdes.Add(avd); avd.SetName(data); } else if(tag.Find("Device") > -1) avd.SetDeviceType(data); else if(tag.Find("Path") > -1) avd.SetPath(data); else if(tag.Find("Target") > -1) avd.SetTarget(data); else if(tag.Find("Tag/ABI") > -1) avd.SetAbi(data); // TODO: implement all possible tags } } if(!avd.GetName().IsEmpty()) avdes.Add(avd); } return avdes; }
Vector<AndroidDevice> AndroidSDK::FindDevices() const { Vector<AndroidDevice> devices; String out; if(Sys(NormalizeExePath(AdbPath()) + " devices -l", out) == 0) { Vector<String> lines; Vector<String> outputLines = Split(out, "\n"); for(int i = 0; i < outputLines.GetCount(); i++) { if(!outputLines[i].StartsWith("*") && !outputLines[i].StartsWith(" ")) lines.Add(outputLines[i]); } for(int i = 1; i < lines.GetCount(); i++) { AndroidDevice device; Vector<String> elements = Split(lines[i], " "); for(int j = 0; j < elements.GetCount(); j++) { if(j == 0) device.SetSerial(elements[j]); else if(j == 1) device.SetState(elements[j]); else { Vector<String> element = Split(elements[j], ":"); if(element.GetCount() == 2) { String tag = element[0]; String data = element[1]; if(tag == "usb") device.SetUsb(data); else if(tag == "model") device.SetModel(data); } } } devices.Add(device); } } return devices; }
int main() { // Loop test Ape a = Ape(); //a.update(); //return 0; //while (1) { printf("\n"); a.update(); a.sort(CPU); a.printProcesses(CPU); usleep(1000 * 1000); system("clear"); //} Sys s = Sys(); printf(s.version); fileTest(); //removeTest(); //mapTest(); //initTest(); //sysTest(); //procStatTest(); //procCPUTest(); //fileTest(); //testCore(); //sendSignal(); //getchar(); }
bool CloseCDTray(String drive) { String dummy; return Sys("eject -t", dummy) > 0; }
bool OpenCDTray(String drive) { String dummy; return Sys("eject", dummy) > 0; }
int SEL_main(int argc,char ** argv) { MMD_InitArgcArgv(argc,argv); Pt2di aSzW(1000,900); /* if (! ELISE_fp::exist_file(MMDir() + "bin/MICMACSaisieLiaisons")) VoidSystem("make -f MakeMICMAC bin/MICMACSaisieLiaisons"); */ std::string aDir; std::string aN1; std::string aN2; std::string aKeyH; int aRedr=0; std::string aFilter=""; bool aRedrL1 = false; bool ModeEpip = false; std::string aKeyCompl="Cple2HomAp"; std::string SH=""; ElInitArgMain ( argc,argv, LArgMain() << EAMC(aDir,"Directory", eSAM_IsDir) << EAMC(aN1,"First image name", eSAM_IsExistFile) << EAMC(aN2,"Second image name", eSAM_IsExistFile) , LArgMain() << EAM(aRedr,"R",true) << EAM(aRedrL1,"RL1",true,"Estimate Homography using L1 mode") << EAM(aFilter,"F",true) << EAM(aKeyH,"KH",true,"In P PB PBR M S NB NT MMD",eSAM_None,ListOfVal(eTS_NbVals,"eTS_")) << EAM(aKeyCompl,"KCpl",true) << EAM(aSzW,"SzW",true) << EAM(ModeEpip,"ModeEpip",true,"If mode epip, the y displacement are forced to 0") << EAM(SH,"SH",true,"Homologue extenion for NB/NT mode") ); if (!MMVisualMode) { std::string aCom = MM3dBinFile("MICMACSaisieLiaisons") // + MMDir()+std::string("applis/XML-Pattron/Pattron-MicMacLiaison.xml ") + MMDir()+std::string("include/XML_MicMac/Pattron-MicMacLiaison.xml ") + " WorkDir=" + aDir + " %Im1=" + aN1 + " %Im2=" + aN2 + " %SL_XSzW=" + ToString(aSzW.x) + " %SL_YSzW=" + ToString(aSzW.y) + " %SL_Epip=" + ToString(ModeEpip) ; if (aRedr) aCom = aCom + " SL_NewRedrCur=true"; if (aRedrL1) aCom = aCom + " SL_L2Estim=false"; if (aFilter!="") aCom = aCom /* + " SL_TJS_FILTER=true" */ + " SL_FILTER=" +aFilter; if (aKeyH!="") { if (aKeyH=="P") { aKeyCompl = "PastisHom"; } else if (aKeyH=="PB") { aKeyCompl = "Key-Assoc-CpleIm2HomolPastisBin"; } else if (aKeyH=="PBR") { aKeyCompl = "Key-Assoc-SsRes-CpleIm2HomolPastisBin"; } else if (aKeyH=="M") { aKeyCompl = "MarcHom"; } else if (aKeyH=="S") { // aKeyCompl = "Key-Assoc-StdHom"; aKeyCompl = "NKS-Assoc-CplIm2Hom@-Man@xml"; } else if (aKeyH=="NB") { aKeyCompl = "NKS-Assoc-CplIm2Hom@"+SH+"@dat"; } else if (aKeyH=="NT") { aKeyCompl = "NKS-Assoc-CplIm2Hom@"+SH+"@txt"; } else if (aKeyH=="MMD") { aKeyCompl = "NKS-Assoc-CplIm2Hom@-DenseM@dat"; } else { std::cout << "For Key=[" << aKeyH << "]\n"; ELISE_ASSERT(false,"Do Not know key"); } } aCom = aCom + " FCND_CalcHomFromI1I2=" + aKeyCompl; std::cout << aCom << "\n"; Sys(aCom); Banniere_SEL(); return 0; } else return EXIT_SUCCESS; }