Exemple #1
0
        /// <summary>
        /// Start a new application using manifest metadata
        /// </summary>
        /// <param name="manifest">Application manifest</param>
        /// <returns></returns>
        public ApplicationProcess StartApplication(AppManifest manifest)
        {
            string viewLocation = FSHelper.NormalizeLocation($"{manifest.Location}\\{manifest.MainPage}");

            Log($"Starting application from package '{manifest.Domain}'");

            if (!File.Exists(viewLocation))
            {
                throw new LauncherException($"Failed to start application '{manifest.Name}' ({manifest.Domain}). View not found.");
            }

            ApplicationProcess proc = ProcessManager.GetInstance().CreateProcess();

            proc.Name       = manifest.Name;
            proc.Domain     = manifest.Domain;
            proc.DomainPath = manifest.Location;

            // TODO: Add icon loader
            proc.Host.ViewName = manifest.MainPage;
            proc.Host.Styles   = manifest.Window;
            proc.Host.Label    = manifest.Name;


            proc.Start();
            proc.Host.Show();

            return(proc);
        }
Exemple #2
0
        public HostConfiguration()
        {
            DebugModeEnabled = !false;
            string currentDirectory = AppDomain.CurrentDomain.BaseDirectory;

            LogFile = FSHelper.NormalizeLocation($"{currentDirectory}\\log.txt");
            SystemPackagesLocation = FormatPath(currentDirectory, PackagesDirectoryName);
            GlobalPackagesLocation = FormatPath(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), PackagesDirectoryName);
            LocalPackagesLocation  = FormatPath(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), PackagesDirectoryName);
        }
Exemple #3
0
        /// <summary>
        /// Read manifest file
        /// </summary>
        /// <param name="filePath">File path</param>
        /// <returns></returns>
        protected async Task <AppManifest> ReadManifestAsync(string filePath)
        {
            string savePath = FSHelper.NormalizeLocation(filePath);
            string result;

            using (StreamReader reader = File.OpenText(savePath))
            {
                result = await reader.ReadToEndAsync();
            }

            try
            {
                AppManifest manifest = JsonConvert.DeserializeObject <AppManifest>(result);
                manifest.Location = Path.GetDirectoryName(filePath);

                return(manifest);
            }
            catch (Exception ex)
            {
                LogError($"Corrupted app manifest at '{savePath}'. Error: {ex.Message}");
                return(null);
            }
        }
Exemple #4
0
 protected string GetResourceFullPath(string resourceName)
 {
     return(FSHelper.NormalizeLocation($"{AppProcess.DomainPath}\\{resourceName}"));
 }
Exemple #5
0
 /// <summary>
 /// Get cache file path for specific directory
 /// </summary>
 /// <param name="directoryPath"></param>
 /// <returns></returns>
 private string GetCacheFilePath(string directoryPath)
 {
     return(FSHelper.NormalizeLocation($"{directoryPath}\\{CacheFileName}"));
 }