public static void addToDownloadList(AsposeComponent component, string urlStr, string outputFile)
 {
     AsyncDownload asyncDownload = new AsyncDownload();
     asyncDownload.Url = urlStr;
     asyncDownload.LocalPath = getLibaryDownloadPath() + outputFile;
     asyncDownload.Component = component;
     AsyncDownloadList.list.Add(asyncDownload);
 }
        public AsposeComponents()
        {
            list.Clear();

            AsposeComponent asposeWords = new AsposeComponent();
            asposeWords.set_downloadUrl("");
            asposeWords.set_downloadFileName("aspose.words.zip");
            asposeWords.set_name(Constants.ASPOSE_COMPONENT);
            asposeWords.set_remoteExamplesRepository("https://github.com/asposewords/Aspose_Words_NET.git");
            list.Add(Constants.ASPOSE_COMPONENT, asposeWords);
        }
        public static string readVersion(AsposeComponent component)
        {
            string localPath = getLibaryDownloadPath() + component.get_name() + ".ver";
            string line = string.Empty;

            try
            {
                return System.IO.File.ReadAllText(localPath);
            }
            catch (Exception) { }
            return line;
        }
        public static void storeVersion(AsposeComponent component)
        {
            string localPath = getLibaryDownloadPath() + component.get_name() + ".ver";

            try
            {
                System.IO.File.WriteAllText(localPath, component.get_latestVersion());
            }
            catch (FileNotFoundException e)
            {
            }
            catch (Exception e)
            {
            }
        }
        public void storeReleaseNotes(AsposeComponent component)
        {
            string localPath = getLibaryDownloadPath() + component.get_name() + ".htm";

            try
            {
                System.IO.File.WriteAllText(localPath, component.get_changeLog());
            }
            catch (FileNotFoundException e)
            {
            }
            catch (Exception e)
            {
            }
        }
