public AsposeComponents()
 {
     list.Clear();
     
     AsposeComponent asposeCells = new AsposeComponent();
     asposeCells.set_downloadUrl("");
     asposeCells.set_downloadFileName("aspose.Cells.zip");
     asposeCells.set_name(Constants.ASPOSE_COMPONENT);
     asposeCells.set_remoteExamplesRepository("https://github.com/asposeCells/Aspose_Cells_NET.git");
     list.Add(Constants.ASPOSE_COMPONENT, asposeCells);
 }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="component"></param>
        /// <returns></returns>

        public static string CloneOrCheckOutRepo(AsposeComponent component)
        {
            if (Directory.Exists(getLocalRepositoryPath(component)))
            {
                if (Directory.Exists(getLocalRepositoryPath(component) + "\\.git\\refs\\heads"))
                {
                    if (Directory.GetFiles(getLocalRepositoryPath(component) + "\\.git\\refs\\heads").Length <= 0)
                    {
                        System.IO.DirectoryInfo directory = new System.IO.DirectoryInfo(getLocalRepositoryPath(component));
                        Empty(directory);
                    }
                }
            }

            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 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)
            {
            }
        }
        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)
            {

            }

        }
Esempio n. 7
0
 public static string getLocalRepositoryPath(AsposeComponent component)
 {
     return(AsposeComponentsManager.getAsposeHomePath() + "gitrepos" + "/" + component.get_name());
 }
 private void CloneOrCheckOutRepoWorker(AsposeComponent component)
 {
     GitHelper.CloneOrCheckOutRepo(component);
     downloadTaskCompleted = true;
 }
 private void CloneOrCheckOutRepo(AsposeComponent component)
 {
     UpdateProgress(0);
     downloadTaskCompleted = false;
     timer1.Start();
     Task repoUpdateWorker = new Task(delegate { CloneOrCheckOutRepoWorker(component); });
     repoUpdateWorker.Start();
     progressTask = new Task(delegate { progressDisplayTask(); });
     progressBar.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);
            }
        }
 void processComponents()
 {
     AsposeComponent component = new AsposeComponent();
     AsposeComponents.list.TryGetValue(Constants.ASPOSE_COMPONENT, out component);
     component.Selected = true;
 }
        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);
        }
        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 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 static string getLocalRepositoryPath(AsposeComponent component)
 {
     return AsposeComponentsManager.getAsposeHomePath() + "gitrepos" + "/" + component.get_name();
 }