Example #1
0
 public override void GenerateJavaScript(JSContext context, System.IO.TextWriter textWriter)
 {
     textWriter.WriteLine();
     context.Indentation--;
     textWriter.Write(context.IndentationText);
     textWriter.Write("}");
 }
Example #2
0
 public override void SaveState(System.IO.BinaryWriter stream)
 {
     base.SaveState(stream);
     stream.Write(address_8001);
     stream.Write(prg_a);
     stream.Write(prg_reg);
 }
Example #3
0
        protected override void Convert(System.IO.TextWriter writer, object state)
        {
            try
            {
                if (state is LoggingEvent)
                {
                    LoggingEvent logEvent = (LoggingEvent)state;

                    if (logEvent.MessageObject is MLString)
                    {
                        writer.Write( ((MLString)logEvent.MessageObject).EnglishValue );
                    }
                    else
                    {
                        writer.Write(logEvent.MessageObject.ToString());
                    }

                }
                else
                {
                    writer.Write(SystemInfo.NotAvailableText);
                }
            }
            catch (Exception)
            {
                writer.Write(SystemInfo.NotAvailableText);
            }
        }
Example #4
0
 public ObjectBuilder(System.IO.TextWriter output,string tab=null) {
     _output = output;
     _tab = tab;
     if (_tab != null) { _output.Write(_tab); _tab += "\t"; }
     _output.Write('{');
     if (_tab != null) _output.Write("\r\n");
 }
 protected override void RenderEditMode(System.Web.UI.HtmlTextWriter writer)
 {
     List<PackageType> packageTypes = PackageController.GetPackageTypes();
     ControlStyle.AddAttributesToRender(writer);
     writer.AddAttribute(HtmlTextWriterAttribute.Type, "text");
     writer.AddAttribute(HtmlTextWriterAttribute.Name, this.UniqueID);
     writer.RenderBeginTag(HtmlTextWriterTag.Select);
     writer.AddAttribute(HtmlTextWriterAttribute.Value, Null.NullString);
     if (StringValue == Null.NullString)
     {
         writer.AddAttribute(HtmlTextWriterAttribute.Selected, "selected");
     }
     writer.RenderBeginTag(HtmlTextWriterTag.Option);
     writer.Write("<" + Localization.Localization.GetString("Not_Specified", Localization.Localization.SharedResourceFile) + ">");
     writer.RenderEndTag();
     foreach (PackageType type in packageTypes)
     {
         writer.AddAttribute(HtmlTextWriterAttribute.Value, type.Type);
         if (type.Type == StringValue)
         {
             writer.AddAttribute(HtmlTextWriterAttribute.Selected, "selected");
         }
         writer.RenderBeginTag(HtmlTextWriterTag.Option);
         writer.Write(type.Type);
         writer.RenderEndTag();
     }
     writer.RenderEndTag();
 }
Example #6
0
      /// <summary>
      /// Returns the CRC32 for the specified stream, and writes the input into the output stream.
      /// </summary>
      /// <param name="input">The stream over which to calculate the CRC32</param>
      /// <param name="output">The stream into which to deflate the input</param>
      /// <returns>the CRC32 calculation</returns>
      public UInt32 GetCrc32AndCopy(System.IO.Stream input, System.IO.Stream output)
      {
         unchecked
         {
            UInt32 crc32Result;
            crc32Result = 0xFFFFFFFF;
            byte[] buffer = new byte[BUFFER_SIZE];
            int readSize = BUFFER_SIZE;

	    _TotalBytesRead= 0;
            int count = input.Read(buffer, 0, readSize);
	    if (output != null) output.Write(buffer,0,count); 
	    _TotalBytesRead += count;
            while (count > 0)
            {
               for (int i = 0; i < count; i++)
               {
                  crc32Result = ((crc32Result) >> 8) ^ crc32Table[(buffer[i]) ^ ((crc32Result) & 0x000000FF)];
               }
               count = input.Read(buffer, 0, readSize);
	       if (output != null) output.Write(buffer,0,count); 
	       _TotalBytesRead += count;

            }
            
            return ~crc32Result;
         }
      }
