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

'''
SG 中的文件内容不需要处理，各版本是可以向下兼容的
只需要将文件头的版本号改为新版本即可．
因此　.s .d .t 三个文件，处理相同．
'''

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

logp = logger.FinalLogger.getLogger()

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

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


def verSGData(inOld, inNew, inFn):
    logp.info ('SG %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
