using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.IO; using Foo.Platform.Win32; using System.Runtime.InteropServices; using System.Diagnostics; namespace Foo.WorkspaceMgr.Launchers { internal class Launcher_Generic : ILaunch { #region ILaunch Members /// /// Checks to see if the file exists in the system i.e. can be reached over /// the network. if FileExists fails, we shouldn't be able to launch it. /// /// location of the path + file to launch /// public FuncDepBoolType IQueryLaunch(string strArtifactLocation) { if (!String.IsNullOrEmpty(strArtifactLocation) && (strArtifactLocation.Length > 3)) { if (File.Exists(strArtifactLocation)) return FuncDepBoolType.Success; else return FuncDepBoolType.ArtifactLocationUnavailable; } else { return FuncDepBoolType.ParametersInvalid; } } /// /// Generic Launcher should be able to handle any file type. Launched the .Net Way. /// ~this is the same as if the User clicks on the file. /// /// location of the path + file to launch /// public FuncDepBoolType ILaunch(string strArtifactLocation) { if (!String.IsNullOrEmpty(strArtifactLocation) && (strArtifactLocation.Length > 3)) { Process.Start(strArtifactLocation); return FuncDepBoolType.Success; } return FuncDepBoolType.ParametersInvalid; } #endregion } }