当前位置: 首页>>代码示例>>C#>>正文


C# frmMain.WriteLog方法代码示例

本文整理汇总了C#中frmMain.WriteLog方法的典型用法代码示例。如果您正苦于以下问题:C# frmMain.WriteLog方法的具体用法?C# frmMain.WriteLog怎么用?C# frmMain.WriteLog使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在frmMain的用法示例。


在下文中一共展示了frmMain.WriteLog方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Decode3

        // Compression 3:
        public static void Decode3(byte[] Source, ref byte[] Dest, int cx, int cy, ref int max, frmMain sender)
        {
            int SP;
            int DP;
            int x;
            int y;
            int Count;
            int v;
            int maxdp;
            ushort Pos;
            maxdp = cx * cy;
            SP = 0;
            DP = 0;
            Pos = 0;
            try
            {

                for (y = 1; y <= cy; y++)
                {

                    reinterpretwordfrombytes(Source[SP], Source[SP + 1], ref Pos);

                    Count = Pos - 2;

                    SP = SP + 2;

                    x = 0;
                    while (Count > 0)
                    {
                        Count = Count - 1;
                        if ((SP > max) || (DP > maxdp))
                        {
                            break;
                        }
                        else
                        {
                            // SP has reached max value, exit
                            v = Source[SP];
                            SP++;
                            if (v != 0)
                            {
                                if ((SP > max) || (DP > maxdp))
                                {
                                    break;
                                }
                                else
                                {
                                    x++;
                                    Dest[DP] += (byte)v;
                                }
                                DP++;
                            }
                            else
                            {
                                Count -= 1;
                                v = Source[SP];

                                SP++;
                                if ((x + v) > cx)
                                {
                                    v = cx - x;
                                }
                                x = x + v;
                                while (v > 0)
                                {
                                    if ((SP > max) || (DP > maxdp))
                                    {
                                        break;
                                    }
                                    else
                                    {
                                        v -= 1;
                                        Dest[DP] = 0;

                                    }
                                    DP++;
                                    // SP has reached max value, exit
                                }
                            }
                        }
                    }
                    if ((SP >= max) || (DP >= maxdp))
                    {
                        return;
                    }
                    // SP has reached max value, exit
                }
            }

            catch (Exception ex)
            {
                sender.WriteLog("Error: " + ex.ToString());
            }
        }
开发者ID:katzsmile,项目名称:OpenRA,代码行数:95,代码来源:ShpTSReader.cs

示例2: ShpTSReader

        public ShpTSReader(string Filename, ref TSHP SHP, frmMain sender)
        {
            int FileSize;
                int x;
                int CP;
                int result;
                string hex;
                byte[] Cbyte;
                int Image_Size;
                int NextOffset;
                CP = 0;

                byte[] PCurrentData;
                byte CData;
                byte[] Databuffer;
                FileStream F = new FileStream(Filename, FileMode.Open, FileAccess.Read);
                BinaryReader reader = new BinaryReader(F);

                // Store the whole file in the memory
                FileSize = (int)F.Length;

                PCurrentData = new byte[FileSize];
                F.Read(PCurrentData, 0, (int)FileSize);
                F.Close();

                // Get Header
                SHP.Header.A = ((ushort)((ushort)(PCurrentData[CP])));
                CP += 2;

                Cbyte = new byte[2];
                Cbyte[1] = ((byte)(PCurrentData[CP]));
                CP += 1;
                Cbyte[0] = ((byte)(PCurrentData[CP]));
                hex = BitConverter.ToString(Cbyte);
                hex = hex.Replace("-", "");
                result = System.UInt16.Parse(hex, System.Globalization.NumberStyles.AllowHexSpecifier);
                SHP.Header.Width = (ushort)result;
                CP += 1;
                Cbyte = new byte[2];
                Cbyte[1] = ((byte)(PCurrentData[CP]));
                CP += 1;
                Cbyte[0] = ((byte)(PCurrentData[CP]));
                hex = BitConverter.ToString(Cbyte);
                hex = hex.Replace("-", "");
                result = System.UInt16.Parse(hex, System.Globalization.NumberStyles.AllowHexSpecifier);
                SHP.Header.Height = (ushort)result;
                CP += 1;
                SHP.Header.NumImages = ((ushort)((ushort)(PCurrentData[CP])));

                CP += 2;

                SHP.Data = new TSHPData[SHP.Header.NumImages + 1];

                for (x = 1; x <= SHP.Header.NumImages; x++)
                {
                    SHP.Data[x].Header_Image = new THeader_Image();
                    // Load Image Headers

                    SHP.Data[x].Header_Image.x = ((ushort)((ushort)(PCurrentData[CP])));
                    CP += 2;
                    SHP.Data[x].Header_Image.y = ((ushort)((ushort)(PCurrentData[CP])));
                    CP += 2;
                    SHP.Data[x].Header_Image.cx = ((ushort)((ushort)(PCurrentData[CP])));
                    CP += 2;
                    SHP.Data[x].Header_Image.cy = ((ushort)((ushort)(PCurrentData[CP])));
                    CP += 2;
                    SHP.Data[x].Header_Image.compression = ((byte)(PCurrentData[CP]));
                    CP += 1;
                    SHP.Data[x].Header_Image.align = new byte[3];
                    SHP.Data[x].Header_Image.align[0] = ((byte)(PCurrentData[CP]));
                    CP += 1;
                    SHP.Data[x].Header_Image.align[1] = ((byte)(PCurrentData[CP]));
                    CP += 1;
                    SHP.Data[x].Header_Image.align[2] = ((byte)(PCurrentData[CP]));
                    CP += 5;
                    SHP.Data[x].Header_Image.zero = ((int)(PCurrentData[CP]));
                    CP += 1;
                    SHP.Data[x].Header_Image.transparent = new byte[3];
                    SHP.Data[x].Header_Image.transparent[0] = ((byte)(PCurrentData[CP]));
                    CP += 1;
                    SHP.Data[x].Header_Image.transparent[1] = ((byte)(PCurrentData[CP]));
                    CP += 1;
                    SHP.Data[x].Header_Image.transparent[2] = ((byte)(PCurrentData[CP]));
                    CP += 1;

                    sender.WriteLog("R: " + Convert.ToString(SHP.Data[x].Header_Image.transparent[0]) + " G: " + Convert.ToString(SHP.Data[x].Header_Image.transparent[1]) + " B: " + Convert.ToString(SHP.Data[x].Header_Image.transparent[2]));

                    Cbyte = new byte[4];
                    Cbyte[3] = ((byte)(PCurrentData[CP]));
                    CP += 1;
                    Cbyte[2] = ((byte)(PCurrentData[CP]));
                    CP += 1;
                    Cbyte[1] = ((byte)(PCurrentData[CP]));
                    CP += 1;
                    Cbyte[0] = ((byte)(PCurrentData[CP]));
                    hex = BitConverter.ToString(Cbyte);
                    hex = hex.Replace("-", "");
                    result = System.Int32.Parse(hex, System.Globalization.NumberStyles.AllowHexSpecifier);

                    SHP.Data[x].Header_Image.offset = result;
//.........这里部分代码省略.........
开发者ID:katzsmile,项目名称:OpenRA,代码行数:101,代码来源:ShpTSReader.cs

示例3: Decode2

 public static void Decode2(byte[] Source, ref byte[] Dest, int cx, int cy, ref int max, frmMain sender)
 {
     int SP;
     int DP;
     int y;
     int Count;
     int maxdp;
     ushort Pos;
     maxdp = cx * cy;
     SP = 0;
     DP = 0;
     Pos = 0;
     try
     {
         for (y = 1; y <= cy; y++)
         {
             reinterpretwordfrombytes(Source[SP], Source[SP + 1], ref Pos);
             Count = Pos - 2;
             SP += 2;
             while (Count > 0)
             {
                 Count -= 1;
                 if ((SP > max) || (DP > maxdp))
                 {
                     return;
                 }
                 // SP has reached max value, exit
                 Dest[DP] = Source[SP];
                 SP++;
                 DP++;
             }
             if ((SP >= max) || (DP >= maxdp))
             {
                 return;
             }
             // SP has reached max value, exit
         }
     }
     catch (Exception ex)
     {
         sender.WriteLog("Error: " + ex.ToString());
     }
 }
开发者ID:katzsmile,项目名称:OpenRA,代码行数:43,代码来源:ShpTSReader.cs


注:本文中的frmMain.WriteLog方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。