Example #7
0
 /// <summary>
 /// Save the structure in a binary writer
 /// </summary>
 /// <param name="writer">   Binary writer</param>
 public void SaveToStream(System.IO.BinaryWriter writer) {
     writer.Write(m_lVal1);
     writer.Write(m_lVal2);
     writer.Write(m_lVal3);
     writer.Write(m_lVal4);
     writer.Write((int)m_eInfo);
 }
Example #8
0
        public override void Serialize(System.IO.BinaryWriter writer)
        {
            base.Serialize(writer);

            writer.Write(Speed);
            writer.Write(FirstMarker);
        }
 public override void save(System.IO.BinaryWriter Data)
 {
     Data.Write(posX);
     Data.Write(posY);
     Data.Write(worldID);
     Data.Write(worldName);
 }
Example #10
0
        protected override void Render(System.Web.UI.HtmlTextWriter writer)
        {
            IPageable paging = this.NamingContainer.FindControl(this.PageLinkFor) as IPageable;
            if (paging == null)
            {
                throw new ArgumentException(
                    string.Format(
                    "The control specified using PageLinkFor ({0}) is not valid.  This property must be set to the ID of "
                    + "a control that implements IPageable.",
                    this.PageLinkFor
                    )
                );
            }

            writer.WriteBeginTag("select");
            writer.WriteAttribute("onchange", "location = this.options[this.selectedIndex].value;");
            writer.Write(HtmlTextWriter.TagRightChar);

            foreach (PagePair pair in paging.AllPages)
            {
                writer.WriteBeginTag("option");
                writer.WriteAttribute("value", pair.Link);
                if (pair.Link == paging.CurrentPage.Link) writer.WriteAttribute("selected", "selected");
                writer.Write(HtmlTextWriter.TagRightChar);
                writer.Write(pair.Name);
                writer.WriteEndTag("option");
            }
            writer.WriteEndTag("select");
            base.Render(writer);
        }
Example #11
0
        public override void GenerateJavaScript(JSContext context, System.IO.TextWriter textWriter)
        {
            textWriter.Write("if (");
            _condition.GenerateJavaScript(context, textWriter);
            textWriter.WriteLine(") {");
            context.Indentation++;
            textWriter.Write(context.IndentationText);
            _thenExpression.GenerateJavaScript(context, textWriter);
            textWriter.WriteLine();

            context.Indentation--;
            textWriter.Write(context.IndentationText);

            if (_elseExpression != null)
            {

                textWriter.WriteLine("} else {");
                context.Indentation++;
                textWriter.Write(context.IndentationText);

                _elseExpression.GenerateJavaScript(context, textWriter);
                context.Indentation--;

                textWriter.WriteLine();
                textWriter.Write(context.IndentationText);
            }

            textWriter.WriteLine("}");
        }
Example #12
0
 public void SetData(ArraySegment<byte> data,System.IO.Stream stream)
 {
     Seek(stream);
     stream.Write(BitConverter.GetBytes(data.Count),0,4);
     stream.Write(data.Array, data.Offset, data.Count);
     stream.Flush();
 }
        public virtual void Render(System.IO.TextWriter writer, UI.UIControlState state, params HtmlAttribute[] attributes)
        {


            writer.Write("<div class=\"");
            if (state.Validated)
            {
                if (string.IsNullOrEmpty(state.ErrorMessage))
                {
                    writer.Write("form-group has-success");
                }
                else
                {
                    writer.Write("form-group has-error");
                }
            }
            else
            {
                writer.Write("form-group");
            }

            writer.WriteLine("\">");

            RenderLabel(writer, state);
            RenderInput(writer, state, attributes);
            RenderHintOrError(writer, state);


            writer.WriteLine("</div>");

        }
Example #14
0
 public override void SaveState(System.IO.BinaryWriter stream)
 {
     base.SaveState(stream);
     stream.Write(SRAM_PRG_Page);
     stream.Write(irqEnable);
     stream.Write(irqCounter);
 }
