コード例 #1
0
        private void AddMarker(SnapshotSpan span, Geometry markerGeometry, FormatInfo formatInfo)
        {
            GeometryDrawing drawing = new GeometryDrawing(formatInfo.Background, formatInfo.Outline, markerGeometry);
            drawing.Freeze();

            DrawingImage drawingImage = new DrawingImage(drawing);
            drawingImage.Freeze();

            Image image = new Image();
            image.Source = drawingImage;

            // Align the image with the top of the bounds of the text geometry
            Canvas.SetLeft(image, markerGeometry.Bounds.Left);
            Canvas.SetTop(image, markerGeometry.Bounds.Top);

            adornmentLayer.AddAdornment(AdornmentPositioningBehavior.TextRelative, span, null, image, null);
        }
コード例 #2
0
ファイル: TimeSpanEdit.cs プロジェクト: Demotron/AdminTools
 public override string GetDisplayText(FormatInfo format, object editValue)
 {
     if (editValue is TimeSpan)
     {
         return TimeSpanHelper.TimeSpanToString((TimeSpan) editValue);
     }
     if (editValue is string)
     {
         return editValue.ToString();
     }
     return GetDisplayText(null, new TimeSpan(0));
 }
コード例 #3
0
 public async Task <bool> Encode(BitmapInfo bitmapInfo, FormatInfo formatInfo, IProgress <ProgressReport> progress)
 {
     throw new NotImplementedException();
 }
コード例 #4
0
ファイル: TextureView.cs プロジェクト: ski982/Ryujinx-1
        private void ReadFrom(IntPtr data, int size)
        {
            TextureTarget target = Target.Convert();

            Bind(target, 0);

            FormatInfo format = FormatTable.GetFormatInfo(Info.Format);

            int width  = Info.Width;
            int height = Info.Height;
            int depth  = Info.Depth;

            int offset = 0;

            for (int level = 0; level < Info.Levels; level++)
            {
                int mipSize = Info.GetMipSize(level);

                int endOffset = offset + mipSize;

                if ((uint)endOffset > (uint)size)
                {
                    return;
                }

                switch (Info.Target)
                {
                case Target.Texture1D:
                    if (format.IsCompressed)
                    {
                        GL.CompressedTexSubImage1D(
                            target,
                            level,
                            0,
                            width,
                            format.PixelFormat,
                            mipSize,
                            data);
                    }
                    else
                    {
                        GL.TexSubImage1D(
                            target,
                            level,
                            0,
                            width,
                            format.PixelFormat,
                            format.PixelType,
                            data);
                    }
                    break;

                case Target.Texture1DArray:
                case Target.Texture2D:
                    if (format.IsCompressed)
                    {
                        GL.CompressedTexSubImage2D(
                            target,
                            level,
                            0,
                            0,
                            width,
                            height,
                            format.PixelFormat,
                            mipSize,
                            data);
                    }
                    else
                    {
                        GL.TexSubImage2D(
                            target,
                            level,
                            0,
                            0,
                            width,
                            height,
                            format.PixelFormat,
                            format.PixelType,
                            data);
                    }
                    break;

                case Target.Texture2DArray:
                case Target.Texture3D:
                case Target.CubemapArray:
                    if (format.IsCompressed)
                    {
                        GL.CompressedTexSubImage3D(
                            target,
                            level,
                            0,
                            0,
                            0,
                            width,
                            height,
                            depth,
                            format.PixelFormat,
                            mipSize,
                            data);
                    }
                    else
                    {
                        GL.TexSubImage3D(
                            target,
                            level,
                            0,
                            0,
                            0,
                            width,
                            height,
                            depth,
                            format.PixelFormat,
                            format.PixelType,
                            data);
                    }
                    break;

                case Target.Cubemap:
                    int faceOffset = 0;

                    for (int face = 0; face < 6; face++, faceOffset += mipSize / 6)
                    {
                        if (format.IsCompressed)
                        {
                            GL.CompressedTexSubImage2D(
                                TextureTarget.TextureCubeMapPositiveX + face,
                                level,
                                0,
                                0,
                                width,
                                height,
                                format.PixelFormat,
                                mipSize / 6,
                                data + faceOffset);
                        }
                        else
                        {
                            GL.TexSubImage2D(
                                TextureTarget.TextureCubeMapPositiveX + face,
                                level,
                                0,
                                0,
                                width,
                                height,
                                format.PixelFormat,
                                format.PixelType,
                                data + faceOffset);
                        }
                    }
                    break;
                }

                data   += mipSize;
                offset += mipSize;

                width  = Math.Max(1, width >> 1);
                height = Math.Max(1, height >> 1);

                if (Target == Target.Texture3D)
                {
                    depth = Math.Max(1, depth >> 1);
                }
            }
        }
コード例 #5
0
 public override string GetDisplayText(FormatInfo format, object editValue)
 {
     return ReflectionHelper.GetObjectDisplayText(editValue);
 }
コード例 #6
0
        /// <summary>
        /// Determines if data is compatible between the source and destination texture.
        /// The two textures must have the same size, layout, and bytes per pixel.
        /// </summary>
        /// <param name="lhs">Info for the first texture</param>
        /// <param name="rhs">Info for the second texture</param>
        /// <param name="lhsFormat">Format of the first texture</param>
        /// <param name="rhsFormat">Format of the second texture</param>
        /// <returns>True if the data is compatible, false otherwise</returns>
        private bool IsDataCompatible(TwodTexture lhs, TwodTexture rhs, FormatInfo lhsFormat, FormatInfo rhsFormat)
        {
            if (lhsFormat.BytesPerPixel != rhsFormat.BytesPerPixel ||
                lhs.Height != rhs.Height ||
                lhs.Depth != rhs.Depth ||
                lhs.LinearLayout != rhs.LinearLayout ||
                lhs.MemoryLayout.Packed != rhs.MemoryLayout.Packed)
            {
                return(false);
            }

            if (lhs.LinearLayout)
            {
                return(lhs.Stride == rhs.Stride);
            }
            else
            {
                return(lhs.Width == rhs.Width);
            }
        }
コード例 #7
0
ファイル: numberaction.cs プロジェクト: ArildF/masters
        /*  
        ----------------------------------------------------------------------------
            parseFormat()

            Parse format string into format tokens (alphanumeric) and separators
            (non-alphanumeric).

         
        */
        private static ArrayList ParseFormat(String  sFormat) {
            if (sFormat == null || sFormat.Length == 0) {
                return null;
            }
            String wszStart = sFormat;
            int length = 0;
            bool fIsAlphaNum = IsCharAlphaNumeric(sFormat[length]);
            ArrayList arrFormatInfo = new ArrayList();
            FormatInfo  pFormatInfo;
            int count = 0;
            int tokenlength = sFormat.Length ;
            bool currentchar;
            
            while (length <= sFormat.Length ) {
                // Loop until a switch from format token to separator is detected (or vice-versa)
               if (length == sFormat.Length) {
                   currentchar = !fIsAlphaNum;
               }
               else {
                   currentchar = IsCharAlphaNumeric(sFormat[length]);
               }
               if (fIsAlphaNum != currentchar) {
                    pFormatInfo = new FormatInfo();
                    if (fIsAlphaNum) {
                        // We just finished a format token.  Map it to a numbering format ID and a min-length bound.
                        mapFormatToken(sFormat, count, length - count ,out pFormatInfo._numberingType, out pFormatInfo._cMinLen);
                    } 
                    else {
                        pFormatInfo._fIsSeparator = true;
                        // We just finished a separator.  Save its length and a pointer to it.
                        pFormatInfo._wszSeparator = sFormat.Substring(count,length - count);
                    }
                    count = length;
                    length++;
                    // Begin parsing the next format token or separator
          
                    arrFormatInfo.Add(pFormatInfo);
                    // Flip flag from format token to separator (or vice-versa)
                    fIsAlphaNum = currentchar;
                }
                else {
                    length++;
                }

            }

            return arrFormatInfo;
        }
コード例 #8
0
ファイル: CPortAudioPlay.cs プロジェクト: winterdl/Vocaluxe
        public int Open(string FileName)
        {
            if (_FileOpened)
            {
                return(-1);
            }

            if (!System.IO.File.Exists(FileName))
            {
                return(-1);
            }

            if (_FileOpened)
            {
                return(-1);
            }

            _Decoder = new CAudioDecoderFFmpeg();
            _Decoder.Init();

            try
            {
                if (errorCheck("Initialize", PortAudio.Pa_Initialize()))
                {
                    return(-1);
                }

                _Initialized = true;
                int hostApi = apiSelect();
                _apiInfo          = PortAudio.Pa_GetHostApiInfo(hostApi);
                _outputDeviceInfo = PortAudio.Pa_GetDeviceInfo(_apiInfo.defaultOutputDevice);
                _paStreamCallback = new PortAudio.PaStreamCallbackDelegate(_PaStreamCallback);

                if (_outputDeviceInfo.defaultLowOutputLatency < 0.1)
                {
                    _outputDeviceInfo.defaultLowOutputLatency = 0.1;
                }
            }

            catch (Exception)
            {
                _Initialized = false;
                CLog.LogError("Error Init PortAudio Playback");
                return(-1);
            }

            _FileName = FileName;
            _Decoder.Open(FileName);
            _Duration = _Decoder.GetLength();

            FormatInfo format = _Decoder.GetFormatInfo();

            _ByteCount      = 2 * format.ChannelCount;
            _BytesPerSecond = format.SamplesPerSecond * _ByteCount;
            _CurrentTime    = 0f;
            _SyncTimer.Time = _CurrentTime;

            AudioStreams stream = new AudioStreams(0);

            IntPtr data = new IntPtr(0);

            PortAudio.PaStreamParameters outputParams = new PortAudio.PaStreamParameters();
            outputParams.channelCount     = format.ChannelCount;
            outputParams.device           = _apiInfo.defaultOutputDevice;
            outputParams.sampleFormat     = PortAudio.PaSampleFormat.paInt16;
            outputParams.suggestedLatency = _outputDeviceInfo.defaultLowOutputLatency;

            uint bufsize = (uint)CConfig.AudioBufferSize;

            errorCheck("OpenDefaultStream", PortAudio.Pa_OpenStream(
                           out _Ptr,
                           IntPtr.Zero,
                           ref outputParams,
                           format.SamplesPerSecond,
                           bufsize,
                           PortAudio.PaStreamFlags.paNoFlag,
                           _paStreamCallback,
                           data));

            stream.handle = _Ptr.ToInt32();

            if (stream.handle != 0)
            {
                _Paused                 = true;
                _waiting                = true;
                _FileOpened             = true;
                _data                   = new RingBuffer(BUFSIZE);
                _NoMoreData             = false;
                _DecoderThread.Priority = ThreadPriority.Normal;
                _DecoderThread.Name     = Path.GetFileName(FileName);
                _DecoderThread.Start();

                return(stream.handle);
            }
            return(-1);
        }
コード例 #9
0
 public async Task <bool> Encode(BitmapInfo bitmapInfo, FormatInfo formatInfo, IProgress <ProgressReport> progress)
 {
     return(false);
 }
コード例 #10
0
 public override string GetDisplayText(FormatInfo format, object editValue) {
     string result = base.GetDisplayText(format, RuntimeHelpers.GetObjectValue(editValue));
     if ((string.IsNullOrEmpty(result) && (editValue != null)) && (m_helper != null)) {
         result = m_helper.GetDisplayText(RuntimeHelpers.GetObjectValue(editValue), NullText, format.FormatString);
     }
     return result;
 }
コード例 #11
0
ファイル: Format.cs プロジェクト: sammoorhouse/aplusdotnet
        /// <summary>
        /// Cut argument 2 part: length and precesion.
        /// If argument is integer than precision is undefined.
        /// </summary>
        /// <param name="argument"></param>
        private static FormatInfo ExtractSingleFormatInfo(AType argument)
        {
            // TODO: currently this feels a bit hacky...
            string[] items = argument.asFloat.ToString(CultureInfo.InvariantCulture).Split(new char[] { '.' }, 2);

            FormatInfo format = new FormatInfo()
            {
                TotalLength = int.Parse(items[0]),
                FractionLength = int.MaxValue
            };

            if (items.Length == 2)
            {
                // the reference implementation only cares for the first digit, so do we
                format.FractionLength = int.Parse(items[1].Substring(0, 1));
            }

            return format;
        }
コード例 #12
0
ファイル: Format.cs プロジェクト: sammoorhouse/aplusdotnet
        /// <summary>
        /// Format an AType scalar number to a AType character representation.
        /// </summary>
        /// <param name="argument"></param>
        /// <param name="format"></param>
        /// <remarks>
        /// Exponential format: the result for a postive number is padded on the left with two blanks
        /// and for a negative with one, and this padded result is left justified within thw width, after
        /// being truncated on the right if it is too long.
        /// Otherwise: the result is right justified within the width, after being truncated on the right
        /// if it is too long.
        /// </remarks>
        /// <returns></returns>
        private static AType[] FormatNumber(AType argument, FormatInfo format)
        {
            if (format.TotalLength == 0)
            {
                return null;
            }

            string result;

            if (format.TotalLength < 0)
            {
                string formatString = "0.";

                if (format.FractionLength != int.MaxValue)
                {
                    formatString = formatString.PadRight(2 + format.FractionLength, '0');
                }

                formatString += "e+00";
                result = argument.asFloat.ToString(formatString, CultureInfo.InvariantCulture);
                result = result.PadLeft(result.Length + (result[0] == '-' ? 1 : 2));
                result = Pad(result, format.TotalLength);
            }
            else
            {
                if (format.FractionLength != int.MaxValue)
                {
                    result = argument.asFloat.ToString("f" + format.FractionLength, CultureInfo.InvariantCulture);
                }
                else
                {
                    result = Math.Round(argument.asFloat).ToString(CultureInfo.InvariantCulture);
                }

                result = Pad(result, format.TotalLength);
            }

            return ConvertToCharArray(result);
        }
コード例 #13
0
ファイル: Format.cs プロジェクト: sammoorhouse/aplusdotnet
        /// <summary>
        /// Argument is formatted in their displayed form with
        /// backquotes removed. Each of them is right justified in
        /// the specified width/length, after being truncated on the right
        /// if it is too long.
        /// </summary>
        /// <param name="argument"></param>
        /// <returns></returns>
        private static AType[] FormatSymbol(AType argument, FormatInfo format)
        {
            string result = format.TotalLength < 0 ? ' ' + argument.asString : argument.asString;

            return ConvertToCharArray(Pad(result, format.TotalLength));
        }
コード例 #14
0
        /// <summary>
        /// Argument is formatted in their displayed form with
        /// backquotes removed. Each of them is right justified in
        /// the specified width/length, after being truncated on the right
        /// if it is too long.
        /// </summary>
        /// <param name="argument"></param>
        /// <returns></returns>
        private static AType[] FormatSymbol(AType argument, FormatInfo format)
        {
            string result = format.TotalLength < 0 ? ' ' + argument.asString : argument.asString;

            return(ConvertToCharArray(Pad(result, format.TotalLength)));
        }
コード例 #15
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="image"></param>
 /// <param name="formatInfo"></param>
 public KsltBitmapInfo(Bitmap image, FormatInfo formatInfo) : base(image, formatInfo)
 {
 }
