예제 #1
0
 public ConfigManager(DeviceManager manager)
 {
     _DeviceManager = manager;
     //  InitXMLmodul();
     SystemLog.I(TAG, " 开始加载程序配置信息 ");
     LoadDataFromDataBase();
     SystemLog.I(TAG, " 开始加载程序信息结束 ");
 }
예제 #2
0
 internal ChipSupportManager(DeviceManager manager)
 {
     _DeviceManager = manager;
     //InitXMLmodul();
     SystemLog.I(TAG, "芯片列表信息开始初始化");
     InitDBmodul();
     SystemLog.I(TAG, "芯片列表信息初始化完成");
 }
예제 #3
0
        private DeviceManager()
        {
            var startpropt = "\n--------------------------------------------\n" +
                             "--------------------------------------------\n" +
                             "--------------------------------------------\n" +
                             "--------------------------------------------\n";

            SystemLog.I("程序", "准备启动");
            SystemLog.I("程序", startpropt);
        }
예제 #4
0
 private void CreateDbFile()
 {
     if (File.Exists(_dbfile))
     {
         DialogResult result = MessageBox.Show(null,
                                               "文件已存在,将被重写!", "文件已存在", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         File.Delete(_dbfile);
         SystemLog.I(TAG, "覆盖旧文件 ");
     }
     SQLiteConnection.CreateFile(_dbfile);
     SystemLog.I(TAG, "新建  " + _dbfile);
 }
예제 #5
0
 public void ExeSetKeyVal(Hashtable table)
 {
     foreach (string key in table.Keys)
     {
         var value = table[key] as string;
         if (!string.IsNullOrEmpty(key) && !string.IsNullOrEmpty(value))
         {
             ExeSetKeyVal(key, value);
             SystemLog.I(TAG, " 设置工程属性: " + key + ": " + value);
         }
     }
 }
예제 #6
0
        public void InitDir(string fullpath)
        {
            _fuallpathdir = fullpath;
            _dbfile       = fullpath + @"/" + ProjectInfo.PROJECT_DB_FILE_NAME;
            // create a db. create table.
            SystemLog.I(TAG, "工程路径: "   + _fuallpathdir);
            SystemLog.I(TAG, "工程database: " + _dbfile);

            CreateDbFile();
            connectToDatabase();
            CreateTable();
        }
예제 #7
0
        private void okbutton_Click(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(ImgBinFileInfo.ImageBinFileMD5Sum))
            {
                StateChanged?.Invoke(this, ImgBinFileInfo); //
                SystemLog.I(TAG, ImgBinFileInfo);
            }

            if (CalFileMD5work != null && CalFileMD5work.WorkerSupportsCancellation)
            {
                CalFileMD5work?.CancelAsync();
            }
            Dispose();
        }
예제 #8
0
        private void Ok_Click(object sender, EventArgs e)
        {
            if (_CurrentChooseChip != null)
            {
                DeviceManager.Instance.ConfigManager.PutChooseChipHistoryItem(_CurrentChooseChip.name);
                SystemLog.I(TAG, "选择芯片" + _CurrentChooseChip.ToString());
            }

            this.Hide();
            var ChooseChipFromEventArgs = new ChooseChipFromEventArgs();

            ChooseChipFromEventArgs.ChipInfo = _CurrentChooseChip;
            StateChanged?.Invoke(this, ChooseChipFromEventArgs);
        }
예제 #9
0
        public DataBaseManager(DeviceManager manager)
        {
            _DeviceManager = manager;

            if (File.Exists(ProgramInfo.DBFILE))
            {
                var connect = "Data Source=" + ProgramInfo.DBFILE + "; Version=3;";
                _dbConnection = new SQLiteConnection(connect);
                _dbConnection.Open();
                SystemLog.I(TAG, " database " + ProgramInfo.DBFILE + ".opened");
            }
            else
            {
                SystemLog.E(TAG, " database " + ProgramInfo.DBFILE + ".not found");
            }
            //  test();
        }
예제 #10
0
        private void SetAdbForward()
        {
            if (currentDeviceData != null && currentDeviceData.State.Equals(DeviceState.Online))
            {
                //    Tools.Tools.RunCmd("adb shell am broadcast -a NotifyServiceStop");

                AdbClient.Instance.RemoveAllForwards(currentDeviceData);
                AdbClient.Instance.CreateForward(currentDeviceData, "tcp:5000", "tcp:13000", true);

                //  Tools.Tools.RunCmd("adb shell am broadcast -a NotifyServiceStart");
                SystemLog.I(TAG, "添加ADB forward转发");
                //if (index++ == 0)
                //{
                //Task.Run(new Action(
                // ));
                //}
            }
        }
