Click here to Skip to main content
15,892,746 members
Articles / Desktop Programming / Windows Forms

SQLite Compare Utility

Rate me:
Please Sign up or sign in to vote.
4.89/5 (68 votes)
21 Feb 2015LGPL35 min read 284.8K   37.2K   131  
Utility for comparing two SQLite database files for both structure and data
using System;
using System.Collections.Generic;
using System.Text;

namespace Common
{
    /// <summary>
    /// This class holds the license information
    /// </summary>
    [Serializable]
    public class LicenseDetails
    {
        public int DemoDays
        {
            get
            {
                return _demoDays;
            }
            set
            {
                _demoDays = value;
            }
        }

        public string CustomerName
        {
            get { return _customerName; }
            set { _customerName = value; }
        }

        public string ContactEmail
        {
            get { return _email; }
            set { _email = value; }
        }

        public int NumberOfSeats
        {
            get { return _numberOfSeats; }
            set { _numberOfSeats = value; }
        }

        public LicenseUsage Usage
        {
            get { return _usage; }
            set { _usage = value; }
        }

        public bool IsSiteLicense
        {
            get { return _siteLicense; }
            set { _siteLicense = value; }
        }

        public override string ToString()
        {
            return _demoDays+DELIM+_customerName + DELIM + _usage.ToString() + DELIM + _numberOfSeats.ToString() + DELIM + _siteLicense.ToString()+DELIM+_email;
        }

        public static LicenseDetails Parse(string str)
        {
            string[] parts = str.Split(new string[] { "!+-!" }, StringSplitOptions.None);
            if (parts.Length != 6)
                throw new ArgumentException("illegal license string");

            LicenseDetails res = new LicenseDetails();
            res._demoDays = int.Parse(parts[0]);
            res._customerName = parts[1];
            res._usage = (LicenseUsage)Enum.Parse(typeof(LicenseUsage), parts[2]);
            res._numberOfSeats = int.Parse(parts[3]);
            res._siteLicense = bool.Parse(parts[4]);
            res._email = parts[5];
            return res;
        }

        private const string DELIM = "!+-!";

        private bool _siteLicense;
        private LicenseUsage _usage;
        private int _numberOfSeats;
        private string _customerName;
        private int _demoDays;
        private string _email;
    }

    public enum LicenseUsage
    {
        Demo = 0,

        Academic = 1,

        Personal = 2,

        Commercial = 3,
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The GNU Lesser General Public License (LGPLv3)


Written By
Software Developer
Israel Israel
My name is Liron Levi and I'm developing software for fun & profit for 15 years already.

Comments and Discussions