コード例 #16
0
        public IEnumerable <byte> GetFormat(FormatInfo info)
        {
            var sRecBuilder = new StringBuilder();
            var end         = info.StartAddress + info.ObjectBytes.Count();
            var pc          = info.StartAddress;
            var fileBytes   = info.ObjectBytes.ToArray();
            var bytesLeft   = fileBytes.Length;
            var lineCount   = 0;

            string recHeader;
            int    recordBytes;
            var    fmt = info.FormatName.ToLower();

            if (fmt.Equals("srec"))
            {
                recHeader   = "S1";
                recordBytes = RecordSize;
                sRecBuilder.Append("S0030000FC\n"); // header
            }
            else
            {
                recHeader   = ";";
                recordBytes = MosRecordSize;
            }

            while (pc < end)
            {
                var lineBytes = bytesLeft < recordBytes ? bytesLeft % recordBytes : recordBytes;
                var lineSize  = recHeader[0] == 'S' ? lineBytes + 3 : lineBytes;
                sRecBuilder.Append(recHeader);
                sRecBuilder.Append($"{lineSize:X2}");
                sRecBuilder.Append($"{pc:X4}");
                var checkSum = lineSize + GetPcCheckSum(pc);

                for (int i = 0; i < lineBytes; i++)
                {
                    var offset = (pc - info.StartAddress) + i;
                    checkSum += fileBytes[offset];
                    sRecBuilder.Append($"{fileBytes[offset]:X2}");
                }
                if (recHeader[0] == 'S')
                {
                    checkSum = GetSRecordchecksum(checkSum);
                    sRecBuilder.Append($"{checkSum:X2}");
                }
                else
                {
                    checkSum &= 65535;
                    sRecBuilder.Append($"{checkSum:X4}");
                }
                pc        += lineBytes;
                bytesLeft -= lineBytes;
                sRecBuilder.Append('\n');
                lineCount++;
            }
            if (recHeader[0] == 'S')
            {
                sRecBuilder.Append("S9030000FC");
            }
            else
            {
                sRecBuilder.Append($";00{lineCount:X4}{lineCount:X4}");
            }
            return(Encoding.ASCII.GetBytes(sRecBuilder.ToString()));
        }
コード例 #17
0
        private void CreateImmutableStorage()
        {
            TextureTarget target = Info.Target.Convert();

            GL.ActiveTexture(TextureUnit.Texture0);

            GL.BindTexture(target, Handle);

            FormatInfo format = FormatTable.GetFormatInfo(Info.Format);

            SizedInternalFormat internalFormat;

            if (format.IsCompressed)
            {
                internalFormat = (SizedInternalFormat)format.PixelFormat;
            }
            else
            {
                internalFormat = (SizedInternalFormat)format.PixelInternalFormat;
            }

            int levels = Info.GetLevelsClamped();

            switch (Info.Target)
            {
            case Target.Texture1D:
                GL.TexStorage1D(
                    TextureTarget1d.Texture1D,
                    levels,
                    internalFormat,
                    Info.Width);
                break;

            case Target.Texture1DArray:
                GL.TexStorage2D(
                    TextureTarget2d.Texture1DArray,
                    levels,
                    internalFormat,
                    Info.Width,
                    Info.Height);
                break;

            case Target.Texture2D:
                GL.TexStorage2D(
                    TextureTarget2d.Texture2D,
                    levels,
                    internalFormat,
                    Info.Width,
                    Info.Height);
                break;

            case Target.Texture2DArray:
                GL.TexStorage3D(
                    TextureTarget3d.Texture2DArray,
                    levels,
                    internalFormat,
                    Info.Width,
                    Info.Height,
                    Info.Depth);
                break;

            case Target.Texture2DMultisample:
                GL.TexStorage2DMultisample(
                    TextureTargetMultisample2d.Texture2DMultisample,
                    Info.Samples,
                    internalFormat,
                    Info.Width,
                    Info.Height,
                    true);
                break;

            case Target.Texture2DMultisampleArray:
                GL.TexStorage3DMultisample(
                    TextureTargetMultisample3d.Texture2DMultisampleArray,
                    Info.Samples,
                    internalFormat,
                    Info.Width,
                    Info.Height,
                    Info.Depth,
                    true);
                break;

            case Target.Texture3D:
                GL.TexStorage3D(
                    TextureTarget3d.Texture3D,
                    levels,
                    internalFormat,
                    Info.Width,
                    Info.Height,
                    Info.Depth);
                break;

            case Target.Cubemap:
                GL.TexStorage2D(
                    TextureTarget2d.TextureCubeMap,
                    levels,
                    internalFormat,
                    Info.Width,
                    Info.Height);
                break;

            case Target.CubemapArray:
                GL.TexStorage3D(
                    (TextureTarget3d)All.TextureCubeMapArray,
                    levels,
                    internalFormat,
                    Info.Width,
                    Info.Height,
                    Info.Depth);
                break;

            default:
                Logger.Debug?.Print(LogClass.Gpu, $"Invalid or unsupported texture target: {target}.");
                break;
            }
        }
コード例 #18
0
        public virtual IColumnizedLogLine SplitLine(ILogLineColumnizerCallback callback, ILogLine line)
        {
            // 0         1         2         3         4         5         6         7         8         9         10        11        12        13        14        15        16
            // 012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
            // 03.01.2008 14:48:00.066 <rest of line>

            ColumnizedLogLine clogLine = new ColumnizedLogLine();

            clogLine.LogLine = line;

            Column[] columns = new Column[3]
            {
                new Column {
                    FullValue = "", Parent = clogLine
                },
                new Column {
                    FullValue = "", Parent = clogLine
                },
                new Column {
                    FullValue = "", Parent = clogLine
                },
            };

            clogLine.ColumnValues = columns.Select(a => a as IColumn).ToArray();

            string temp = line.FullLine;


            if (temp.Length < 21)
            {
                columns[2].FullValue = temp;
                return(clogLine);
            }

            FormatInfo formatInfo = DetermineDateTimeFormatInfo(line);

            if (formatInfo == null)
            {
                columns[2].FullValue = temp;
                return(clogLine);
            }
            int endPos  = formatInfo.DateTimeFormat.Length;
            int timeLen = formatInfo.TimeFormat.Length;
            int dateLen = formatInfo.DateFormat.Length;

            try
            {
                if (this.timeOffset != 0)
                {
                    DateTime dateTime = DateTime.ParseExact(temp.Substring(0, endPos), formatInfo.DateTimeFormat,
                                                            formatInfo.CultureInfo);
                    dateTime = dateTime.Add(new TimeSpan(0, 0, 0, 0, this.timeOffset));
                    string newDate = dateTime.ToString(formatInfo.DateTimeFormat, formatInfo.CultureInfo);
                    columns[0].FullValue = newDate.Substring(0, dateLen);           // date
                    columns[1].FullValue = newDate.Substring(dateLen + 1, timeLen); // time
                    columns[2].FullValue = temp.Substring(endPos);                  // rest of line
                }
                else
                {
                    columns[0].FullValue = temp.Substring(0, dateLen);           // date
                    columns[1].FullValue = temp.Substring(dateLen + 1, timeLen); // time
                    columns[2].FullValue = temp.Substring(endPos);               // rest of line
                }
            }
            catch (Exception)
            {
                columns[0].FullValue = "n/a";
                columns[1].FullValue = "n/a";
                columns[2].FullValue = temp;
            }
            return(clogLine);
        }
コード例 #19
0
 public override string GetDisplayText(FormatInfo format, object editValue)
 {
     string result = base.GetDisplayText(format, editValue);
     if (string.IsNullOrEmpty(result) && editValue != null && helper != null)
         result = helper.GetDisplayText(editValue, NullText, format.FormatString);
     return result;
 }
コード例 #20
0
        /// <summary>
        /// 点击开始按钮时触发的事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void lbl_kaishi_Click(object sender, EventArgs e)
        {
            //修改程序状态为执行,刷新状态信息
            lbl_zhuangtai.Text   = "正在进行数据解析……";
            lbl_kaishi.Enabled   = false;
            lbl_kaishi.BackColor = Color.Gray;
            statue = 1;

            //获得文件夹下所有的文件名
            for (int i = folderIndex; i < dgv_task.Rows.Count; i++)
            {
                folderIndex = i;//时刻记录当前程序执行到的文件夹位置
                string   folder = dgv_task.Rows[i].Cells[1].Value.ToString();
                string[] files  = Directory.GetFiles(folder);
                for (int k = fileIndex; k < files.Length; k++)
                {
                    //计算百分率
                    double _processRate = 100 * Convert.ToDouble(k + 1) / Convert.ToDouble(files.Length);
                    dgv_task.Rows[i].Cells[3].Value = $"{_processRate.ToString("00.00")}%";
                    Application.DoEvents();

                    //如果用户终止了或者暂停了程序,就跳出循环
                    if (statue == 0 || statue == 2)
                    {
                        return;
                    }
                    fileIndex = k;//时刻记录当前程序执行到的文件位置
                    string file = files[k];
                    #region  1、文件名格式标准化

                    /*1、开始文件名格式标准化*/
                    string path         = Path.GetDirectoryName(file);
                    string fileOriginal = Path.GetFileNameWithoutExtension(file);
                    string extension    = Path.GetExtension(file);
                    string filename     = string.Empty;//用于存放改后的文件名
                    //判断“文件名标准化”格式,如果不是“无”,则进行文件名格式标准化

                    if (!SystemInfo._userInfo._wjmbzh.Equals("无"))
                    {
                        //拆分出路径和文件名
                        ///拆分后的文件名集合,对list进行处理,如果是\d星,那么要和前一项合并
                        List <string> list = Regex.Split(fileOriginal, @"\.").ToList();
                        for (int j = 0; j < list.Count; j++)
                        {
                            if (Regex.IsMatch(list[j], @"\d星"))
                            {
                                list[j] = $"{list[j - 1] }.{list[j]}";
                                list.RemoveAt(j - 1);
                                break;
                            }
                        }
                        //获得文件名标准格式下的所有rule名称
                        FormatInfo fi = new FormatInfo(SystemInfo._userInfo._wjmbzh);
                        fi.GetFormatInfo();
                        List <string> rules = Regex.Split(fi._formatSet, @"\|").ToList();
                        //对每一个rule循环,获得设置root
                        foreach (string rule in rules)
                        {
                            RuleInfo myri = new RuleInfo(rule, "文件名标准化");
                            myri.GetRuleInfo();
                            WjmRuleRoot myroot = ((WjmRuleRoot)myri._root);
                            //判断位置,得到操作目标,对每种可能的目标进行判断操作
                            if (myroot.position[0].Equals("整个文件名"))
                            {
                                //对操作目标进行操作
                                if (!myroot.delete.Trim().Equals(string.Empty))
                                {
                                    filename = Regex.Replace(fileOriginal, myroot.delete.Trim(), "");
                                }
                                else if (!myroot.replace0.Trim().Equals(string.Empty))
                                {
                                    filename = Regex.Replace(fileOriginal, myroot.replace0.Trim(), myroot.replace);
                                }
                            }
                            else if (myroot.position[0].Equals("文件名前"))
                            {
                                //新增内容
                                if (!myroot.newText.Trim().Equals(string.Empty))
                                {
                                    filename = $"{myroot.newText}{fileOriginal}";
                                }
                            }
                            else if (myroot.position[0].Equals("文件名后"))
                            {
                                //新增内容
                                if (!myroot.newText.Trim().Equals(string.Empty))
                                {
                                    filename = $"{fileOriginal}{myroot.newText}";
                                }
                            }
                            else if (Regex.IsMatch(myroot.position[0], @"文件名第\d项前"))
                            {
                                //获得数字,然后获得目标文本
                                int    index  = Convert.ToInt32(Regex.Match(myroot.position[0], @"\d").Value);
                                string target = list[index - 1];
                                //新增内容
                                if (!myroot.newText.Trim().Equals(string.Empty))
                                {
                                    target = $"{myroot.newText.Trim()}{target}";
                                }
                                list[index - 1] = target;
                                filename        = string.Join(".", list);
                            }
                            else if (Regex.IsMatch(myroot.position[0], @"文件名第\d项后"))
                            {
                                //获得数字,然后获得目标文本
                                int    index  = Convert.ToInt32(Regex.Match(myroot.position[0], @"\d").Value);
                                string target = list[index - 1];
                                //新增内容
                                if (!myroot.newText.Trim().Equals(string.Empty))
                                {
                                    target = $"{target}{myroot.newText.Trim()}";
                                }
                                list[index - 1] = target;
                                filename        = string.Join(".", list);
                            }
                            //给文件改名
                            File.Move($"{file}", $"{path}\\{filename}{extension}");
                        }
                    }
                    else//如果不进行文件名标准化,那么新得文件名和原先一样
                    {
                        filename = fileOriginal;
                    }
                    string currentFilename = $"{path}\\{filename}{extension}";

                    #endregion



                    #region 2、文档格式标准化
                    //判断“文档格式标准化”格式,如果用户不是选择了“无”,则执行文件格式标准化
                    if (!SystemInfo._userInfo._wjbzh.Equals("无"))
                    {
                        //获得标准化规则
                        FormatInfo _format = new FormatInfo(SystemInfo._userInfo._wjbzh);
                        _format.GetFormatInfo();
                        string   _rule     = Regex.Split(_format._formatSet, @"\|")[0];
                        RuleInfo _ruleInfo = new RuleInfo(_rule, "格式标准化");
                        _ruleInfo.GetRuleInfo();
                        BzhRuleRoot _root = _ruleInfo._root as BzhRuleRoot;
                        //调整文档格式,包括大标题,副标题,正文,一级标题,二级标题,三级标题,页边距,
                        MyMethod.UpdateFormat2(currentFilename, _root);

                        //文本标注,暂时 放一放
                    }


                    #endregion

                    #region 3、查重清洗
                    //判断用户选择的查重清洗格式,如果不等于,则进行查重清洗
                    if (!SystemInfo._userInfo._ccqx.Equals("无"))
                    {
                    }

                    #endregion
                    #region 4、基础解析
                    //判断用户选择的基础解析格式,如果不等于无,则进行基础解析
                    JJDocument _jjDoc = new JJDocument(currentFilename);

                    if (!SystemInfo._userInfo._jcjx.Equals("无"))
                    {
                        var listbase = _jjDoc.GetBaseAnalysis();
                        _jjDoc.SaveList2Excel(listbase);
                    }


                    #endregion

                    #region 5、内容解析
                    //判断用户选择的内容解析格式,如果不等于无,则进行内容解析
                    if (!SystemInfo._userInfo._nrjx.Equals("无"))
                    {
                        var listneirong = _jjDoc.GetNeirongAnalysis();
                        _jjDoc.SaveList2Excel(listneirong);
                    }

                    #endregion
                    #region 6、大数据版
                    //判断用户选择的大数据版,如果不等于无,则进行大数据版
                    if (!SystemInfo._userInfo._dsjb.Equals("无"))
                    {
                    }
                    #endregion
                }
            }
            //执行完成提示,完成并将系统状态还原为0
            statue             = 0;
            lbl_kaishi.Enabled = true;

            lbl_kaishi.ForeColor = Color.White;
            lbl_kaishi.BackColor = Color.MediumSeaGreen;
            lbl_zhuangtai.Text   = "已就绪,请点击\"开始\"执行解析";
            MessageBox.Show("本次数据处理已完成!");
        }
