Esempio n. 1
0
    // opt: 1-below, 2-above, 3-replace
    private static void Write(XClass cls, WriteOpt opt, string oldBlock, string newBlock)
    {
        string error = string.Empty;

        switch (opt)
        {
        case WriteOpt.Below:
            error = cls.WriteBelow(oldBlock, newBlock);
            break;

        case WriteOpt.Above:
            error = cls.WriteAbove(oldBlock, newBlock);
            break;

        case WriteOpt.Replace:
            error = cls.Replace(oldBlock, newBlock);
            break;
        }

        if (!string.IsNullOrEmpty(error))
        {
            throw new System.Exception(error);
        }
    }