Example #15
0
 protected static void Write(System.IO.TextWriter stream, string val)
 {
     stream.Write('"');
     foreach (var c in val)
     {
         switch (c)
         {
         case '\b':
             stream.Write("\\b");
             break;
         case '\f':
             stream.Write("\\f");
             break;
         case '\n':
             stream.Write("\\n");
             break;
         case '\r':
             stream.Write("\\r");
             break;
         case '\t':
             stream.Write("\\t");
             break;
         case '"':
         case '\\':
             stream.Write('\\');
             stream.Write(c);
             break;
         default:
             stream.Write(c);
             break;
         }
     }
     stream.Write('"');
 }
Example #16
0
        /// <summary> 
        /// Generates a <code>HLAInteractionParameter</code>.
        /// </summary>
        private void GenerateHLAInteractionParameterAttribute(int localIndentLevel, System.IO.StreamWriter ps, ParameterDescriptor parameterDescriptor)
        {
            string indentStr = GenerateIndentString(localIndentLevel);
            string newLine = "," + Environment.NewLine + indentStr + "              ";

            ps.Write(indentStr + "[HLAInteractionParameter(Name = \"" + parameterDescriptor.Name + "\"");
            if (!String.IsNullOrEmpty(parameterDescriptor.NameNotes))
            {
                ps.Write(newLine);
                ps.Write("NameNotes = \"" + parameterDescriptor.NameNotes + "\"");
            }
            if (!String.IsNullOrEmpty(parameterDescriptor.Semantics))
            {
                ps.Write(newLine);
                ps.Write("Semantics = \"" + parameterDescriptor.Semantics + "\"");
            }
            if (!String.IsNullOrEmpty(parameterDescriptor.SemanticsNotes))
            {
                ps.Write(newLine);
                ps.Write("SemanticsNotes = \"" + parameterDescriptor.SemanticsNotes + "\"");
            }
            if (!String.IsNullOrEmpty(parameterDescriptor.DataType))
            {
                ps.Write(newLine);
                ps.Write("DataType = \"" + parameterDescriptor.DataType + "\"");
            }
            if (!String.IsNullOrEmpty(parameterDescriptor.DataTypeNotes))
            {
                ps.Write(newLine);
                ps.Write("DataTypeNotes = \"" + parameterDescriptor.DataTypeNotes + "\"");
            }
            ps.WriteLine(")]");
        }
Example #17
0
 protected static void Write(System.IO.TextWriter stream, bool val)
 {
     if (val)
         stream.Write("true");
     else
         stream.Write("false");
 }
Example #18
0
        public override void GenerateJavaScript(JSContext context, System.IO.TextWriter textWriter)
        {
            if (LineTypes == LineTypes.None)
            {
                throw new ApplicationException("Line type not set for line " + LineNumber);
            }

            if ((LineTypes & LineTypes.FunctionStart) > 0)
            {
                textWriter.Write(context.IndentationText);
                textWriter.WriteLine("function line" + LineNumber + "() {");
                context.Indentation++;
            }

            textWriter.Write(context.IndentationText);
            StatementList.GenerateJavaScript(context, textWriter);
            textWriter.WriteLine();

            if ((LineTypes & LineTypes.FunctionEnd) > 0)
            {
                if (!string.IsNullOrEmpty(ReturnText))
                {
                    textWriter.Write(context.IndentationText);
                    textWriter.WriteLine(ReturnText);
                }
                context.Indentation--;
                textWriter.Write(context.IndentationText);
                textWriter.WriteLine("}");
            }
        }
        protected override void Render(System.Web.UI.HtmlTextWriter writer)
        {
            if (this.RowStyle.CssClass == "")
            this.RowStyle.CssClass = "esdGridRowStyle";
             if (this.SelectedRowStyle.CssClass == "")
            this.SelectedRowStyle.CssClass = "esdGridSelectedRowStyle";
             if (this.PagerStyle.CssClass == "")
            this.PagerStyle.CssClass = "gridPagerStyle";
             if (this.HeaderStyle.CssClass == "")
            this.HeaderStyle.CssClass = "esdGridHeaderStyle";
             if (this.AlternatingRowStyle.CssClass == "")
            this.AlternatingRowStyle.CssClass = "esdGridAlternativeRowStyle";
             this.GridLines = GridLines.None;
             this.CellPadding = 0;
             this.CellPadding = 0;

             if (this.Rows.Count > 0)
             {
            this.UseAccessibleHeader = true;
            this.HeaderRow.TableSection = TableRowSection.TableHeader;
             }

             if (this.Scrollable)
             {
            writer.Write("<div id='" + this.ClientID + "_ScrollArea' style='overflow: auto; width: " + this.ScrollWidth + "; height: " + this.ScrollHeight + "'>");
            base.Render(writer);
            writer.Write("</div>");
             }
             else
             {
            base.Render(writer);
             }
        }
