Пример #1
0
 internal P4Form(string FormCommand, string specDef, Hashtable S, System.Text.Encoding encoding) : base(S)
 {
     _specdef     = specDef;
     _encoding    = encoding;
     _spec        = new p4dn.Spec(specDef, encoding);
     _formCommand = FormCommand;
 }
Пример #2
0
 internal P4Form(string FormCommand, string specDef, Dictionary <string, string> S, System.Text.Encoding encoding)
     : base(S)
 {
     _specdef = specDef;
     // clone this so we don't hold a reference to another object's encoding object
     // preventing it from Garbage collecting.
     _encoding    = (System.Text.Encoding)encoding.Clone();
     _spec        = new p4dn.Spec(specDef, encoding);
     _formCommand = FormCommand;
 }
Пример #3
0
 internal P4Form(string FormCommand, string specDef, Dictionary<string, string> S, System.Text.Encoding encoding)
     : base(S)
 {
     _specdef = specDef;
     // clone this so we don't hold a reference to another object's encoding object
     // preventing it from Garbage collecting.
     _encoding = (System.Text.Encoding) encoding.Clone();
     _spec = new p4dn.Spec(specDef, encoding);
     _formCommand = FormCommand;
 }
Пример #4
0
        /// <summary>
        /// Parses a Perforce form without making a server connection.
        /// </summary>
        /// <param name="formCommand">The command that would otherwise be used to fetch the form.</param>
        /// <param name="specDef">The Perforce 'specdef' for the form.</param>
        /// <param name="formContents">The raw formated form text.</param>
        /// <param name="encoding">Server encoding (either ANSI or UFT-8).</param>
        /// <returns>A Perforce form object.</returns>
        /// <remarks>
        /// LoadFromSpec can be used to parse a form without making a call to the server.
        /// LoadFromSpec can be useful in form triggers.
        /// It does require you to know the SpecDef to call, which can change when upgrading or changing
        /// the server configuration.
        /// </remarks>
        public static P4Form LoadFromSpec(string formCommand, string specDef, string formContents, System.Text.Encoding encoding)
        {
            p4dn.Spec spec = new p4dn.Spec(specDef, encoding);
            Hashtable ht   = null;

            using (p4dn.Error err = new p4dn.Error(encoding))
            {
                ht = spec.Parse(formContents, err);
                if (err.Test())
                {
                    throw new Exceptions.FormParseException(formCommand, err.Fmt());
                }
            }
            return(new P4Form(formCommand, specDef, ht, encoding));
        }
Пример #5
0
        /// <summary>
        /// Parses a Perforce form without making a server connection.
        /// </summary>
        /// <param name="formCommand">The command that would otherwise be used to fetch the form.</param>
        /// <param name="specDef">The Perforce 'specdef' for the form.</param>
        /// <param name="formContents">The raw formated form text.</param>
        /// <param name="encoding">Server encoding (either ANSI or UFT-8).</param>
        /// <returns>A Perforce form object.</returns>
        /// <remarks>
        /// LoadFromSpec can be used to parse a form without making a call to the server.  
        /// LoadFromSpec can be useful in form triggers.
        /// It does require you to know the SpecDef to call, which can change when upgrading or changing
        /// the server configuration.
        /// </remarks>
        public static P4Form LoadFromSpec(string formCommand, string specDef, string formContents, System.Text.Encoding encoding)
        {

            p4dn.Spec spec = new p4dn.Spec(specDef, encoding);
            Dictionary<string, string> ht = null;
            using (p4dn.Error err = new p4dn.Error(encoding))
            {
                ht = spec.Parse(formContents, err);
                if (err.Test())
                {
                    throw new Exceptions.FormParseException(formCommand, err.Fmt());
                }
            }
            return new P4Form(formCommand, specDef, ht, encoding);

        }