コード例 #21
0
        /*
        ----------------------------------------------------------------------------
            parseFormat()

            Parse format string into format tokens (alphanumeric) and separators
            (non-alphanumeric).

        */
        private static List<FormatInfo> ParseFormat(string formatString) {
            if (formatString == null || formatString.Length == 0) {
                return null;
            }
            int length = 0;
            bool lastAlphaNumeric = CharUtil.IsAlphaNumeric(formatString[length]);
            List<FormatInfo> tokens = new List<FormatInfo>();
            int count = 0;

            if (lastAlphaNumeric) {
                // If the first one is alpha num add empty separator as a prefix.
                tokens.Add(null);
            }

            while (length <= formatString.Length) {
                // Loop until a switch from format token to separator is detected (or vice-versa)
                bool currentchar = length < formatString.Length ? CharUtil.IsAlphaNumeric(formatString[length]) : !lastAlphaNumeric;
                if (lastAlphaNumeric != currentchar) {
                    FormatInfo formatInfo = new FormatInfo();
                    if (lastAlphaNumeric) {
                        // We just finished a format token.  Map it to a numbering format ID and a min-length bound.
                        mapFormatToken(formatString, count, length - count, out formatInfo.numSequence, out formatInfo.length);
                    }
                    else {
                        formatInfo.isSeparator = true;
                        // We just finished a separator.  Save its length and a pointer to it.
                        formatInfo.formatString = formatString.Substring(count, length - count);
                    }
                    count = length;
                    length++;
                    // Begin parsing the next format token or separator

                    tokens.Add(formatInfo);
                    // Flip flag from format token to separator (or vice-versa)
                    lastAlphaNumeric = currentchar;
                }
                else {
                    length++;
                }
            }

            return tokens;
        }
コード例 #22
0
 public MTTexBitmapInfo(Bitmap image, FormatInfo formatInfo) : base(image, formatInfo)
 {
 }
コード例 #23
0
        private void cbb_jiexigeshi_TextChanged(object sender, EventArgs e)
        {
            //获得格式名称
            string formatname = cbb_jiexigeshi.Text;

            //但是如果格式名为空,就不进行操作
            if (formatname.Trim().Equals(string.Empty))
            {
                return;
            }
            //获得格式名称对应的格式信息
            FormatInfo myfi = _mycontroller.GetFormatInfo(formatname);

            if (myfi == null)
            {
                return;              //如果不存在解析格式名,就退出
            }
            //excel存放赋值
            if (myfi._excelpath.Equals(string.Empty))
            {
                rb_moren.Checked = true;
            }
            else
            {
                rb_qita.Checked  = true;
                tb_savepath.Text = myfi._excelpath;
            }
            //把查重库列表相关信息显示在界面上

            cb_wu2.Checked        = Convert.ToBoolean(myfi._wu2);
            rb_xieru.Checked      = Convert.ToBoolean(myfi._chachongmd5);
            cbb_quanwen.Text      = myfi._quanwenku;
            cbb_zhengwen.Text     = myfi._zhengwenku;
            cbb_biaozhunduan.Text = myfi._biaozhunduanku;
            cbb_biaozhunju.Text   = myfi._biaozhunjuku;

            //把选中规则前面的对号打上
            foreach (DataGridViewRow item in dgv_jiexiguize.Rows)
            {
                item.Cells[0].Value = false;
                (item.Cells[0] as DataGridViewCheckBoxCell).EditingCellFormattedValue = false;

                string name = item.Cells["jieximingcheng"].Value.ToString();
                if (myfi.list_jiexiguize.Contains(name))
                {
                    item.Cells[0].Value = true;
                    (item.Cells[0] as DataGridViewCheckBoxCell).EditingCellFormattedValue = true;
                    //获得行索引
                    int index = item.Index;
                    dgv_jiexiguize.Rows.RemoveAt(index);
                    dgv_jiexiguize.Rows.Insert(0, item);
                }
            }
            //基础规则置顶
            foreach (DataGridViewRow item in dgv_jiexiguize.Rows)
            {
                string name = item.Cells["jieximingcheng"].Value.ToString();
                if (name.Trim().Contains("基础规则"))
                {
                    int index = item.Index;
                    dgv_jiexiguize.Rows.RemoveAt(index);
                    dgv_jiexiguize.Rows.Insert(0, item);
                }
            }
        }
コード例 #24
0
 public override string GetDisplayText(FormatInfo format, object editValue)
 {
     return(ProtectedContentEdit.ProtectedContentText);
 }
コード例 #25
0
 public static Boolean DeleteReportFormats(FormatInfo String)
 {
     return(Convert.ToBoolean(Agent.CallService("Yqun.BO.ReportManager.dll", "DeleteReportFormats", new object[] { String })));
 }
コード例 #26
0
ファイル: TextureView.cs プロジェクト: piyachetk/Ryujinx
        private void ReadFrom(IntPtr data, int size)
        {
            TextureTarget target    = Target.Convert();
            int           baseLevel = 0;

            // glTexSubImage on cubemap views is broken on Intel, we have to use the storage instead.
            if (Target == Target.Cubemap && HwCapabilities.Vendor == HwCapabilities.GpuVendor.IntelWindows)
            {
                GL.ActiveTexture(TextureUnit.Texture0);
                GL.BindTexture(target, Storage.Handle);
                baseLevel = FirstLevel;
            }
            else
            {
                Bind(target, 0);
            }

            FormatInfo format = FormatTable.GetFormatInfo(Info.Format);

            int width  = Info.Width;
            int height = Info.Height;
            int depth  = Info.Depth;
            int levels = Info.GetLevelsClamped();

            int offset = 0;

            for (int level = 0; level < levels; level++)
            {
                int mipSize = Info.GetMipSize(level);

                int endOffset = offset + mipSize;

                if ((uint)endOffset > (uint)size)
                {
                    return;
                }

                switch (Target)
                {
                case Target.Texture1D:
                    if (format.IsCompressed)
                    {
                        GL.CompressedTexSubImage1D(
                            target,
                            level,
                            0,
                            width,
                            format.PixelFormat,
                            mipSize,
                            data);
                    }
                    else
                    {
                        GL.TexSubImage1D(
                            target,
                            level,
                            0,
                            width,
                            format.PixelFormat,
                            format.PixelType,
                            data);
                    }
                    break;

                case Target.Texture1DArray:
                case Target.Texture2D:
                    if (format.IsCompressed)
                    {
                        GL.CompressedTexSubImage2D(
                            target,
                            level,
                            0,
                            0,
                            width,
                            height,
                            format.PixelFormat,
                            mipSize,
                            data);
                    }
                    else
                    {
                        GL.TexSubImage2D(
                            target,
                            level,
                            0,
                            0,
                            width,
                            height,
                            format.PixelFormat,
                            format.PixelType,
                            data);
                    }
                    break;

                case Target.Texture2DArray:
                case Target.Texture3D:
                case Target.CubemapArray:
                    if (format.IsCompressed)
                    {
                        GL.CompressedTexSubImage3D(
                            target,
                            level,
                            0,
                            0,
                            0,
                            width,
                            height,
                            depth,
                            format.PixelFormat,
                            mipSize,
                            data);
                    }
                    else
                    {
                        GL.TexSubImage3D(
                            target,
                            level,
                            0,
                            0,
                            0,
                            width,
                            height,
                            depth,
                            format.PixelFormat,
                            format.PixelType,
                            data);
                    }
                    break;

                case Target.Cubemap:
                    int faceOffset = 0;

                    for (int face = 0; face < 6; face++, faceOffset += mipSize / 6)
                    {
                        if (format.IsCompressed)
                        {
                            GL.CompressedTexSubImage2D(
                                TextureTarget.TextureCubeMapPositiveX + face,
                                baseLevel + level,
                                0,
                                0,
                                width,
                                height,
                                format.PixelFormat,
                                mipSize / 6,
                                data + faceOffset);
                        }
                        else
                        {
                            GL.TexSubImage2D(
                                TextureTarget.TextureCubeMapPositiveX + face,
                                baseLevel + level,
                                0,
                                0,
                                width,
                                height,
                                format.PixelFormat,
                                format.PixelType,
                                data + faceOffset);
                        }
                    }
                    break;
                }

                data   += mipSize;
                offset += mipSize;

                width  = Math.Max(1, width >> 1);
                height = Math.Max(1, height >> 1);

                if (Target == Target.Texture3D)
                {
                    depth = Math.Max(1, depth >> 1);
                }
            }
        }
コード例 #27
0
        /// <summary>
        /// Raises the <see cref="E:System.Windows.Forms.Form.Shown" /> event.
        /// </summary>
        /// <param name="e">A <see cref="T:System.EventArgs" /> that contains the event data.</param>
        protected override void OnShown(EventArgs e)
        {
            base.OnShown(e);
            var format = adapter.Format;
            var font   = format.Font;

            // Initialize controls on the Numbers
            string formatString = format.FormatString;

            if (string.IsNullOrEmpty(formatString) == false)
            {
                FormatInfo formatInfo = null;
                foreach (NumberFormatInfo numberFormat in this.numberFormats)
                {
                    formatInfo = numberFormat.FindFormat(formatString);

                    if (formatInfo != null)
                    {
                        this.treeCategory.GetNodeByKey(numberFormat.CategoryName).Selected        = true;
                        this.treeFormats.Nodes[numberFormat.Formats.IndexOf(formatInfo)].Selected = true;
                        break;
                    }
                }

                if (formatInfo == null)
                {
                    var customGroup = this.numberFormats.First(x => x.IsCustom);
                    this.treeCategory.GetNodeByKey(customGroup.CategoryName).Selected = true;

                    formatInfo = customGroup.AddFormatInfo(formatString);
                    this.treeFormats.Nodes[customGroup.Formats.IndexOf(formatInfo)].Selected = true;
                }
            }

            // Initialize controls on the Alignment tab
            #region Alignment tab

            this.cboHorizontal.Value   = format.Alignment;
            this.cboVertical.Value     = format.VerticalAlignment;
            this.nmeIndent.Value       = format.Indent;
            this.cbWrapText.Checked    = format.WrapText == ExcelDefaultableBoolean.True;
            this.cbShrinkToFit.Checked = format.ShrinkToFit == ExcelDefaultableBoolean.True;

            #endregion // Alignment tab

            // Initialize controls on the Font tab
            #region Font tab

            Infragistics.Win.UltraWinTree.UltraTreeNode node = this.treeFontFamily.GetNodeByKey(font.Name);
            if (node != null)
            {
                node.Selected = true;
                node.BringIntoView();
            }

            FontStylesCustom style = FontStylesCustom.Regular;
            if (font.Italic == ExcelDefaultableBoolean.True)
            {
                style = (font.Bold == ExcelDefaultableBoolean.True) ? FontStylesCustom.BoldItalic : FontStylesCustom.Italic;
            }
            else if (font.Bold == ExcelDefaultableBoolean.True)
            {
                style = FontStylesCustom.Bold;
            }

            node = this.treeFontStyle.GetNodeByKey(style.ToString());
            if (node != null)
            {
                node.Selected = true;
                node.BringIntoView();
            }

            node = this.treeFontSize.GetNodeByKey((font.Height / 20).ToString());
            if (node != null)
            {
                node.Selected = true;
                node.BringIntoView();
            }

            this.cboUnderline.Value      = font.UnderlineStyle;
            this.cbSubscript.Checked     = (font.SuperscriptSubscriptStyle == FontSuperscriptSubscriptStyle.Subscript);
            this.cbSuperscript.Checked   = (font.SuperscriptSubscriptStyle == FontSuperscriptSubscriptStyle.Superscript);
            this.cbStrikethrough.Checked = (font.Strikeout == ExcelDefaultableBoolean.True);
            this.cpFontColor.Color       = adapter.ForegroundColor;

            this.shouldEvaluateIsNormalFont = true;
            this.EvaluateIsNormalFont();
            #endregion //Font tab

            // Initialize controls on the Fill tab
            #region Fill tab

            CellFillPattern fillPattern = format.Fill as CellFillPattern;
            if (fillPattern != null)
            {
                this.cboPatternStyle.Value = fillPattern.PatternStyle;
                this.cpBackColor.Color     = adapter.FillColor;

                if (fillPattern.PatternColorInfo.IsAutomatic)
                {
                    this.cpPatternColor.Color = Color.Empty;
                }
                else
                {
                    if (fillPattern.PatternColorInfo.Color != null)
                    {
                        this.cpPatternColor.Color = fillPattern.PatternColorInfo.Color.Value;
                    }
                    else
                    {
                        this.cpPatternColor.Color = Color.Empty;
                    }
                }
            }

            #endregion // Fill tab

            this.recordPropertiesChanges = true;
        }
