master
editor 2 months ago
commit 4e2de6bfd9

@ -0,0 +1,75 @@
WINFORM配置表生成工具
一、源码描述
Winform配置表生成工具
环境VS2022 Winform
二、功能介绍
可导出多种格式:
加密格式
Json格式
Xml格式
Lua格式
C#格式
Txt格式
Binary格式
三、注意事项
ctrl+F5运行即可。
作者: coderbest
如需获得该源码的视频、更新等更多资料请访问: https://www.51aspx.com/Code/BuildTools
------------------------------------------------------------------------------------------------
源码服务专家
官网: https://www.51aspx.com
讨论圈: https://club.51aspx.com/
平台声明:
1.51Aspx平台上提供下载的资源为免费、共享、商业三类源码,其中免费和共享源码仅供个人学习和研究使用,商业源码请在相应的授权许可条件下使用;
2.51Aspx平台对提供下载的软件及其它资源不拥有任何权利,其版权归属源码合法拥有者所有;
3.著作权人发现本网站载有侵害其合法权益的内容或作品,请与我们联系( 登录官网与客服反馈或发送邮件到support@51Aspx.com
4.51Aspx平台不保证提供的下载资源的准确性、安全性和完整性;
友情提示:
一般数据库文件默认在 DB_51Aspx 文件夹下
默认账号密码一般均为51Aspx
关于源码使用常见问题及解决方案,请参阅: https://www.51aspx.com/Help

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/>
</startup>
</configuration>

@ -0,0 +1,12 @@
<Application x:Class="tablegen2.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:tablegen2">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="StaticResources.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
</Application>

@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;
namespace tablegen2
{
/// <summary>
/// App.xaml 的交互逻辑
/// </summary>
public partial class App : Application
{

@ -0,0 +1,14 @@
namespace tablegen2
{
static class ApplicationEvents
{
public static void Application_Startup()
{
AppData.loadConfig();
}
public static void Application_Exit()
{
}
}
}

@ -0,0 +1,15 @@
using System;
using System.Globalization;
using System.Windows;
using System.Windows.Data;
namespace tablegen2
{
class BoolToVisibilityConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
return (bool)value ? Visibility.Visible : Visibility.Hidden;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)

@ -0,0 +1,15 @@
using System;
using System.IO;
using System.Text;
using System.Windows;
using tablegen2.logic;
using tablegen2.layouts;
using System.Collections.Generic;
using System.Linq;
namespace tablegen2
{
internal enum CommandType
{
Unknown = 0,
Help,

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{4D5AEC09-00D5-41EA-9BE3-67D090C7FCC1}</ProjectGuid>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>tablegen2</RootNamespace>
<AssemblyName>tablegen2</AssemblyName>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel>

@ -0,0 +1,15 @@
<Window x:Class="tablegen2.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:el="clr-namespace:tablegen2.layouts"
mc:Ignorable="d"
Title="配置表生成工具" Height="600" Width="800"
Icon="/tablegen2;component/app.ico"
MinWidth="500" MinHeight="400"
WindowStartupLocation="CenterScreen"
PreviewKeyUp="Window_PreviewKeyUp"
Background="#BBBBBB">
<Grid>
<Grid.RowDefinitions>

@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Windows;
using System.Windows.Input;
using System.Windows.Media;
using tablegen2.layouts;
using tablegen2.logic;
namespace tablegen2
{
/// <summary>
/// MainWindow.xaml 的交互逻辑
/// </summary>

@ -0,0 +1,15 @@
using System;
using System.Windows;
namespace tablegen2
{
static class Program
{
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main(string[] args)
{
ApplicationEvents.Application_Startup();

@ -0,0 +1,15 @@
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Windows;
// 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("tablegen2")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("tablegen2")]
[assembly: AssemblyCopyright("Copyright © 2018")]

@ -0,0 +1,15 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码由工具生成。
// 运行时版本:4.0.30319.42000
//
// 对此文件的更改可能会导致不正确的行为,并且如果
// 重新生成代码,这些更改将会丢失。
// </auto-generated>
//------------------------------------------------------------------------------
namespace tablegen2.Properties {
using System;
/// <summary>

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...

@ -0,0 +1,15 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码由工具生成。
// 运行时版本:4.0.30319.42000
//
// 对此文件的更改可能会导致不正确的行为,并且如果
// 重新生成代码,这些更改将会丢失。
// </auto-generated>
//------------------------------------------------------------------------------
namespace tablegen2.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.4.0.0")]

@ -0,0 +1,15 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:tablegen2"
xmlns:el="clr-namespace:tablegen2.layouts"
xmlns:Themes="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero">
<FontFamily x:Key="CommonFont">微软雅黑</FontFamily>
<SolidColorBrush x:Key="CommonBorder">#0A72D9</SolidColorBrush>
<SolidColorBrush x:Key="CommonBack">#4592F0</SolidColorBrush>
<SolidColorBrush x:Key="CommonGrayBorder">#999999</SolidColorBrush>
<SolidColorBrush x:Key="CommonLightGrayBorder">#D8D8D8</SolidColorBrush>
<local:BoolToVisibilityConverter x:Key="BoolToVisibilityConverter"/>
<Style x:Key="{x:Type TextBlock}" TargetType="{x:Type TextBlock}">

@ -0,0 +1,15 @@
using System.Collections.Generic;
using tablegen2.logic;
namespace tablegen2
{
public static class AppData
{
public static MainWindow MainWindow = null;
public static TableGenConfig Config = null;
public static string FileName = null;
static AppData()
{
}

@ -0,0 +1,15 @@
using System.IO;
using System.Text;
namespace tablegen2
{
public static class BinaryExtension
{
public static void WriteUtf8String(this BinaryWriter bw, string str)
{
bw.Write(Encoding.UTF8.GetBytes(str));
bw.Write((byte)0);
}
public static string ReadUtf8String(this BinaryReader br)
{

@ -0,0 +1,15 @@
using System;
using System.Windows.Controls;
using System.Windows;
using System.Windows.Media;
using System.Linq;
namespace tablegen2
{
internal static class FrameworkExtension
{
public static Vector GetOffsetFromRelativeParent(this FrameworkElement e, FrameworkElement p)
{
p.UpdateLayout();
var r = new Vector(0, 0);

@ -0,0 +1,15 @@
using System;
using System.IO;
using System.IO.Compression;
namespace tablegen2
{
internal static class GzipHelper
{
public static byte[] processGZipEncode(byte[] content)
{
return processGZipEncode(content, content.Length);
}
public static byte[] processGZipEncode(byte[] content, int length)
{

@ -0,0 +1,15 @@
using System.IO;
using System.Text;
using System.Web.Script.Serialization;
namespace tablegen2
{
internal static class JsonConfig
{
public static void writeToFile(string fileName, object target)
{
var jss = new JavaScriptSerializer();
var content = jss.Serialize(target);
var filePath = Path.Combine(Util.WorkPath, fileName);
File.WriteAllBytes(filePath, Encoding.UTF8.GetBytes(content));
}

@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Media;
namespace tablegen2
{
internal static class Log
{
public static void Msg(string msg, params object[] args)
{
var mw = App.Current.MainWindow as MainWindow;
if (mw != null)

@ -0,0 +1,15 @@
using System.Windows;
namespace tablegen2
{
public static class MessageBoxExtensions
{
public static void InfBox(this FrameworkElement owner, string str, params object[] args)
{
MessageBox.Show(
Window.GetWindow(owner),
string.Format(str, args),
"提示",
MessageBoxButton.OK,
MessageBoxImage.Information);
}

@ -0,0 +1,15 @@
using System;
using System.IO;
using System.Security.Cryptography;
using System.Text;
using System.Threading;
namespace tablegen2
{
internal static class Util
{
/// <summary>
/// 获取环境目录
/// </summary>
public static string WorkPath
{

@ -0,0 +1,15 @@
<Button x:Class="tablegen2.layouts.ButtonDark"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d"
d:DesignHeight="30" d:DesignWidth="100"
FocusVisualStyle="{x:Null}">
<Button.Resources>
<SolidColorBrush x:Key="ButtonGrayFill">#BB808080</SolidColorBrush>
<SolidColorBrush x:Key="ButtonGrayBorder">#BB404040</SolidColorBrush>
<SolidColorBrush x:Key="ButtonGrayText">#FFDDDDDD</SolidColorBrush>
</Button.Resources>
<Button.Template>
<ControlTemplate TargetType="{x:Type Button}">

@ -0,0 +1,15 @@
using System.Windows.Controls;
namespace tablegen2.layouts
{
/// <summary>
/// DarkButton.xaml 的交互逻辑
/// </summary>
public partial class ButtonDark : Button
{
public ButtonDark()
{
InitializeComponent();
}
}
}

@ -0,0 +1,15 @@
<Button x:Class="tablegen2.layouts.ButtonLight"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d"
d:DesignHeight="30" d:DesignWidth="100"
FocusVisualStyle="{x:Null}">
<Button.Resources>
<SolidColorBrush x:Key="ButtonGrayFill">#BBBBBBBB</SolidColorBrush>
<SolidColorBrush x:Key="ButtonGrayBorder">#BB808080</SolidColorBrush>
<SolidColorBrush x:Key="ButtonGrayText">#FF505050</SolidColorBrush>
</Button.Resources>
<Button.Template>
<ControlTemplate TargetType="{x:Type Button}">

@ -0,0 +1,15 @@
using System.Windows.Controls;
namespace tablegen2.layouts
{
/// <summary>
/// LightButton.xaml 的交互逻辑
/// </summary>
public partial class ButtonLight : Button
{
public ButtonLight()
{
InitializeComponent();
}
}
}

@ -0,0 +1,15 @@
<UserControl x:Class="tablegen2.layouts.HelperPanel"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:el="clr-namespace:tablegen2.layouts"
mc:Ignorable="d"
Width="500" Height="400">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="30"/>
<RowDefinition Height="*"/>
<RowDefinition Height="50"/>
</Grid.RowDefinitions>
<Grid Grid.Row="0" Background="#80000000">

@ -0,0 +1,15 @@
using System.Windows;
using System.Windows.Controls;
namespace tablegen2.layouts
{
/// <summary>
/// HelperPanel.xaml 的交互逻辑
/// </summary>
public partial class HelperPanel : UserControl
{
public static readonly string HelpString =
@"1.Excel格式说明
*
string

@ -0,0 +1,15 @@
using System.Windows;
using System.Windows.Controls;
namespace tablegen2.layouts
{
public class ListItemBase : UserControl
{
//条目是否选中
public static readonly DependencyProperty IsSelectedProperty;
static ListItemBase()
{
IsSelectedProperty = DependencyProperty.Register(
"IsSelected",
typeof(bool),
typeof(ListItemBase),

@ -0,0 +1,15 @@
<Window x:Class="tablegen2.layouts.PopupWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:el="clr-namespace:tablegen2.layouts"
mc:Ignorable="d"
Title="PopupWindow" Height="300" Width="300"
WindowStartupLocation="CenterOwner"
SizeToContent="WidthAndHeight"
Icon="/tablegen2;component/app.ico"
ResizeMode="NoResize" ShowInTaskbar="False"
PreviewKeyDown="Window_PreviewKeyDown">
<Grid x:Name="gridContainer" Background="LightGray">

@ -0,0 +1,15 @@
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
namespace tablegen2.layouts
{
/// <summary>
/// PopupWindow.xaml 的交互逻辑
/// </summary>
public partial class PopupWindow : Window
{
public bool IsEscapeClose { get; set; }
public event Func<bool> PreClosingEvent;
public UserControl Panel { get; internal set; }

@ -0,0 +1,15 @@
<UserControl x:Class="tablegen2.layouts.WaitingControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:ec="clr-namespace:tablegen2.layouts"
FontFamily="Consolas"
Background="#C0000000"
MouseDown="UserControl_MouseDown"
KeyDown="UserControl_KeyDown">
<UserControl.Resources>
<Storyboard x:Key="sbStory" RepeatBehavior="Forever">
<DoubleAnimation Storyboard.TargetName="r01" Storyboard.TargetProperty="Opacity" AutoReverse="True" Duration="0:0:0.08333" BeginTime="0:0:0.00000" To="0"/>
<DoubleAnimation Storyboard.TargetName="r02" Storyboard.TargetProperty="Opacity" AutoReverse="True" Duration="0:0:0.08333" BeginTime="0:0:0.08333" To="0"/>
<DoubleAnimation Storyboard.TargetName="r03" Storyboard.TargetProperty="Opacity" AutoReverse="True" Duration="0:0:0.08333" BeginTime="0:0:0.16666" To="0"/>

@ -0,0 +1,15 @@
using System;
using System.Threading;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Media.Animation;
using System.Windows.Threading;
namespace tablegen2.layouts
{
/// <summary>
/// WaitingControl.xaml 的交互逻辑
/// </summary>
public partial class WaitingControl : UserControl
{

@ -0,0 +1,15 @@
<UserControl x:Class="tablegen2.layouts.FrameConsole"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:el="clr-namespace:tablegen2.layouts"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="35"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Border Grid.Row="0" BorderThickness="1" BorderBrush="Gray"

@ -0,0 +1,15 @@
using System;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Media;
namespace tablegen2.layouts
{
/// <summary>
/// FrameConsole.xaml 的交互逻辑
/// </summary>
public partial class FrameConsole : UserControl
{
public FrameConsole()
{
InitializeComponent();

@ -0,0 +1,15 @@
<UserControl x:Class="tablegen2.layouts.FrameExcelView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:el="clr-namespace:tablegen2.layouts"
mc:Ignorable="d"
d:DesignHeight="600" d:DesignWidth="800">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="60"/>
</Grid.RowDefinitions>
<DataGrid Grid.Row="0" AutoGenerateColumns="True" Name="dataGrid1" VerticalAlignment="Top"
CanUserSortColumns="False" Margin="5" IsReadOnly="False"

@ -0,0 +1,15 @@
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using tablegen2.logic;
namespace tablegen2.layouts
{
/// <summary>
/// FrameExcelView.xaml 的交互逻辑
/// </summary>
public partial class FrameExcelView : UserControl
{
private TableExcelData data_;

@ -0,0 +1,15 @@
<UserControl x:Class="tablegen2.layouts.FrameFileTree"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:el="clr-namespace:tablegen2.layouts"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="35"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Border Grid.Row="0" BorderThickness="1" BorderBrush="Gray"

@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Windows;
using System.Windows.Controls;
using tablegen2.logic;
namespace tablegen2.layouts
{
/// <summary>
/// FrameFileTree.xaml 的交互逻辑
/// </summary>
public partial class FrameFileTree : UserControl
{
public event Action OpenExcelRequest;

@ -0,0 +1,15 @@
<UserControl x:Class="tablegen2.layouts.FrameSetting"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:el="clr-namespace:tablegen2.layouts"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="400">
<Border Margin="3" BorderThickness="1" BorderBrush="Gray" Background="#80FFFFFF" CornerRadius="5">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="14"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>

@ -0,0 +1,15 @@
using System;
using System.IO;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using tablegen2.logic;
namespace tablegen2.layouts
{
/// <summary>
/// FrameSetting.xaml 的交互逻辑
/// </summary>
public partial class FrameSetting : UserControl
{
public event Action ExcelDirChanged;

@ -0,0 +1,15 @@
<UserControl x:Class="tablegen2.layouts.FrameSettingMore"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:el="clr-namespace:tablegen2.layouts"
mc:Ignorable="d"
Height="Auto" Width="300">
<Grid Background="#60FFFFFF">
<Grid.RowDefinitions>
<RowDefinition Height="14"/>
<RowDefinition Height="40"/>
<RowDefinition Height="40"/>
<RowDefinition Height="40"/>
</Grid.RowDefinitions>

@ -0,0 +1,15 @@
using System.Windows;
using System.Windows.Controls;
namespace tablegen2.layouts
{
/// <summary>
/// FrameSettingMore.xaml 的交互逻辑
/// </summary>
public partial class FrameSettingMore : UserControl
{
public FrameSettingMore()
{
InitializeComponent();
if (AppData.Config != null)
{

@ -0,0 +1,15 @@
<UserControl x:Class="tablegen2.layouts.FrameToolBar"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:el="clr-namespace:tablegen2.layouts"
mc:Ignorable="d"
d:DesignHeight="30" d:DesignWidth="400">
<UserControl.Background>
<LinearGradientBrush StartPoint="0.5,0.1" EndPoint="0.5,1">
<GradientBrush.GradientStops>
<GradientStopCollection>
<GradientStop Color="#40FFFFFF" Offset="0.0"/>
<GradientStop Color="#40BBBBBB" Offset="1.0"/>
</GradientStopCollection>

@ -0,0 +1,15 @@
using System;
using System.Windows;
using System.Windows.Controls;
namespace tablegen2.layouts
{
/// <summary>
/// FrameToolBar.xaml 的交互逻辑
/// </summary>
public partial class FrameToolBar : UserControl
{
public event Action OpenExcelEvent;
public FrameToolBar()
{

@ -0,0 +1,15 @@
<el:ListItemBase x:Class="tablegen2.layouts.TreeListItem"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:el="clr-namespace:tablegen2.layouts"
mc:Ignorable="d"
Height="26" Width="200"
DataContext="{Binding RelativeSource={RelativeSource Self}}"
Style="{StaticResource ListItemStyle}">
<Grid Background="Transparent">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="30"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>

@ -0,0 +1,15 @@
using System.IO;
namespace tablegen2.layouts
{
/// <summary>
/// TreeListItem.xaml 的交互逻辑
/// </summary>
public partial class TreeListItem : ListItemBase
{
public string FullPath { get; set; }
public TreeListItem()
{
InitializeComponent();
}

@ -0,0 +1,15 @@
<UserControl x:Class="tablegen2.layouts.TreeListView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:el="clr-namespace:tablegen2.layouts"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300">
<Grid>
<ScrollViewer x:Name="sv" Margin="0" Focusable="False"
HorizontalScrollBarVisibility="Disabled"
VerticalScrollBarVisibility="Auto"
Padding="0" MouseLeftButtonDown="sv_MouseLeftButtonDown"
MouseRightButtonDown="sv_MouseRightButtonDown">
<StackPanel Orientation="Vertical" Margin="0,2,0,2">

@ -0,0 +1,15 @@
using System;
using System.IO;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows;
using System.Linq;
using System.Windows.Data;
using tablegen2.logic;
using System.Collections.Generic;
namespace tablegen2.layouts
{
/// <summary>
/// TreeListView.xaml 的交互逻辑
/// </summary>

@ -0,0 +1,15 @@
<UserControl x:Class="tablegen2.layouts.HeaderFieldEdit"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:el="clr-namespace:tablegen2.layouts"
mc:Ignorable="d"
Height="300" Width="400"
DataContext="{Binding RelativeSource={RelativeSource Self}}">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="0"/>
<RowDefinition Height="50.087"/>
<RowDefinition Height="50"/>
<RowDefinition Height="*"/>

@ -0,0 +1,15 @@
using System.Windows;
using System.Windows.Controls;
namespace tablegen2.layouts
{
/// <summary>
/// HeaderFieldEdit.xaml 的交互逻辑
/// </summary>
public partial class HeaderFieldEdit : UserControl
{
#region 依赖属性
public static readonly DependencyProperty FieldNameProperty;
public static readonly DependencyProperty IsFieldNameReadonlyProperty;
public static readonly DependencyProperty FieldDescProperty;
public static readonly DependencyProperty FieldDefaultProperty;

@ -0,0 +1,15 @@
<el:ListItemBase x:Class="tablegen2.layouts.HeaderListItem"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:el="clr-namespace:tablegen2.layouts"
mc:Ignorable="d"
Height="50" d:DesignWidth="700"
DataContext="{Binding RelativeSource={RelativeSource Self}}"
Style="{StaticResource ListItemStyle}">
<Grid Background="Transparent">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="160"/>
<ColumnDefinition Width="50"/>
<ColumnDefinition Width="*"/>

@ -0,0 +1,15 @@
using System.Windows;
namespace tablegen2.layouts
{
/// <summary>
/// HeaderListItem.xaml 的交互逻辑
/// </summary>
public partial class HeaderListItem : ListItemBase
{
#region 依赖属性
public static readonly DependencyProperty FieldNameProperty;
public static readonly DependencyProperty FieldTypeProperty;
public static readonly DependencyProperty FieldDescProperty;
public static readonly DependencyProperty FieldDefaultProperty;
public static readonly DependencyProperty EditableProperty;

@ -0,0 +1,15 @@
<UserControl x:Class="tablegen2.layouts.HeaderListView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:tablegen2.layouts"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300">
<Grid>
<TextBlock x:Name="txtEmpty" Text="没有数据,空空如也~" Foreground="Gray" HorizontalAlignment="Center" VerticalAlignment="Center"/>
<ScrollViewer x:Name="sv" Margin="0" Focusable="False"
HorizontalScrollBarVisibility="Disabled"
VerticalScrollBarVisibility="Auto"
Padding="0"
MouseLeftButtonDown="sv_MouseLeftButtonDown"

@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Input;
using tablegen2.logic;
namespace tablegen2.layouts
{
/// <summary>
/// HeaderListView.xaml 的交互逻辑
/// </summary>
public partial class HeaderListView : UserControl

@ -0,0 +1,15 @@
<UserControl x:Class="tablegen2.layouts.HeaderPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:el="clr-namespace:tablegen2.layouts"
mc:Ignorable="d"
DataContext="{Binding RelativeSource={RelativeSource Self}}" Height="360" Width="640">
<Grid Margin="0,0,0.278,-0.209">
<Grid.RowDefinitions>
<RowDefinition Height="34"/>
<RowDefinition/>
<RowDefinition Height="63.443"/>
</Grid.RowDefinitions>
<Border Grid.Row="0" Background="Transparent" BorderThickness="1" BorderBrush="Gray" Margin="0,0,0,0.226">

@ -0,0 +1,15 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using tablegen2.logic;
namespace tablegen2.layouts
{
/// <summary>
/// HeaderPage.xaml 的交互逻辑
/// </summary>
public partial class HeaderPage : UserControl
{
#region 依赖属性

@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
namespace tablegen2.logic.parser.DataTableGenerator
{
public sealed class DataTableGenerator
{
private const string path = "CodeDataTemplate.txt";
private static readonly Regex EndWithNumberRegex = new Regex(@"\d+$");
private static readonly Regex NameRegex = new Regex(@"^[A-Z][A-Za-z0-9_]*$");

@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
namespace tablegen2.logic.parser.DataTableGenerator
{
public sealed partial class DataTableProcessor
{
public abstract class DataProcessor
{
public abstract Type Type{ get;}
public abstract bool IsId { get; }

@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
namespace tablegen2.logic.parser.DataTableGenerator
{
public sealed partial class DataTableProcessor
{
private static class DataProcessorUtility
{
private static readonly IDictionary<string, DataProcessor> s_DataProcessors = new SortedDictionary<string, DataProcessor>(StringComparer.Ordinal);

@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
namespace tablegen2.logic.parser.DataTableGenerator
{
public delegate void DataTableCodeGenerator(DataTableProcessor dataTableProcessor, StringBuilder codeContent, object userData);
public sealed partial class DataTableProcessor
{
private const string CommentLineSeparator = "#";
private static readonly char[] DataSplitSeparators = new char[] { '\t' };
private static readonly char[] DataTrimSeparators = new char[] { '\"' };

@ -0,0 +1,15 @@
using System.Collections.Generic;
using System.Linq;
namespace tablegen2.logic
{
public class TableExcelData
{
//private TableExcelProperty propertys_ = new TableExcelProperty();
private string className_ = null;
private List<TableExcelHeader> headers_ = new List<TableExcelHeader>();
private List<TableExcelRow> rows_ = new List<TableExcelRow>();
public TableExcelData()

@ -0,0 +1,15 @@
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.IO;
using System.IO.Pipes;
using System.Linq;
using System.Runtime.Serialization.Formatters.Binary;
using System.Text;
using System.Text.RegularExpressions;
namespace tablegen2.logic
{
public class TableExcelExportBinary
{

@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Globalization;
namespace tablegen2.logic
{
public class TableExcelExportCS
{
private static readonly string s_CodeDataTemplate = "\\CodeDataTemplate.txt";
private static readonly string s_Timer = "__DATA_TABLE_CREATE_TIME__";
private static readonly string s_NameSpace = "__DATA_TABLE_NAME_SPACE__";
private static readonly string s_ClassName = "__DATA_TABLE_CLASS_NAME__";

@ -0,0 +1,15 @@
using NPOI.SS.Formula.Functions;
using System;
using System.IO;
using System.Text;
namespace tablegen2.logic
{
public static class TableExcelExportDat
{
public static void exportExcelFile(TableExcelData data, string filePath)
{
const int version = 1;
var ms = new MemoryStream();
var bw = new BinaryWriter(ms, Encoding.UTF8);

@ -0,0 +1,15 @@
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Newtonsoft.Json;
using System.IO;
using System;
namespace tablegen2.logic
{
public static class TableExcelExportJson
{
public static void exportExcelFile(TableExcelData data, string filePath)
{
List<Dictionary<string, object>> lst = data.Rows.Select(a =>
{

@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
namespace tablegen2.logic
{
public static class TableExcelExportLua
{
public static void exportExcelFile(TableExcelData data, string filePath)
{
exportLua_Impl2(data, filePath);
}
public static void appendFormatLineEx(StringBuilder sb, int indent, string fmtstr, params object[] args)

@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
namespace tablegen2.logic
{
public class TableExcelExportTxt
{
// public static void appendFormatLineEx(StringBuilder sb, int indent, string fmtstr, params object[] args)
// {
// if (indent > 0)

@ -0,0 +1,15 @@
using System.IO;
using System.Text;
using System.Xml;
namespace tablegen2.logic
{
public static class TableExcelExportXml
{
public static void exportExcelFile(TableExcelData data, string filePath)
{
var doc = new XmlDocument();
var root = doc.CreateElement("root");
doc.AppendChild(root);
foreach (var row in data.Rows)

@ -0,0 +1,10 @@
namespace tablegen2.logic
{
public class TableExcelHeader
{
public string FieldName { get; set; }
public string FieldType { get; set; }
public string FieldDesc { get; set; }
public string FieldDefulat { get; set; }
}
}

@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.IO;
namespace tablegen2.logic
{
public static class TableExcelImportDat
{
public static TableExcelData importFile(string filePath)
{
var content = GzipHelper.processGZipDecode(File.ReadAllBytes(filePath));
var ms = new MemoryStream(content);
var br = new BinaryReader(ms);
if (br.ReadInt32() != 1)

@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace tablegen2.logic
{
//public class TableExcelProperty
//{
//
// public List<string> StrList { get; set; }
//
// public TableExcelProperty()
// {
// StrList = new List<string>();

@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using NPOI.HSSF.UserModel;
using NPOI.SS.UserModel;
using System.IO;
using NPOI.XSSF.UserModel;
using System.Text.RegularExpressions;
using NPOI.SS.Formula.Functions;
using System.Text;
namespace tablegen2.logic
{
public static class TableExcelReader
{
public static TableExcelData loadFromExcel(string filePath)

@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace tablegen2.logic
{
public class TableExcelRow
{
public List<string> StrList { get; set; }
public TableExcelRow()
{
StrList = new List<string>();

@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using NPOI.HSSF.UserModel;
using NPOI.SS.UserModel;
using NPOI.XSSF.UserModel;
namespace tablegen2.logic
{
public static class TableExcelWriter
{
public static void genExcel(TableExcelData data, string filePath)
{
Util.MakesureFolderExist(Path.GetDirectoryName(filePath));

@ -0,0 +1,15 @@
using System;
namespace tablegen2.logic
{
public enum TableExportFormat
{
Unknown = 0, // 未知
Dat, // 加密数据格式
Json, // Json格式
Xml, // Xml格式
Lua, // Lua格式
Txt, // 文本格式
Binary, // 二进制格式
CSharp // CS文件
}

@ -0,0 +1,15 @@
namespace tablegen2.logic
{
public class TableGenConfig
{
public string ExcelDir = string.Empty;
public TableExportFormat ExportFormat = TableExportFormat.Unknown;
public string ExportDir = string.Empty;
public string SheetNameForField = string.Empty;
public string SheetNameForData = string.Empty;
public string defalutStringData = string.Empty;
public string defalutIntData = string.Empty;
public string defalutFloatData = string.Empty;

@ -0,0 +1,15 @@
<?xml version="1.0"?>
<doc>
<assembly>
<name>Newtonsoft.Json</name>
</assembly>
<members>
<member name="T:Newtonsoft.Json.Bson.BsonObjectId">
<summary>
Represents a BSON Oid (object id).
</summary>
</member>
<member name="P:Newtonsoft.Json.Bson.BsonObjectId.Value">
<summary>
Gets or sets the value of the Oid.
</summary>
Loading…
Cancel
Save