예제 #1
0
 static void loadCursors()
 {
     //Load cursors
     XCursor.Cross   = XCursorFile.Load("#Crow.Images.Icons.Cursors.cross").Cursors[0];
     XCursor.Default = XCursorFile.Load("#Crow.Images.Icons.Cursors.arrow").Cursors[0];
     XCursor.NW      = XCursorFile.Load("#Crow.Images.Icons.Cursors.top_left_corner").Cursors[0];
     XCursor.NE      = XCursorFile.Load("#Crow.Images.Icons.Cursors.top_right_corner").Cursors[0];
     XCursor.SW      = XCursorFile.Load("#Crow.Images.Icons.Cursors.bottom_left_corner").Cursors[0];
     XCursor.SE      = XCursorFile.Load("#Crow.Images.Icons.Cursors.bottom_right_corner").Cursors[0];
     XCursor.H       = XCursorFile.Load("#Crow.Images.Icons.Cursors.sb_h_double_arrow").Cursors[0];
     XCursor.V       = XCursorFile.Load("#Crow.Images.Icons.Cursors.sb_v_double_arrow").Cursors[0];
     XCursor.Text    = XCursorFile.Load("#Crow.Images.Icons.Cursors.ibeam").Cursors[0];
 }
예제 #2
0
        static XCursorFile loadFromStream(Stream s)
        {
            List <toc>  tocList = new List <toc> ();
            XCursorFile tmp     = new XCursorFile();

            using (BinaryReader sr = new BinaryReader(s)) {
                byte[] data;
                //magic: CARD32 ’Xcur’ (0x58, 0x63, 0x75, 0x72)
                if (new string (sr.ReadChars(4)) != "Xcur")
                {
                    Debug.WriteLine("XCursor Load error: Wrong magic");
                    return(null);
                }
                //header: CARD32 bytes in this header
                uint headerLength = sr.ReadUInt32();
                //version: CARD32 file version number
                uint version = sr.ReadUInt32();
                //ntoc: CARD32 number of toc entries
                uint nbToc = sr.ReadUInt32();
                //toc: LISTofTOC table of contents
                for (uint i = 0; i < nbToc; i++)
                {
                    tocList.Add(new toc(sr));
                }

                foreach (toc t in tocList)
                {
                    if (t.type != XC_TYPE_IMG)
                    {
                        continue;
                    }

                    sr.BaseStream.Seek(t.pos, SeekOrigin.Begin);
                    tmp.Cursors.Add(imageLoad(sr));
                }
            }
            return(tmp);
        }
예제 #3
0
파일: XCursor.cs 프로젝트: jpbruyere/Crow
        static XCursorFile loadFromStream(Stream s)
        {
            List<toc> tocList = new List<toc> ();
            XCursorFile tmp = new XCursorFile ();

            using (BinaryReader sr = new BinaryReader (s)) {
                byte[] data;
                //magic: CARD32 ’Xcur’ (0x58, 0x63, 0x75, 0x72)
                if (new string (sr.ReadChars (4)) != "Xcur") {
                    Debug.WriteLine ("XCursor Load error: Wrong magic");
                    return null;
                }
                //header: CARD32 bytes in this header
                uint headerLength = sr.ReadUInt32 ();
                //version: CARD32 file version number
                uint version = sr.ReadUInt32 ();
                //ntoc: CARD32 number of toc entries
                uint nbToc = sr.ReadUInt32 ();
                //toc: LISTofTOC table of contents
                for (uint i = 0; i < nbToc; i++) {
                    tocList.Add (new toc (sr));
                }

                foreach (toc t in tocList) {
                    if (t.type != XC_TYPE_IMG)
                        continue;

                    sr.BaseStream.Seek (t.pos, SeekOrigin.Begin);
                    tmp.Cursors.Add(imageLoad (sr));
                }
            }
            return tmp;
        }