Adobe AIR Application to run only with CD - air

Developed a desktop application using Adobe Air. The application will get installed through a CD on the users machine. The user should insert the CD every time to access the application.
Need help is restricting the application from opening without the Cd inserted.
Have written the following code but does not help.
var volumes:Vector.<StorageVolume> = StorageVolumeInfo.storageVolumeInfo.getStorageVolumes();
for each (var volume:StorageVolume in volumes)
{
// use isRemovable property for USB:
if (volume.isRemovable)
if(volume.File.name == "application")
{
Alert.show("Found");
}
else
{
Alert.show("NOt found","Incorrect Access",4,null,myClickHandler,null,4,null);
// Define button actions.
}
}

Related

Get AD Users Visual Studio Web App versus Console

I have the following code below.
When I run Debug in Visual Studio with this code in an ASP.NET Core App (so running as IIS Express) this works
When I run Debug in Visual Studio with this code in a ASP.NET hosted process in a Windows Service this return nothing, but also no error messages
I connect from my home laptop via RDP to another laptop where VPN is running, so I think that is probably it. I tried running visual studio as admin, running the compiled exe as admin, /runas with the domain specified, etc but the commandline app will show nothing while the asp.net core app shows the list. So it must be the user it runs under.
But when i run WindowsIdentity.GetCurrent().Name in both cases it gives the same domain and name (me). In task manager the devenv and iis process is me.
public List<AdSecurityGroupDTO> GetAllDomainSecurityGroups(string domain)
{
List<AdSecurityGroupDTO> result = new List<AdSecurityGroupDTO>();
using (var ctx = new PrincipalContext(ContextType.Domain, domain))
{
GroupPrincipal findAllGroups = new GroupPrincipal(ctx, " * ");
PrincipalSearcher ps = new PrincipalSearcher(findAllGroups);
foreach (Principal group in ps.FindAll())
{
AdSecurityGroupDTO adSecurityGroupDTO = new();
adSecurityGroupDTO.Name = group.Name;
adSecurityGroupDTO.Description = group.Description;
adSecurityGroupDTO.DisplayName = group.DisplayName;
adSecurityGroupDTO.DistinguishedName = group.DistinguishedName;
adSecurityGroupDTO.SamAccountName = group.SamAccountName;
result.Add(adSecurityGroupDTO);
}
return result;
}
}

Task Module call from Ms Teams in Bot Framework

