Пример #1
0
        private void RunPreBuildAction(ISolutionProjectModel solution, IServiceSettings settings)
        {
            if (solution.SolutionFileName.ToLower().Contains(SolutionNames.PlannerEmbedded.ToLower()))
            {
                CPFileHelper.KillProcess("CP-Suite");
            }

            if (solution.SolutionFileName.ToLower().Contains(SolutionNames.ServerEmbedded.ToLower()))
            {
                CPFileHelper.KillProcess("CP-Server");
            }

            var cpSettings = settings.GetSettingsFromProvider <CPSettings>(solution);

            if (cpSettings.DeleteTypeLibs)
            {
                if (solution.ItemPath.Contains(SolutionNames.Common))
                {
                    DeleteTypeLibs(solution);
                }
            }
            if (cpSettings.RegisterCom)
            {
                if (solution.ItemPath.Contains(SolutionNames.ControlCenter))
                {
                    RegisterLicProtectorEasyGo(solution.ItemPath);
                }
            }
            if (solution.IsDelphiProject)
            {
                RemoveReadOnly(Path.ChangeExtension(solution.ItemPath, ".res"), Path.ChangeExtension(solution.ItemPath, ".ridl"), Path.ChangeExtension(solution.ItemPath, ".tlb"));
            }
        }
Пример #2
0
 private async Task CopyAsync(DirectoryInfo source, DirectoryInfo target, bool overwrite = false)
 {
     if (source.Exists)
     {
         await Task.Run(() => CPFileHelper.CopyFolderFast(source.FullName, target.FullName, true, !overwrite));
     }
 }
Пример #3
0
 private bool ShouldDeleteTypeLibs(WorkingFolder folder)
 {
     foreach (var libId in typeLibIds)
     {
         string path;
         var    regpath = "TypeLib\\{" + libId + "}\\4.5\\0\\win32";
         if (RegistryHelper.TryReadValue <string>(RegistryHive.ClassesRoot, regpath, "", RegistryValueKind.String, out path))
         {
             if (folder == null || !CPFileHelper.IsSubPathOf(path, folder.LocalItem))
             {
                 return(true);
             }
         }
     }
     return(false);
 }
Пример #4
0
 private void RegisterLicProtectorEasyGo(string solution)
 {
     try
     {
         string path = Path.GetDirectoryName(solution);
         if (path != null)
         {
             string licDll = Path.Combine(path, @"Assemblies\LicProtectorEasyGo264.dll");
             if (File.Exists(licDll))
             {
                 CPFileHelper.Regsvr(licDll);
             }
             else
             {
                 Trace.WriteLine("Error could not register LicProtectorEasyGo264.dll: File not found " + licDll);
             }
         }
     }
     catch (Exception e)
     {
         Trace.WriteLine("Error could not register LicProtectorEasyGo264.dll: " + e.Message, "Lic");
     }
 }