コード例 #28
0
ファイル: HtmlFormatter.cs プロジェクト: ikvm/webmatrix
        public void Format(string input, TextWriter output, HtmlFormatterOptions options)
        {
            bool makeXhtml = options.MakeXhtml;
            int maxLineLength = options.MaxLineLength;
            string indentString = new string(options.IndentChar, options.IndentSize);
            char[] chars = input.ToCharArray();
            System.Collections.Generic.Stack<FormatInfo> formatInfoStack = new System.Collections.Generic.Stack<FormatInfo>();
            System.Collections.Generic.Stack<HtmlWriter> writerStack = new System.Collections.Generic.Stack<HtmlWriter>();
            FormatInfo curTagFormatInfo = null;
            FormatInfo prevTokenFormatInfo = null;
            string s = string.Empty;
            bool flag2 = false;
            bool hasNoEndTag = false;
            bool flag4 = false;
            HtmlWriter writer = new HtmlWriter(output, indentString, maxLineLength);
            writerStack.Push(writer);
            Token curToken = HtmlTokenizer.GetFirstToken(chars);
            Token prevToken = curToken;
            while (curToken != null)
            {
                string text;
                string tagName;
                TagInfo tagInfo;
                writer = (HtmlWriter) writerStack.Peek();
                switch (curToken.Type)
                {
                    case Token.Whitespace:
                        if (curToken.Text.Length > 0)
                        {
                            writer.Write(' ');
                        }
                        goto Label_Get_Next_Token;

                    case Token.TagName:
                    case Token.Comment:
                    case Token.InlineServerScript:
                        hasNoEndTag = false;
                        if (curToken.Type != Token.Comment)
                        {
                            goto Label_Token_TagName_Or_InlineServerScript;
                        }

                        tagName = curToken.Text;
                        tagInfo = new TagInfo(curToken.Text, commentTag);
                        goto Label_Process_Comment;

                    case Token.AttrName:
                        if (!makeXhtml)
                        {
                            goto Label_0164;
                        }
                        text = string.Empty;
                        if (curTagFormatInfo.tagInfo.IsXml)
                        {
                            break;
                        }
                        text = curToken.Text.ToLower();
                        goto Label_0127;

                    case Token.AttrVal:
                        if ((!makeXhtml || (prevToken.Type == 13)) || (prevToken.Type == 14))
                        {
                            goto Label_0227;
                        }
                        writer.Write('"');
                        writer.Write(curToken.Text.Replace("\"", "&quot;"));
                        writer.Write('"');
                        goto Label_Get_Next_Token;

                    case Token.TextToken:
                    case Token.ClientScriptBlock:
                    case Token.Style:
                    case Token.ServerScriptBlock:
                        s = s + curToken.Text;
                        goto Label_Get_Next_Token;

                    case Token.SelfTerminating:
                        curTagFormatInfo.isEndTag = true;
                        if (!curTagFormatInfo.tagInfo.NoEndTag)
                        {
                            formatInfoStack.Pop();
                            if (curTagFormatInfo.tagInfo.IsXml)
                            {
                                HtmlWriter writer2 = (HtmlWriter) writerStack.Pop();
                                writer = (HtmlWriter) writerStack.Peek();
                                writer.Write(writer2.Content);
                            }
                        }
                        if ((prevToken.Type == Token.Whitespace) && (prevToken.Text.Length > 0))
                        {
                            writer.Write("/>");
                        }
                        else
                        {
                            writer.Write(" />");
                        }
                        goto Label_Get_Next_Token;

                    case Token.Error:
                        if (prevToken.Type == Token.OpenBracket)
                        {
                            writer.Write('<');
                        }
                        writer.Write(curToken.Text);
                        goto Label_Get_Next_Token;

                    case Token.CloseBracket:
                        if (!makeXhtml)
                        {
                            goto Label_027A;
                        }
                        if (!flag4)
                        {
                            goto Label_Process_CloseBracket; // proc CloseBracket
                        }
                        flag4 = false;
                        goto Label_Get_Next_Token;

                    case Token.DoubleQuote:
                        writer.Write('"');
                        goto Label_Get_Next_Token;

                    case Token.SingleQuote:
                        writer.Write('\'');
                        goto Label_Get_Next_Token;

                    case Token.EqualsChar:
                        writer.Write('=');
                        goto Label_Get_Next_Token;

                    case Token.XmlDirective:
                        writer.WriteLineIfNotOnNewLine();
                        writer.Write('<');
                        writer.Write(curToken.Text);
                        writer.Write('>');
                        writer.WriteLineIfNotOnNewLine();
                        curTagFormatInfo = new FormatInfo(directiveTag, false);
                        flag4 = true;
                        goto Label_Get_Next_Token;

                    default:
                        goto Label_Get_Next_Token;
                }

                text = curToken.Text;

            Label_0127:
                writer.Write(text);
                if (HtmlTokenizer.GetNextToken(curToken).Type != 15)
                {
                    writer.Write("=\"" + text + "\"");
                }
                goto Label_Get_Next_Token;

            Label_0164:
                if (!curTagFormatInfo.tagInfo.IsXml)
                {
                    if (options.AttributeCasing == HtmlFormatterCase.UpperCase)
                    {
                        writer.Write(curToken.Text.ToUpper());
                    }
                    else if (options.AttributeCasing == HtmlFormatterCase.LowerCase)
                    {
                        writer.Write(curToken.Text.ToLower());
                    }
                    else
                    {
                        writer.Write(curToken.Text);
                    }
                }
                else
                {
                    writer.Write(curToken.Text);
                }
                goto Label_Get_Next_Token;

            Label_0227:
                writer.Write(curToken.Text);
                goto Label_Get_Next_Token;

            Label_Process_CloseBracket: // write closebucket
                if (hasNoEndTag && !curTagFormatInfo.tagInfo.IsComment) // flag3 = NoEndTag
                {
                    writer.Write(" />");
                }
                else
                {
                    writer.Write('>');
                }
                goto Label_Get_Next_Token;

            Label_027A:
                writer.Write('>');
                goto Label_Get_Next_Token;

            Label_Token_TagName_Or_InlineServerScript:
                if (curToken.Type == Token.InlineServerScript)
                {
                    string newTagName = curToken.Text.Trim().Substring(1);
                    tagName = newTagName;
                    if (newTagName.StartsWith("%@"))
                    {
                        tagInfo = new TagInfo(newTagName, directiveTag);
                    }
                    else
                    {
                        tagInfo = new TagInfo(newTagName, otherServerSideScriptTag);
                    }
                }
                else
                {
                    tagName = curToken.Text;
                    tagInfo = tagTable[tagName] as TagInfo;
                    if (tagInfo == null)
                    {
                        if (tagName.IndexOf(':') > -1)
                        {
                            tagInfo = new TagInfo(tagName, unknownXmlTag);
                        }
                        else if (writer is XmlWriter)
                        {
                            tagInfo = new TagInfo(tagName, nestedXmlTag);
                        }
                        else
                        {
                            tagInfo = new TagInfo(tagName, unknownHtmlTag);
                        }
                    }
                    else if ((options.ElementCasing == HtmlFormatterCase.LowerCase) || makeXhtml)
                    {
                        tagName = tagInfo.TagName;
                    }
                    else if (options.ElementCasing == HtmlFormatterCase.UpperCase)
                    {
                        tagName = tagInfo.TagName.ToUpper();
                    }
                }

            Label_Process_Comment:
                if (curTagFormatInfo == null)
                {
                    curTagFormatInfo = new FormatInfo(tagInfo, false);
                    curTagFormatInfo.indent = 0;
                    formatInfoStack.Push(curTagFormatInfo);
                    writer.Write(s);
                    if (tagInfo.IsXml)
                    {
                        HtmlWriter writer3 = new XmlWriter(writer.Indent, tagInfo.TagName, indentString, maxLineLength);
                        writerStack.Push(writer3);
                        writer = writer3;
                    }
                    if (prevToken.Type == Token.ForwardSlash)
                    {
                        writer.Write("</");
                    }
                    else
                    {
                        writer.Write('<');
                    }
                    writer.Write(tagName);
                    s = string.Empty;
                }
                else
                {
                    WhiteSpaceType followingWhiteSpaceType;
                    prevTokenFormatInfo = new FormatInfo(tagInfo, prevToken.Type == Token.ForwardSlash);
                    followingWhiteSpaceType = curTagFormatInfo.isEndTag ? curTagFormatInfo.tagInfo.FollowingWhiteSpaceType : curTagFormatInfo.tagInfo.InnerWhiteSpaceType;
                    bool isInline = curTagFormatInfo.tagInfo.IsInline;
                    bool flag6 = false;
                    bool flag7 = false;
                    if (writer is XmlWriter)
                    {
                        XmlWriter writer4 = (XmlWriter) writer;
                        if (writer4.IsUnknownXml)
                        {
                            flag7 = ((curTagFormatInfo.isBeginTag && (curTagFormatInfo.tagInfo.TagName.ToLower() == writer4.TagName.ToLower())) || (prevTokenFormatInfo.isEndTag && (prevTokenFormatInfo.tagInfo.TagName.ToLower() == writer4.TagName.ToLower()))) && !FormattedTextWriter.IsWhiteSpace(s);
                        }
                        if (curTagFormatInfo.isBeginTag)
                        {
                            if (FormattedTextWriter.IsWhiteSpace(s))
                            {
                                if ((writer4.IsUnknownXml && prevTokenFormatInfo.isEndTag) && (curTagFormatInfo.tagInfo.TagName.ToLower() == prevTokenFormatInfo.tagInfo.TagName.ToLower()))
                                {
                                    isInline = true;
                                    flag6 = true;
                                    s = "";
                                }
                            }
                            else if (!writer4.IsUnknownXml)
                            {
                                writer4.ContainsText = true;
                            }
                        }
                    }
                    bool frontWhiteSpace = true;
                    if (curTagFormatInfo.isBeginTag && curTagFormatInfo.tagInfo.PreserveContent)
                    {
                        writer.Write(s);
                    }
                    else
                    {
                        switch (followingWhiteSpaceType)
                        {
                            case WhiteSpaceType.NotSignificant:
                                if (!isInline && !flag7)
                                {
                                    writer.WriteLineIfNotOnNewLine();
                                    frontWhiteSpace = false;
                                }
                                break;

                            case WhiteSpaceType.Significant:
                                if ((FormattedTextWriter.HasFrontWhiteSpace(s) && !isInline) && !flag7)
                                {
                                    writer.WriteLineIfNotOnNewLine();
                                    frontWhiteSpace = false;
                                }
                                break;

                            default:
                                if (((followingWhiteSpaceType == WhiteSpaceType.CarryThrough) && (flag2 || FormattedTextWriter.HasFrontWhiteSpace(s))) && (!isInline && !flag7))
                                {
                                    writer.WriteLineIfNotOnNewLine();
                                    frontWhiteSpace = false;
                                }
                                break;
                        }
                        if ((curTagFormatInfo.isBeginTag && !curTagFormatInfo.tagInfo.NoIndent) && !isInline)
                        {
                            writer.Indent++;
                        }
                        if (flag7)
                        {
                            writer.Write(s);
                        }
                        else
                        {
                            writer.WriteLiteral(s, frontWhiteSpace);
                        }
                    }
                    if (prevTokenFormatInfo.isEndTag)
                    {
                        if (!prevTokenFormatInfo.tagInfo.NoEndTag)
                        {
                            //ArrayList list = new ArrayList();
                            List<FormatInfo> formatInfoList = new List<FormatInfo>();
                            FormatInfo info4 = null;
                            bool flag9 = false;
                            bool flag10 = false;
                            if ((prevTokenFormatInfo.tagInfo.Flags & FormattingFlags.AllowPartialTags) != FormattingFlags.None)
                            {
                                flag10 = true;
                            }
                            if (formatInfoStack.Count > 0)
                            {
                                info4 = (FormatInfo) formatInfoStack.Pop();
                                formatInfoList.Add(info4);
                                while ((formatInfoStack.Count > 0) && (info4.tagInfo.TagName.ToLower() != prevTokenFormatInfo.tagInfo.TagName.ToLower()))
                                {
                                    if ((info4.tagInfo.Flags & FormattingFlags.AllowPartialTags) != FormattingFlags.None)
                                    {
                                        flag10 = true;
                                        break;
                                    }
                                    info4 = (FormatInfo) formatInfoStack.Pop();
                                    formatInfoList.Add(info4);
                                }
                                if (info4.tagInfo.TagName.ToLower() != prevTokenFormatInfo.tagInfo.TagName.ToLower())
                                {
                                    for (int i = formatInfoList.Count - 1; i >= 0; i--)
                                    {
                                        formatInfoStack.Push(formatInfoList[i]);
                                    }
                                }
                                else
                                {
                                    flag9 = true;
                                    for (int j = 0; j < (formatInfoList.Count - 1); j++)
                                    {
                                        FormatInfo info5 = (FormatInfo) formatInfoList[j];
                                        if (info5.tagInfo.IsXml && (writerStack.Count > 1))
                                        {
                                            HtmlWriter writer5 = (HtmlWriter) writerStack.Pop();
                                            writer = (HtmlWriter) writerStack.Peek();
                                            writer.Write(writer5.Content);
                                        }
                                        if (!info5.tagInfo.NoEndTag)
                                        {
                                            writer.WriteLineIfNotOnNewLine();
                                            writer.Indent = info5.indent;
                                            if (makeXhtml && !flag10)
                                            {
                                                writer.Write("</" + info5.tagInfo.TagName + ">");
                                            }
                                        }
                                    }
                                    writer.Indent = info4.indent;
                                }
                            }
                            if (flag9 || flag10)
                            {
                                if ((((!flag6 && !flag7) && (!prevTokenFormatInfo.tagInfo.IsInline && !prevTokenFormatInfo.tagInfo.PreserveContent)) && ((FormattedTextWriter.IsWhiteSpace(s) || FormattedTextWriter.HasBackWhiteSpace(s)) || (prevTokenFormatInfo.tagInfo.FollowingWhiteSpaceType == WhiteSpaceType.NotSignificant))) && (!(prevTokenFormatInfo.tagInfo is TDTagInfo) || FormattedTextWriter.HasBackWhiteSpace(s)))
                                {
                                    writer.WriteLineIfNotOnNewLine();
                                }
                                writer.Write("</");
                                writer.Write(tagName);
                            }
                            else
                            {
                                flag4 = true;
                            }
                            if (prevTokenFormatInfo.tagInfo.IsXml && (writerStack.Count > 1))
                            {
                                HtmlWriter writer6 = (HtmlWriter) writerStack.Pop();
                                writer = (HtmlWriter) writerStack.Peek();
                                writer.Write(writer6.Content);
                            }
                        }
                        else
                        {
                            flag4 = true;
                        }
                    }
                    // prevTokenFormatInfo.isEndTag == false
                    else
                    {
                        bool flag11 = false;
                        while (!flag11 && (formatInfoStack.Count > 0))
                        {
                            FormatInfo info6 = (FormatInfo) formatInfoStack.Peek();
                            if (!info6.tagInfo.CanContainTag(prevTokenFormatInfo.tagInfo))
                            {
                                formatInfoStack.Pop();
                                writer.Indent = info6.indent;
                                if (makeXhtml)
                                {
                                    if (!info6.tagInfo.IsInline)
                                    {
                                        writer.WriteLineIfNotOnNewLine();
                                    }
                                    writer.Write("</" + info6.tagInfo.TagName + ">");
                                }
                            }
                            flag11 = true;
                        }
                        prevTokenFormatInfo.indent = writer.Indent;
                        if (((!flag7 && !prevTokenFormatInfo.tagInfo.IsInline) && !prevTokenFormatInfo.tagInfo.PreserveContent) && ((FormattedTextWriter.IsWhiteSpace(s) || FormattedTextWriter.HasBackWhiteSpace(s)) || ((s.Length == 0) && ((curTagFormatInfo.isBeginTag && (curTagFormatInfo.tagInfo.InnerWhiteSpaceType == WhiteSpaceType.NotSignificant)) || (curTagFormatInfo.isEndTag && (curTagFormatInfo.tagInfo.FollowingWhiteSpaceType == WhiteSpaceType.NotSignificant))))))
                        {
                            writer.WriteLineIfNotOnNewLine();
                        }
                        if (!prevTokenFormatInfo.tagInfo.NoEndTag)
                        {
                            formatInfoStack.Push(prevTokenFormatInfo);
                        }
                        else
                        {
                            hasNoEndTag = true;
                        }
                        if (prevTokenFormatInfo.tagInfo.IsXml)
                        {
                            HtmlWriter writer7 = new XmlWriter(writer.Indent, prevTokenFormatInfo.tagInfo.TagName, indentString, maxLineLength);
                            writerStack.Push(writer7);
                            writer = writer7;
                        }
                        writer.Write('<');
                        writer.Write(tagName);
                    }
                    flag2 = FormattedTextWriter.HasBackWhiteSpace(s);
                    s = string.Empty;
                    curTagFormatInfo = prevTokenFormatInfo;
                }

            Label_Get_Next_Token:
                prevToken = curToken;
                curToken = HtmlTokenizer.GetNextToken(curToken);
            }
            if (s.Length > 0)
            {
                writer.Write(s);
            }
            while (writerStack.Count > 1)
            {
                HtmlWriter writer8 = (HtmlWriter) writerStack.Pop();
                writer = (HtmlWriter) writerStack.Peek();
                writer.Write(writer8.Content);
            }
            writer.Flush();
        }
コード例 #29
0
        public IColumnizedLogLine SplitLine(LogExpert.ILogLineColumnizerCallback callback, ILogLine line)
        {
            // 0         1         2         3         4         5         6         7         8         9         10        11        12        13        14        15        16
            // 012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
            // 03.01.2008 14:48:00.066 <rest of line>

            ColumnizedLogLine clogLine = new ColumnizedLogLine
            {
                LogLine = line
            };

            Column[] columns = new Column[]
            {
                new Column {
                    FullValue = "", Parent = clogLine
                },
                new Column {
                    FullValue = "", Parent = clogLine
                },
                new Column {
                    FullValue = "", Parent = clogLine
                },
            };

            string temp = line.FullLine;

            if (temp.Length < 3)
            {
                columns[2].FullValue = temp;
                return(clogLine);
            }

            FormatInfo formatInfo = _timeFormatDeterminer.DetermineDateTimeFormatInfo(line.FullLine);

            if (formatInfo == null)
            {
                columns[2].FullValue = temp;
                SquareSplit(ref columns, temp, 0, 0, 0, clogLine);
            }
            else
            {
                int endPos  = formatInfo.DateTimeFormat.Length;
                int timeLen = formatInfo.TimeFormat.Length;
                int dateLen = formatInfo.DateFormat.Length;
                try
                {
                    if (this.timeOffset != 0)
                    {
                        DateTime dateTime = DateTime.ParseExact(temp.Substring(0, endPos), formatInfo.DateTimeFormat,
                                                                formatInfo.CultureInfo);
                        dateTime = dateTime.Add(new TimeSpan(0, 0, 0, 0, this.timeOffset));
                        string newDate = dateTime.ToString(formatInfo.DateTimeFormat, formatInfo.CultureInfo);

                        SquareSplit(ref columns, newDate, dateLen, timeLen, endPos, clogLine);
                    }
                    else
                    {
                        SquareSplit(ref columns, temp, dateLen, timeLen, endPos, clogLine);
                    }
                }
                catch (Exception)
                {
                    columns[0].FullValue = "n/a";
                    columns[1].FullValue = "n/a";
                    columns[2].FullValue = temp;
                }
            }

            clogLine.ColumnValues = columns.Select(a => a as IColumn).ToArray();

            return(clogLine);
        }