I am looking to open a task module (Pop up - iframe with audio/video) in my bot that is connected to Teams channel. I am having issues following the sample code provided on the GitHub page.
I have tried to follow the sample and incorporate to my code by did not succeed.
In my bot.cs file I am creating card action of invoke type:
card.Buttons.Add(new CardAction("invoke", TaskModuleUIConstants.YouTube.ButtonTitle, null,null,null,
new Teams.Samples.TaskModule.Web.Models.BotFrameworkCardValue<string>()
{
Data = TaskModuleUIConstants.YouTube.Id
}));
In my BotController.cs that inherits from Controller
[HttpPost]
public async Task PostAsync()
{
// Delegate the processing of the HTTP POST to the adapter.
// The adapter will invoke the bot.
await _adapter.ProcessAsync(Request, Response, _bot);
}
public async Task<HttpResponseMessage> Post([FromBody] Activity activity)
{
if (activity.Type == ActivityTypes.Invoke)
{
return HandleInvokeMessages(activity);
}
return new HttpResponseMessage(HttpStatusCode.Accepted);
}
private HttpResponseMessage HandleInvokeMessages (Activity activity)
{
var activityValue = activity.Value.ToString();
if (activity.Name == "task/fetch")
{
var action = Newtonsoft.Json.JsonConvert.DeserializeObject<Teams.Samples.TaskModule.Web.Models.BotFrameworkCardValue<string>>(activityValue);
Teams.Samples.TaskModule.Web.Models.TaskInfo taskInfo = GetTaskInfo(action.Data);
Teams.Samples.TaskModule.Web.Models.TaskEnvelope taskEnvelope = new Teams.Samples.TaskModule.Web.Models.TaskEnvelope
{
Task = new Teams.Samples.TaskModule.Web.Models.Task()
{
Type = Teams.Samples.TaskModule.Web.Models.TaskType.Continue,
TaskInfo = taskInfo
}
};
return msg;
}
return new HttpResponseMessage(HttpStatusCode.Accepted);
}
There is more code as per the GitHub sample but I won't paste it here. Can someone point me into the correct direction ?
I have got to the stage that it is displaying a pop up window but the content and title comes from manifest file instead of creating actual iframe also no video is rendering. My goal is to render video within my teams using iframe container.
The important part from the sample:
This sample is deployed on Microsoft Azure and you can try it yourself by uploading Task Module CSharp.zip to one of your teams and/or as a personal app. (Sideloading must be enabled for your tenant; see step 6 here.) The app is running on the free Azure tier, so it may take a while to load if you haven't used it recently and it goes back to sleep quickly if it's not being used, but once it's loaded it's pretty snappy.
So,
Your Teams Admin MUST enable sideloading
Your bot MUST be sideloaded into Teams
The easiest way to do this would be download the sample manifest, open it in App Studio, then edit your bot information in. You then need to make sure Domains and permissions > Valid Domains are set for your bot. Also ensure you change the Tabs URLs to your own.
You also need to make sure that in your Tasks, the URLs they call ALL use https and not http. If anywhere in the chain is using http (like if you're using ngrok and http://localhost), it won't work.

Launching .vsto file after installation. (InstallShield)

I have an msi installer, made via InstallShield, which moves some files to required location,
writes some info to registry and installes VSTO runtime. But I need to launch the .vsto file, that is installed with the application, after the installation is over. Can I do this with custom actions? If that file was an .exe file, that would be rather easy, but how could I launch a .vsto file?
[upd]
Well, may be there is an easier solution:
Can I just call the function:
public override void Install(IDictionary stateSaver)
from InstallShield? Something like that:
Custom Action->Call a function in a Windows Installer dynamic link library->stored in binary table=>
AssemblyFile = \InclusionListCustomActions.dll
MethodSignature = InclusionListCustomActions.TrustInstaller.Install(but what parameter goes here?)
You shouldn't launch the VSTO file because this will only install it per-user. What you should do is add it to the AddIns registry key for the office application you need and use the |vstolocal attribute to tell it to not deploy to the click once cache.
you can follow steps described in http://msdn.microsoft.com/en-us/library/cc563937%28v=office.12%29.aspx, you can copy same steps in Installshield, After file is copied and registry value set as specified, on starting office app it will automatically pick up vsto file
To add information to inclusion list you will have to write a console application and then call console app from installshield. Below code will help
string RSA_PublicKey = #"<RSAKeyValue><Modulus></Modulus></RSAKeyValue>";
//get this key from .vsto file
try
{
SecurityPermission permission =
new SecurityPermission(PermissionState.Unrestricted);
permission.Demand();
}
catch (SecurityException)
{
Console.WriteLine(
"You have insufficient privileges to " +
"register a trust relationship. Start Excel " +
"and confirm the trust dialog to run the addin.");
Console.ReadLine();
}
Uri deploymentManifestLocation = null;
var excelPath = YourAPPPath;
if (Uri.TryCreate(excelPath,
UriKind.RelativeOrAbsolute, out deploymentManifestLocation) == false)
{
Console.WriteLine(
"The location of the deployment manifest is missing or invalid.");
Console.ReadLine();
}
if (!File.Exists(excelPath))
{
UserInclusionList.Remove(deploymentManifestLocation);
Console.WriteLine(deploymentManifestLocation.ToString() + "removed from inclusion list");
}
else
{
AddInSecurityEntry entry = new AddInSecurityEntry(
deploymentManifestLocation, RSA_PublicKey);
UserInclusionList.Add(entry);
Console.WriteLine(deploymentManifestLocation.ToString() + "Added to inclusion list");
}

How to automate keystrokes for Blackberry J2ME Application?

I am trying to do automation testing over a blackberry application written using J2ME over MIDlet architecture.
I have an application already running on blackberry devices. I am writing my TestApp (written again in J2ME) over existing App. (i.e., my TestApp extends to already Original App and it runs - inheriting).
I am trying to run the OriginalApp through my TestApp and handle the controls automatically using my TestApp. I am not able to automate the key strokes although I have already got the key codes of the blackberry device.
Keycodes I am using are like
KEY_BB_FIRE = -1204;
KEY_BB_UP = -1200;
KEY_BB_DOWN = -1201;
KEY_BB_LEFT = -1202;
KEY_BB_RIGHT = -1203;
I am trying to use _keyPressed and _keyReleased methods of Screen class.
boolean sendKeys(Form obj, int keyObj){
try{
obj._keyPressed(keyObj);
obj._keyReleased(keyObj);
}
catch (Exception e){
System.out.println("ERROR: Striking key in Form failed: "+keyObj);
return false;
}
return true;
}
Similarly I have got the key codes for Nokia device and I have completed automating the same application for Nokia. Just having trouble using the same technique on a blackberry.

Self updating .net CF application

I need to make my CF app self-updating through the web service.
I found one article on MSDN from 2003 that explains it quite well. However, I would like to talk practice here. Anyone really done it before or does everyone rely on third party solutions?
I have been specifically asked to do it this way, so if you know of any tips/caveats, any info is appreciated.
Thanks!
This is relatively easy to do. Basically, your application calls a web service to compare its version with the version available on the server. If the server version is newer, your application downloads the new EXE as a byte[] array.
Next, because you can't delete or overwrite a running EXE file, your application renames its original EXE file to something like "MyApplication.old" (the OS allows this, fortunately). Your app then saves the downloaded byte[] array in the same folder as the original EXE file, and with the same original name (e.g. "MyApplication.exe"). You then display a message to the user (e.g. "new version detected, please restart") and close.
When the user restarts the app, it will be the new version they're starting. The new version deletes the old file ("MyApplication.old") and the update is complete.
Having an application update itself without requiring the user to restart is a huge pain in the butt (you have to kick off a separate process to do the updating, which means a separate updater application that cannot itself be auto-updated) and I've never been able to make it work 100% reliably. I've never had a customer complain about the required restart.
I asked this same question a while back:
How to Auto-Update Windows Mobile application
Basically you need two applications.
App1: Launches the actual application, but also checks for a CAB file (installer). If the cab file is there, it executes the CAB file.
App2: Actual application. It will call a web service, passing a version number to the service and retrieve a URL back if a new version exists (). Once downloaded, you can optionally install the cab file and shut down.
One potiencial issue: if you have files that one install puts on the file system, but can't overwrite (database file, log, etc), you will need two separate installs.
To install a cab: look up wceload.exe http://msdn.microsoft.com/en-us/library/bb158700.aspx
private static bool LaunchInstaller(string cabFile)
{
// Info on WceLoad.exe
//http://msdn.microsoft.com/en-us/library/bb158700.aspx
const string installerExe = "\\windows\\wceload.exe";
const string processOptions = "";
try
{
ProcessStartInfo processInfo = new ProcessStartInfo();
processInfo.FileName = installerExe;
processInfo.Arguments = processOptions + " \"" + cabFile + "\"";
var process = Process.Start(processInfo);
if (process != null)
{
process.WaitForExit();
}
return InstallationSuccessCheck(cabFile);
}
catch (Exception e)
{
MessageBox.Show("Sorry, for some reason this installation failed.\n" + e.Message);
Console.WriteLine(e);
throw;
}
}
private static bool InstallationSuccessCheck(string cabFile)
{
if (File.Exists(cabFile))
{
MessageBox.Show("Something in the install went wrong. Please contact support.");
return false;
}
return true;
}
To get the version number: Assembly.GetExecutingAssembly().GetName().Version.ToString()
To download a cab:
public void DownloadUpdatedVersion(string updateUrl)
{
var request = WebRequest.Create(updateUrl);
request.Credentials = CredentialCache.DefaultCredentials;
var response = request.GetResponse();
try
{
var dataStream = response.GetResponseStream();
string fileName = GetFileName();
var fileStream = new FileStream(fileName, FileMode.CreateNew);
ReadWriteStream(dataStream, fileStream);
}
finally
{
response.Close();
}
}
What exactly do you mean by "self-updating"? If you're referring to configuration or data, then webservices should work great. If you're talking about automatically downloading and installing a new version of itself, that's a different story.
Found this downloadable sample from Microsoft- looks like it should help.
If you want to use a third-party component, have a look at AppToDate developed by the guys at MoDaCo.