Example #1
0
        //public static Perforce ConnectToProject(Project project)
        //{
        //    return ConnectToPath(project.ProjectPath);
        //}

        public Perforce()
        {
            ConfigManager  configManager  = new ConfigManager();
            PerforceConfig perforceConfig = (PerforceConfig)configManager.GetCategory(SettingsCategories.PERFORCE);

            Enabled = perforceConfig.Enabled;
            if (Enabled == true)
            {
                PerforceHost   = perforceConfig.Host;
                PerforceServer = perforceConfig.Server.Replace("<Host>", PerforceHost);

                ClientName     = perforceConfig.UserName ?? Environment.UserName;
                ClientHostName = perforceConfig.ClientHostName ?? Environment.MachineName;
                WorkspaceName  = perforceConfig.WorkspaceName ?? string.Format("{0}_{1}", ClientName, ClientHostName);

                //if (NetworkHost.CanConnect(perforceHost))
                //{
                //    this.Server = new Server(new ServerAddress(perforceServer));
                //    this.Repository = new Repository(this.Server);
                //    this.Username = Environment.UserName;
                //}

                this.Server     = new Server(new ServerAddress(PerforceServer));
                this.Repository = new Repository(this.Server);
                this.Username   = ClientName;
            }
        }
Example #2
0
 private void loadConfig()
 {
     m_config = PerforceConfig.load(m_configFile);
     if (m_config == null)
     {
         return;
     }
     if (!String.IsNullOrEmpty(m_config.User))
     {
         m_connection.User = m_config.User;
     }
     if (!String.IsNullOrEmpty(m_config.Client))
     {
         m_connection.Client = m_config.Client;
     }
     m_connection.Port = m_config.Port;
 }
Example #3
0
            //-----------------------------------------------------------------------------------------
            static public PerforceConfig load(string _file)
            {
                string         error  = null;
                PerforceConfig result = VinceToolbox.xmlFunctions.load <PerforceConfig>(_file, out error);

                if (result == null)
                {
                    result = new PerforceConfig();
                }
                result.m_file = _file;
                if (String.IsNullOrEmpty(result.Port))
                {
                    result.Port = s_defaultPort;
                }
                if (!string.IsNullOrEmpty(result.Password))
                {
                    result.Password = result.decrypt(result.Password, "AED25BA0F6395CCA325F4A77B4613B91");
                }
                return(result);
            }