コード例 #30
0
        public override string GetDisplayText(FormatInfo format, object editValue)
        {
            if (editValue is TimeSpan)
                return XpandDurationAsTextHelper.ConvertTimeSpanToReadableString(((TimeSpan)editValue));
            if (editValue is string)
            {
                return XpandDurationAsTextHelper.ConvertTimeSpanToReadableString(XpandDurationAsTextHelper.ConvertStringToTimeSpan(editValue.ToString()));
                //return editValue.ToString();
            }

            return GetDisplayText(null, new TimeSpan(0));
        }
コード例 #31
0
ファイル: TextureView.cs プロジェクト: Ryujinx/Ryujinx
        private void CreateView()
        {
            TextureTarget target = Target.Convert();

            FormatInfo format = FormatTable.GetFormatInfo(Info.Format);

            PixelInternalFormat pixelInternalFormat;

            if (format.IsCompressed)
            {
                pixelInternalFormat = (PixelInternalFormat)format.PixelFormat;
            }
            else
            {
                pixelInternalFormat = format.PixelInternalFormat;
            }

            int levels = Info.GetLevelsClamped();

            GL.TextureView(
                Handle,
                target,
                _parent.Handle,
                pixelInternalFormat,
                FirstLevel,
                levels,
                FirstLayer,
                Info.GetLayers());

            GL.ActiveTexture(TextureUnit.Texture0);

            GL.BindTexture(target, Handle);

            int[] swizzleRgba = new int[]
            {
                (int)Info.SwizzleR.Convert(),
                (int)Info.SwizzleG.Convert(),
                (int)Info.SwizzleB.Convert(),
                (int)Info.SwizzleA.Convert()
            };

            if (Info.Format == Format.A1B5G5R5Unorm)
            {
                int temp  = swizzleRgba[0];
                int temp2 = swizzleRgba[1];
                swizzleRgba[0] = swizzleRgba[3];
                swizzleRgba[1] = swizzleRgba[2];
                swizzleRgba[2] = temp2;
                swizzleRgba[3] = temp;
            }
            else if (Info.Format.IsBgr())
            {
                // Swap B <-> R for BGRA formats, as OpenGL has no support for them
                // and we need to manually swap the components on read/write on the GPU.
                int temp = swizzleRgba[0];
                swizzleRgba[0] = swizzleRgba[2];
                swizzleRgba[2] = temp;
            }

            GL.TexParameter(target, TextureParameterName.TextureSwizzleRgba, swizzleRgba);

            int maxLevel = levels - 1;

            if (maxLevel < 0)
            {
                maxLevel = 0;
            }

            GL.TexParameter(target, TextureParameterName.TextureMaxLevel, maxLevel);
            GL.TexParameter(target, TextureParameterName.DepthStencilTextureMode, (int)Info.DepthStencilMode.Convert());
        }
コード例 #32
0
ファイル: ExcelDocument.cs プロジェクト: rymarrv/Compas
        private void BuildInternalTables()
        {
            FormatInfo info;

            foreach (var cell in cells)
            {
                info = new FormatInfo(cell.Value);
                if (cell.Value.Document.FX.IndexOf(info) == -1)
                    cell.Value.Document.FX.Add(info);

                cell.Value.FXIndex = (byte)(cell.Value.Document.FX.IndexOf(info) + 21);
            }
        }
コード例 #33
0
        private static string Format(ArrayList numberlist, ArrayList formatlist, string lang, string letter, string groupingSep, string groupingSize)
        {
            StringBuilder result   = new StringBuilder();
            int           cFormats = 0;

            if (formatlist != null)
            {
                cFormats = formatlist.Count;
            }

            NumberingFormat numberingFormat = new NumberingFormat();

            if (groupingSize != null)
            {
                try {
                    numberingFormat.setGroupingSize(Convert.ToInt32(groupingSize));
                }
                catch (System.OverflowException) {}
            }
            if (groupingSep != null)
            {
                numberingFormat.setGroupingSeparator(groupingSep);
            }
            if (cFormats > 0)
            {
                //numberingFormat.setletter(this.letter);
                //numberingFormat.setLang(this.lang);

                int        numberlistCount = numberlist.Count;
                FormatInfo pFormatToken    = null;
                FormatInfo pFormatInfo     = formatlist[0] as FormatInfo;
                int        index           = 0;
                for (int i = 0; i < numberlistCount; i++)
                {
                    if (pFormatInfo._fIsSeparator)
                    {
                        result.Append(pFormatInfo._wszSeparator);

                        if (cFormats > 1)
                        {
                            pFormatToken = formatlist[++index] as FormatInfo;

                            if (cFormats > 3)
                            {
                                // Use the next format pair (otherwise use same pair over again)
                                pFormatInfo = formatlist[++index] as FormatInfo;
                                cFormats   -= 2;
                            }
                        }
                        else
                        {
                            // Format string consists of a lone separator.  Use "1" as format token.
                            Debug.Assert(cFormats == 1);
                            pFormatToken = DefaultFormat;
                        }
                    }
                    else
                    {
                        // Format string begins with format token, not a separator
                        if (i != 0)
                        {
                            // Default separator token is period
                            result.Append(".");
                        }

                        pFormatToken = pFormatInfo;
                        if (cFormats > 2)
                        {
                            // Use the succeeding pair
                            pFormatInfo = formatlist[++index] as FormatInfo;
                            cFormats--;
                        }
                    }

                    numberingFormat.setNumberingType(pFormatToken._numberingType);
                    numberingFormat.setMinLen(pFormatToken._cMinLen);
                    result.Append(numberingFormat.format(Convert.ToDouble(numberlist[i])));
                }

                if (numberlistCount == 0 && pFormatInfo._fIsSeparator)
                {
                    // If we had no counts, then write out beginning separator, if it exists
                    result.Append(pFormatInfo._wszSeparator);
                }

                if (numberlistCount != 0 || cFormats > 1)
                {
                    // If we have at least one count, find last entry in format             information array
                    Debug.Assert(cFormats >= 1);
                    pFormatInfo = formatlist[formatlist.Count - 1] as FormatInfo;
                    // If last entry is a separator, always write it out
                    if (pFormatInfo._fIsSeparator)
                    {
                        result.Append(pFormatInfo._wszSeparator);
                    }
                }
            }
            else
            {
                numberingFormat.setNumberingType(MSONFC.msonfcArabic);
                for (int i = 0; i < numberlist.Count; i++)
                {
                    if (i != 0)
                    {
                        result.Append(".");
                    }
                    result.Append(numberingFormat.format(Convert.ToDouble(numberlist[i])));
                }
            }
            return(result.ToString());
        }
コード例 #34
0
ファイル: ExcelDocument.cs プロジェクト: rymarrv/Compas
        private void WriteFXRecord(BinaryWriter writer, FormatInfo info)
        {
            ushort[] clData = new ushort[2];
            clData[0] = BIFF.ExtendedRecord;
            clData[1] = 0x00C;
            WriteUshortArray(writer, clData);

            byte[] clValue = new byte[4];
            clValue[0] = (byte)info.FontIndex;
            clValue[1] = (byte)info.FormatIndex;
            clValue[2] = (byte)0x01;

            byte attr = 0;
            if (info.FontIndex > 0)
                attr |= 0x02;
            if (info.HorizontalAlignment != Alignment.General)
                attr |= 0x04;
            if (info.BackColor.Index != ExcelColor.Automatic.Index)
                attr |= 0x10;
            attr = (byte)(attr << 2);
            clValue[3] = attr;
            WriteByteArray(writer, clValue);

            //(orig & ~mask) | (input & mask)

            ushort horizontalAlignment = (ushort)info.HorizontalAlignment;

            ushort backgroundArea = 1;
            if (info.BackColor.Index != ExcelColor.Automatic.Index)
            {
                backgroundArea = (ushort)((backgroundArea & ~(ushort)0x07C0) | (info.BackColor.Index & (ushort)0x07C0 >> 6) << 6);
                backgroundArea = (ushort)((backgroundArea & ~(ushort)0xF800) | (ExcelColor.WindowText.Index & (ushort)0xF800 >> 11) << 11);
            }
            else
                backgroundArea = 0xCE00;

            ushort[] rest = { horizontalAlignment, backgroundArea, 0x0000, 0x0000 };
            WriteUshortArray(writer, rest);
        }
コード例 #35
0
ファイル: COpenALPlay.cs プロジェクト: winterdl/Vocaluxe
        public int Open(string FileName)
        {
            if (_FileOpened)
            {
                return(-1);
            }

            if (!System.IO.File.Exists(FileName))
            {
                return(-1);
            }

            if (_FileOpened)
            {
                return(-1);
            }

            _Decoder = new CAudioDecoderFFmpeg();
            _Decoder.Init();

            try
            {
                _source  = AL.GenSource();
                _buffers = AL.GenBuffers(buffer_count);
                _state   = 0;
                //AL.SourceQueueBuffers(_source, _buffers.Length, _buffers);
            }

            catch (Exception)
            {
                _Initialized = false;
                CLog.LogError("Error Init OpenAL Playback");
                return(-1);
            }

            _FileName = FileName;
            _Decoder.Open(FileName);
            _Duration = _Decoder.GetLength();

            _format         = _Decoder.GetFormatInfo();
            _ByteCount      = 2 * _format.ChannelCount;
            _BytesPerSecond = _format.SamplesPerSecond * _ByteCount;
            _CurrentTime    = 0f;
            _Timer.Reset();

            AudioStreams stream = new AudioStreams(0);

            stream.handle = _buffers[0];

            if (stream.handle != 0)
            {
                _FileOpened             = true;
                _data                   = new RingBuffer(BUFSIZE);
                _NoMoreData             = false;
                _DecoderThread.Priority = ThreadPriority.Normal;
                _DecoderThread.Name     = Path.GetFileName(FileName);
                _DecoderThread.Start();

                return(stream.handle);
            }
            return(-1);
        }
コード例 #36
0
ファイル: TextureView.cs プロジェクト: ianuub/Ryujinxxx
        private void ReadFrom2D(IntPtr data, int layer, int level, int width, int height)
        {
            TextureTarget target = Target.Convert();

            int mipSize = Info.GetMipSize2D(level);

            Bind(target, 0);

            FormatInfo format = FormatTable.GetFormatInfo(Info.Format);

            switch (Target)
            {
            case Target.Texture1D:
                if (format.IsCompressed)
                {
                    GL.CompressedTexSubImage1D(
                        target,
                        level,
                        0,
                        width,
                        format.PixelFormat,
                        mipSize,
                        data);
                }
                else
                {
                    GL.TexSubImage1D(
                        target,
                        level,
                        0,
                        width,
                        format.PixelFormat,
                        format.PixelType,
                        data);
                }
                break;

            case Target.Texture1DArray:
                if (format.IsCompressed)
                {
                    GL.CompressedTexSubImage2D(
                        target,
                        level,
                        0,
                        layer,
                        width,
                        1,
                        format.PixelFormat,
                        mipSize,
                        data);
                }
                else
                {
                    GL.TexSubImage2D(
                        target,
                        level,
                        0,
                        layer,
                        width,
                        1,
                        format.PixelFormat,
                        format.PixelType,
                        data);
                }
                break;

            case Target.Texture2D:
                if (format.IsCompressed)
                {
                    GL.CompressedTexSubImage2D(
                        target,
                        level,
                        0,
                        0,
                        width,
                        height,
                        format.PixelFormat,
                        mipSize,
                        data);
                }
                else
                {
                    GL.TexSubImage2D(
                        target,
                        level,
                        0,
                        0,
                        width,
                        height,
                        format.PixelFormat,
                        format.PixelType,
                        data);
                }
                break;

            case Target.Texture2DArray:
            case Target.Texture3D:
            case Target.CubemapArray:
                if (format.IsCompressed)
                {
                    GL.CompressedTexSubImage3D(
                        target,
                        level,
                        0,
                        0,
                        layer,
                        width,
                        height,
                        1,
                        format.PixelFormat,
                        mipSize,
                        data);
                }
                else
                {
                    GL.TexSubImage3D(
                        target,
                        level,
                        0,
                        0,
                        layer,
                        width,
                        height,
                        1,
                        format.PixelFormat,
                        format.PixelType,
                        data);
                }
                break;

            case Target.Cubemap:
                if (format.IsCompressed)
                {
                    GL.CompressedTexSubImage2D(
                        TextureTarget.TextureCubeMapPositiveX + layer,
                        level,
                        0,
                        0,
                        width,
                        height,
                        format.PixelFormat,
                        mipSize,
                        data);
                }
                else
                {
                    GL.TexSubImage2D(
                        TextureTarget.TextureCubeMapPositiveX + layer,
                        level,
                        0,
                        0,
                        width,
                        height,
                        format.PixelFormat,
                        format.PixelType,
                        data);
                }
                break;
            }
        }
コード例 #37
0
ファイル: NumberAction.cs プロジェクト: rsumner31/corefx2
        // SDUB: perf.
        // for each call to xsl:number Format() will build new NumberingFormat object.
        // in case of no AVTs we can build this object at compile time and reuse it on execution time.
        // even partial step in this derection will be usefull (when cFormats == 0)

        private static string Format(ArrayList numberlist, List <FormatInfo> tokens, string lang, string letter, string groupingSep, string groupingSize)
        {
            StringBuilder result   = new StringBuilder();
            int           cFormats = 0;

            if (tokens != null)
            {
                cFormats = tokens.Count;
            }

            NumberingFormat numberingFormat = new NumberingFormat();

            if (groupingSize != null)
            {
                try
                {
                    numberingFormat.setGroupingSize(Convert.ToInt32(groupingSize, CultureInfo.InvariantCulture));
                }
                catch (System.FormatException) { }
                catch (System.OverflowException) { }
            }
            if (groupingSep != null)
            {
                if (groupingSep.Length > 1)
                {
                    // It is a breaking change to throw an exception, SQLBUDT 324367
                    //throw XsltException.Create(SR.Xslt_CharAttribute, "grouping-separator");
                }
                numberingFormat.setGroupingSeparator(groupingSep);
            }
            if (0 < cFormats)
            {
                FormatInfo prefix = tokens[0];
                Debug.Assert(prefix == null || prefix.isSeparator);
                FormatInfo sufix = null;
                if (cFormats % 2 == 1)
                {
                    sufix = tokens[cFormats - 1];
                    cFormats--;
                }
                FormatInfo periodicSeparator = 2 < cFormats ? tokens[cFormats - 2] : s_defaultSeparator;
                FormatInfo periodicFormat    = 0 < cFormats ? tokens[cFormats - 1] : s_defaultFormat;
                if (prefix != null)
                {
                    result.Append(prefix.formatString);
                }
                int numberlistCount = numberlist.Count;
                for (int i = 0; i < numberlistCount; i++)
                {
                    int  formatIndex = i * 2;
                    bool haveFormat  = formatIndex < cFormats;
                    if (0 < i)
                    {
                        FormatInfo thisSeparator = haveFormat ? tokens[formatIndex + 0] : periodicSeparator;
                        Debug.Assert(thisSeparator.isSeparator);
                        result.Append(thisSeparator.formatString);
                    }

                    FormatInfo thisFormat = haveFormat ? tokens[formatIndex + 1] : periodicFormat;
                    Debug.Assert(!thisFormat.isSeparator);

                    //numberingFormat.setletter(this.letter);
                    //numberingFormat.setLang(this.lang);

                    numberingFormat.setNumberingType(thisFormat.numSequence);
                    numberingFormat.setMinLen(thisFormat.length);
                    result.Append(numberingFormat.FormatItem(numberlist[i]));
                }

                if (sufix != null)
                {
                    result.Append(sufix.formatString);
                }
            }
            else
            {
                numberingFormat.setNumberingType(NumberingSequence.Arabic);
                for (int i = 0; i < numberlist.Count; i++)
                {
                    if (i != 0)
                    {
                        result.Append(".");
                    }
                    result.Append(numberingFormat.FormatItem(numberlist[i]));
                }
            }
            return(result.ToString());
        }
