public override string Serialize()
        {
            StringBuilder msg = new StringBuilder("$ID");

            msg.Append(From);
            msg.Append(DELIMITER);
            msg.Append(To);
            msg.Append(DELIMITER);
            msg.Append(ClientID.ToString("x4"));
            msg.Append(DELIMITER);
            msg.Append(ClientName);
            msg.Append(DELIMITER);
            msg.Append(MajorVersion.ToString());
            msg.Append(DELIMITER);
            msg.Append(MinorVersion.ToString());
            msg.Append(DELIMITER);
            msg.Append(CID);
            msg.Append(DELIMITER);
            msg.Append(SysUID);
            if (!string.IsNullOrEmpty(InitialChallenge))
            {
                msg.Append(DELIMITER);
                msg.Append(InitialChallenge);
            }
            return(msg.ToString());
        }
Esempio n. 2
0
 public override void DumpBody(XmlWriter writer)
 {
     writer.WriteElementString("url", Url);
     writer.WriteElementString("major-version", MajorVersion.ToString());
     writer.WriteElementString("minor-version", MinorVersion.ToString());
     Assets.DumpXml(writer);
 }
Esempio n. 3
0
 public override void DumpBody(XmlWriter writer)
 {
     writer.WriteElementString("product-id", ProductId.ToString());
     writer.WriteElementString("edition", Edition.ToString());
     writer.WriteElementString("major-version", MajorVersion.ToString());
     writer.WriteElementString("minor-version", MinorVersion.ToString());
     writer.WriteElementString("build-number", BuildNumber.ToString());
     writer.WriteElementString("build-date", BuildDate.ToString());
 }
Esempio n. 4
0
        public virtual void WriteXml(XmlDictionaryWriter writer,
                                     SamlSerializer samlSerializer,
                                     SecurityTokenSerializer keyInfoTokenSerializer)
        {
            if (writer == null)
            {
                throw new ArgumentNullException("writer");
            }

            if (Issuer == null || Issuer.Length == 0)
            {
                throw new SecurityTokenException("Issuer must not be null or empty.");
            }
            if (Statements.Count == 0)
            {
                throw new SecurityTokenException("At least one assertion statement is required.");
            }

            if (samlSerializer == null)
            {
                throw new ArgumentNullException("samlSerializer");
            }
            CultureInfo invariant = CultureInfo.InvariantCulture;

            writer.WriteStartElement("saml", "Assertion", SamlConstants.Namespace);
            writer.WriteAttributeString("MajorVersion", MajorVersion.ToString(invariant));
            writer.WriteAttributeString("MinorVersion", MinorVersion.ToString(invariant));
            writer.WriteAttributeString("AssertionID", AssertionId);
            writer.WriteAttributeString("Issuer", Issuer);
            writer.WriteAttributeString("IssueInstant", IssueInstant.ToString(SamlConstants.DateFormat, invariant));

            try
            {
                if (Conditions != null)
                {
                    Conditions.WriteXml(writer, samlSerializer, keyInfoTokenSerializer);
                }
                if (Advice != null)
                {
                    Advice.WriteXml(writer, samlSerializer, keyInfoTokenSerializer);
                }
                foreach (SamlStatement statement in Statements)
                {
                    statement.WriteXml(writer, samlSerializer, keyInfoTokenSerializer);
                }
            }
            catch (NotImplementedException)
            {
                throw;
            }
            catch (Exception ex) // bad catch, eh?
            {
                throw new InvalidOperationException("There is an error on writing assertion statements.", ex);
            }
            writer.WriteEndElement();
        }
Esempio n. 5
0
 public override void WriteMetadata(StringBuilder builder)
 {
     builder.Append(Encoding.ASCII.GetString(HttpMethodBytes.GetBytes(Method)));
     builder.Append(" ");
     builder.Append(Path);
     builder.Append(" HTTP/");
     builder.Append(MajorVersion.ToString(CultureInfo.InvariantCulture));
     builder.Append(".");
     builder.Append(MinorVersion.ToString(CultureInfo.InvariantCulture));
     builder.Append("\r\n");
     Headers.Write(builder, null, Encoding.ASCII);
 }
        /// <summary>
        /// Implements the WriteXml() method of the <seealso cref="IXmlSerializable"/> interface.
        /// </summary>
        /// <param name="writer"></param>
        void IXmlSerializable.WriteXml(XmlWriter writer)
        {
            writer.WriteAttributeString("Version", Version.ToString());
            writer.WriteAttributeString("MinorVersion", MinorVersion.ToString());

            // RootItems are written here...
            if (Root != null)
            {
                var rootSer = new DataContractSerializer(typeof(SolutionRootItemModel));
                rootSer.WriteObject(writer, Root);
            }
        }
