Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Using files

Using files

Scheduled Pinned Locked Moved C#
xmlquestion
7 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    Christian Flutcher
    wrote on last edited by
    #1

    Hello, I am designing an application where data is stored in files. My file is in XML format so that I can easily manipulate it's data. Everything worked really well so far. Recently we are getting many support mails which says the program showing some weird errors. We have found that it is mainly because people open the file in a text editor and edited the XML data manually. I am looking for a method which will prevent users from editing it. How do you guys usually manage it ? Any suggestions ?

    G D 2 Replies Last reply
    0
    • C Christian Flutcher

      Hello, I am designing an application where data is stored in files. My file is in XML format so that I can easily manipulate it's data. Everything worked really well so far. Recently we are getting many support mails which says the program showing some weird errors. We have found that it is mainly because people open the file in a text editor and edited the XML data manually. I am looking for a method which will prevent users from editing it. How do you guys usually manage it ? Any suggestions ?

      G Offline
      G Offline
      Giorgi Dalakishvili
      wrote on last edited by
      #2

      Hide the files.

      Giorgi Dalakishvili #region signature my articles #endregion

      C 1 Reply Last reply
      0
      • G Giorgi Dalakishvili

        Hide the files.

        Giorgi Dalakishvili #region signature my articles #endregion

        C Offline
        C Offline
        Christian Flutcher
        wrote on last edited by
        #3

        Thanks, But that's not a reliable way as it can be made visible by the user. Any other suggestions ? How about writing the XML content into a binary file ?

        L 1 Reply Last reply
        0
        • C Christian Flutcher

          Hello, I am designing an application where data is stored in files. My file is in XML format so that I can easily manipulate it's data. Everything worked really well so far. Recently we are getting many support mails which says the program showing some weird errors. We have found that it is mainly because people open the file in a text editor and edited the XML data manually. I am looking for a method which will prevent users from editing it. How do you guys usually manage it ? Any suggestions ?

          D Offline
          D Offline
          DaveyM69
          wrote on last edited by
          #4

          In the past I've used xml in memory and used simple encryption/decryption for writing to disk. This can slow stuff down a little though. Alternatively, encrypt just the tag contents rather than the xml file - but make sure the encryption only uses characters that are going to be valid.

          Dave
          BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
          Expect everything to be hard and then enjoy the things that come easy. (code-frog)

          1 Reply Last reply
          0
          • C Christian Flutcher

            Thanks, But that's not a reliable way as it can be made visible by the user. Any other suggestions ? How about writing the XML content into a binary file ?

            L Offline
            L Offline
            lisan_al_ghaib
            wrote on last edited by
            #5

            Hi ! is your xml file large? Do you load it entierly when executing your program? if you load your xml file into an object you can do a binary serialization. You save your object or array of objects into a binay file. When executing your program you can load this file at start up.

            C 1 Reply Last reply
            0
            • L lisan_al_ghaib

              Hi ! is your xml file large? Do you load it entierly when executing your program? if you load your xml file into an object you can do a binary serialization. You save your object or array of objects into a binay file. When executing your program you can load this file at start up.

              C Offline
              C Offline
              Christian Flutcher
              wrote on last edited by
              #6

              That's a brilliant suggestion. I will check it.

              L 1 Reply Last reply
              0
              • C Christian Flutcher

                That's a brilliant suggestion. I will check it.

                L Offline
                L Offline
                lisan_al_ghaib
                wrote on last edited by
                #7

                Hi ! Just you have to be sure that when you serialize or deserialize your object you MUST keep the same class structure (same fields, same names, sames types) regards :)

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups