Exemplo n.º 1
0
        /// <summary>
        /// Get server information.
        /// </summary>
        /// <returns>Information about a connection's client-side application context.</returns>
        /// <remarks>
        /// <br/><b>p4 help info</b>
        /// <br/>
        /// <br/>     info -- Display client/server information
        /// <br/>
        /// <br/>     p4 info [-s]
        /// <br/>
        /// <br/>   Info lists information about the current client (user name,
        /// <br/>   client name, applicable client root, client current directory,
        /// <br/>   and the client IP address) and some server information (server
        /// <br/>   IP address, server root, date, uptime, version and license data).
        /// <br/>
        /// <br/>   The -s option produces 'short' output that omits any information
        /// <br/>   that requires a database lookup such as the client root).
        /// <br/>
        /// <br/>
        /// </remarks>
        /// <example>
        ///     To get the server root:
        ///
        /// <code>
        ///
        ///         ServerMetaData s = rep.GetServerMetaData(null);
        ///         string root = s.Root;
        ///
        /// </code>
        ///     To get the server case handling:
        ///
        /// <code>
        ///         ServerMetaData s = rep.GetServerMetaData(null);
        ///         bool caseSensitive = s.CaseSensitive;
        /// </code>
        ///
        /// </example>
        public ServerMetaData GetServerMetaData(Options options)
        {
            P4Command cmd = new P4Command(this, "info", true);

            P4CommandResult results = cmd.Run(options);

            if (results.Success)
            {
                if ((results.TaggedOutput == null) || (results.TaggedOutput.Count <= 0))
                {
                    return(null);
                }
                ServerMetaData value = new ServerMetaData();
                foreach (TaggedObject obj in results.TaggedOutput)
                {
                    value.FromGetServerMetaDataCmdTaggedOutput(obj);
                }
                this.Server.SetMetadata(value);

                return(value);
            }
            else
            {
                P4Exception.Throw(results.ErrorList);
            }
            return(null);
        }
Exemplo n.º 2
0
        public static bool DSTMismatch(ServerMetaData smd)
        {
            DateTime serverDate = smd.Date;
            bool     UTC_dst    =
                TimeZoneInfo.FindSystemTimeZoneById("GMT Standard Time").IsDaylightSavingTime(serverDate);
            bool server_dst = serverDate.IsDaylightSavingTime();

            if (server_dst && !UTC_dst)
            {
                return(true);
            }
            return(false);
        }
Exemplo n.º 3
0
 internal void SetMetadata(ServerMetaData metadata)
 {
     Metadata = metadata;
 }