Esempio n. 7
0
        public override string ToString()
        {
            // Start with the unix epoch of Jan, 1, 1970.
            var compTime = new DateTime(1970, 1, 1, 0, 0, 0, 0);

            // Add the total seconds to the epoch.
            compTime = compTime.AddSeconds(Convert.ToDouble(CompilationTime));

            var sb = new StringBuilder();

            sb.Append($"Magic: {Magic.ToString("X8")} ");
            sb.Append($"Major: {MajorVersion.ToString("X2")} ");
            sb.Append($"Minor: {MinorVersion.ToString("X2")} ");
            sb.Append($"Game ID: {GameID.ToString("X4")} ");
            sb.Append($"Compile: {compTime}{Environment.NewLine}");
            sb.Append($"Script Name: {SourceFileName}{Environment.NewLine}");
            sb.Append($"User Name: {UserName}{Environment.NewLine}");
            sb.Append($"Computer Name: {ComputerName}");
            return(sb.ToString());
        }
        internal override string GetRtfFormattedRule()
        {
            RichTextBox rTxtBx = new RichTextBox();

            if (UseMajorVersion || UseProductType)
            {
                if (ReverseRule)
                {
                    print(rTxtBx, GroupDisplayer.normalFont, GroupDisplayer.green, "<lar:");
                    print(rTxtBx, GroupDisplayer.boldFont, GroupDisplayer.black, "Not");
                    print(rTxtBx, GroupDisplayer.normalFont, GroupDisplayer.green, ">\r\n");
                }

                print(rTxtBx, GroupDisplayer.normalFont, GroupDisplayer.black, "<bar:");
                print(rTxtBx, GroupDisplayer.elementAndAttributeFont, GroupDisplayer.red, "WindowsVersion");

                if (UseComparison)
                {
                    print(rTxtBx, GroupDisplayer.elementAndAttributeFont, GroupDisplayer.blue, " Comparison");
                    print(rTxtBx, GroupDisplayer.normalFont, GroupDisplayer.black, "=\"");
                    print(rTxtBx, GroupDisplayer.boldFont, GroupDisplayer.black, Comparison);
                    print(rTxtBx, GroupDisplayer.normalFont, GroupDisplayer.black, "\"");
                }

                if (UseMajorVersion)
                {
                    print(rTxtBx, GroupDisplayer.elementAndAttributeFont, GroupDisplayer.blue, " MajorVersion");
                    print(rTxtBx, GroupDisplayer.normalFont, GroupDisplayer.black, "=\"");
                    print(rTxtBx, GroupDisplayer.boldFont, GroupDisplayer.black, MajorVersion.ToString());
                    print(rTxtBx, GroupDisplayer.normalFont, GroupDisplayer.black, "\"");
                }

                if (UseMinorVersion)
                {
                    print(rTxtBx, GroupDisplayer.elementAndAttributeFont, GroupDisplayer.blue, " MinorVersion");
                    print(rTxtBx, GroupDisplayer.normalFont, GroupDisplayer.black, "=\"");
                    print(rTxtBx, GroupDisplayer.boldFont, GroupDisplayer.black, MinorVersion.ToString());
                    print(rTxtBx, GroupDisplayer.normalFont, GroupDisplayer.black, "\"");
                }

                if (UseBuildNumber)
                {
                    print(rTxtBx, GroupDisplayer.elementAndAttributeFont, GroupDisplayer.blue, " BuildNumber");
                    print(rTxtBx, GroupDisplayer.normalFont, GroupDisplayer.black, "=\"");
                    print(rTxtBx, GroupDisplayer.boldFont, GroupDisplayer.black, BuildNumber.ToString());
                    print(rTxtBx, GroupDisplayer.normalFont, GroupDisplayer.black, "\"");
                }

                if (UseServicePackMajor)
                {
                    print(rTxtBx, GroupDisplayer.elementAndAttributeFont, GroupDisplayer.blue, " ServicePackMajor");
                    print(rTxtBx, GroupDisplayer.normalFont, GroupDisplayer.black, "=\"");
                    print(rTxtBx, GroupDisplayer.boldFont, GroupDisplayer.black, ServicePackMajor.ToString());
                    print(rTxtBx, GroupDisplayer.normalFont, GroupDisplayer.black, "\"");
                }

                if (UseServicePackMinor)
                {
                    print(rTxtBx, GroupDisplayer.elementAndAttributeFont, GroupDisplayer.blue, " ServicePackMinor");
                    print(rTxtBx, GroupDisplayer.normalFont, GroupDisplayer.black, "=\"");
                    print(rTxtBx, GroupDisplayer.boldFont, GroupDisplayer.black, ServicePackMinor.ToString());
                    print(rTxtBx, GroupDisplayer.normalFont, GroupDisplayer.black, "\"");
                }

                if (UseProductType)
                {
                    print(rTxtBx, GroupDisplayer.elementAndAttributeFont, GroupDisplayer.blue, " ProductType");
                    print(rTxtBx, GroupDisplayer.normalFont, GroupDisplayer.black, "=\"");
                    print(rTxtBx, GroupDisplayer.boldFont, GroupDisplayer.black, ProductType.ToString());
                    print(rTxtBx, GroupDisplayer.normalFont, GroupDisplayer.black, "\"");
                }

                print(rTxtBx, GroupDisplayer.normalFont, GroupDisplayer.black, "/>");

                if (ReverseRule)
                {
                    print(rTxtBx, GroupDisplayer.normalFont, GroupDisplayer.black, "\r\n");
                    print(rTxtBx, GroupDisplayer.normalFont, GroupDisplayer.green, "</lar:");
                    print(rTxtBx, GroupDisplayer.boldFont, GroupDisplayer.black, "Not");
                    print(rTxtBx, GroupDisplayer.normalFont, GroupDisplayer.green, ">");
                }
            }
            return(rTxtBx.Rtf);
        }
Esempio n. 9
0
 public override string ToString()
 {
     return(string.Format("sc{0}{1}{2}", MajorVersion.ToString("00"), MinorVersion.ToString("00"), ScriptVersion.ToString("00")));
 }