コード例 #38
0
        static void initFormatDictionary()
        {
            if (format != null)
            {
                return;
            }

            format = new Dictionary <String, FormatInfo>();

            FormatInfo i = new FormatInfo("ColorMode", "");

            i.lookup["0"] = "Bitmap";
            i.lookup["1"] = "Gray scale";
            i.lookup["2"] = "Indexed colour";
            i.lookup["3"] = "RGB colour";
            i.lookup["4"] = "CMYK colour";
            i.lookup["7"] = "Multi-channel";
            i.lookup["8"] = "Duotone";
            i.lookup["9"] = "LAB colour";

            format.Add(i.name, i);

            i             = new FormatInfo("Compression", "");
            i.lookup["1"] = "uncompressed";
            i.lookup["6"] = "jpeg";

            format.Add(i.name, i);

            i = new FormatInfo("ImageLength", "pixels");

            format.Add(i.name, i);

            i = new FormatInfo("ImageWidth", "pixels");

            format.Add(i.name, i);

            i             = new FormatInfo("PhotometricInterpretation", "");;
            i.lookup["2"] = "RGB";
            i.lookup["6"] = "YCbCr";

            format.Add(i.name, i);

            i             = new FormatInfo("PlanarConfiguration", "");
            i.lookup["1"] = "chunky";
            i.lookup["2"] = "planar";

            format.Add(i.name, i);

            i             = new FormatInfo("ResolutionUnit", "");
            i.lookup["2"] = "inches";
            i.lookup["3"] = "centimeters";

            format.Add(i.name, i);

            i = new FormatInfo("XResolution", "pixels per unit");

            format.Add(i.name, i);

            i = new FormatInfo("YResolution", "pixels per unit");

            format.Add(i.name, i);

            i             = new FormatInfo("YCbCrPositioning", "");
            i.lookup["1"] = "centered";
            i.lookup["2"] = "co-sited";

            format.Add(i.name, i);

            i = new FormatInfo("ApertureValue", "");

            format.Add(i.name, i);

            i = new FormatInfo("BrightnessValue", "");

            format.Add(i.name, i);

            i                 = new FormatInfo("ColorSpace", "");
            i.lookup["1"]     = "sRGB";
            i.lookup["65535"] = "uncalibrated";

            format.Add(i.name, i);

            i             = new FormatInfo("ComponentsConfiguration", "");
            i.lookup["0"] = "does not exist";
            i.lookup["1"] = "Y";
            i.lookup["2"] = "Cb";
            i.lookup["3"] = "Cr";
            i.lookup["4"] = "R";
            i.lookup["5"] = "G";
            i.lookup["6"] = "B";

            format.Add(i.name + "[]", i);

            /*format.Add(i.name + "[2]", i);
            *  format.Add(i.name + "[3]", i);
            *  format.Add(i.name + "[4]", i);*/

            i             = new FormatInfo("Contrast", "");
            i.lookup["0"] = "Normal";
            i.lookup["1"] = "Soft";
            i.lookup["2"] = "Hard";

            format.Add(i.name, i);

            i             = new FormatInfo("CustomRendered", "");
            i.lookup["0"] = "Normal process";
            i.lookup["1"] = "Custom process";

            format.Add(i.name, i);

            i = new FormatInfo("ExposureBiasValue", "EV");

            format.Add(i.name, i);

            i             = new FormatInfo("ExposureMode", "");
            i.lookup["0"] = "Auto exposure";
            i.lookup["1"] = "Manual exposure";
            i.lookup["2"] = "Auto bracket";

            format.Add(i.name, i);

            i = new FormatInfo("ExposureProgram", "");

            i.lookup["0"] = "not defined";
            i.lookup["1"] = "Manual";
            i.lookup["2"] = "Normal program";
            i.lookup["3"] = "Aperture priority";
            i.lookup["4"] = "Shutter priority";
            i.lookup["5"] = "Creative program";
            i.lookup["6"] = "Action program";
            i.lookup["7"] = "Portrait mode";
            i.lookup["8"] = "Landscape mode";

            format.Add(i.name, i);

            i = new FormatInfo("ExposureTime", "seconds");

            format.Add(i.name, i);

            i             = new FormatInfo("FileSource", "");
            i.lookup["3"] = "DSC";

            format.Add(i.name, i);

            i = new FormatInfo("FocalLength", "millimeters");

            format.Add(i.name, i);

            i             = new FormatInfo("FocalPlaneResolutionUnit", "");
            i.lookup["2"] = "inches";
            i.lookup["3"] = "centimeters";

            format.Add(i.name, i);

            i = new FormatInfo("FocalPlaneXResolution", "pixels per unit");

            format.Add(i.name, i);

            i = new FormatInfo("FocalPlaneYResolution", "pixels per unit");

            format.Add(i.name, i);

            i = new FormatInfo("GainControl", "");

            i.lookup["0"] = "None";
            i.lookup["1"] = "Low gain up";
            i.lookup["2"] = "High gain up";
            i.lookup["3"] = "Low gain down";
            i.lookup["4"] = "High gain down";

            format.Add(i.name, i);

            i = new FormatInfo("GPSAltitudeRef", "");

            i.lookup["0"] = "Above sea level";
            i.lookup["1"] = "Below sea level";

            format.Add(i.name, i);

            i = new FormatInfo("GPSDestBearingRef", "");

            i.lookup["T"] = "true direction";
            i.lookup["M"] = "magnetic direction";

            format.Add(i.name, i);

            i = new FormatInfo("GPSDestDistanceRef", "");

            i.lookup["K"] = "kilometers per hour";
            i.lookup["M"] = "miles per hour";
            i.lookup["N"] = "knots";

            format.Add(i.name, i);

            i = new FormatInfo("GPSDifferential", "");

            i.lookup["0"] = "Without correction";
            i.lookup["1"] = "Correction applied";

            format.Add(i.name, i);

            i = new FormatInfo("GPSImgDirectionRef", "");

            i.lookup["T"] = "true direction";
            i.lookup["M"] = "magnetic direction";

            format.Add(i.name, i);

            i = new FormatInfo("GPSMeasureMode", "");

            i.lookup["2"] = "two-dimensional measurement";
            i.lookup["3"] = "three-dimensional measurement";

            format.Add(i.name, i);

            i = new FormatInfo("GPSTrackRef", "");

            i.lookup["T"] = "true direction";
            i.lookup["M"] = "magnetic direction";

            format.Add(i.name, i);

            i = new FormatInfo("GPSSpeedRef", "");

            i.lookup["K"] = "kilometers per hour";
            i.lookup["M"] = "miles per hour";
            i.lookup["N"] = "knots";

            format.Add(i.name, i);

            i = new FormatInfo("GPSStatus", "");

            i.lookup["A"] = "Measurement in progress";
            i.lookup["V"] = "Measurement is interoperability";

            format.Add(i.name, i);

            i = new FormatInfo("LightSource", "");

            i.lookup["0"]   = "Unknown";
            i.lookup["1"]   = "Daylight";
            i.lookup["2"]   = "Fluorescent";
            i.lookup["3"]   = "Tungsten";
            i.lookup["4"]   = "Flash";
            i.lookup["9"]   = "Fine weather";
            i.lookup["10"]  = "Cloudy weather";
            i.lookup["11"]  = "Shade";
            i.lookup["12"]  = "Daylight fluorescent (D 5700 – 7100K)";
            i.lookup["13"]  = "Day white fluorescent (N 4600 – 5400K)";
            i.lookup["14"]  = "Cool white fluorescent (W 3900 – 4500K)";
            i.lookup["15"]  = "White fluorescent (WW 3200 – 3700K)";
            i.lookup["17"]  = "Standard light A";
            i.lookup["18"]  = "Standard light B";
            i.lookup["19"]  = "Standard light C";
            i.lookup["20"]  = "D55";
            i.lookup["21"]  = "D65";
            i.lookup["22"]  = "D75";
            i.lookup["23"]  = "D50";
            i.lookup["24"]  = "ISO studio tungsten";
            i.lookup["255"] = "other";

            format.Add(i.name, i);

            i = new FormatInfo("MaxApertureValue", "");

            format.Add(i.name, i);

            i = new FormatInfo("MeteringMode", "");

            i.lookup["0"] = "Unknown";
            i.lookup["1"] = "Average";
            i.lookup["2"] = "CenterWeightedAverage";
            i.lookup["3"] = "Spot";
            i.lookup["4"] = "MultiSpot";
            i.lookup["5"] = "Pattern";
            i.lookup["6"] = "Partial";
            i.lookup["7"] = "Other";

            format.Add(i.name, i);

            i = new FormatInfo("PixelXDimension", "pixels");

            format.Add(i.name, i);

            i = new FormatInfo("PixelYDimension", "pixels");

            format.Add(i.name, i);

            i = new FormatInfo("Saturation", "");

            i.lookup["0"] = "Normal saturation";
            i.lookup["1"] = "Low saturation";
            i.lookup["2"] = "High saturation";

            format.Add(i.name, i);

            i = new FormatInfo("SceneCaptureType", "");

            i.lookup["0"] = "Standard";
            i.lookup["1"] = "Landscape";
            i.lookup["2"] = "Portrait";
            i.lookup["3"] = "Night scene";

            format.Add(i.name, i);

            i = new FormatInfo("SceneType", "");

            i.lookup["1"] = "Directly photographed image";

            format.Add(i.name, i);

            i = new FormatInfo("SensingMethod", "");

            i.lookup["1"] = "Not defined";
            i.lookup["2"] = "One-chip colour area sensor";
            i.lookup["3"] = "Two-chip colour area sensor";
            i.lookup["4"] = "Three-chip colour area sensor";
            i.lookup["5"] = "Colour sequential area sensor";
            i.lookup["7"] = "Trilinear sensor";
            i.lookup["8"] = "Colour sequential linear sensor";

            format.Add(i.name, i);

            i = new FormatInfo("Sharpness", "");

            i.lookup["0"] = "Normal";
            i.lookup["1"] = "Soft";
            i.lookup["2"] = "Hard";

            format.Add(i.name, i);

            i = new FormatInfo("ShutterSpeedValue", "");

            format.Add(i.name, i);

            i = new FormatInfo("SubjectDistance", "meters");

            format.Add(i.name, i);

            i = new FormatInfo("SubjectDistanceRange", "");

            i.lookup["0"] = "Unknown";
            i.lookup["1"] = "Macro";
            i.lookup["2"] = "Close view";
            i.lookup["3"] = "Distant view";

            format.Add(i.name, i);

            i = new FormatInfo("WhiteBalance", "");

            i.lookup["0"] = "Auto white balance";
            i.lookup["1"] = "Manual white balance";

            format.Add(i.name, i);

            i = new FormatInfo("FlashMode", "");

            i.lookup["0"] = "unknown";
            i.lookup["1"] = "compulsory flash firing";
            i.lookup["2"] = "compulsory flash suppression";
            i.lookup["3"] = "auto mode";

            format.Add(i.name, i);

            i = new FormatInfo("FlashReturn", "");

            i.lookup["0"] = "no strobe return detection";
            i.lookup["2"] = "strobe return light not detected";
            i.lookup["3"] = "strobe return light detected";

            format.Add(i.name, i);

            i = new FormatInfo("FlashFired", "");

            i.lookup["False"] = "Did not fire";
            i.lookup["True"]  = "Fired";

            format.Add(i.name, i);

            i             = new FormatInfo("Orientation", "");
            i.lookup["1"] = "Horizontal";
            i.lookup["2"] = "Mirror horizontal";
            i.lookup["3"] = "Rotate 180°";
            i.lookup["4"] = "Mirror vertical";
            i.lookup["5"] = "Mirror horizontal, rotate 270°";
            i.lookup["6"] = "Rotate 90°";
            i.lookup["7"] = "Mirror horizontal, rotate 90°";
            i.lookup["8"] = "Rotate 270°";

            format.Add(i.name, i);
        }
コード例 #39
0
ファイル: SearchLoockUP.cs プロジェクト: Rukhlov/DataStudio
        public override string GetDisplayText(FormatInfo format, object editValue)
        {
            //string result = NullText;
            //if (m_helper != null)
            //{
            //    result = m_helper.GetDisplayText(editValue, NullText, format.FormatString);
            //}
            //return result;

            string result = base.GetDisplayText(format, editValue);
            if (editValue is IDepartment)
            {
                if (editValue != null && m_helper != null)
                    result = m_helper.GetDisplayText((editValue as IDepartment).FacilityData, NullText, format.FormatString);
            }
            if (editValue is IIdentifyCardType)
            {
                if (editValue != null && m_helper != null)
                    result = m_helper.GetDisplayText((editValue as IIdentifyCardType).DocumentName, NullText, format.FormatString);
            }

            if (editValue is IInsurance)
            {
                if (editValue != null && m_helper != null)
                    result = m_helper.GetDisplayText((editValue as IInsurance).IsuranceName, NullText, format.FormatString);
            }

            if (string.IsNullOrEmpty(result) && editValue != null && m_helper != null)
                result = m_helper.GetDisplayText(editValue, NullText, format.FormatString);
            return result;
        }
コード例 #40
0
 public async Task <bool> Encode(BitmapInfo bitmapInfo, FormatInfo formatInfo, IProgress <ProgressReport> progress)
 {
     // TODO: Get Kanvas to encode the image and update the UI with it.
     return(false);
 }
コード例 #41
0
        public override string GetDisplayText(FormatInfo format, object editValue)
        {
            if (!CultureManager.Instance.ControlsCulture.IsFarsiCulture())
                return base.GetDisplayText(format, editValue);

            return TryFormatEditValue(editValue);
        }
コード例 #42
0
        /// <summary>
        /// Enqueues a frame for presentation.
        /// This method is thread safe and can be called from any thread.
        /// When the texture is presented and not needed anymore, the release callback is called.
        /// It's an error to modify the texture after calling this method, before the release callback is called.
        /// </summary>
        /// <param name="pid">Process ID of the process that owns the texture pointed to by <paramref name="address"/></param>
        /// <param name="address">CPU virtual address of the texture data</param>
        /// <param name="width">Texture width</param>
        /// <param name="height">Texture height</param>
        /// <param name="stride">Texture stride for linear texture, should be zero otherwise</param>
        /// <param name="isLinear">Indicates if the texture is linear, normally false</param>
        /// <param name="gobBlocksInY">GOB blocks in the Y direction, for block linear textures</param>
        /// <param name="format">Texture format</param>
        /// <param name="bytesPerPixel">Texture format bytes per pixel (must match the format)</param>
        /// <param name="crop">Texture crop region</param>
        /// <param name="acquireCallback">Texture acquire callback</param>
        /// <param name="releaseCallback">Texture release callback</param>
        /// <param name="userObj">User defined object passed to the release callback</param>
        /// <exception cref="ArgumentException">Thrown when <paramref name="pid"/> is invalid</exception>
        public void EnqueueFrameThreadSafe(
            long pid,
            ulong address,
            int width,
            int height,
            int stride,
            bool isLinear,
            int gobBlocksInY,
            Format format,
            int bytesPerPixel,
            ImageCrop crop,
            Action <GpuContext, object> acquireCallback,
            Action <object> releaseCallback,
            object userObj)
        {
            if (!_context.PhysicalMemoryRegistry.TryGetValue(pid, out var physicalMemory))
            {
                throw new ArgumentException("The PID is invalid or the process was not registered", nameof(pid));
            }

            FormatInfo formatInfo = new FormatInfo(format, 1, 1, bytesPerPixel, 4);

            TextureInfo info = new TextureInfo(
                0UL,
                width,
                height,
                1,
                1,
                1,
                1,
                stride,
                isLinear,
                gobBlocksInY,
                1,
                1,
                Target.Texture2D,
                formatInfo);

            int size = SizeCalculator.GetBlockLinearTextureSize(
                width,
                height,
                1,
                1,
                1,
                1,
                1,
                bytesPerPixel,
                gobBlocksInY,
                1,
                1).TotalSize;

            MultiRange range = new MultiRange(address, (ulong)size);

            _frameQueue.Enqueue(new PresentationTexture(
                                    physicalMemory.TextureCache,
                                    info,
                                    range,
                                    crop,
                                    acquireCallback,
                                    releaseCallback,
                                    userObj));
        }
