Ejemplo n.º 1
0
    private ApplicationSettings.AppInfo CreateAppInfo(ref DataTable table)
    {
        ApplicationSettings.AppInfo info = new ApplicationSettings.AppInfo();

        table.Get("version_major", ref info.version_major);
        table.Get("version_minor", ref info.version_minor);
        table.Get("version_rev", ref info.version_rev);

        return(info);
    }
Ejemplo n.º 2
0
    private void ConsolidateData(ref DataTable left, ref DataTable right, ref DataTable output)
    {
        if (m_consolidater == null)
        {
            // We need to make sure the loaded data (assumed to be on the right)
            // is not an accidental save from a fresh save data. We don't want
            // to overwrite the old working data for this.
            bool isNotFresh = false;
            right.Get("nonfresh_save", ref isNotFresh);
            if (!isNotFresh)
            {
                DebugUtil.Log("Ignoring invalid 'right' data");
                output = left;
                return;
            }

            DebugUtil.Log("'right' data is valid'");

            ApplicationSettings.AppInfo infoLeft  = CreateAppInfo(ref left);
            ApplicationSettings.AppInfo infoRight = CreateAppInfo(ref right);

            output = left;
            if (infoRight.IsEqualVersion(infoLeft) || infoRight.IsHigherVersionThan(infoLeft))
            {
                DebugUtil.Log("'right' is the better version.");
                output = right;
            }
            else
            {
                DebugUtil.Log("'left' is the better version.");
            }

            return;
        }

        m_consolidater(ref left, ref right, ref output);
    }