mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 18:55:26 +00:00
added functions in win.js for parsing diskpart output
This commit is contained in:
parent
f5d27d036f
commit
e7868a8b02
6 changed files with 82 additions and 7 deletions
|
|
@ -8,6 +8,9 @@
|
|||
* Added functions DOM.getCurrentFileContent(pCallBack [, pCurrentFile])
|
||||
and Util.setTimeout(pFunction [, pCallBack, pTime])
|
||||
|
||||
* Added functions in win.js for parsing diskpart output.
|
||||
|
||||
|
||||
2012.12.12, Version 0.1.8
|
||||
|
||||
* Added ability to shutdown Cloud Commander
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
'# used for work with Aplication Cache.' + '\n' +
|
||||
'# If you wont to see at work set appcache: true' + '\n' +
|
||||
'# in config.json and start cloudcmd.js' + '\n' +
|
||||
'# http://github.com/coderaiser/cloudcmd' + '\n');
|
||||
'# http://coderaiser.github.com/cloudcmd' + '\n');
|
||||
|
||||
var main = global.cloudcmd.main,
|
||||
fs = main.fs,
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
'# parameters in config.json or environment' + '\n' +
|
||||
'# and start cloudcmd.js or just do' + '\n' +
|
||||
'# require(\'auth.js\').auth(pCode, pCallBack)' + '\n' +
|
||||
'# http://github.com/coderaiser/cloudcmd' + '\n');
|
||||
'# http://coderaiser.github.com/cloudcmd' + '\n');
|
||||
|
||||
var main = global.cloudcmd.main,
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
'# used for work with REST API.' + '\n' +
|
||||
'# If you wont to see at work set rest: true' + '\n' +
|
||||
'# and api_url in config.json' + '\n' +
|
||||
'# http://github.com/coderaiser/cloudcmd' + '\n');
|
||||
'# http://coderaiser.github.com/cloudcmd' + '\n');
|
||||
|
||||
var main = global.cloudcmd.main,
|
||||
Util = main.util,
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
'# Module is part of Cloud Commander,' + '\n' +
|
||||
'# used for work update thru git.' + '\n' +
|
||||
'# If you wont to see at work install git' + '\n' +
|
||||
'# http://github.com/coderaiser/cloudcmd' + '\n');
|
||||
'# http://coderaiser.github.com/cloudcmd' + '\n');
|
||||
|
||||
var main = global.cloudcmd.main,
|
||||
mainpackage = main.mainpackage,
|
||||
|
|
@ -35,7 +35,7 @@
|
|||
* @param pStdout
|
||||
* @param pStderr
|
||||
*/
|
||||
function pull(pError, pStdout, pStderr){
|
||||
function pull(pError, pStdout, pStderr){
|
||||
var lExec;
|
||||
|
||||
if(!pError){
|
||||
|
|
|
|||
|
|
@ -1,3 +1,75 @@
|
|||
/* Library contain windows specific functions
|
||||
/*
|
||||
* Library contain windows specific functions
|
||||
* like getting information about volumes
|
||||
*/
|
||||
*/
|
||||
|
||||
(function(){
|
||||
"use strict";
|
||||
|
||||
if(!global.cloudcmd)
|
||||
return console.log(
|
||||
'# win.js' + '\n' +
|
||||
'# -----------' + '\n' +
|
||||
'# Module is part of Cloud Commander,' + '\n' +
|
||||
'# used for work with windows specific' + '\n' +
|
||||
'# functions. Woud be work on win32 only.' + '\n' +
|
||||
'# http://coderaiser.github.com/cloudcmd' + '\n');
|
||||
|
||||
var main = global.cloudcmd.main,
|
||||
|
||||
SRVDIR = main.SRVDIR,
|
||||
BATDIR = SRVDIR + 'win\\',
|
||||
GETVOLUMES = BATDIR + 'getvolumes',
|
||||
BAT = GETVOLUMES + '.bat',
|
||||
SCENARIO = GETVOLUMES + '.txt',
|
||||
StdOut,
|
||||
exec = main.child_process.exec,
|
||||
Util = main.util;
|
||||
|
||||
|
||||
/**
|
||||
* get position of current name of volume
|
||||
* @param pNumber = number of volume
|
||||
*/
|
||||
function getPosition(pNumber){
|
||||
var lRet,
|
||||
lstrPattern = 'Том ';
|
||||
|
||||
lRet = StdOut.indexOf(lstrPattern + pNumber);
|
||||
|
||||
return lRet;
|
||||
}
|
||||
|
||||
/**
|
||||
* get name of volume
|
||||
* @param pPosition - current char position
|
||||
*/
|
||||
function getVolumeName(pPosition){
|
||||
var lRet,
|
||||
lCharPosition = 10;
|
||||
|
||||
lRet = StdOut[pPosition + lCharPosition];
|
||||
|
||||
return lRet;
|
||||
}
|
||||
|
||||
|
||||
exec(BAT + ' -s ' + SCENARIO, processOuput);
|
||||
|
||||
|
||||
function processOuput(pError, pStdout, pStderr){
|
||||
StdOut = pStdout;
|
||||
if(!pError){
|
||||
var lVolumes = [],
|
||||
i = 0,
|
||||
lNum = getPosition(i);
|
||||
|
||||
do{
|
||||
lVolumes[i] = getVolumeName(lNum);
|
||||
lNum = getPosition(++i);
|
||||
}while(lNum > 0);
|
||||
}
|
||||
else
|
||||
Util.log(pError);
|
||||
}
|
||||
})();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue