示例#1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string uid = Request.QueryString["uid"];
            string cbk = Request.QueryString["callback"];

            if (string.IsNullOrEmpty(uid))
            {
                this.toContentJson(cbk + "({\"value\":null})");
                return;
            }

            DBConfig cfg  = new DBConfig();
            DnFile   db   = cfg.downF();
            string   json = db.all_uncmp(int.Parse(uid));

            if (!string.IsNullOrEmpty(json))
            {
                json = HttpUtility.UrlEncode(json);
                json = json.Replace("+", "%20");
                json = cbk + "({\"value\":\"" + json + "\"})";
            }
            else
            {
                json = cbk + "({\"value\":null})";
            };

            this.toContentJson(json);
        }
示例#2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string fid    = Request.QueryString["id"];
            string uid    = Request.QueryString["uid"];
            string lenLoc = Request.QueryString["lenLoc"];
            string per    = Request.QueryString["perLoc"];
            string cbk    = Request.QueryString["callback"];

            //

            if (string.IsNullOrEmpty(uid) ||
                string.IsNullOrEmpty(fid) ||
                string.IsNullOrEmpty(cbk))
            {
                this.toContent(cbk + "({\"value\":0})", "application/json");
                return;
            }

            DBConfig cfg = new DBConfig();
            DnFile   db  = cfg.downF();

            db.process(fid, int.Parse(uid), lenLoc, per);

            this.toContent(cbk + "({\"value\":1})", "application/json");
        }
示例#3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string uid = Request.QueryString["uid"];
            string cbk = Request.QueryString["callback"];

            if (string.IsNullOrEmpty(uid))
            {
                Response.Write(cbk + "({\"value\":null})");
                Response.End();
                return;
            }

            DnFile df   = new DnFile();
            string json = df.all_uncmp(int.Parse(uid));

            if (!string.IsNullOrEmpty(json))
            {
                json = HttpUtility.UrlEncode(json);
                json = json.Replace("+", "%20");
                json = cbk + "({\"value\":\"" + json + "\"})";
            }
            else
            {
                json = cbk + "({\"value\":null})";
            };

            Response.Write(json);
        }
示例#4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string fid     = Request.QueryString["id"];
            string uid     = Request.QueryString["uid"];
            string sizeLoc = Request.QueryString["sizeLoc"];
            string per     = Request.QueryString["perLoc"];
            string cbk     = Request.QueryString["callback"];

            per     = PathTool.url_decode(per);
            sizeLoc = PathTool.url_decode(sizeLoc);
            //
            if (string.IsNullOrEmpty(fid) ||
                string.IsNullOrEmpty(cbk) ||
                string.IsNullOrEmpty(sizeLoc))
            {
                Response.Write(cbk + "({\"value\":0})");
                Response.End();
                return;
            }

            DnFile db = new DnFile();

            db.process(fid, int.Parse(uid), sizeLoc, per);

            Response.Write(cbk + "({\"value\":1})");
        }
示例#5
0
        void file_proc()
        {
            string fid    = Request.QueryString["id"];
            string uid    = Request.QueryString["uid"];
            string lenLoc = Request.QueryString["lenLoc"];
            string per    = Request.QueryString["perLoc"];
            string cbk    = Request.QueryString["callback"];

            //

            if (string.IsNullOrEmpty(uid) ||
                string.IsNullOrEmpty(fid) ||
                string.IsNullOrEmpty(cbk) ||
                string.IsNullOrEmpty(lenLoc))
            {
                Response.Write(cbk + "({\"value\":0})");
                Response.End();
                return;
            }

            DnFile db = new DnFile();

            db.process(fid, int.Parse(uid), lenLoc, per);

            PageTool.to_content(cbk + "({\"value\":1})");
        }
示例#6
0
        public void Create(string filePath)
        {
            for (int i = 0; i < PHY_MAX; i++)
            {
                _arrPhy[i] = null;
            }

            int          fileSize = 0;
            FileStream   fs       = DnFile.GetFileStream(filePath, out fileSize);
            BinaryReader br       = new BinaryReader(fs);

            int nOffset = DnFile.C3_HEADER_SIZE;

            while (nOffset < fileSize)
            {
                ChunkHeader ch = new ChunkHeader(br);
                nOffset += ChunkHeader.SIZE_BYTE;
                if (ch.IsPhyFile())
                {
                    C3Phy phy = new C3Phy();
                    phy.Load(br);
                    _arrPhy[_phyNum++] = new C3Phy();
                }
                else
                {
                    br.BaseStream.Seek(ch.chunkSize, SeekOrigin.Current);
                }
                nOffset += (int)ch.chunkSize;
            }
        }
示例#7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string uid     = Request.QueryString["uid"];
            string id      = Request.QueryString["id"];
            string f_id    = Request.QueryString["f_id"];
            string nameLoc = Request.QueryString["nameLoc"]; //客户端使用的是encodeURIComponent编码,
            string pathLoc = Request.QueryString["pathLoc"]; //客户端使用的是encodeURIComponent编码,
            string fileUrl = Request.QueryString["fileUrl"];
            string lenSvr  = Request.QueryString["lenSvr"];
            string sizeSvr = Request.QueryString["sizeSvr"];
            string cbk     = Request.QueryString["callback"]; //应用于jsonp数据

            pathLoc = PathTool.url_decode(pathLoc);
            nameLoc = PathTool.url_decode(nameLoc);

            if (string.IsNullOrEmpty(uid) ||
                string.IsNullOrEmpty(pathLoc) ||
                string.IsNullOrEmpty(fileUrl) ||
                string.IsNullOrEmpty(lenSvr))
            {
                Response.Write(cbk + "({\"value\":null})");
                Response.End();
                return;
            }

            DnFileInf inf = new DnFileInf();

            inf.id      = id;
            inf.f_id    = f_id;
            inf.uid     = int.Parse(uid);
            inf.nameLoc = nameLoc;
            inf.pathLoc = pathLoc;//记录本地存储位置
            inf.fileUrl = fileUrl;
            inf.lenSvr  = long.Parse(lenSvr);
            inf.sizeSvr = sizeSvr;

            DnFile df = new DnFile();

            df.Add(ref inf);

            string json = JsonConvert.SerializeObject(inf);

            json = HttpUtility.UrlEncode(json);
            json = json.Replace("+", "%20");
            json = cbk + "({\"value\":\"" + json + "\"})";//返回jsonp格式数据。
            Response.Write(json);
        }
示例#8
0
        public C3Texture(string path, int mipLevel = 3, int colorKey = 0)
        {
            filePath = path;
            int size = 0;

            byte [] fileBytes = DnFile.GetFileBytes(path, out size); //从内存中查找
            if (fileBytes != null)
            {
                texture = Texture.FromMemory(Core.Device, fileBytes, 0, 0, mipLevel, Usage.None, Format.Unknown
                                             , Pool.Managed, Filter.Linear, Filter.Linear, colorKey, out imageInfo);
            }
            else
            {
                texture = Texture.FromFile(Core.Device, path, 0, 0, mipLevel, Usage.None, Format.Unknown
                                           , Pool.Managed, Filter.Linear, Filter.Linear, colorKey, out imageInfo);
            }
        }
示例#9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string uid = Request.QueryString["uid"];
            string id  = Request.QueryString["id"];
            string cbk = Request.QueryString["callback"];

            if (string.IsNullOrEmpty(uid) ||
                string.IsNullOrEmpty(id))
            {
                Response.Write(cbk + "(0)");
                return;
            }

            DnFile d = new DnFile();

            d.Delete(id, int.Parse(uid));

            Response.Write(cbk + "(1)");
        }
示例#10
0
        void file_del()
        {
            string fid = Request.QueryString["id"];
            string uid = Request.QueryString["uid"];
            string cbk = Request.QueryString["callback"];

            if (string.IsNullOrEmpty(uid) ||
                string.IsNullOrEmpty(fid))
            {
                Response.Write(cbk + "({\"value\":null})");
                return;
            }

            DnFile db = new DnFile();

            db.Delete(fid, int.Parse(uid));

            PageTool.to_content(cbk + "({\"value\":1})");
        }
示例#11
0
        void file_init()
        {
            string id      = Request.QueryString["id"];
            string uid     = Request.QueryString["uid"];
            string fdTask  = Request.QueryString["fdTask"];
            string nameLoc = Request.QueryString["nameLoc"]; //客户端使用的是encodeURIComponent编码,
            string pathLoc = Request.QueryString["pathLoc"]; //客户端使用的是encodeURIComponent编码,
            string lenSvr  = Request.QueryString["lenSvr"];
            string sizeSvr = Request.QueryString["sizeSvr"];
            string cbk     = Request.QueryString["callback"]; //应用于jsonp数据

            pathLoc = HttpUtility.UrlDecode(pathLoc);         //utf-8解码
            nameLoc = HttpUtility.UrlDecode(nameLoc);
            sizeSvr = HttpUtility.UrlDecode(sizeSvr);

            if (string.IsNullOrEmpty(uid) ||
                string.IsNullOrEmpty(pathLoc) ||
                string.IsNullOrEmpty(lenSvr))
            {
                Response.Write(cbk + "({\"value\":null})");
                Response.End();
                return;
            }

            down2.model.DnFileInf inf = new down2.model.DnFileInf();
            inf.id      = id;
            inf.uid     = int.Parse(uid);
            inf.nameLoc = nameLoc;
            inf.pathLoc = pathLoc;//记录本地存储位置
            inf.lenSvr  = long.Parse(lenSvr);
            inf.sizeSvr = sizeSvr;
            inf.fdTask  = fdTask == "1";
            DnFile db = new DnFile();

            db.Add(ref inf);

            string json = JsonConvert.SerializeObject(inf);

            json = HttpUtility.UrlEncode(json);
            json = json.Replace("+", "%20");
            json = cbk + "({\"value\":\"" + json + "\"})";//返回jsonp格式数据。
            PageTool.to_content(json);
        }
示例#12
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string id      = Request.QueryString["id"];
            string uid     = Request.QueryString["uid"];
            string fdTask  = Request.QueryString["fdTask"];
            string nameLoc = Request.QueryString["nameLoc"]; //客户端使用的是encodeURIComponent编码,
            string pathLoc = Request.QueryString["pathLoc"]; //客户端使用的是encodeURIComponent编码,
            string lenSvr  = Request.QueryString["lenSvr"];
            string sizeSvr = Request.QueryString["sizeSvr"];
            string cbk     = Request.QueryString["callback"]; //应用于jsonp数据

            pathLoc = HttpUtility.UrlDecode(pathLoc);         //utf-8解码
            nameLoc = HttpUtility.UrlDecode(nameLoc);
            sizeSvr = HttpUtility.UrlDecode(sizeSvr);

            if (string.IsNullOrEmpty(uid) ||
                string.IsNullOrEmpty(pathLoc) ||
                string.IsNullOrEmpty(lenSvr))
            {
                this.toContentJson(cbk + "({\"value\":null})");
                return;
            }

            model.DnFileInf inf = new model.DnFileInf();
            inf.id      = id;
            inf.uid     = int.Parse(uid);
            inf.nameLoc = nameLoc;
            inf.pathLoc = pathLoc;//记录本地存储位置
            inf.lenSvr  = long.Parse(lenSvr);
            inf.sizeSvr = sizeSvr;
            inf.fdTask  = fdTask == "1";
            DBConfig cfg = new DBConfig();
            DnFile   db  = cfg.downF();

            db.Add(ref inf);

            string json = JsonConvert.SerializeObject(inf);

            json = HttpUtility.UrlEncode(json);
            json = json.Replace("+", "%20");
            json = cbk + "({\"value\":\"" + json + "\"})";//返回jsonp格式数据。
            this.toContentJson(json);
        }
