Exemple #1
0
 /// <summary>Compares two JamaProjects and returns whether they are equal or not.</summary>
 /// <param name="inProject1">One of the JamaProjects to compare.</param>
 /// <param name="inProject2">Another JamaProject to compare.</param>
 /// <returns>True if the settings are the same, false if not.</returns>
 public bool IsEqual(JamaProjectInfo inProject1, JamaProjectInfo inProject2)
 {
     if (inProject2.ServerURL.Trim() == inProject1.ServerURL.Trim() &&
         inProject2.UserName == inProject1.UserName &&
         inProject2.ProjectNum == inProject1.ProjectNum)
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
Exemple #2
0
 /// <summary>Returns a savable string from a project object.</summary>
 /// <param name="inProject">The JamaProject to convert.</param>
 /// <returns>A string of the fields seperated by the field seperator.</returns>
 static internal string GenerateToString(JamaProjectInfo inProject)
 {
     if (inProject != null)
     {
         return(inProject.UserName + JamaProjectInfo.CHAR_FIELD +
                inProject.UserPass + JamaProjectInfo.CHAR_FIELD +
                inProject.ServerURL + JamaProjectInfo.CHAR_FIELD +
                inProject.ProjectNum.ToString() + JamaProjectInfo.CHAR_FIELD +
                inProject.ProjectName + JamaProjectInfo.CHAR_FIELD);
     }
     else
     {
         return(null);
     }
 }
Exemple #3
0
        /// <summary>Converts an encoded string into a JamaProject. Uses \xE for field seperation.</summary>
        /// <param name="inString">The string to decode.</param>
        /// <returns>A JamaProject based on the given string, or null if error.</returns>
        static internal JamaProjectInfo GenerateFromString(StreamWriter streamWriter, string inString)
        {
            //Get the values.
            string[] values = inString.Split(JamaProjectInfo.CHAR_FIELD);

            try
            {
                JamaProjectInfo retProject = new JamaProjectInfo();

                retProject.UserName    = values[0];
                retProject.UserPass    = values[1];
                retProject.ServerURL   = values[2];
                retProject.ProjectNum  = int.Parse(values[3]);
                retProject.ProjectName = values[4];

                return(retProject);
            }
            catch (Exception ex)
            {
                streamWriter.WriteLine(ex.Message);
                return(null);
            }
        }