Skip to content

Commit

Permalink
20181205
Browse files Browse the repository at this point in the history
  • Loading branch information
yangjinhe committed Dec 5, 2018
1 parent 8b11ccc commit e71f3f3
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
13 changes: 10 additions & 3 deletions MainFormImpl.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,16 @@ func (f *TMainForm) OnAboutMenuClick(sender vcl.IObject) {
}

func (f *TMainForm) OnPopStartMenuClick(sender vcl.IObject) {
proxy.Stop(currentServerName)
currentServerName = MainForm.ServerListView.Selected().Caption()
serverInfo := readConfig(currentServerName)
configContent := buildConfig(serverInfo, " ")
//fmt.Println(configContent)
MainForm.OutpuMemo.Lines().Clear()
var loggerCallback proxy.LogCallback
loggerCallback = new(MyLogCallback)
errStr := proxy.StartWithLog(currentServerName, configContent, loggerCallback)
//errStr := proxy.Start(currentServerName, configContent)
if errStr != "" {
vcl.MessageDlg("启动失败:"+errStr, types.MtError, types.MbOK)
}
Expand Down Expand Up @@ -152,14 +155,18 @@ type MyLogCallback struct {
}

func (myLogCallback MyLogCallback) Write(line string) {
MainForm.OutpuMemo.Lines().Append(line)
go func() {
vcl.ThreadSync(func() {
MainForm.OutpuMemo.Lines().Append(line)
})
}()
}

func (f *TMainForm) OnPopStopMenuClick(sender vcl.IObject) {
// 这里肯定有问题,我是乱写的
// 这里估计有问题,我是乱写的
proxy.Stop(currentServerName)
go func() {
vcl.ThreadSync(func() {
go proxy.Stop(currentServerName)
cfg, _ := goconfig.LoadConfigFile(mainConfigName)
cfg.SetValue(currentServerName, "Status", "false")
_ = goconfig.SaveConfigFile(cfg, mainConfigName)
Expand Down
3 changes: 1 addition & 2 deletions NewProxyServerFormImpl.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
package main

import (
"fmt"
"github.com/Unknwon/goconfig"
"github.com/satori/go.uuid"
"github.com/ying32/govcl/vcl"
Expand Down Expand Up @@ -60,7 +59,7 @@ func (f *TNewProxyServerForm) OnOkButtonClick(sender vcl.IObject) {
var key = ""
if currentEditServerName == "" {
u1 := uuid.Must(uuid.NewV4())
fmt.Printf("UUIDv4: %s\n", u1)
//fmt.Printf("UUIDv4: %s\n", u1)
key = u1.String()
} else {
key = currentEditServerName
Expand Down
2 changes: 1 addition & 1 deletion config.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[common]
autoRun = false
sysProxy = false
sysProxyAddr =
sysProxyAddr = 127.0.0.1:1080

0 comments on commit e71f3f3

Please sign in to comment.