360haven works best with JavaScript enabled
need some guidance on write function packageio. Reading is fine
Loading
Register
Results 1 to 7 of 7
  1. #1
    Keylan

    need some guidance on write function packageio. Reading is fine

    I am wondering if anyone can help me. I have been racking my brain most of today trying to figure this out. I am creating a save editor with C#. I made one before in vb, but I am switching languages, and not fully understanding what I am doing wrong.

    I am using packageio, and I am using the following code to read:

    Code:
    reader.Position = PosEXP;
    EXP = reader.ReadInt32();
    reader.Position = PosLV;
    LV = reader.ReadByte();
    reader.Position = PosHP
    HP = reader.ReadInt16();
    This code works fine for reading the offsets. However, when I go to code the writing part, I am having issues. This first part works fine:

    Code:
    writer.Position = PosEXP;
    writer.WriteInt32(EXP, Endian.Little);
    But when I try to write wither the LV or HP, I get an error when trying to WriteByte and WriteInt16:
    Code:
    writer.Position = PosLV;
    writer.WriteByte(LV);
    writer.Position = HP;
    writer.WriteInt16(HP);
    I have tried Int16 with the Endian.Little part as well, and I keep getting errors. Does anyone know what my problem is? I had the same issue in my vb editor, and ended up using StreamWriter for those types of bytes, but I would like to stick with packageio this time around.

    Thanks in advance for any assistance that can be given.

  2. #2
    JENGA MASTER SUPREME
    Emerald Lance

    Emerald Lance is offline
    Join Date : Dec 2010
    Location : Awesome Land
    Age : 33
    Posts : 1,834
    Array

    Re: need some guidance on write function packageio. Reading is fine

    WriteByte is writing a value between 0 and 255, right? And you're making sure to accomodate for the differences between a signed and unsigned integer (not trying to write 65355 unless the integer is specified)? Also, does your program have a GUI or is it text based? If GUI, are you making sure to specify which tool you're using within the GUI (textbox, combobox, numericupdown, etc)? If text, are you making sure everything is defined and called correctly?

    Those are all common mistakes that everybody makes sometimes, so it's always good to double check. At any rate, everything looks fine for a text-style editor based on the snippets of code you posted. I don't think it will work as is for a GUI-style editor though (not unless you do some extra coding). Specifically, what error are you getting?
    Downloads : 22 || Uploads : 0 || Rep Power : 6853 || Posts : 1,834 || Thanks : 436 || Thanked 633 Times in 307 Posts


    Quote Originally Posted by SaiyanPrince302, commenting on how to become a Super Saiyan,
    "I know where these guys are going, but in all seriousness, just trying to imagine loved ones being killed almost never works. Be a man and travel into space and shoot at asteroids until you get yourself in an actual life threatening situation."
    --Gamefaqs.com

  3. The Following User Says Thank You to Emerald Lance For This Useful Post:


  4. #3
    Keylan

    Re: need some guidance on write function packageio. Reading is fine

    Quote Originally Posted by Emerald Lance View Post
    WriteByte is writing a value between 0 and 255, right? And you're making sure to accomodate for the differences between a signed and unsigned integer (not trying to write 65355 unless the integer is specified)? Also, does your program have a GUI or is it text based? If GUI, are you making sure to specify which tool you're using within the GUI (textbox, combobox, numericupdown, etc)? If text, are you making sure everything is defined and called correctly?

    Those are all common mistakes that everybody makes sometimes, so it's always good to double check. At any rate, everything looks fine for a text-style editor based on the snippets of code you posted. I don't think it will work as is for a GUI-style editor though (not unless you do some extra coding). Specifically, what error are you getting?
    Thanks for the reply.

    I am using Visual Studio 2012, and using a GUI. I have it writing the data to textboxes. The textboxes are set to only allow for one number (for the Byte) and two numbers (for the Int16). I even tried to change the LV to tbLV.Text, but it is giving errors saying:

    "The best overload method match for 'PackageIO.Writer.WriteByte(byte)' has some invalid arguments."

    and

    "The best overload method match for 'PackageIO.Writer.WriteInt16(short)' has some invalid arguments."

    EDIT:
    I apparently had all of my variables listed as int. I changed the single one to byte, and the 16 to short, and it seems to have made the red error line go away and let me compile. Hopefully it works.

    Now I just need to figure out how to make it update the variables to match the textboxes. Going to try to use textbox_changed and see if it will work, but I have had issues with that in the past.

  5. #4
    Administrator
    360HAVEN

    Sephiroth is offline
    Join Date : Nov 2010
    Location : Setagaya-ku, Tokyo, Japan
    Posts : 3,380
    Array
    Twitter: @

    Re: need some guidance on write function packageio. Reading is fine

    Quote Originally Posted by Keylan View Post
    Thanks for the reply.

    I am using Visual Studio 2012, and using a GUI. I have it writing the data to textboxes. The textboxes are set to only allow for one number (for the Byte) and two numbers (for the Int16). I even tried to change the LV to tbLV.Text, but it is giving errors saying:

    "The best overload method match for 'PackageIO.Writer.WriteByte(byte)' has some invalid arguments."

    and

    "The best overload method match for 'PackageIO.Writer.WriteInt16(short)' has some invalid arguments."

    EDIT:
    I apparently had all of my variables listed as int. I changed the single one to byte, and the 16 to short, and it seems to have made the red error line go away and let me compile. Hopefully it works.

    Now I just need to figure out how to make it update the variables to match the textboxes. Going to try to use textbox_changed and see if it will work, but I have had issues with that in the past.
    Reader
    Code:
    VB - byte
    
    Code:
    Reader.Position = lv
    Textbox1.Text = Reader.ReadByte
    C# - byte
    Code:
    Reader.Position = lv;
    Textbox1.Text = Reader.ReadByte;
    VB - int8
    Code:
    Reader.Position = lv
    Textbox1.Text = Reader.Readint8
    C# - int8
    Code:
    Reader.Position = lv;
    Textbox1.Text = Reader.Readint8;
    VB - int16
    Code:
    Reader.Position = lv
    Textbox1.Text = Reader.Readint16
    C# - int16
    Code:
    Reader.Position = lv;
    Textbox1.Text = Reader.Readint16;
    VB - int24
    Code:
    Reader.Position = lv
    Textbox1.Text = Reader.Readint24
    C# - int24
    Code:
    Reader.Position = lv;
    Textbox1.Text = Reader.Readint24;
    VB - int32
    Code:
    Reader.Position = lv
    Textbox1.Text = Reader.Readint32
    C# - int32
    Code:
    Reader.Position = lv;
    Textbox1.Text = Reader.Readint32;

    Writer
    Code:
    VB - byte
    
    Code:
    Writer.Position = lv
            Writer.WriteByte(CByte(Textbox1.Text))
    C# - byte
    Code:
    Writer.Position = lv;
    Writer.WriteByte(Convert.ToByte(Textbox1.Text));
    VB - int8
    Code:
    Writer.Position = lv
            Writer.Writeint8(CInt(Textbox1.Text))
    C# - int8
    Code:
    Writer.Position = lv;
    Writer.Writeint8(Convert.ToInt8(Textbox1.Text));
    VB - int16
    Code:
    Writer.Position = lv
            Writer.Writeint16(CInt(Textbox1.Text))
    C# - int16
    Code:
    Writer.Position = lv;
    Writer.Writeint16(Convert.ToInt16(Textbox1.Text));
    VB - int24
    Code:
    Writer.Position = lv
            Writer.Writeint24(CInt(Textbox1.Text))
    C# - int24
    Code:
    Writer.Position = lv;
    Writer.Writeint24(Convert.ToInt24(Textbox1.Text));
    VB - int32
    Code:
    Writer.Position = lv
            Writer.Writeint32(CInt(Textbox1.Text))
    C# - int32
    Code:
    Writer.Position = lv;
    Writer.Writeint32(Convert.ToInt32(Textbox1.Text));
    Last edited by Sephiroth; 09-28-2013 at 06:42 PM.
    Downloads : 171 || Uploads : 13 || Rep Power : 9423 || Posts : 3,380 || Thanks : 513 || Thanked 4,270 Times in 1,295 Posts




    What i have shown you is reality. What you remember... that is the illusion.




  6. The Following User Says Thank You to Sephiroth For This Useful Post:


  7. #5
    Keylan

    Re: need some guidance on write function packageio. Reading is fine

    Thank you so much. I had to make a few changes to what you posted, as it said for c# code to use WriteInt16(Convert.ToInt32()); and that have me errors. Just changed the 32 to 16 and it worked fine.

    Sent from my Verizon Galaxy Note 2 using Xparent Skyblue Tapatalk 2

  8. #6
    JENGA MASTER SUPREME
    Emerald Lance

    Emerald Lance is offline
    Join Date : Dec 2010
    Location : Awesome Land
    Age : 33
    Posts : 1,834
    Array

    Re: need some guidance on write function packageio. Reading is fine

    That's good, I'm glad you got it working. Also, for the future, might I suggest numeric up down boxes for numbers? They're like text boxes that are specifically for numbers, and sometimes text boxes have a hard time transitioning from strings to integers (instead of Textbox1.Text, you'd use NumericUpDown.Value, which can only correspond to integers). At any rate, good luck with your editor. ^-^
    Downloads : 22 || Uploads : 0 || Rep Power : 6853 || Posts : 1,834 || Thanks : 436 || Thanked 633 Times in 307 Posts


    Quote Originally Posted by SaiyanPrince302, commenting on how to become a Super Saiyan,
    "I know where these guys are going, but in all seriousness, just trying to imagine loved ones being killed almost never works. Be a man and travel into space and shoot at asteroids until you get yourself in an actual life threatening situation."
    --Gamefaqs.com

  9. The Following User Says Thank You to Emerald Lance For This Useful Post:


  10. #7
    Administrator
    360HAVEN

    Sephiroth is offline
    Join Date : Nov 2010
    Location : Setagaya-ku, Tokyo, Japan
    Posts : 3,380
    Array
    Twitter: @

    Re: need some guidance on write function packageio. Reading is fine

    Quote Originally Posted by Keylan View Post
    Thank you so much. I had to make a few changes to what you posted, as it said for c# code to use WriteInt16(Convert.ToInt32()); and that have me errors. Just changed the 32 to 16 and it worked fine.

    Sent from my Verizon Galaxy Note 2 using Xparent Skyblue Tapatalk 2
    Oops my bad lol
    Downloads : 171 || Uploads : 13 || Rep Power : 9423 || Posts : 3,380 || Thanks : 513 || Thanked 4,270 Times in 1,295 Posts




    What i have shown you is reality. What you remember... that is the illusion.




 

 

Similar Threads

  1. Double Fine presents new game ''The Cave''
    By longy999 in forum Nintendo Game News
    Replies: 5
    Last Post: 05-27-2012, 06:58 AM

Visitors found this page by searching for:

Nobody landed on this page from a search engine, yet!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

About 360haven

    360haven is an Forum Devoted To Game modding Fans from all over the world.

    An Awesome Community of Xbox 360 Gamers, Modders and Developers who Create & Share Tutorials, Applications, Gfx, Trainers and Gamesaves.

    A haven for the l33t.
    A scarce paradise for modders.

★★★★★¯\_(ツ)_/¯