Exemplo n.º 1
0
        public Chunk_MODF(WDTFile file) : base(file, "MODF", Magic)
        {
            Stuffer.Stuff(this, file, GetLogPrefix());

            // There are 2 bytes (UInt16) of padding here, but we should
            // be safe to ignore as chunks are parsed by size.
        }
Exemplo n.º 2
0
        public static FogInfo Read(FormatBase input)
        {
            FogInfo temp = new FogInfo();

            Stuffer.Stuff(temp, input, "FogInfo", true);
            return(temp);
        }
Exemplo n.º 3
0
 public IActionResult Index(Stuffer stf)
 {
     if (ModelState.IsValid)
     {
     }
     return(View(stf));
 }
Exemplo n.º 4
0
        public static GroupInformation Read(FormatBase input)
        {
            GroupInformation temp = new GroupInformation();

            Stuffer.Stuff(temp, input, "GroupInformation", true);
            return(temp);
        }
Exemplo n.º 5
0
        /// <summary>
        /// Creates the File name and path. Stores vaules in the provided Stuffer
        /// </summary>
        /// <param name="stf">Stuffer object containing user input</param>
        public void fileCreation(Stuffer stf)
        {
            string newFileName = Hasher.GetRandKey().ToUpper();

            stf.FileName = newFileName;
            string newFilePath = getFilePath(stf.FileName);

            stf.FilePath = newFilePath;
        }
Exemplo n.º 6
0
        public IActionResult Index()
        {
            Stuffer stf = new Stuffer();

            if (TempData["FilePath"] != null)
            {
                stf.FilePath = TempData["FilePath"].ToString();
            }
            return(View(stf));
        }
Exemplo n.º 7
0
        }                                // Unused

        public Chunk_MCNK(ADTFile file) : base(file, "MCNK", Magic)
        {
            Chunks = new List <Chunk_Base>();

            if (file.Type == ADTFileType.ROOT) // Only root has the header.
            {
                lqTexMap = new UInt32[4];      // Assign a size so the stuffer knows what to do.
                Stuffer.Stuff(this, file, GetLogPrefix(), true);
            }
        }
Exemplo n.º 8
0
        /// <summary>
        /// TESTING AREA
        /// </summary>
        /// <returns></returns>
        public ActionResult Testing()
        {
            string imgPath  = @"C:\Web\DataCordonBleu\DataCordonBleu-Framework\Uploads\test.jpg";
            string savePath = @"C:\Web\DataCordonBleu\DataCordonBleu-Framework\Exports\test.jpg";

            Bitmap bmp   = new Bitmap(imgPath);
            string input = "Can I read this?";
            int    block = 2;

            Stuffer stfr = new Stuffer(input, bmp, block);

            stfr.InsertMessage();

            //Source: https://docs.microsoft.com/en-us/dotnet/api/system.drawing.imaging.encoderparameter?redirectedfrom=MSDN&view=net-5.0
            //Source: https://stackoverflow.com/questions/1484759/quality-of-a-saved-jpg-in-c-sharp
            ImageCodecInfo    encoder    = ImageCodecInfo.GetImageEncoders().First(c => c.FormatID == ImageFormat.Jpeg.Guid);
            EncoderParameters jpegParams = new EncoderParameters(1);

            //
            jpegParams.Param[0] = new EncoderParameter(Encoder.Quality, 100);

            stfr.ImageBMP.Save(savePath, encoder, jpegParams);

            Bitmap temp = stfr.ImageBMP;

            Stuffer unstf = new Stuffer();

            unstf.ImageBMP = new Bitmap(savePath);
            //unstf.ImageBMP = temp;
            unstf.ExtractMessage();


            //int[][] msgArray = BitBlock.MessageToBinary(input, block);
            //string output = BitBlock.BinaryToMessage(msgArray, block);

            return(View());


            //int[] foo = msgArray[0];
            //int backwards = BitBlock.BinaryArrayToInt(msgArray[0]);

            //Source: https://docs.microsoft.com/en-us/dotnet/api/system.drawing.bitmap?view=netcore-3.1
            //Gets X coordinate
            //for (int x = 0; x < bmp.Width; x++) {
            //    //Gets X coordinate
            //    for (int y = 0; y < bmp.Height; y++) {
            //        //Color: Struct that hold the ARGB values of a pixel
            //        Color pixelColor = bmp.GetPixel(x, y);
            //        Color newColor = Color.FromArgb(0, pixelColor.G, pixelColor.B);
            //        bmp.SetPixel(x, y, newColor);
            //    }
            //}
            //bmp.Save(savePath, ImageFormat.Jpeg);
        }
