private static void AddSpklMapping(SpklConfig spklConfig, Project project, string profile, WebResourceItem webResourceItem)
        {
            var spklConfigWebresourceFile = new SpklConfigWebresourceFile
            {
                uniquename  = webResourceItem.Name,
                file        = webResourceItem.BoundFile,
                description = webResourceItem.Description
            };

            if (WebResourceTypes.GetExtensionType(webResourceItem.BoundFile) == D365DeveloperExtensions.Core.Enums.FileExtensionType.Ts)
            {
                spklConfigWebresourceFile.file = TsHelper.GetJsForTsPath(webResourceItem.BoundFile, project);
                spklConfigWebresourceFile.ts   = webResourceItem.BoundFile;
            }

            if (profile.StartsWith(ExtensionConstants.NoProfilesText))
            {
                spklConfig.webresources[0].files.Add(spklConfigWebresourceFile);
            }
            else
            {
                spklConfig.webresources.FirstOrDefault(w => w.profile == profile)?.files.Add(spklConfigWebresourceFile);
            }

            var projectPath = D365DeveloperExtensions.Core.Vs.ProjectWorker.GetProjectPath(project);

            ConfigFile.UpdateSpklConfigFile(projectPath, spklConfig);
        }
        private static void UpdateSpklMapping(SpklConfig spklConfig, Project project, string profile, WebResourceItem webResourceItem)
        {
            var spklConfigWebresourceFiles = GetSpklConfigWebresourceFiles(profile, spklConfig);

            if (spklConfigWebresourceFiles == null)
            {
                return;
            }

            if (!string.IsNullOrEmpty(webResourceItem.BoundFile))
            {
                var isTs = WebResourceTypes.GetExtensionType(webResourceItem.BoundFile) == D365DeveloperExtensions.Core.Enums.FileExtensionType.Ts;
                foreach (var spklConfigWebresourceFile in
                         spklConfigWebresourceFiles.Where(w => w.uniquename == webResourceItem.Name))
                {
                    spklConfigWebresourceFile.file        = webResourceItem.BoundFile;
                    spklConfigWebresourceFile.description = webResourceItem.Description;
                    spklConfigWebresourceFile.ts          = null;

                    if (!isTs)
                    {
                        continue;
                    }

                    spklConfigWebresourceFile.file = TsHelper.GetJsForTsPath(webResourceItem.BoundFile, project);
                    spklConfigWebresourceFile.ts   = webResourceItem.BoundFile;
                }
            }
            else
            {
                spklConfigWebresourceFiles.RemoveAll(w => w.uniquename == webResourceItem.Name);
            }

            if (profile.StartsWith(ExtensionConstants.NoProfilesText))
            {
                spklConfig.webresources[0].files = spklConfigWebresourceFiles;
            }
            else
            {
                var webresourceDeployConfig = spklConfig.webresources.FirstOrDefault(w => w.profile == profile);
                if (webresourceDeployConfig != null)
                {
                    webresourceDeployConfig.files = spklConfigWebresourceFiles;
                }
            }

            var projectPath = D365DeveloperExtensions.Core.Vs.ProjectWorker.GetProjectPath(project);

            ConfigFile.UpdateSpklConfigFile(projectPath, spklConfig);
        }
        private static string GetFileContent(string filePath, Project project)
        {
            FileExtensionType extension = WebResourceTypes.GetExtensionType(filePath);

            //Images
            if (WebResourceTypes.IsImageType(extension))
            {
                var content = EncodedImage(filePath, extension);
                return(content);
            }

            //TypeScript
            if (extension == FileExtensionType.Ts)
            {
                string jsPath = TsHelper.GetJsForTsPath(filePath, project);
                jsPath = FileSystem.BoundFileToLocalPath(jsPath,
                                                         D365DeveloperExtensions.Core.Vs.ProjectWorker.GetProjectPath(project));
                return(GetNonImageFileContext(jsPath));
            }

            //Everything else
            return(GetNonImageFileContext(filePath));
        }