コード例 #43
0
ファイル: HtmlFormatter.cs プロジェクト: AArnott/dasblog
        public void Format(string input, TextWriter output, HtmlFormatterOptions options)
        {
            // Determine if we are outputting xhtml
            bool makeXhtml = options.MakeXhtml;

            // Save the max line length
            int maxLineLength = options.MaxLineLength;

            // Make the indent string
            string indentString = new String(options.IndentChar, options.IndentSize);

            char[] chars = input.ToCharArray();
            Stack tagStack = new Stack();
            Stack writerStack = new Stack();

            // The previous begin or end tag that was seen
            FormatInfo previousTag = null;

            // The current begin or end tag that was seen
            FormatInfo currentTag = null;

            // The text between previousTag and currentTag
            string text = String.Empty;

            // True if we've seen whitespace at the end of the last text outputted
            bool sawWhiteSpace = false;

            // True if the last tag seen was self-terminated with a '/>'
            bool sawSelfTerminatingTag = false;

            // True if we saw a tag that we decided not to render
            bool ignoredLastTag = false;

            // Put the initial writer on the stack
            HtmlWriter writer = new HtmlWriter(output, indentString, maxLineLength);
            writerStack.Push(writer);

            Token t = HtmlTokenizer.GetFirstToken(chars);
            Token lastToken = t;

            while (t != null)
            {
                writer = (HtmlWriter)writerStack.Peek();
                switch (t.Type)
                {
                    case Token.AttrName:
                        if (makeXhtml)
                        {
                            string attrName = String.Empty;
                            if (!previousTag.tagInfo.IsXml)
                            {
                                // Need to lowercase the HTML attribute names for XHTML
                                attrName = t.Text.ToLower();
                            }
                            else
                            {
                                attrName = t.Text;
                            }
                            writer.Write(attrName);

                            // If we are trying to be compliant XHTML, don't allow attribute minimization
                            Token nextToken = HtmlTokenizer.GetNextToken(t);
                            if (nextToken.Type != Token.EqualsChar)
                            {
                                writer.Write("=\"" + attrName + "\"");
                            }
                        }
                        else
                        {
                            // Convert the case of the attribute if the tag isn't xml
                            if (!previousTag.tagInfo.IsXml)
                            {
                                if (options.AttributeCasing == HtmlFormatterCase.UpperCase)
                                {
                                    writer.Write(t.Text.ToUpper());
                                }
                                else if (options.AttributeCasing == HtmlFormatterCase.LowerCase)
                                {
                                    writer.Write(t.Text.ToLower());
                                }
                                else
                                {
                                    writer.Write(t.Text);
                                }
                            }
                            else
                            {
                                writer.Write(t.Text);
                            }
                        }
                        break;
                    case Token.AttrVal:
                        if (makeXhtml && (lastToken.Type != Token.DoubleQuote) && (lastToken.Type != Token.SingleQuote))
                        {
                            // If the attribute value isn't quoted, double quote it, replacing the inner double quotes
                            writer.Write('\"');
                            writer.Write(t.Text.Replace("\"", "&quot;"));
                            writer.Write('\"');
                        }
                        else
                        {
                            writer.Write(t.Text);
                        }
                        break;
                    case Token.CloseBracket:
                        if (makeXhtml)
                        {
                            if (ignoredLastTag)
                            {
                                // Don't render the close bracket if we ignored the last tag
                                ignoredLastTag = false;
                            }
                            else
                            {
                                if (sawSelfTerminatingTag && (!previousTag.tagInfo.IsComment))
                                {
                                    // If we saw a self terminating tag, that doesn't have the forward slash, put it in (except for comments)
                                    writer.Write(" />");
                                }
                                else
                                {
                                    // If we are just closing a normal tag, just put in a normal close bracket
                                    writer.Write('>');
                                }
                            }
                        }
                        else
                        {
                            // If there's no XHTML to be made, just put in a normal close bracket
                            writer.Write('>');
                        }
                        break;
                    case Token.DoubleQuote:
                        writer.Write('\"');
                        break;
                    case Token.Empty:
                        break;
                    case Token.EqualsChar:
                        writer.Write('=');
                        break;
                    case Token.Error:
                        if (lastToken.Type == Token.OpenBracket)
                        {
                            // Since we aren't outputting open brackets right away, we might have to output one now
                            writer.Write('<');
                        }
                        writer.Write(t.Text);
                        break;
                    case Token.ForwardSlash:
                    case Token.OpenBracket:
                        // Just push these symbols on the stack for now... output them when we write the tag
                        break;
                    case Token.SelfTerminating:
                        previousTag.isEndTag = true;
                        if (!previousTag.tagInfo.NoEndTag)
                        {
                            // If the tag that is self-terminating is normally not a self-closed tag
                            // then we've placed an entry on the stack for it.  Since it's self terminating, we now need
                            // to pop that item off of the tag stack
                            tagStack.Pop();

                            // If it was a self-closed Xml tag, then we also need to clean up the writerStack
                            if (previousTag.tagInfo.IsXml)
                            {
                                HtmlWriter oldWriter = (HtmlWriter)writerStack.Pop();
                                writer = (HtmlWriter)writerStack.Peek();

                                // Since a self-closed xml tag can't have any text content, we can just write out the formatted contents
                                writer.Write(oldWriter.Content);
                            }
                        }
                        if ((lastToken.Type == Token.Whitespace) && (lastToken.Text.Length > 0))
                        {
                            writer.Write("/>");
                        }
                        else
                        {
                            writer.Write(" />");
                        }
                        break;
                    case Token.SingleQuote:
                        writer.Write('\'');
                        break;
                    case Token.XmlDirective:
                        writer.WriteLineIfNotOnNewLine();
                        writer.Write('<');
                        writer.Write(t.Text);
                        writer.Write('>');
                        writer.WriteLineIfNotOnNewLine();
                        ignoredLastTag = true;
                        break;
                    case Token.TagName:
                    case Token.Comment:
                    case Token.InlineServerScript:
                        string tagName;

                        // Reset the self terminating tag flag
                        sawSelfTerminatingTag = false;

                        // Create or get the proper tagInfo, depending on the type of token
                        TagInfo info;
                        if (t.Type == Token.Comment)
                        {
                            // Handle comment tags
                            tagName = t.Text;
                            info = new TagInfo(t.Text, commentTag);
                        }
                        else if (t.Type == Token.InlineServerScript)
                        {
                            // Handle server-side script tags
                            string script = t.Text.Trim();
                            script = script.Substring(1);
                            tagName = script;
                            if (script.StartsWith("%@"))
                            {
                                // Directives are block tags
                                info = new TagInfo(script, directiveTag);
                            }
                            else
                            {
                                // Other server side script tags aren't
                                info = new TagInfo(script, otherServerSideScriptTag);
                            }
                        }
                        else
                        {
                            // Otherwise, this is a normal tag, and try to get a TagInfo for it
                            tagName = t.Text;
                            info = tagTable[tagName] as TagInfo;
                            if (info == null)
                            {
                                // if we couldn't find one, create a copy of the unknownTag with a new tagname
                                if (tagName.IndexOf(':') > -1)
                                {
                                    // If it is a prefixed tag, it's probably unknown XML
                                    info = new TagInfo(tagName, unknownXmlTag);
                                }
                                else if (writer is XmlWriter)
                                {
                                    info = new TagInfo(tagName, nestedXmlTag);
                                }
                                else
                                {
                                    // If it is a not prefixed, it's probably an unknown HTML tag
                                    info = new TagInfo(tagName, unknownHtmlTag);
                                }
                            }
                            else
                            {
                                // If it's not an unknown tag, converting to the desired case (and leave as is for PreserveCase)
                                if ((options.ElementCasing == HtmlFormatterCase.LowerCase) || makeXhtml)
                                {
                                    tagName = info.TagName;
                                }
                                else if (options.ElementCasing == HtmlFormatterCase.UpperCase)
                                {
                                    tagName = info.TagName.ToUpper();
                                }
                            }
                        }

                        if (previousTag == null)
                        {
                            // Special case for the first tag seen
                            previousTag = new FormatInfo(info, false);
                            // Since this is the first tag, set it's indent to 0
                            previousTag.indent = 0;

                            // Push it on the stack
                            tagStack.Push(previousTag);
                            // And output the preceeding text
                            writer.Write(text);

                            if (info.IsXml)
                            {
                                // When we encounter an xml block, create a new writer to contain the inner content of the xml
                                HtmlWriter newWriter = new XmlWriter(writer.Indent, info.TagName, indentString, maxLineLength);
                                writerStack.Push(newWriter);
                                writer = newWriter;
                            }

                            if (lastToken.Type == Token.ForwardSlash)
                            {
                                // If this is an end tag, output the proper prefix
                                writer.Write("</");
                            }
                            else
                            {
                                writer.Write('<');
                            }
                            // Write the name
                            writer.Write(tagName);
                            // Indicate that we've written out the last text block
                            text = String.Empty;
                        }
                        else
                        {
                            // Put the new tag in the next spot
                            currentTag = new FormatInfo(info, (lastToken.Type == Token.ForwardSlash));

                            WhiteSpaceType whiteSpaceType;
                            if (previousTag.isEndTag)
                            {
                                // If the previous tag is an end tag, we need to check the following whitespace
                                whiteSpaceType = previousTag.tagInfo.FollowingWhiteSpaceType;
                            }
                            else
                            {
                                // otherwise check the initial inner whitespace
                                whiteSpaceType = previousTag.tagInfo.InnerWhiteSpaceType;
                            }

                            // Flag that indicates if the previous tag (before the text) is an inline tag
                            bool inline = previousTag.tagInfo.IsInline;
                            bool emptyXml = false;
                            bool firstOrLastUnknownXmlText = false;

                            if (writer is XmlWriter)
                            {
                                // if we're in an xml block
                                XmlWriter xmlWriter = (XmlWriter)writer;

                                if (xmlWriter.IsUnknownXml)
                                {
                                    // Special case for unknown XML tags
                                    // Determine if this is the first or last xml text in an unknown xml tag, so we know to preserve the text content here
                                    firstOrLastUnknownXmlText = (((previousTag.isBeginTag) && (previousTag.tagInfo.TagName.ToLower() == xmlWriter.TagName.ToLower())) ||
                                        ((currentTag.isEndTag) && (currentTag.tagInfo.TagName.ToLower() == xmlWriter.TagName.ToLower()))) &&
                                        (!FormattedTextWriter.IsWhiteSpace(text));
                                }

                                if (previousTag.isBeginTag)
                                {
                                    if (FormattedTextWriter.IsWhiteSpace(text))
                                    {
                                        if ((xmlWriter.IsUnknownXml) && (currentTag.isEndTag) &&
                                            (previousTag.tagInfo.TagName.ToLower() == currentTag.tagInfo.TagName.ToLower()))
                                        {
                                            // Special case for unknown XML tags:
                                            // If the previous tag is an open tag and the next tag is the corresponding close tag and the text is only whitespace, also
                                            // treat the tag as inline, so the begin and end tag appear on the same line
                                            inline = true;
                                            emptyXml = true;
                                            // Empty the text since we want the open and close tag to be touching
                                            text = "";
                                        }
                                    }
                                    else
                                    {
                                        if (!xmlWriter.IsUnknownXml)
                                        {
                                            // If there is non-whitespace text and we're in a normal Xml block, then remember that there was text
                                            xmlWriter.ContainsText = true;
                                        }
                                    }
                                }
                            }

                            // Flag that indicates if we want to preserve whitespace in the front of the text
                            bool frontWhitespace = true;

                            if ((previousTag.isBeginTag) && (previousTag.tagInfo.PreserveContent))
                            {
                                // If the previous tag is a begin tag and we're preserving the content as-is, just write out the text
                                writer.Write(text);
                            }
                            else
                            {
                                if (whiteSpaceType == WhiteSpaceType.NotSignificant)
                                {
                                    // If the whitespace is not significant in this location
                                    if (!inline && !firstOrLastUnknownXmlText)
                                    {
                                        // If the previous tag is not an inline tag, write out a new line
                                        writer.WriteLineIfNotOnNewLine();
                                        // Since we've written out a newline, we no longer need to preserve front whitespace
                                        frontWhitespace = false;
                                    }
                                }
                                else if (whiteSpaceType == WhiteSpaceType.Significant)
                                {
                                    // If the whitespace in this location is significant
                                    if (FormattedTextWriter.HasFrontWhiteSpace(text))
                                    {
                                        // If there is whitespace in the front, that means we can insert more whitespace without
                                        // changing rendering behavior
                                        if (!inline && !firstOrLastUnknownXmlText)
                                        {
                                            // Only insert a new line if the tag isn't inline
                                            writer.WriteLineIfNotOnNewLine();
                                            frontWhitespace = false;
                                        }
                                    }
                                }
                                else if (whiteSpaceType == WhiteSpaceType.CarryThrough)
                                {
                                    // If the whitespace in this location is carry through (meaning whitespace at the end of the previous
                                    // text block eats up any whitespace in this location
                                    if ((sawWhiteSpace) || (FormattedTextWriter.HasFrontWhiteSpace(text)))
                                    {
                                        // If the last text block ended in whitspace or if there is already whitespace in this location
                                        // we can add a new line
                                        if (!inline && !firstOrLastUnknownXmlText)
                                        {
                                            // Only add it if the previous tag isn't inline
                                            writer.WriteLineIfNotOnNewLine();
                                            frontWhitespace = false;
                                        }
                                    }
                                }

                                if (previousTag.isBeginTag)
                                {
                                    // If the previous tag is a begin tag
                                    if (!previousTag.tagInfo.NoIndent && !inline)
                                    {
                                        // Indent if desired
                                        writer.Indent++;
                                    }
                                }

                                // Special case for unknown XML tags:
                                if (firstOrLastUnknownXmlText)
                                {
                                    writer.Write(text);
                                }
                                else
                                {
                                    writer.WriteLiteral(text, frontWhitespace);
                                }
                            }

                            if (currentTag.isEndTag)
                            {
                                // If the currentTag is an end tag
                                if (!currentTag.tagInfo.NoEndTag)
                                {
                                    // Figure out where the corresponding begin tag is
                                    ArrayList popped = new ArrayList();
                                    FormatInfo formatInfo = null;

                                    bool foundOpenTag = false;

                                    bool allowPartial = false;
                                    if ((currentTag.tagInfo.Flags & FormattingFlags.AllowPartialTags) != 0)
                                    {
                                        // Once we've exited a tag that allows partial tags, clear the flag
                                        allowPartial = true;
                                    }

                                    // Start popping off the tag stack if there are tags on the stack
                                    if (tagStack.Count > 0)
                                    {
                                        // Keep popping until we find the right tag, remember what we've popped off
                                        formatInfo = (FormatInfo)tagStack.Pop();
                                        popped.Add(formatInfo);
                                        while ((tagStack.Count > 0) && (formatInfo.tagInfo.TagName.ToLower() != currentTag.tagInfo.TagName.ToLower()))
                                        {
                                            if ((formatInfo.tagInfo.Flags & FormattingFlags.AllowPartialTags) != 0)
                                            {
                                                // Special case for tags that allow partial tags inside of them.
                                                allowPartial = true;
                                                break;
                                            }
                                            formatInfo = (FormatInfo)tagStack.Pop();
                                            popped.Add(formatInfo);
                                        }

                                        if (formatInfo.tagInfo.TagName.ToLower() != currentTag.tagInfo.TagName.ToLower())
                                        {
                                            // If we didn't find the corresponding open tag, push everything back on
                                            for (int i = popped.Count - 1; i >= 0; i--)
                                            {
                                                tagStack.Push(popped[i]);
                                            }
                                        }
                                        else
                                        {
                                            foundOpenTag = true;
                                            for (int i = 0; i < popped.Count - 1; i++)
                                            {
                                                FormatInfo fInfo = (FormatInfo)popped[i];
                                                if (fInfo.tagInfo.IsXml)
                                                {
                                                    // If we have an xml tag that was unclosed, we need to clean up the xml stack
                                                    if (writerStack.Count > 1)
                                                    {
                                                        HtmlWriter oldWriter = (HtmlWriter)writerStack.Pop();
                                                        writer = (HtmlWriter)writerStack.Peek();
                                                        // Write out the contents of the old writer
                                                        writer.Write(oldWriter.Content);
                                                    }
                                                }

                                                if (!fInfo.tagInfo.NoEndTag)
                                                {
                                                    writer.WriteLineIfNotOnNewLine();
                                                    writer.Indent = fInfo.indent;
                                                    if ((makeXhtml) && (!allowPartial))
                                                    {
                                                        // If we're trying to be XHTML compliant, close unclosed child tags
                                                        // Don't close if we are under a tag that allows partial tags
                                                        writer.Write("</"+fInfo.tagInfo.TagName+">");
                                                    }
                                                }
                                            }

                                            // Set the indent to the indent of the corresponding open tag
                                            writer.Indent = formatInfo.indent;
                                        }
                                    }
                                    if (foundOpenTag || allowPartial)
                                    {
                                        // Only write out the close tag if there was a corresponding open tag or we are under
                                        // a tag that allows partial tags
                                        if ((!emptyXml) &&
                                            (!firstOrLastUnknownXmlText) &&
                                            (!currentTag.tagInfo.IsInline) &&
                                            (!currentTag.tagInfo.PreserveContent) &&
                                            (  FormattedTextWriter.IsWhiteSpace(text) ||
                                            FormattedTextWriter.HasBackWhiteSpace(text) ||
                                            (currentTag.tagInfo.FollowingWhiteSpaceType == WhiteSpaceType.NotSignificant)
                                            ) &&
                                            (  !(currentTag.tagInfo is TDTagInfo) ||
                                            FormattedTextWriter.HasBackWhiteSpace(text)
                                            )
                                            )
                                        {
                                            // Insert a newline before the next tag, if allowed
                                            writer.WriteLineIfNotOnNewLine();
                                        }
                                        // Write out the end tag prefix
                                        writer.Write("</");
                                        // Finally, write out the tag name
                                        writer.Write(tagName);
                                    }
                                    else
                                    {
                                        ignoredLastTag = true;
                                    }

                                    if (currentTag.tagInfo.IsXml)
                                    {
                                        // If we have an xml tag that was unclosed, we need to clean up the xml stack
                                        if (writerStack.Count > 1)
                                        {
                                            HtmlWriter oldWriter = (HtmlWriter)writerStack.Pop();
                                            writer = (HtmlWriter)writerStack.Peek();
                                            // Write out the contents of the old writer
                                            writer.Write(oldWriter.Content);
                                        }
                                    }
                                }
                                else
                                {
                                    ignoredLastTag = true;
                                }
                            }
                            else
                            {
                                // If the currentTag is a begin tag
                                bool done = false;
                                // Close implicitClosure tags
                                while (!done && (tagStack.Count > 0))
                                {
                                    // Peek at the top of the stack to see the last unclosed tag
                                    FormatInfo fInfo = (FormatInfo)tagStack.Peek();
                                    // If the currentTag can't be a child of that tag, then we need to close that tag
                                    done = fInfo.tagInfo.CanContainTag(currentTag.tagInfo);
                                    if (!done)
                                    {
                                        // Pop it off and write a close tag for it
                                        // REVIEW: Will XML tags always be able to contained in any tag?  If not we should be cleaning up the writerStack as well...
                                        tagStack.Pop();
                                        writer.Indent = fInfo.indent;
                                        // If we're trying to be XHTML compliant, write in the end tags
                                        if (makeXhtml)
                                        {
                                            if (!fInfo.tagInfo.IsInline)
                                            {
                                                // Only insert a newline if we are allowed to
                                                writer.WriteLineIfNotOnNewLine();
                                            }
                                            writer.Write("</"+fInfo.tagInfo.TagName+">");
                                        }
                                    }
                                }

                                // Remember the indent so we can properly indent the corresponding close tag for this open tag
                                currentTag.indent = writer.Indent;

                                if ((!firstOrLastUnknownXmlText) &&
                                    (!currentTag.tagInfo.IsInline) &&
                                    (!currentTag.tagInfo.PreserveContent) &&
                                    ( (FormattedTextWriter.IsWhiteSpace(text) || FormattedTextWriter.HasBackWhiteSpace(text)) ||
                                    (  (text.Length == 0) &&
                                    (  ((previousTag.isBeginTag) && (previousTag.tagInfo.InnerWhiteSpaceType == WhiteSpaceType.NotSignificant)) ||
                                    ((previousTag.isEndTag) && (previousTag.tagInfo.FollowingWhiteSpaceType == WhiteSpaceType.NotSignificant))
                                    )
                                    )
                                    )
                                    )
                                {
                                    // Insert a newline before the currentTag if we are allowed to
                                    writer.WriteLineIfNotOnNewLine();
                                }

                                if (!currentTag.tagInfo.NoEndTag)
                                {
                                    // Only push tags with close tags onto the stack
                                    tagStack.Push(currentTag);
                                }
                                else
                                {
                                    // If this tag doesn't have a close tag, remember that it is self terminating
                                    sawSelfTerminatingTag = true;
                                }

                                if (currentTag.tagInfo.IsXml)
                                {
                                    // When we encounter an xml block, create a new writer to contain the inner content of the xml
                                    HtmlWriter newWriter = new XmlWriter(writer.Indent, currentTag.tagInfo.TagName, indentString, maxLineLength);
                                    writerStack.Push(newWriter);
                                    writer = newWriter;
                                }

                                writer.Write('<');
                                // Finally, write out the tag name
                                writer.Write(tagName);
                            }

                            // Remember if the text ended in whitespace
                            sawWhiteSpace = FormattedTextWriter.HasBackWhiteSpace(text);

                            // Clear out the text, since we have already outputted it
                            text = String.Empty;

                            previousTag = currentTag;
                        }
                        break;
                    case Token.ServerScriptBlock:
                    case Token.ClientScriptBlock:
                    case Token.Style:
                    case Token.TextToken:
                        // Remember all these types of tokens as text so we can output them between the tags
                        if (makeXhtml)
                        {
                            // UNDONE: Need to implement this in the tokenizer, etc...
                            text += t.Text.Replace("&nbsp;", "&#160;");
                        }
                        else
                        {
                            text += t.Text;
                        }
                        break;
                    case Token.Whitespace:
                        if (t.Text.Length > 0)
                        {
                            writer.Write(' ');
                        }
                        break;
                    default:
                        Debug.Fail("Invalid token type!");
                        break;
                }
                // Remember what the last token was
                lastToken = t;

                // Get the next token
                t = HtmlTokenizer.GetNextToken(t);
            }

            if (text.Length > 0)
            {
                // Write out the last text if there is any
                writer.Write(text);
            }

            while (writerStack.Count > 1)
            {
                // If we haven't cleared out the writer stack, do it
                HtmlWriter oldWriter = (HtmlWriter)writerStack.Pop();
                writer = (HtmlWriter)writerStack.Peek();
                writer.Write(oldWriter.Content);
            }

            // Flush the writer original
            writer.Flush();
        }