示例#13
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string fid = Request.QueryString["id"];
            string uid = Request.QueryString["uid"];
            string cbk = Request.QueryString["callback"];

            if (string.IsNullOrEmpty(uid) ||
                string.IsNullOrEmpty(fid))
            {
                this.toContentJson(cbk + "({\"value\":null})");
                return;
            }

            DBConfig cfg = new DBConfig();
            DnFile   db  = cfg.downF();

            db.Delete(fid, int.Parse(uid));

            this.toContentJson(cbk + "({\"value\":1})");
        }
示例#14
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string uid = Request.QueryString["uid"];
            string cbk = Request.QueryString["callback"];//jsonp

            if (!string.IsNullOrEmpty(uid))
            {
                DnFile db   = new DnFile();
                string json = db.all_complete(int.Parse(uid));
                if (!string.IsNullOrEmpty(json))
                {
                    System.Diagnostics.Debug.WriteLine(json);
                    json = HttpUtility.UrlEncode(json);
                    //UrlEncode会将空格解析成+号
                    json = json.Replace("+", "%20");
                    Response.Write(cbk + "({\"value\":\"" + json + "\"})");
                    return;
                }
            }
            Response.Write(cbk + "({\"value\":null})");
        }
示例#15
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string uid     = Request.QueryString["uid"];
            string cbk     = Request.QueryString["callback"];
            string id      = Request.QueryString["id"];
            string nameLoc = Request.QueryString["nameLoc"];
            string pathLoc = Request.QueryString["pathLoc"];
            string sizeSvr = Request.QueryString["sizeSvr"];

            sizeSvr = PathTool.url_decode(sizeSvr);
            pathLoc = PathTool.url_decode(pathLoc);
            nameLoc = PathTool.url_decode(nameLoc);

            if (string.IsNullOrEmpty(uid) ||
                string.IsNullOrEmpty(nameLoc) ||
                string.IsNullOrEmpty(pathLoc)
                )
            {
                Response.Write(cbk + "(0)");
                return;
            }

            DnFileInf fd = new DnFileInf();

            fd.nameLoc = nameLoc;
            fd.pathLoc = pathLoc;
            fd.id      = id;
            fd.sizeSvr = sizeSvr;
            fd.fdTask  = true;
            DnFile db = new DnFile();

            db.Add(ref fd);

            string json = JsonConvert.SerializeObject(fd);

            json = HttpUtility.UrlEncode(json);
            json = json.Replace("+", "%20");
            json = cbk + "({\"value\":\"" + json + "\"})";//返回jsonp格式数据。
            Response.Write(json);
        }
示例#16
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string uid = this.reqStringSafe("uid");
            string cbk = this.reqStringSafe("callback");//jsonp

            if (!string.IsNullOrEmpty(uid))
            {
                DBConfig cfg  = new DBConfig();
                DnFile   db   = cfg.downF();
                string   json = db.all_complete(int.Parse(uid));
                if (!string.IsNullOrEmpty(json))
                {
                    System.Diagnostics.Debug.WriteLine(json);
                    json = HttpUtility.UrlEncode(json);
                    //UrlEncode会将空格解析成+号
                    json = json.Replace("+", "%20");
                    this.toContent(cbk + "({\"value\":\"" + json + "\"})", "application/json");
                    return;
                }
            }
            this.toContent(cbk + "({\"value\":null})", "application/json");
        }
