public GithubConfigurationForm(GithubConfiguration githubFoncifguration)
 {
     remoteGitPath = githubFoncifguration.remoteGitPath;
     localGitPath  = githubFoncifguration.localGitPath;
     publishUrl    = githubFoncifguration.publishUrl;
     userName      = githubFoncifguration.userName;
     passWord      = githubFoncifguration.passWord;
     acessUrl      = githubFoncifguration.acessUrl;
     clearLocalGit = githubFoncifguration.clearLocalGit;
     openSite      = githubFoncifguration.openSite;
     InitializeComponent();
 }
        public GithubConfiguration ExportGithubConfiguration()
        {
            GithubConfiguration githubFoncifguration = new GithubConfiguration();

            githubFoncifguration.remoteGitPath = remoteGitPath;
            githubFoncifguration.localGitPath  = localGitPath;
            githubFoncifguration.publishUrl    = publishUrl;
            githubFoncifguration.userName      = userName;
            githubFoncifguration.passWord      = passWord;
            githubFoncifguration.acessUrl      = acessUrl;
            githubFoncifguration.clearLocalGit = clearLocalGit;
            githubFoncifguration.openSite      = openSite;
            return(githubFoncifguration);
        }
Example #3
0
        public static void PublishToGithub(string githubConfigFile)
        {
            GithubConfiguration githubFoncifguration = new GithubConfiguration();
            JsonSerializer      jsonSerializer       = new JsonSerializer();

            // Read configuration if exist
            if (File.Exists(githubConfigFile))
            {
                StreamReader streamReader = new StreamReader(githubConfigFile);
                Newtonsoft.Json.JsonTextReader jsonTextReader = new JsonTextReader(streamReader);
                githubFoncifguration = jsonSerializer.Deserialize <GithubConfiguration>(jsonTextReader);
                jsonTextReader.Close();
                streamReader.Close();
            }

            string remoteGitPath = githubFoncifguration.remoteGitPath;
            string localGitPath  = githubFoncifguration.localGitPath;
            string publishUrl    = githubFoncifguration.publishUrl;
            string userName      = githubFoncifguration.userName;
            string passWord      = githubFoncifguration.passWord;
            string acessUrl      = githubFoncifguration.acessUrl;
            bool   clearLocalGit = githubFoncifguration.clearLocalGit;
            bool   openSite      = githubFoncifguration.openSite;

            if (!Directory.Exists(localGitPath))
            {
                return;
            }

            //publish
            GitRepositoryPublisher.PublishToGit(remoteGitPath, localGitPath, userName, passWord);

            //open browser
            if (openSite)
            {
                System.Diagnostics.Process.Start(acessUrl);
            }
        }