1/* 2* Copyright (c) 2024 Shenzhen Kaihong Digital Industry Development Co., Ltd. 3* Licensed under the Apache License, Version 2.0 (the "License"); 4* you may not use this file except in compliance with the License. 5* You may obtain a copy of the License at 6* 7* http://www.apache.org/licenses/LICENSE-2.0 8* 9* Unless required by applicable law or agreed to in writing, software 10* distributed under the License is distributed on an "AS IS" BASIS, 11* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12* See the License for the specific language governing permissions and 13* limitations under the License. 14*/ 15 16import { Uri } from "vscode"; 17import { Dts2cppMod } from "../model/dts2cppmod"; 18import { IModel } from "../model/imodel"; 19import { Dts2cppView } from "../view/dts2cppview"; 20import { Logger } from "../common/log"; 21import { IView } from "../view/iview"; 22import { IController } from "./icontroller"; 23import { EVENT_ERROR } from "../common/eventtype"; 24 25export class Dts2cppCtrl extends IController { 26 name: string; 27 view: IView; 28 model: IModel; 29 uri: Uri; 30 constructor(uri: Uri) { 31 super(); 32 this.name = 'dts2cppctrl'; 33 this.model = Dts2cppMod.getInstance(); 34 this.view = new Dts2cppView; 35 this.uri = uri; 36 } 37 38 public init(): void { 39 if (this.uri && this.uri.fsPath) { 40 this.view.init(this); 41 this.model.init(this.uri); 42 this.view.showProgress(); 43 } 44 } 45 46 public start(): void { 47 try { 48 this.model.doStart(); 49 } catch(e) { 50 let errmsg = this.name + " start error: " + JSON.stringify(e) 51 Logger.getInstance().error(errmsg); 52 this.view.showMsg(EVENT_ERROR, errmsg); 53 } 54 } 55 56 public stop(): void { 57 throw new Error("Method not implemented."); 58 } 59 60 public pause(): void { 61 throw new Error("Method not implemented."); 62 } 63 64 public resume(): void { 65 throw new Error("Method not implemented."); 66 } 67}