Beispiel #6
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="component"></param>
        /// <returns></returns>
        public static string CloneOrCheckOutRepo(AsposeComponent component)
        {
            string repUrl = component.get_remoteExamplesRepository();
            string localFolder = getLocalRepositoryPath(component);
            string error = string.Empty;

            checkAndCreateFolder(getLocalRepositoryPath(component));

            try
            {
                CloneCommand clone = Git.CloneRepository();
                clone.SetURI(repUrl);
                clone.SetDirectory(localFolder);

                Git repo = clone.Call();
                //writer.Close();
                repo.GetRepository().Close();
               }
            catch (Exception ex)
            {

                try
                {
                    var git = Git.Open(localFolder);
                    //var repository = git.GetRepository();
                    //PullCommand pullCommand = git.Pull();
                    //pullCommand.Call();
                    //repository.Close();

                    var reset = git.Reset().SetMode(ResetCommand.ResetType.HARD).SetRef("origin/master").Call();

                }
                catch (Exception ex2)
                {

                    error = ex2.Message;
                }

                error = ex.Message;
            }

            return error;
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="component"></param>
        /// <returns></returns>

        public static string CloneOrCheckOutRepo(AsposeComponent component)
        {
            string repUrl      = component.get_remoteExamplesRepository();
            string localFolder = getLocalRepositoryPath(component);
            string error       = string.Empty;

            checkAndCreateFolder(getLocalRepositoryPath(component));

            try
            {
                CloneCommand clone = Git.CloneRepository();
                clone.SetURI(repUrl);
                clone.SetDirectory(localFolder);

                Git repo = clone.Call();
                //writer.Close();
                repo.GetRepository().Close();
            }
            catch (Exception ex)
            {
                try
                {
                    var git = Git.Open(localFolder);
                    //var repository = git.GetRepository();
                    //PullCommand pullCommand = git.Pull();
                    //pullCommand.Call();
                    //repository.Close();

                    var reset = git.Reset().SetMode(ResetCommand.ResetType.HARD).SetRef("origin/master").Call();
                }
                catch (Exception ex2)
                {
                    error = ex2.Message;
                }

                error = ex.Message;
            }

            return(error);
        }
        public void storeReleaseNotes(AsposeComponent component)
        {
            string localPath = getLibaryDownloadPath() + component.get_name() + ".htm";
            try
            {
                System.IO.File.WriteAllText(localPath, component.get_changeLog());
            }
            catch (FileNotFoundException e)
            {

            }
            catch (Exception e)
            {

            }
        }
        public static void storeVersion(AsposeComponent component)
        {
            string localPath = getLibaryDownloadPath() + component.get_name() + ".ver";
            try
            {
                System.IO.File.WriteAllText(localPath, component.get_latestVersion());
            }
            catch (FileNotFoundException e)
            {

            }
            catch (Exception e)
            {

            }
        }
        private void UpdatePrjReferenceHintPath(string projectFilePath, AsposeComponent component)
        {
            if (!File.Exists(projectFilePath))
                return;

            XmlDocument xdDoc = new XmlDocument();
            xdDoc.Load(projectFilePath);

            XmlNamespaceManager xnManager =
             new XmlNamespaceManager(xdDoc.NameTable);
            xnManager.AddNamespace("tu",
             "http://schemas.microsoft.com/developer/msbuild/2003");

            XmlNode xnRoot = xdDoc.DocumentElement;
            XmlNodeList xnlPages = xnRoot.SelectNodes("//tu:ItemGroup", xnManager);
            foreach (XmlNode node in xnlPages)
            {
                XmlNodeList nodelist = node.SelectNodes("//tu:HintPath", xnManager);
                foreach (XmlNode nd in nodelist)
                {
                    string innter = nd.InnerText;
                    nd.InnerText = "..\\Bin\\" + component.Name + ".dll";
                }
            }
            xdDoc.Save(projectFilePath);
        }
 private void CloneOrCheckOutRepoWorker(AsposeComponent component)
 {
     GitHelper.CloneOrCheckOutRepo(component);
     downloadTaskCompleted = true;
 }
 private void CloneOrCheckOutRepo(AsposeComponent component)
 {
     downloadTaskCompleted = false;
     timer1.Start();
     Task repoUpdateWorker = new Task(delegate { CloneOrCheckOutRepoWorker(component); });
     repoUpdateWorker.Start();
     progressTask = new Task(delegate { progressDisplayTask(); });
     progressBar1.Enabled = true;
     progressTask.Start();
     ContinueButton.Enabled = false;
     toolStripStatusMessage.Text = "Please wait while the Examples are being downloaded...";
 }
        private void checkAndUpdateRepo(AsposeComponent component)
        {
            if (null == component)
                return;
            if (null == component.get_remoteExamplesRepository() || component.RemoteExamplesRepository == string.Empty)
            {
                showMessage("Examples not available", component.get_name() + " - " + Constants.EXAMPLES_NOT_AVAILABLE_MESSAGE, MessageBoxButtons.OK, MessageBoxIcon.Information);
                examplesNotAvailable = true;
                return;
            }
            else
            {
                examplesNotAvailable = false;
            }

            if (AsposeComponentsManager.isIneternetConnected())
            {
                CloneOrCheckOutRepo(component);
            }
            else
            {
                showMessage(Constants.INTERNET_CONNECTION_REQUIRED_MESSAGE_TITLE, component.get_name() + " - " + Constants.EXAMPLES_INTERNET_CONNECTION_REQUIRED_MESSAGE, MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Beispiel #14
0
 public static string getLocalRepositoryPath(AsposeComponent component)
 {
     return AsposeComponentsManager.getAsposeHomePath() + "gitrepos" + "/" + component.get_name();
 }
 void processComponents()
 {
     AsposeComponent component = new AsposeComponent();
     AsposeComponents.list.TryGetValue(Constants.ASPOSE_COMPONENT, out component);
     component.Selected = true;
 }
 public static string getLocalRepositoryPath(AsposeComponent component)
 {
     return(AsposeComponentsManager.getAsposeHomePath() + "gitrepos" + "/" + component.get_name());
 }