public GroupDocsComponents()
        {
            list.Clear();

            GroupDocsComponent groupdocsMetadata = new GroupDocsComponent();
            groupdocsMetadata.set_downloadUrl("");
            groupdocsMetadata.set_downloadFileName("groupdocs.metadata.zip");
            groupdocsMetadata.set_name(Constants.GROUPDOCS_COMPONENT);
            groupdocsMetadata.set_remoteExamplesRepository("https://github.com/groupdocsmetadata/GroupDocs_Metadata_NET.git");
            list.Add(Constants.GROUPDOCS_COMPONENT, groupdocsMetadata);
        }
        public static string readVersion(GroupDocsComponent component)
        {
            string localPath = getLibaryDownloadPath() + component.get_name() + ".ver";
            string line = string.Empty;

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

            try
            {
                System.IO.File.WriteAllText(localPath, component.get_latestVersion());
            }
            catch (FileNotFoundException e)
            {
            }
            catch (Exception e)
            {
            }
        }
Example #4
0
        public void storeReleaseNotes(GroupDocsComponent 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(GroupDocsComponent component)
        {
            string localPath = getLibaryDownloadPath() + component.get_name() + ".htm";
            try
            {
                System.IO.File.WriteAllText(localPath, component.get_changeLog());
            }
            catch (FileNotFoundException e)
            {

            }
            catch (Exception e)
            {

            }

        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="component"></param>
        /// <returns></returns>

        public static string CloneOrCheckOutRepo(GroupDocsComponent 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;
        }
Example #7
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="component"></param>
        /// <returns></returns>

        public static string CloneOrCheckOutRepo(GroupDocsComponent 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);
        }
        private void UpdatePrjReferenceHintPath(string projectFilePath, GroupDocsComponent 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 checkAndUpdateRepo(GroupDocsComponent 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 (GroupDocsComponentsManager.isIneternetConnected())
            {
                CloneOrCheckOutRepo(component);
            }
            else
            {
                showMessage(Constants.INTERNET_CONNECTION_REQUIRED_MESSAGE_TITLE, component.get_name() + " - " + Constants.EXAMPLES_INTERNET_CONNECTION_REQUIRED_MESSAGE, MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
        private void CloneOrCheckOutRepoWorker(GroupDocsComponent component)
        {
            GitHelper.CloneOrCheckOutRepo(component);
            downloadTaskCompleted = true;

        }
 private void CloneOrCheckOutRepo(GroupDocsComponent 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...";
 }
Example #12
0
 public static string getLocalRepositoryPath(GroupDocsComponent component)
 {
     return(GroupDocsComponentsManager.getGroupDocsHomePath() + "gitrepos" + "/" + component.get_name());
 }
 public static string getLocalRepositoryPath(GroupDocsComponent component)
 {
     return GroupDocsComponentsManager.getGroupDocsHomePath() + "gitrepos" + "/" + component.get_name();
 }
        public static void storeVersion(GroupDocsComponent 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(GroupDocsComponent component, string urlStr, string outputFile)
 {
     AsyncDownload asyncDownload = new AsyncDownload();
     asyncDownload.Url = urlStr;
     asyncDownload.LocalPath = getLibaryDownloadPath() + outputFile;
     asyncDownload.Component = component;
     AsyncDownloadList.list.Add(asyncDownload);
 }
 void processComponents()
 {
     GroupDocsComponent component = new GroupDocsComponent();
     GroupDocsComponents.list.TryGetValue(Constants.GROUPDOCS_COMPONENT, out component);
     component.Selected = true;
 }