Esempio n. 1
0
        static void BuildDeployPackage()
        {
            string versionMinusSvnVersion =
                Windsor.Commons.AssemblyInfo.AssemblyInfo.cAssemblyVersion.Substring(0,
                                                                                     Windsor.Commons.AssemblyInfo.AssemblyInfo.cAssemblyVersion.LastIndexOf('.'));
            string zipFile = Path.Combine(PackagesFolderPath, "DotNET v4.6.2 OpenNode2 v" +
                                          versionMinusSvnVersion + ".zip");

            zipFile = AdjustDeploymentName(zipFile);
            RemoveVSHostFiles(Path.Combine(BuildFolderPath, "Server"));
            UpdateMaxNumConcurrentThreads();
            FileUtils.SafeDeleteFile(zipFile);
            DotNetZipHelper zipHelper = new DotNetZipHelper();

            zipHelper.CompressDirectory(zipFile, Path.Combine(BuildFolderPath, "Config"), "Config");
            zipHelper.CompressDirectory(zipFile, Path.Combine(BuildFolderPath, "Logs"), "Logs");
            zipHelper.CompressDirectory(zipFile, Path.Combine(BuildFolderPath, "Repository"), "Repository");
            zipHelper.CompressDirectory(zipFile, Path.Combine(BuildFolderPath, "Server"), "Server");
            zipHelper.CompressDirectory(zipFile, Path.Combine(BuildFolderPath, "Sql"), "Sql");
            zipHelper.CompressDirectory(zipFile, Path.Combine(BuildFolderPath, "Temp"), "Temp");
            zipHelper.CompressDirectory(zipFile, Path.Combine(BuildFolderPath, "www"), "www");

            string pluginsFolder = Path.Combine(BuildFolderPath, "Plugins");

            string[] pluginFilePaths = Directory.GetFiles(pluginsFolder, "*.dll", SearchOption.AllDirectories);
            CollectionUtils.ForEach(pluginFilePaths, delegate(string pluginFilePath)
            {
                try
                {
                    Assembly loadedAssembly = Assembly.LoadFile(pluginFilePath);
                    Attribute[] standardPluginAttributes = Attribute.GetCustomAttributes(loadedAssembly, typeof(StandardPluginAttribute));
                    Attribute[] publicPluginAttributes   = Attribute.GetCustomAttributes(loadedAssembly, typeof(PublicPluginAttribute));
                    if (!CollectionUtils.IsNullOrEmpty(standardPluginAttributes) || !CollectionUtils.IsNullOrEmpty(publicPluginAttributes))
                    {
                        // This is a standard or public plugin that is included with the default deployment package
                        string includeFolder = Path.GetDirectoryName(pluginFilePath);
                        string zipFolderName = includeFolder.Substring(includeFolder.LastIndexOf("Plugins\\", StringComparison.InvariantCultureIgnoreCase));
                        zipHelper.CompressDirectory(zipFile, includeFolder, zipFolderName);
                    }
                }
                catch (BadImageFormatException)
                {
                    DebugUtils.CheckDebuggerBreak();
                    throw;
                }
                catch (Exception)
                {
                    DebugUtils.CheckDebuggerBreak();
                    throw;
                }
            });
        }