Example #20
0
 /// <summary>
 /// Writes to the given stream the equilivent shape file record given a Geometry object.
 /// </summary>
 /// <param name="geometry">The geometry object to write.</param>
 /// <param name="file">The stream to write to.</param>
 /// <param name="geometryFactory">The geometry factory to use.</param>
 public override void Write(IGeometry geometry, System.IO.BinaryWriter file, IGeometryFactory geometryFactory)
 {
     file.Write(int.Parse(Enum.Format(typeof(ShapeGeometryTypes), this.ShapeType, "d")));
     ICoordinate external = geometry.Coordinates[0];
     file.Write(external.X);
     file.Write(external.Y);
 }
        protected override void Render(System.Web.UI.HtmlTextWriter writer)
        {
            this.ReadOnly = true;
             if (this.ReadOnly == false)
            this.CssClass = "esdButtonTextBox";
             else
            this.CssClass = "esdButtonTextBoxDisabled";

             base.Render(writer);

             string strImgbtn = "esdtextbutton";
             string strbtn = "";
             if (!EnabledButton)
             {
            strbtn = "disabled=" + '"' + "true" + '"';
            strImgbtn = "esdtextbuttonDisabled";
             }
             if (ShowButton)
             {
            writer.Write("<div " + strbtn + " class=" + '"' + strImgbtn + '"' + " id=" + '"' + "" + ClientID + "_button" + '"');

            if (!string.IsNullOrEmpty(this.OnClientClick))
               writer.Write(" OnClick=" + '"' + OnClientClick + '"');

            writer.Write("></div>");

             }
        }
Example #22
0
 public override void SaveState(System.IO.BinaryWriter stream)
 {
     base.SaveState(stream);
     stream.Write(irq_enabled);
     stream.Write(irq_counter);
     stream.Write(odd);
 }
Example #23
0
 public override void Serialize(System.IO.StreamWriter w)
 {
     w.Write('"');
     w.Write(this.Name);
     w.Write("\" ");
     this.SerializeAttributes(w);
 }
        protected override void Render(System.Web.UI.HtmlTextWriter writer)
        {
            if (string.IsNullOrEmpty(this.DocName))
            {
                base.Render(writer);
                return;
            }
            string username = "***************";
            string password = "***********";

            DocumentsService service = new DocumentsService("MyDocumentsListIntegration-v1");
            service.setUserCredentials(username, password);

            //DocumentsListQuery query = new DocumentsListQuery();
            TextDocumentQuery query = new TextDocumentQuery();

            // Make a request to the API and get all documents.
            DocumentsFeed feed = service.Query(query);

            // Iterate through all of the documents returned
            foreach (DocumentEntry entry in feed.Entries)
            {
                if (entry.Title.Text == this.DocName)
                {
                    writer.Write("<div class='gdoc'>");
                    Stream stream = service.Query(new Uri(entry.Content.Src.ToString()));
                    StreamReader reader = new StreamReader(stream);
                    writer.Write(reader.ReadToEnd());
                    writer.Write("</div>");
                    break;
                }
            }

            base.Render(writer);
        }