コード例 #44
0
        /// <summary>
        /// Performs the blit operation, triggered by the register write.
        /// </summary>
        /// <param name="argument">Method call argument</param>
        private void PixelsFromMemorySrcY0Int(int argument)
        {
            var memoryManager = _channel.MemoryManager;

            var dstCopyTexture = Unsafe.As <uint, TwodTexture>(ref _state.State.SetDstFormat);
            var srcCopyTexture = Unsafe.As <uint, TwodTexture>(ref _state.State.SetSrcFormat);

            long srcX = ((long)_state.State.SetPixelsFromMemorySrcX0Int << 32) | (long)(ulong)_state.State.SetPixelsFromMemorySrcX0Frac;
            long srcY = ((long)_state.State.PixelsFromMemorySrcY0Int << 32) | (long)(ulong)_state.State.SetPixelsFromMemorySrcY0Frac;

            long duDx = ((long)_state.State.SetPixelsFromMemoryDuDxInt << 32) | (long)(ulong)_state.State.SetPixelsFromMemoryDuDxFrac;
            long dvDy = ((long)_state.State.SetPixelsFromMemoryDvDyInt << 32) | (long)(ulong)_state.State.SetPixelsFromMemoryDvDyFrac;

            bool originCorner = _state.State.SetPixelsFromMemorySampleModeOrigin == SetPixelsFromMemorySampleModeOrigin.Corner;

            if (originCorner)
            {
                // If the origin is corner, it is assumed that the guest API
                // is manually centering the origin by adding a offset to the
                // source region X/Y coordinates.
                // Here we attempt to remove such offset to ensure we have the correct region.
                // The offset is calculated as FactorXY / 2.0, where FactorXY = SrcXY / DstXY,
                // so we do the same here by dividing the fixed point value by 2, while
                // throwing away the fractional part to avoid rounding errors.
                srcX -= (duDx >> 33) << 32;
                srcY -= (dvDy >> 33) << 32;
            }

            int srcX1 = (int)(srcX >> 32);
            int srcY1 = (int)(srcY >> 32);

            int srcX2 = srcX1 + (int)((duDx * _state.State.SetPixelsFromMemoryDstWidth + uint.MaxValue) >> 32);
            int srcY2 = srcY1 + (int)((dvDy * _state.State.SetPixelsFromMemoryDstHeight + uint.MaxValue) >> 32);

            int dstX1 = (int)_state.State.SetPixelsFromMemoryDstX0;
            int dstY1 = (int)_state.State.SetPixelsFromMemoryDstY0;

            int dstX2 = dstX1 + (int)_state.State.SetPixelsFromMemoryDstWidth;
            int dstY2 = dstY1 + (int)_state.State.SetPixelsFromMemoryDstHeight;

            // The source and destination textures should at least be as big as the region being requested.
            // The hints will only resize within alignment constraints, so out of bound copies won't resize in most cases.
            var srcHint = new Size(srcX2, srcY2, 1);
            var dstHint = new Size(dstX2, dstY2, 1);

            var srcCopyTextureFormat = srcCopyTexture.Format.Convert();

            int srcWidthAligned = srcCopyTexture.Stride / srcCopyTextureFormat.BytesPerPixel;

            ulong offset = 0;

            // For an out of bounds copy, we must ensure that the copy wraps to the next line,
            // so for a copy from a 64x64 texture, in the region [32, 96[, there are 32 pixels that are
            // outside the bounds of the texture. We fill the destination with the first 32 pixels
            // of the next line on the source texture.
            // This can be done by simply adding an offset to the texture address, so that the initial
            // gap is skipped and the copy is inside bounds again.
            // This is required by the proprietary guest OpenGL driver.
            if (srcCopyTexture.LinearLayout && srcCopyTexture.Width == srcX2 && srcX2 > srcWidthAligned && srcX1 > 0)
            {
                offset = (ulong)(srcX1 * srcCopyTextureFormat.BytesPerPixel);
                srcCopyTexture.Width -= srcX1;
                srcX2 -= srcX1;
                srcX1  = 0;
            }

            FormatInfo dstCopyTextureFormat = dstCopyTexture.Format.Convert();

            bool canDirectCopy = GraphicsConfig.Fast2DCopy &&
                                 srcX2 == dstX2 && srcY2 == dstY2 &&
                                 IsDataCompatible(srcCopyTexture, dstCopyTexture, srcCopyTextureFormat, dstCopyTextureFormat) &&
                                 IsCopyRegionComplete(srcCopyTexture, srcCopyTextureFormat, srcX1, srcY1, srcX2, srcY2) &&
                                 IsCopyRegionComplete(dstCopyTexture, dstCopyTextureFormat, dstX1, dstY1, dstX2, dstY2);

            var srcTexture = memoryManager.Physical.TextureCache.FindOrCreateTexture(
                memoryManager,
                srcCopyTexture,
                offset,
                srcCopyTextureFormat,
                !canDirectCopy,
                false,
                srcHint);

            if (srcTexture == null)
            {
                if (canDirectCopy)
                {
                    // Directly copy the data on CPU.
                    UnscaledFullCopy(srcCopyTexture, dstCopyTexture, srcX2, srcY2, srcCopyTextureFormat.BytesPerPixel);
                }

                return;
            }

            memoryManager.Physical.TextureCache.Lift(srcTexture);

            // When the source texture that was found has a depth format,
            // we must enforce the target texture also has a depth format,
            // as copies between depth and color formats are not allowed.

            if (srcTexture.Format.IsDepthOrStencil())
            {
                dstCopyTextureFormat = srcTexture.Info.FormatInfo;
            }
            else
            {
                dstCopyTextureFormat = dstCopyTexture.Format.Convert();
            }

            var dstTexture = memoryManager.Physical.TextureCache.FindOrCreateTexture(
                memoryManager,
                dstCopyTexture,
                0,
                dstCopyTextureFormat,
                true,
                srcTexture.ScaleMode == TextureScaleMode.Scaled,
                dstHint);

            if (dstTexture == null)
            {
                return;
            }

            float scale    = srcTexture.ScaleFactor;
            float dstScale = dstTexture.ScaleFactor;

            Extents2D srcRegion = new Extents2D(
                (int)Math.Ceiling(scale * (srcX1 / srcTexture.Info.SamplesInX)),
                (int)Math.Ceiling(scale * (srcY1 / srcTexture.Info.SamplesInY)),
                (int)Math.Ceiling(scale * (srcX2 / srcTexture.Info.SamplesInX)),
                (int)Math.Ceiling(scale * (srcY2 / srcTexture.Info.SamplesInY)));

            Extents2D dstRegion = new Extents2D(
                (int)Math.Ceiling(dstScale * (dstX1 / dstTexture.Info.SamplesInX)),
                (int)Math.Ceiling(dstScale * (dstY1 / dstTexture.Info.SamplesInY)),
                (int)Math.Ceiling(dstScale * (dstX2 / dstTexture.Info.SamplesInX)),
                (int)Math.Ceiling(dstScale * (dstY2 / dstTexture.Info.SamplesInY)));

            bool linearFilter = _state.State.SetPixelsFromMemorySampleModeFilter == SetPixelsFromMemorySampleModeFilter.Bilinear;

            srcTexture.HostTexture.CopyTo(dstTexture.HostTexture, srcRegion, dstRegion, linearFilter);

            dstTexture.SignalModified();
        }