#!/usr/bin/env python
# -*- coding: cp936 -*-

import CycleData.ver1To2
import CycleData.ver2To3
import CycleData.ver3To4
import CycleData.ver4To5
import CycleData.ver5To6
import CycleData.ver6To7
import CycleData.ver7To8
import CycleData.ver8To9
import CycleData.ver9To10
import BaseProc
import logging
import logger

logp = logger.FinalLogger.getLogger()

v1To2 = CycleData.ver1To2.ver1To2()
v2To3 = CycleData.ver2To3.ver2To3()
v3To4 = CycleData.ver3To4.ver3To4()
v4To5 = CycleData.ver4To5.ver4To5()
v5To6 = CycleData.ver5To6.ver5To6()
v6To7 = CycleData.ver6To7.ver6To7()
v7To8 = CycleData.ver7To8.ver7To8()
v8To9 = CycleData.ver8To9.ver8To9()
v9To10 = CycleData.ver9To10.ver9To10()

support = [v1To2, v2To3, v3To4, v4To5, v5To6, v6To7, v7To8, v8To9, v9To10]


def verCycleData(inOld, inNew, inFn):
    logp.info ('CycleData %d to %d', inOld, inNew)
    for member in support:
        old, new = member.GetOldNew()
        if ((old == inOld) and (new == inNew)):
            return member.process(inFn)
    logp.error ('not support %d to %d', inOld, inNew)
    return 1
