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

import sys
import BaseProc
import logging
import logger


sys.path.append("proc0")
sys.path.append("proc1")
sys.path.append("proc2")
sys.path.append("proc4")


import proc0.verAllProc
import proc1.verAllProc
import proc2.verAllProc
import proc4.verAllProc


datafileType = ("DataFlash\\0", "DataFlash\\1", "DataFlash\\2",
                "DataFlash\\4", "not found")

logp = logger.FinalLogger.getLogger()

def procAll(inOldType, inNewType, inFn):
    for i in datafileType:    
        if (-1 != inFn.find(i)):
            break
    if (datafileType[0] == i):
        logp.info ('dataflash\\0')
        if (proc0.verAllProc.verProcAll(inOldType, inNewType, inFn)):
            return 1
    elif (datafileType[1] == i):
        logp.info ('dataflash\\1')
        if (proc1.verAllProc.verProcAll(inOldType, inNewType, inFn)):
            return 1
    elif (datafileType[2] == i):
        logp.info ('dataflash\\2')
        if (proc2.verAllProc.verProcAll(inOldType, inNewType, inFn)):
            return 1
    elif (datafileType[3] == i):
        logp.info ('dataflash\\4')
        if (proc4.verAllProc.verProcAll(inOldType, inNewType, inFn)):
            return 1
    else:
        logp.error (inFn , "not support")
        return 1