Exemplo n.º 9
0
        public static Doodad Read(FormatBase input)
        {
            Doodad temp = new Doodad();

            // 24-bit offset?
            byte[] b = input.readBytes(3);
            temp.offset = BitConverter.ToUInt32(new byte[4] {
                b[0], b[1], b[2], 0
            }, 0);
            Stuffer.Stuff(temp, input, "Doodad", true);

            return(temp);
        }
Exemplo n.º 10
0
 public ActionResult FromFile(HttpPostedFileBase file, Stuffer unstf)
 {
     try {
         if (file.ContentLength > 0)
         {
             //Converts file to image
             Image temp = Image.FromStream(file.InputStream);
             unstf.ImageBMP = new Bitmap(temp);
             unstf.ExtractMessage();
         }
         ViewBag.Message = "File uploaded successful";
         return(View("Success", unstf));
     } catch {
         ViewBag.Message = "File uploaded failed";
         return(RedirectToAction("Index"));
     }
 }
Exemplo n.º 11
0
        public static Material Read(FormatBase input, int index)
        {
            Material temp = new Material();

            temp.index     = index;
            temp.flags     = input.readUInt32();
            temp.shader    = input.readUInt32();
            temp.blendMode = input.readUInt32();

            temp.texture1    = MaterialTexture.Read(input);
            temp.texture2    = new MaterialTexture(input.readUInt32(), Colour4.Read(input), 0);
            temp.terrainType = input.readUInt32();
            temp.texture3    = MaterialTexture.Read(input);

            Stuffer.DescribeStuffing(temp);

            input.skip(4 * 4); // runtime floats
            return(temp);
        }
Exemplo n.º 12
0
        //Source: https://www.c-sharpcorner.com/article/upload-files-in-asp-net-mvc-5/
        public ActionResult FromFile(HttpPostedFileBase file, Stuffer stf)
        {
            try {
                if (file.ContentLength > 0 && file != null)
                {
                    //Save the original img to uploads
                    fileCreation(stf);
                    file.SaveAs(stf.FilePath);
                    stf.ImageBMP = new Bitmap(stf.FilePath);

                    //Encode message and save img to exports
                    stf.InsertMessage();
                    string path = Path.Combine(Server.MapPath("~/Exports"), stf.FileName + ".png");
                    stf.ImageBMP.Save(path, ImageFormat.Png);
                }
                ViewBag.Message = "File uploaded successful";
                return(View("Success", stf));
            } catch {
                ViewBag.Message = "File uploaded failed";
                return(RedirectToAction("Index"));
            }
        }
Exemplo n.º 13
0
 public Chunk_MOGP(WMOFile file) : base(file, "MOGP", Magic)
 {
     subChunks = new List <Chunk_Base>();
     Stuffer.Stuff(this, file, GetLogPrefix());
 }
Exemplo n.º 14
0
 public Chunk_MOHD(WMOFile file) : base(file, "MOHD", Magic)
 {
     Stuffer.Stuff(this, file, GetLogPrefix());
 }
Exemplo n.º 15
0
 public People()
 {
     this.stuffer = new Hambuger();//依賴抽象
 }