示例#17
0
        static void Main()
        {
            var form = new RenderForm("SlimDX - MiniTri Direct3D9 Sample");

            //var device = new Device(new Direct3D(), 0, DeviceType.Hardware, form.Handle, CreateFlags.HardwareVertexProcessing, new PresentParameters()
            //{
            //    BackBufferWidth = form.ClientSize.Width,
            //    BackBufferHeight = form.ClientSize.Height
            //});
            Core.CreateDevice(form);
            C3Sprite sprite = null;

            if (DnFile.OpenDnpFile("c3.dnp"))
            {
                C3DObj obj = new C3DObj();
                obj.Create("c3/mesh/002137040.c3");

                DnFile.CloseDnpFile("c3.dnp");
                C3Texture texture = new C3Texture("c3/texture/001000000.dds");
                sprite = new C3Sprite(texture);
            }

            var vertices = new VertexBuffer(Core.Device, 4 * 16, Usage.WriteOnly, VertexFormat.None, Pool.Managed);

            vertices.Lock(0, 0, LockFlags.None).WriteRange(new[] {
                //new Vertex() { Color = Color.Red.ToArgb(), Position = new Vector4(100.0f, 100.0f, 0.5f, 1.0f) },
                //new Vertex() { Color = Color.Blue.ToArgb(), Position = new Vector4(550.0f, 100.0f, 0.5f, 1.0f) },
                //new Vertex() { Color = Color.Green.ToArgb(), Position = new Vector4(350.0f, 500.0f, 0.5f, 1.0f) },
                ////new Vertex() { Color = Color.Blue.ToArgb(), Position = new Vector4(550.0f, 100.0f, 0.5f, 1.0f) },
                //new Vertex() { Color = Color.Green.ToArgb(), Position = new Vector4(450.0f, 500.0f, 0.5f, 1.0f) },
                //new Vertex() { Color = Color.Green.ToArgb(), Position = new Vector4(350.0f, 300.0f, 0.5f, 1.0f) }
                new Vertex()
                {
                    Color = Color.Red.ToArgb(), Position = new Vector3(0.0f, 0.0f, 0.0f)
                },
                new Vertex()
                {
                    Color = Color.Blue.ToArgb(), Position = new Vector3(0.5f, 1.0f, 0.0f)
                },
                new Vertex()
                {
                    Color = Color.Red.ToArgb(), Position = new Vector3(1.0f, 0.0f, 0.0f)
                },
                new Vertex()
                {
                    Color = Color.Red.ToArgb(), Position = new Vector3(0.5f, 0.5f, 1.0f)
                },
            });
            vertices.Unlock();

            IndexBuffer indexs = new IndexBuffer(Core.Device, 6 * sizeof(ushort), Usage.WriteOnly, Pool.Managed, true);

            indexs.Lock(0, 0, LockFlags.None).WriteRange <ushort>(new ushort[] { 0, 1, 2, 1, 3, 2 });
            indexs.Unlock();

            var vertexElems = new[] {
                new VertexElement(0, 0, DeclarationType.Float3, DeclarationMethod.Default, DeclarationUsage.Position, 0),
                new VertexElement(0, 12, DeclarationType.Color, DeclarationMethod.Default, DeclarationUsage.Color, 0),
                VertexElement.VertexDeclarationEnd
            };

            var  vertexDecl = new VertexDeclaration(Core.Device, vertexElems);
            Mesh teapot     = Mesh.CreateTeapot(Core.Device);

            Camera cam = new Camera();

            //cam.BuildView();
            //cam.BuildProjection(form.ClientSize.Width, form.ClientSize.Height);

            Core.Device.SetRenderState(RenderState.Lighting, false);    //很重要 默认是开启光照的
            //Core.Device.SetRenderState(RenderState.FillMode, FillMode.Solid);

            MessagePump.Run(form, () =>
            {
                //device.Clear(ClearFlags.Target | ClearFlags.ZBuffer, Color.Black, 1.0f, 0);
                //Matrix mat = new Matrix();

                //Core.Device.SetTransform(TransformState.World, mat);
                // Core.Device.SetTransform(TransformState.World, Matrix.Identity);
                Core.ClearBuffer(true, true, new Color4(0, 0, 0));
                Core.Begin3D();

                sprite.Draw(0, 0);
                //Core.Device.SetStreamSource(0, vertices, 0, 16);
                //Core.Device.VertexDeclaration = vertexDecl;
                //Core.Device.Indices = indexs;
                ////device.DrawPrimitives(PrimitiveType.TriangleList, 0, 2);
                //Core.Device.DrawIndexedPrimitives(PrimitiveType.TriangleList, 0, 0, 4, 0, 2);

                //teapot.DrawSubset(0);
                Core.End3D();
                Core.Filp();
            });

            foreach (var item in ObjectTable.Objects)
            {
                item.Dispose();
            }
        }
示例#18
0
 protected void Page_Load(object sender, EventArgs e)
 {
     DnFile.Clear();
 }