Example #25
0
 public override void SaveState(System.IO.BinaryWriter stream)
 {
     base.SaveState(stream);
     stream.Write(bank);
     stream.Write(mode);
     stream.Write(offset);
 }
        /// <summary>
        /// Renders the specified writer.
        /// </summary>
        /// <param name="badge">The badge.</param>
        /// <param name="writer">The writer.</param>
        public override void Render( PersonBadgeCache badge, System.Web.UI.HtmlTextWriter writer )
        {
            int duration = GetAttributeValue(badge, "Duration").AsIntegerOrNull() ?? 16;

            writer.Write(string.Format( "<div class='badge badge-weeksattendanceduration badge-id-{0}' data-toggle='tooltip' data-original-title='Family attendance for the last {1} weeks.'>", badge.Id, duration));

            writer.Write("</div>");

            writer.Write(string.Format( @"
                <script>
                    Sys.Application.add_load(function () {{

                        $.ajax({{
                                type: 'GET',
                                url: Rock.settings.get('baseUrl') + 'api/PersonBadges/WeeksAttendedInDuration/{1}/{0}' ,
                                statusCode: {{
                                    200: function (data, status, xhr) {{
                                            var badgeHtml = '<div class=\'weeks-metric\'>';

                                            badgeHtml += '<span class=\'weeks-attended\'>' + data + '</span><span class=\'week-duration\'>/{0}</span>';
                                            badgeHtml += '</div>';

                                            $('.badge-weeksattendanceduration.badge-id-{2}').html(badgeHtml);

                                        }}
                                }},
                        }});
                    }});
                </script>

            ", duration, Person.Id.ToString(), badge.Id));
        }
Example #27
0
        public override void Serialize(System.IO.BinaryWriter writer)
        {
            base.Serialize(writer);

            writer.Write(Respawn);
            writer.Write(RespawnTime);
        }
Example #28
0
        public void SerializePacket(System.IO.BinaryWriter writer)
        {
            writer.Write(Version);
            writer.Write(CustomPackets.Count);

            CustomPackets.ForEach(writer.Write);
        }
Example #29
0
		/// <summary>
		/// Writes a Geometry to the given binary wirter.
		/// </summary>
		/// <param name="geometry">The geometry to write.</param>
		/// <param name="file">The file stream to write to.</param>
		/// <param name="geometryFactory">The geometry factory to use.</param>
		public override void Write(IGeometry geometry, System.IO.BinaryWriter file, IGeometryFactory geometryFactory)
		{
            if(!(geometry is IMultiPoint))
                throw new ArgumentException("Geometry Type error: MultiPoint expected, but the type retrieved is " + geometry.GetType().Name);

            // Slow and maybe not useful...
			// if (!geometry.IsValid)
			// 	Trace.WriteLine("Invalid multipoint being written.");

            IMultiPoint mpoint = geometry as IMultiPoint;
            
            file.Write(int.Parse(Enum.Format(typeof(ShapeGeometryTypes), this.ShapeType, "d")));

            IEnvelope box = geometry.EnvelopeInternal;
			IEnvelope bounds = ShapeHandler.GetEnvelopeExternal(geometryFactory.PrecisionModel, box);
			file.Write(bounds.MinX);
			file.Write(bounds.MinY);
			file.Write(bounds.MaxX);
			file.Write(bounds.MaxY);

            int numPoints = mpoint.NumPoints;
			file.Write(numPoints);						

			// write the points 
			for (int i = 0; i < numPoints; i++)
			{
                IPoint point = (IPoint) mpoint.Geometries[i];
                file.Write(point.X);
                file.Write(point.Y);	
			}            
		}
Example #30
0
 protected override void WriteSelf(System.IO.TextWriter writer, IBootstrapContext context)
 {
     if (value == null)
     {
         return;
     }
     var block = value as IWritable;
     if (block != null)
     {
         block.WriteTo(writer, context);
         return;
     }
     var str = value as string;
     if (str != null)
     {
         if (writeWithoutEncoding)
         {
             writer.Write(str);
         }
         else
         {
             writer.Write(context.HtmlEncode(str));
         }
         return;
     }
     writer.Write(value);
 }