예제 #11
0
        static void Main()
        {
            if (!EnSureOnlyOneInstance())
            {
                SystemLog.E("程序", "已有程序在运行,本次启动失败");
                return;
            }

            SystemLog.I("程序", "信息准备初始化");
            DeviceManager.Instance.Init();
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new MainWindow());
            var endpropt = "\n***************************************************\n" +
                           "***************************************************\n" +
                           "***************************************************\n";

            SystemLog.I("程序", "主程序退出");
            SystemLog.I("程序", endpropt);
        }
예제 #12
0
        private void OKbutton_Click(object sender, EventArgs e)
        {
            var trayType    = TrayType.SelectedItem;
            var projectinfo = DeviceManager.Instance.ProjectManager.GetCurrentProjectConfig();

            if (projectinfo != null && projectinfo.Count > 0)
            {
                var tableargs = new ProjectInfoHashtableEventArgs();
                tableargs.ProjectInfoHashtable = projectinfo;
                StateChanged?.Invoke(this, tableargs);
                SystemLog.I(TAG, "开始保存工程");
                foreach (string key in projectinfo.Keys)
                {
                    SystemLog.I(TAG, "工程属性: " + key + "--->" + projectinfo[key].ToString());
                }
                SystemLog.I(TAG, "结束保存工程");
            }

            Dispose(); // back to main windows
        }
예제 #13
0
        private async void BindAdbStatus()
        {
            ProgLog.D(TAG, "aync bindadbstatus begain " + DateTime.Now);
            await Task.Factory.StartNew(() =>
            {
                // init first.
                var adbdevicedata = DeviceManager.Instance.WrapAdbManager.GetCurrentAdbDeviceData();
                if (adbdevicedata.State.Equals(DeviceState.Online))
                {
                    SystemLog.I(TAG, "初始化找到ADB设备 :" + adbdevicedata.ToString());
                    AdbStatusToollable.Text = "设备已连接";
                    Task.Run(new Action(startNetty));
                }
                else if (adbdevicedata.State.Equals(DeviceState.Offline))
                {
                    SystemLog.I(TAG, "初始化末找到ADB设备 :" + adbdevicedata.ToString());
                    AdbStatusToollable.Text = "设备已断开";
                    NettyJsonCmdManager?.Stop();
                }
                // add monitoer
                DeviceManager.Instance.WrapAdbManager.DeviceStatusChanged += delegate(object sender, DeviceDataEventArgs data)
                {
                    var devicedata = data.Device;
                    if (devicedata.State.Equals(DeviceState.Online))
                    {
                        SystemLog.I(TAG, "设备连接 :" + devicedata.ToString());
                        AdbStatusToollable.Text = "设备已连接";
                        Task.Run(new Action(startNetty));
                    }
                    else if (devicedata.State.Equals(DeviceState.Offline))
                    {
                        SystemLog.I(TAG, "设备已断开 :" + devicedata.ToString());
                        AdbStatusToollable.Text = "设备已断开";
                        NettyJsonCmdManager?.Stop();
                    }
                };
            });

            ProgLog.D(TAG, "aync bindadbstatus end " + DateTime.Now);
        }
예제 #14
0
 public ProjectManager()
 {
     // Init();
     SystemLog.I(TAG, "芯片列表信息开始初始化");
     SystemLog.I(TAG, "芯片列表信息初始化完成");
 }
예제 #15
0
 public override void ExceptionCaught(IChannelHandlerContext context, Exception exception)
 {
     SystemLog.I(TAG, "Netty 网络连接 出现异常,将关闭连接 : " + exception.ToString());
     context.CloseAsync();
 }
예제 #16
0
 public override void ChannelInactive(IChannelHandlerContext context)
 {
     SystemLog.I(TAG, "Netty 网络连接断开");
     context.CloseAsync();
 }
예제 #17
0
 public override void ChannelActive(IChannelHandlerContext context)
 {
     SystemLog.I(TAG, "Netty 网络连接已建立");
     NettyJsonCmdManager.SendStringAppendDelimite("heoool?");
 }
예제 #18
0
 public void ReSet()
 {
     SystemLog.I(TAG, "ReSET工程");
 }