| 1 | |
|---|
| 2 | # -*- coding: utf-8 -*- |
|---|
| 3 | # vim: ts=4:sw=4 |
|---|
| 4 | # This file is part of LOME. |
|---|
| 5 | # |
|---|
| 6 | # LOME is free software: you can redistribute it and/or modify |
|---|
| 7 | # it under the terms of the GNU General Public License as published by |
|---|
| 8 | # the Free Software Foundation, either version 3 of the License, or |
|---|
| 9 | # (at your option) any later version. |
|---|
| 10 | # |
|---|
| 11 | # LOME is distributed in the hope that it will be useful, |
|---|
| 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 14 | # GNU General Public License for more details. |
|---|
| 15 | # |
|---|
| 16 | # You should have received a copy of the GNU General Public License |
|---|
| 17 | # along with LOME. If not, see <http://www.gnu.org/licenses/>. |
|---|
| 18 | # |
|---|
| 19 | import sys,os,logging, traceback |
|---|
| 20 | sys.path.append(os.path.join(sys.path[0],'common')) |
|---|
| 21 | sys.path.append(os.path.join(sys.path[0],'common', 'lodb')) |
|---|
| 22 | sys.path.append(os.path.join(sys.path[0],'common', 'miztools')) |
|---|
| 23 | |
|---|
| 24 | from miztools.mizfile import MizFile |
|---|
| 25 | from miztools.mizmerge import MizMerge |
|---|
| 26 | import zipfile, shutil |
|---|
| 27 | |
|---|
| 28 | if __name__ == "__main__": |
|---|
| 29 | if hasattr(sys, 'frozen'): |
|---|
| 30 | g_pathname = os.path.dirname(sys.executable) |
|---|
| 31 | elif __file__: |
|---|
| 32 | g_pathname = os.path.dirname(__file__) |
|---|
| 33 | |
|---|
| 34 | g_pathname = os.path.abspath(g_pathname ) |
|---|
| 35 | |
|---|
| 36 | |
|---|
| 37 | #- First load a mission |
|---|
| 38 | print "o Load MizFile" |
|---|
| 39 | MizFile.workpath = g_pathname |
|---|
| 40 | # miz = MizFile("./common/files/FC2/Missions/canyon.miz") |
|---|
| 41 | miz = MizFile("./examples/miz/russe.miz") |
|---|
| 42 | |
|---|
| 43 | print "o Merge mission" |
|---|
| 44 | mizM = MizMerge() |
|---|
| 45 | mizM.merge( miz, [ |
|---|
| 46 | # "./common/files/FC2/Missions/A-10A - A visit to the Port.miz", |
|---|
| 47 | # "./common/files/FC2/Missions/perso/missions/runaway_attack.miz", |
|---|
| 48 | "./common/files/FC2/Missions/Su-27 - Ramp Start and Navigation.miz", |
|---|
| 49 | # "./common/files/FC2/Missions/F-15C - Intercept.miz", |
|---|
| 50 | # "./examples/miz/usa.miz", |
|---|
| 51 | ] ) |
|---|
| 52 | |
|---|
| 53 | #- The write it |
|---|
| 54 | print "o Write to test_mission" |
|---|
| 55 | # print miz.get_mission_buffer() |
|---|
| 56 | miz.write('./common/files/FC2/Missions/out.miz') |
|---|