Exemplo n.º 1
0
        /// <summary>
        /// Returns the first connection string found.  Check the web first, then the service.
        /// </summary>
        /// <param name="appInfo"></param>
        /// <returns></returns>
        private static string GetConnectionString(AppInfo appInfo)
        {
            string connectionString = "";

            foreach (var item in appInfo.AppFolders)
            {
                Amiedater a = new Amiedater(item);

                if (item.Type.Name == AppInfo.AppFolderType.Web.Name)
                {
                    connectionString = a.GetConnectionString();
                    if (connectionString != "")
                    {
                        return(connectionString);
                    }
                }
                else if (item.Type.Name == AppInfo.AppFolderType.Service.Name)
                {
                    connectionString = a.GetConnectionString();
                    if (connectionString != "")
                    {
                        return(connectionString);
                    }
                }
            }
            return(connectionString);
        }
Exemplo n.º 2
0
        private static InstallResult PerformSingleUpdateFromAppInfoFile(string appInfoFilePath, string folderNameToUpdate, string connectionString)
        {
            var appInfo = Amie.AppInfo.LoadFromFile(appInfoFilePath);
            var result  = new InstallResult();

            //get the [folder] to update
            var folder = appInfo.AppFolderFromName(folderNameToUpdate);

            if (folder == null)
            {
                result.Success = false;
                result.SetMessage("Update failed: the app to udpate with the name {0} was not found in the AppInfo.json file.  An AppFolder configuration is required to update this product.", folderNameToUpdate);
                return(result);
            }

            Amiedater a = new Amiedater(folder);

            if (folder.Type.Name == AppInfo.AppFolderType.Service.Name)
            {
                result = a.PerformServiceUpdate(connectionString);
            }
            else if (folder.Type.Name == AppInfo.AppFolderType.Web.Name)
            {
                result = a.PerformWebUpdate(connectionString);
            }
            else
            {
                //Must be a resource, such as a command line program or something.  We don't know where the old one is installed but we know where the new one is so at least we can update the connection string....
                result = a.PerformResouceUpdate(connectionString);
            }

            return(result);
        }
Exemplo n.º 3
0
        private static InstallResult PerformUpdateFromAppInfoFile(string appInfoFilePath, System.Reflection.Assembly executingAssembly)
        {
            var appInfo = Amie.AppInfo.LoadFromFile(appInfoFilePath);
            var result  = new InstallResult();

            string connectionString = GetConnectionString(appInfo);

            if (string.IsNullOrEmpty(connectionString))
            {
                result.Success = false;
                result.Message = "Update failed the connection string was not found.";
                return(result);
            }

            DBUpdater dbUpdate = new DBUpdater(executingAssembly);

            result = dbUpdate.UpdateFromConnectionString(connectionString);

            if (!result.Success)
            {
                return(result);
            }

            foreach (var item in appInfo.AppFolders)
            {
                Amiedater a = new Amiedater(item);

                if (item.Type.Name == AppInfo.AppFolderType.Web.Name)
                {
                    result = a.PerformWebUpdate();
                }
                else if (item.Type.Name == AppInfo.AppFolderType.Service.Name)
                {
                    result = a.PerformServiceUpdate();
                }
                else
                {
                    //Must be a resource, such as a command line program or something.  We don't know where the old one is installed but we know where the new one is so at least we can update the connection string....
                    result = a.PerformResouceUpdate(connectionString);
                }
            }

            return(result);
        }