Esempio n. 2
0
        static int Main(string[] args)
        {
            try
            {
                string assemblyPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
                string trunkFolder  = Path.GetFullPath(assemblyPath + @"\..\..\..\..");

                CreateZipPackages = (args.Length > 0) && (args[0] == "/CreatePackages");
                string trunkParent = Path.GetDirectoryName(trunkFolder);
                DBScriptsParentFolderPath = Path.Combine(trunkParent, "database-scripts");
                PackagesFolderPath        = Path.Combine(trunkFolder, "Packages");
                BuildFolderPath           = Path.Combine(trunkFolder, BUILD_FOLDER_NAME);

                if ((args.Length > 0) && (args[0] == "/TestZip"))
                {
                    if (File.Exists(@"D:\TEMP\ICISSubmission.zip"))
                    {
                        File.Delete(@"D:\TEMP\ICISSubmission.zip");
                    }
                    DotNetZipHelper zipHelper = new DotNetZipHelper();
                    zipHelper.CompressFile(@"D:\TEMP\ICISSubmission.xml", @"D:\TEMP\ICISSubmission.zip");
                }

                if (CreateZipPackages)
                {
                    FileUtils.SafeDeleteDirectory(PackagesFolderPath);
                    Directory.CreateDirectory(PackagesFolderPath);
                }

                CreateDefaultFolders(trunkFolder);

                CopyPluginsToBuildFolder(trunkFolder);

                CopyConfigFilesToBuildFolder(trunkFolder);

                if (CreateZipPackages)
                {
                    BuildDeployPackage();
                }

                return(0);
            }
            catch (Exception e)
            {
                DebugUtils.CheckDebuggerBreak();
                Console.WriteLine(ExceptionUtils.ToShortString(e));
                Console.ReadKey();
                return(1);
            }
        }
Esempio n. 3
0
        private void Configure(string targetEndpoint, AuthenticationCredentials credentials, string naasUserToken,
                               string path, IWebProxy proxy, bool compatibilityMode)
        {
            if (string.IsNullOrEmpty(targetEndpoint))
            {
                throw new ArgumentException("Null targetEndpoint");
            }

            if (string.IsNullOrEmpty(path))
            {
                throw new ArgumentException("Null path");
            }

            if (!Directory.Exists(path))
            {
                throw new DirectoryNotFoundException(string.Format("Missing temp folder: \"{0}\"", path));
            }

            if ((credentials != null) && !string.IsNullOrEmpty(credentials.UserName) &&
                !string.IsNullOrEmpty(credentials.Password))
            {
                _credentials         = credentials;
                _cachedSecurityToken = null;
            }
            else if (!string.IsNullOrEmpty(naasUserToken))
            {
                _credentials         = null;
                _cachedSecurityToken = naasUserToken;
            }
            else
            {
                throw new ArgumentException("No NAAS authentication credentials specified");
            }

            _requestor = new ENClient20(targetEndpoint, compatibilityMode);
            _requestor.UseDefaultCredentials = true;
            _requestor.Timeout           = NodeEndpointClientFactory.DefaultTimeout;
            _requestor.SoapVersion       = System.Web.Services.Protocols.SoapProtocolVersion.Soap12;
            _requestor.AllowAutoRedirect = true;

            if (proxy != null)
            {
                _requestor.Proxy = proxy;
            }

            _tempPath = path;

            _compressionHelper = new DotNetZipHelper();
        }
        public static byte[] CompressFile(string folderPath, string filePath)
        {
            DotNetZipHelper compressionHelper = new DotNetZipHelper();

            string tempFilePath = GetTempFilePath(folderPath);

            compressionHelper.CompressFile(filePath, Path.GetFileName(filePath), tempFilePath);
            try
            {
                return(File.ReadAllBytes(tempFilePath));
            }
            finally
            {
                FileUtils.SafeDeleteFile(tempFilePath);
            }
        }
Esempio n. 5
0
        /// <summary>
        /// Perform any database updates in a separate thread.
        /// </summary>
        public virtual void DoUpdatesAsync()
        {
            ExceptionUtils.ThrowIfEmptyString(_manifestDownloadUrl, "ManifestDownloadUrl");
            ExceptionUtils.ThrowIfDirectoryNotFound(_tempFolderPath);
            if (string.IsNullOrEmpty(_downloadedContentPassword))
            {
                _downloadedContentPassword = null;
            }
            _zipHelper          = new DotNetZipHelper();
            _serializationUtils = new SerializationUtils();

            ThreadPool.QueueUserWorkItem(delegate(Object state)
            {
                ThreadWorkProc();
            });
            _isRunning = true;
        }
        public static void UncompressFile(byte[] compressedDocContent, string saveFilePath)
        {
            DotNetZipHelper compressionHelper = new DotNetZipHelper();

            compressionHelper.Uncompress(compressedDocContent, saveFilePath);
        }