private void GetAppComplete(string result) { Debug.Log(result); string version = null; InstalledApps apps = JsonUtil.Deserialize <InstalledApps>(result); for (int i = 0; i < apps.InstalledPackages.Count; i++) { InstalledApp app = apps.InstalledPackages[i]; if (app.Name == SpectatorViewAppName) { appInfo = new SpectatorViewAppInfo(); byte[] bytes = Encoding.GetEncoding("utf-8").GetBytes(app.PackageRelativeId); appInfo.appid = System.Convert.ToBase64String(bytes); bytes = Encoding.GetEncoding("utf-8").GetBytes(app.PackageFullName); appInfo.package = System.Convert.ToBase64String(bytes); version = "" + app.Version.Major + "." + app.Version.Minor + "." + app.Version.Build + "." + app.Version.Revision; break; } } panel.hololensStatusPanel.ShowAppStatus(version); if (version != null) { StartCoroutine(GetAppRunningStatus()); } }
public AppProcessActor(InstalledApp app) { _app = app; CallSafe(() => { _serviceCom = new AnonymousPipeServerStream(PipeDirection.Out, HandleInheritability.Inheritable); _serviceComName = _serviceCom.GetClientHandleAsString(); }, "Error while Initilizing Named pipe"); Receive <CheckProcess>(_ => { if (_process == null) { if (_isProcesRunning) { Self.Tell(new InternalStartApp()); } return; } if (!_process.HasExited || !_isProcesRunning) { return; } _process.Dispose(); _process = null; Log.Info("Process killed Restarting {Name}", _app.Name); Self.Tell(new InternalStartApp()); }); Receive <InternalStartApp>(StartApp); Receive <InternalStopApp>(StopApp); Receive <GetName>(_ => Sender.Tell(new GetNameResponse(_app.Name, _isProcesRunning))); }
public static bool IsEmpty(this InstalledApp app) => app == InstalledApp.Empty;
public static IPreparedFeature New(InstalledApp app, IIpcConnection connection) => Feature.Create(() => new AppProcessActor(), _ => new AppProcessorState(app, Guid.NewGuid().ToString("N"), connection, null, false, string.Empty));
public sealed record AppProcessorState(InstalledApp App, string ServiceName, IIpcConnection ServiceCom, Process?Process, bool IsProcessRunning, string ServiceId);
/// <summary> ///To Get all List of Applications From Device which are currently installed on device to Admin(Database) /// </summary> /// <param name="Ar"></param> /// <returns></returns> public HttpResponseMessage sendInstalledApps(SendInstalledApps SI) { ar = new WebApiResponse(); try { string qry = "select * from MDM_DeviceMaster where DeviceID='" + SI.uuid + "'"; dr = databaseHelper.getDataReader(qry); if (dr.Read()) { InstalledApp IA = new InstalledApp(); IA.Device = dr["DeviceID"].ToString(); IA.CreatedBy = 1; IA.UpdatedBy = 1; var list = SI.applications; if (!dr.IsClosed) { dr.Close(); } qry = "select * from MDM_InstalledApps where DeviceID='" + SI.uuid + "'"; dr = databaseHelper.getDataReader(qry); if (dr.Read()) { if (!dr.IsClosed) { dr.Close(); } qry = "Delete from MDM_InstalledApps where DeviceID='" + SI.uuid + "'"; rcnt = databaseHelper.ExecuteQuery(qry); } if (!dr.IsClosed) { dr.Close(); } foreach (var c in list) { //Check that application package exist in installed apps(accessible application db) if not then insert application details #region Accessible Apps //Check Application Package in (Accessible Apps database)/Installed apps if not then Add /*qry = "select * from MDM_AccessibleApplication where ApplicationPackage='"+c.applicationPackage+"'"; * dr = databaseHelper.getDataReader(qry); * if (!dr.Read()) * { * if (!dr.IsClosed) * dr.Close(); * * qry = "insert into MDM_AccessibleApplication(ApplicationPackage,ApplicationName,CreatedDate)values('"+c.applicationPackage+"','"+c.applicationName+"','"+DateTime.Now+"')"; * * rcnt = databaseHelper.ExecuteQuery(qry); * }*/ #endregion if (c.applicationName == null)//if application name recieved null then insert application package as name also { IA.ApplicationName = c.applicationPackage; } else { IA.ApplicationName = c.applicationName; } IA.ApplicationPackage = c.applicationPackage; IA.CreatedDate = c.installedOn; IA.UpdatedDate = DateTime.Now; IA.isDownloaded = c.isDownloaded; IA.applicationVersion = c.applicationVersion; IA.applicationSize = c.applicationSize; qry = "insert into MDM_InstalledApps(DeviceID,CreatedBy,UpdatedBy,ApplicationName,ApplicationPackage,CreatedDate,UpdatedDate,isDownloaded,ApplicationVersion,ApplicationSize) values('" + IA.Device + "'," + IA.CreatedBy + "," + IA.UpdatedBy + ",'" + IA.ApplicationName + "','" + IA.ApplicationPackage + "','" + IA.CreatedDate.ToString("yyyy-MM-dd HH:mm:ss") + "','" + IA.UpdatedDate.ToString("yyyy-MM-dd HH:mm:ss") + "'," + IA.isDownloaded + ",'" + IA.applicationVersion + "','" + IA.applicationSize + "')"; //linfo.LogFile(enLogType.INFO, qry, "rizwan"); rcnt = databaseHelper.ExecuteQuery(qry); ar.errorCode += c.applicationPackage + " Added Successfully"; } ar.response = true; HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.Created, ar); qry = "delete from MDM_PushNotification where DeviceID='" + SI.uuid + "' and Command='Update Application List'"; rcnt = databaseHelper.ExecuteQuery(qry); return(response); } else { ar.errorCode = "Authentication Failed"; ar.response = false; HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.PartialContent, ar); return(response); } } catch (Exception ex) { linfo.LogFile(enLogType.EXCEPTION, ex.Message + "Problem in SendInstalledApp", null); } finally { if (dr != null && !dr.IsClosed) { dr.Close(); } } return(null); }
public InstalledAppRespond(InstalledApp app) => App = app;
/// <summary> ///To Get all List of Applications From Device which are currently installed on device to Admin(Database) /// </summary> /// <param name="Ar"></param> /// <returns></returns> public HttpResponseMessage sendInstalledApps(SendInstalledApps SI) { ar = new WebApiResponse(); try { string qry = "select * from MDM_DeviceMaster where DeviceID='" + SI.uuid + "'"; dr = databaseHelper.getDataReader(qry); if (dr.Read()) { InstalledApp IA = new InstalledApp(); IA.Device = dr["DeviceID"].ToString(); IA.CreatedBy = 1; IA.UpdatedBy = 1; var list = SI.applications; if (!dr.IsClosed) dr.Close(); qry = "select * from MDM_InstalledApps where DeviceID='" + SI.uuid + "'"; dr = databaseHelper.getDataReader(qry); if (dr.Read()) { if (!dr.IsClosed) dr.Close(); qry = "Delete from MDM_InstalledApps where DeviceID='" + SI.uuid + "'"; rcnt = databaseHelper.ExecuteQuery(qry); } if (!dr.IsClosed) dr.Close(); foreach (var c in list) { //Check that application package exist in installed apps(accessible application db) if not then insert application details #region Accessible Apps //Check Application Package in (Accessible Apps database)/Installed apps if not then Add /*qry = "select * from MDM_AccessibleApplication where ApplicationPackage='"+c.applicationPackage+"'"; dr = databaseHelper.getDataReader(qry); if (!dr.Read()) { if (!dr.IsClosed) dr.Close(); qry = "insert into MDM_AccessibleApplication(ApplicationPackage,ApplicationName,CreatedDate)values('"+c.applicationPackage+"','"+c.applicationName+"','"+DateTime.Now+"')"; rcnt = databaseHelper.ExecuteQuery(qry); }*/ #endregion if (c.applicationName == null)//if application name recieved null then insert application package as name also { IA.ApplicationName = c.applicationPackage; } else { IA.ApplicationName = c.applicationName; } IA.ApplicationPackage = c.applicationPackage; IA.CreatedDate = c.installedOn; IA.UpdatedDate = DateTime.Now; IA.isDownloaded = c.isDownloaded; IA.applicationVersion = c.applicationVersion; IA.applicationSize = c.applicationSize; qry = "insert into MDM_InstalledApps(DeviceID,CreatedBy,UpdatedBy,ApplicationName,ApplicationPackage,CreatedDate,UpdatedDate,isDownloaded,ApplicationVersion,ApplicationSize) values('" + IA.Device + "'," + IA.CreatedBy + "," + IA.UpdatedBy + ",'" + IA.ApplicationName + "','" + IA.ApplicationPackage + "','" + IA.CreatedDate.ToString("yyyy-MM-dd HH:mm:ss") + "','" + IA.UpdatedDate.ToString("yyyy-MM-dd HH:mm:ss") + "'," + IA.isDownloaded + ",'" + IA.applicationVersion + "','" + IA.applicationSize + "')"; //linfo.LogFile(enLogType.INFO, qry, "rizwan"); rcnt = databaseHelper.ExecuteQuery(qry); ar.errorCode += c.applicationPackage + " Added Successfully"; } ar.response = true; HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.Created, ar); qry = "delete from MDM_PushNotification where DeviceID='" + SI.uuid + "' and Command='Update Application List'"; rcnt = databaseHelper.ExecuteQuery(qry); return response; } else { ar.errorCode = "Authentication Failed"; ar.response = false; HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.PartialContent, ar); return response; } } catch (Exception ex) { linfo.LogFile(enLogType.EXCEPTION, ex.Message + "Problem in SendInstalledApp", null); } finally { if (dr != null && !dr.IsClosed) dr.Close(); } return null; }
public StartApp(InstalledApp app) => App = app;
public void SetInstalledApp(InstalledApp app) => InstalledApp = app;