Skip to content

Commit

Permalink
增加导入导出配置文件按键、更正升级后老版本配置没导入的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
chenxuuu committed Jul 4, 2019
1 parent 6f4f40c commit 6cdcead
Show file tree
Hide file tree
Showing 9 changed files with 47 additions and 3 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,13 @@ sys.timerLoopStart(log.info,1000,"timer test")
- [ ] 待添加功能:右侧快捷发送数据导入与导出
- [ ] 配置文件的导入与导出,以便分享

## 常见问题

### 升级的时候要替换哪几个文件?

由于我直接使用了GitHub/Gitee服务器作为release网站,所以也没搞全自动升级,需要自己手动下载

只需要备份自己的`user_script_run``user_script_send_convert`文件夹里的自定义脚本就可以了。如果需要,还可以备份`log`目录。把他们全都扔到新版本软件里覆盖就行了。

## 开源

Expand Down
3 changes: 3 additions & 0 deletions llcom/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@
<setting name="quickData" serializeAs="String">
<value>{"data":[{"id":1,"text":"example string","hex":false},{"id":2,"text":"中文默认utf8编码","hex":false},{"id":3,"text":"aa 01 02 0d 0a","hex":true},{"id":4,"text":"此处数据会被lua处理","hex":false}]}</value>
</setting>
<setting name="UpgradeRequired" serializeAs="String">
<value>True</value>
</setting>
</llcom.Properties.Settings>
</userSettings>
</configuration>
4 changes: 2 additions & 2 deletions llcom/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.6")]
[assembly: AssemblyFileVersion("1.0.0.6")]
[assembly: AssemblyVersion("1.0.0.7")]
[assembly: AssemblyFileVersion("1.0.0.7")]
[assembly: NeutralResourcesLanguage("zh-CN")]

12 changes: 12 additions & 0 deletions llcom/Properties/Settings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions llcom/Properties/Settings.settings
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,8 @@
<Setting Name="quickData" Type="System.String" Scope="User">
<Value Profile="(Default)">{"data":[{"id":1,"text":"example string","hex":false},{"id":2,"text":"中文默认utf8编码","hex":false},{"id":3,"text":"aa 01 02 0d 0a","hex":true},{"id":4,"text":"此处数据会被lua处理","hex":false}]}</Value>
</Setting>
<Setting Name="UpgradeRequired" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
</Setting>
</Settings>
</SettingsFile>
1 change: 1 addition & 0 deletions llcom/SettingWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
<ComboBoxItem Content="低电平"/>
</ComboBox>
</WrapPanel>
<Button Name="settingsButton" Content="导入/导出所有配置,打开配置文件目录" ToolTip="包括快捷发送配置,不包括脚本文件" Click="SettingsButton_Click" Margin="5"/>
</StackPanel>
</TabItem>

Expand Down
8 changes: 8 additions & 0 deletions llcom/SettingWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using ICSharpCode.AvalonEdit.Search;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Globalization;
using System.IO;
using System.Linq;
Expand Down Expand Up @@ -252,5 +253,12 @@ private void TextEditor_LostFocus(object sender, RoutedEventArgs e)
if (lastLuaFile != "")
saveLuaFile(lastLuaFile);
}

private void SettingsButton_Click(object sender, RoutedEventArgs e)
{
MessageBox.Show("请在关闭软件后,再进行复制或覆盖操作,否则配置文件可能不生效。");
string path = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.PerUserRoamingAndLocal).FilePath;
System.Diagnostics.Process.Start("explorer.exe", path.Substring(0,path.Length-11));
}
}
}
11 changes: 10 additions & 1 deletion llcom/Tools/Global.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,23 @@ class Global
//主窗口是否被关闭?
public static bool isMainWindowsClosed = false;
//给全局使用的设置参数项
public static Model.Settings setting = new Model.Settings();
public static Model.Settings setting;
public static Model.Uart uart = new Model.Uart();

/// <summary>
/// 软件打开后,所有东西的初始化流程
/// </summary>
public static void Initial()
{
//导入之前的配置文件
if (Properties.Settings.Default.UpgradeRequired)
{
Properties.Settings.Default.Upgrade();
Properties.Settings.Default.UpgradeRequired = false;
Properties.Settings.Default.Save();
}
setting = new Model.Settings();

Logger.InitUartLog();
uart.Init();
uart.serial.BaudRate = setting.baudRate;
Expand Down
1 change: 1 addition & 0 deletions llcom/llcom.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@
<HintPath>..\packages\Newtonsoft.Json.12.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Data" />
<Reference Include="System.Management" />
<Reference Include="System.Windows.Forms" />
Expand Down

0 comments on commit 6cdcead

Please sign in to comment.