port from perforce
This commit is contained in:
20
evoke-64k/trunk/Tweaky/Backup/Tweaky.sln
Normal file
20
evoke-64k/trunk/Tweaky/Backup/Tweaky.sln
Normal file
@@ -0,0 +1,20 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 10.00
|
||||
# Visual Studio 2008
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tweaky", "Tweaky\Tweaky.csproj", "{17A0CF60-7011-4715-8241-8499B6D3E130}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{17A0CF60-7011-4715-8241-8499B6D3E130}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{17A0CF60-7011-4715-8241-8499B6D3E130}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{17A0CF60-7011-4715-8241-8499B6D3E130}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{17A0CF60-7011-4715-8241-8499B6D3E130}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
10
evoke-64k/trunk/Tweaky/Backup/Tweaky/Config.h
Normal file
10
evoke-64k/trunk/Tweaky/Backup/Tweaky/Config.h
Normal file
@@ -0,0 +1,10 @@
|
||||
#pragma once
|
||||
#include "filemon.h"
|
||||
|
||||
ANY(float, g_DemoTime) = 12.5f;
|
||||
RANGE(float, 0.0f, 1.0f, g_Alpha) = 0.5f;
|
||||
COMBO(int, "0, 1, 2, 3", g_DemoMode) = 1;
|
||||
ANY(bool, g_Doof) = true;
|
||||
|
||||
//ajdhjashdjsfsdf
|
||||
//sdfgdfgdfg
|
||||
21
evoke-64k/trunk/Tweaky/Backup/Tweaky/Program.cs
Normal file
21
evoke-64k/trunk/Tweaky/Backup/Tweaky/Program.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Tweaky
|
||||
{
|
||||
static class Program
|
||||
{
|
||||
/// <summary>
|
||||
/// The main entry point for the application.
|
||||
/// </summary>
|
||||
[STAThread]
|
||||
static void Main()
|
||||
{
|
||||
Application.EnableVisualStyles();
|
||||
Application.SetCompatibleTextRenderingDefault(false);
|
||||
Application.Run(new TweakyMainWindow());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("Tweaky")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("Microsoft")]
|
||||
[assembly: AssemblyProduct("Tweaky")]
|
||||
[assembly: AssemblyCopyright("Copyright © Microsoft 2010")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("3b28bafe-1621-4e21-8f5d-dd2cfd18e6ca")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
71
evoke-64k/trunk/Tweaky/Backup/Tweaky/Properties/Resources.Designer.cs
generated
Normal file
71
evoke-64k/trunk/Tweaky/Backup/Tweaky/Properties/Resources.Designer.cs
generated
Normal file
@@ -0,0 +1,71 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:2.0.50727.4927
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Tweaky.Properties
|
||||
{
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// A strongly-typed resource class, for looking up localized strings, etc.
|
||||
/// </summary>
|
||||
// This class was auto-generated by the StronglyTypedResourceBuilder
|
||||
// class via a tool like ResGen or Visual Studio.
|
||||
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||
// with the /str option, or rebuild your VS project.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Resources
|
||||
{
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal Resources()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the cached ResourceManager instance used by this class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager
|
||||
{
|
||||
get
|
||||
{
|
||||
if ((resourceMan == null))
|
||||
{
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Tweaky.Properties.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Overrides the current thread's CurrentUICulture property for all
|
||||
/// resource lookups using this strongly typed resource class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture
|
||||
{
|
||||
get
|
||||
{
|
||||
return resourceCulture;
|
||||
}
|
||||
set
|
||||
{
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
117
evoke-64k/trunk/Tweaky/Backup/Tweaky/Properties/Resources.resx
Normal file
117
evoke-64k/trunk/Tweaky/Backup/Tweaky/Properties/Resources.resx
Normal file
@@ -0,0 +1,117 @@
|
||||
<?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 ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
37
evoke-64k/trunk/Tweaky/Backup/Tweaky/Properties/Settings.Designer.cs
generated
Normal file
37
evoke-64k/trunk/Tweaky/Backup/Tweaky/Properties/Settings.Designer.cs
generated
Normal file
@@ -0,0 +1,37 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:2.0.50727.4927
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Tweaky.Properties {
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "9.0.0.0")]
|
||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
|
||||
|
||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||
|
||||
public static Settings Default {
|
||||
get {
|
||||
return defaultInstance;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
public global::System.Collections.Specialized.StringCollection LastOpenedFiles {
|
||||
get {
|
||||
return ((global::System.Collections.Specialized.StringCollection)(this["LastOpenedFiles"]));
|
||||
}
|
||||
set {
|
||||
this["LastOpenedFiles"] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="Tweaky.Properties" GeneratedClassName="Settings">
|
||||
<Profiles />
|
||||
<Settings>
|
||||
<Setting Name="LastOpenedFiles" Type="System.Collections.Specialized.StringCollection" Scope="User">
|
||||
<Value Profile="(Default)" />
|
||||
</Setting>
|
||||
</Settings>
|
||||
</SettingsFile>
|
||||
97
evoke-64k/trunk/Tweaky/Backup/Tweaky/Tweaky.csproj
Normal file
97
evoke-64k/trunk/Tweaky/Backup/Tweaky/Tweaky.csproj
Normal file
@@ -0,0 +1,97 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>9.0.21022</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{17A0CF60-7011-4715-8241-8499B6D3E130}</ProjectGuid>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Tweaky</RootNamespace>
|
||||
<AssemblyName>Tweaky</AssemblyName>
|
||||
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Xml.Linq">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Data.DataSetExtensions">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Deployment" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="TweakyCore.cs" />
|
||||
<Compile Include="TweakyMainWindow.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="TweakyMainWindow.Designer.cs">
|
||||
<DependentUpon>TweakyMainWindow.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<EmbeddedResource Include="TweakyMainWindow.resx">
|
||||
<DependentUpon>TweakyMainWindow.cs</DependentUpon>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<Compile Include="Properties\Resources.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
</Compile>
|
||||
<None Include="app.config" />
|
||||
<None Include="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
<Compile Include="Properties\Settings.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Config.h">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
453
evoke-64k/trunk/Tweaky/Backup/Tweaky/TweakyCore.cs
Normal file
453
evoke-64k/trunk/Tweaky/Backup/Tweaky/TweakyCore.cs
Normal file
@@ -0,0 +1,453 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Windows.Forms;
|
||||
using System.IO;
|
||||
using System.Globalization;
|
||||
using System.Data;
|
||||
|
||||
namespace Tweaky
|
||||
{
|
||||
public class TweakyCore
|
||||
{
|
||||
private Regex EntryPattern = new Regex(@"((?<type>ANY\(.*\))|(?<type>RANGE\(.*\))|(?<type>COMBO\(.*\)))\s*\=\s*(?<value>.*)\s*;");
|
||||
private Regex AnyPattern = new Regex(@"ANY\((?<type>\w*),\s*(?<name>.*)\)");
|
||||
private Regex ComboPattern = new Regex(@"COMBO\((?<type>\w*)\s*,\s*(?<options>.*),\s*(?<name>.*)\)");
|
||||
private Regex RangePattern = new Regex(@"RANGE\((?<type>\w*)\s*,\s*(?<from>.*)\s*,\s*(?<to>.*),\s*(?<name>.*)\)");
|
||||
|
||||
private List<VarEntryBase> varEntries = new List<VarEntryBase>();
|
||||
private Timer saveTimer;
|
||||
|
||||
public string FilePath {get; protected set; }
|
||||
public bool HasWatchableVarEntries { get; protected set; }
|
||||
|
||||
public TweakyCore(string filePath)
|
||||
{
|
||||
this.FilePath = filePath;
|
||||
this.ReadFileContent();
|
||||
}
|
||||
|
||||
public void BuildUiElements(Control rootControl)
|
||||
{
|
||||
var table = new TableLayoutPanel();
|
||||
table.AutoSize = true;
|
||||
table.ColumnCount = 3;
|
||||
table.RowCount = varEntries.Count;
|
||||
|
||||
foreach (RowStyle style in table.RowStyles)
|
||||
style.SizeType = SizeType.AutoSize;
|
||||
|
||||
var currentRowIndex = 0;
|
||||
foreach (var entry in varEntries)
|
||||
{
|
||||
var localEntry = entry;
|
||||
|
||||
Control editControl = entry.CreateUi();
|
||||
if (editControl != null)
|
||||
{
|
||||
var nameLabel = new Label();
|
||||
nameLabel.Text = entry.Name;
|
||||
nameLabel.Dock = DockStyle.Fill;
|
||||
nameLabel.AutoSize = true;
|
||||
nameLabel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
|
||||
var resetControl = new Button();
|
||||
resetControl.Text = "Reset";
|
||||
resetControl.Dock = DockStyle.Fill;
|
||||
resetControl.AutoSize = true;
|
||||
resetControl.Click += (s, e) => localEntry.Reset();
|
||||
resetControl.Enabled = false;
|
||||
|
||||
table.Controls.Add(nameLabel, 0, currentRowIndex);
|
||||
table.Controls.Add(editControl, 1, currentRowIndex);
|
||||
table.Controls.Add(resetControl, 2, currentRowIndex);
|
||||
|
||||
localEntry.OnValueChanged += () =>
|
||||
{
|
||||
resetControl.Enabled = !localEntry.HasDefaultValue;
|
||||
};
|
||||
|
||||
currentRowIndex++;
|
||||
}
|
||||
}
|
||||
rootControl.Controls.Add(table);
|
||||
}
|
||||
|
||||
protected void ReadFileContent()
|
||||
{
|
||||
using (var stringReader = new StreamReader(FilePath))
|
||||
{
|
||||
string line;
|
||||
while ((line = stringReader.ReadLine()) != null)
|
||||
{
|
||||
var entryMatch = EntryPattern.Match(line.Trim());
|
||||
if (!entryMatch.Success)
|
||||
{
|
||||
varEntries.Add(new VarEntryBase()
|
||||
{
|
||||
Name = line,
|
||||
});
|
||||
continue;
|
||||
}
|
||||
|
||||
var maintype = entryMatch.Groups["type"].Value;
|
||||
|
||||
var anyMatch = AnyPattern.Match(maintype);
|
||||
var rangeMatch = RangePattern.Match(maintype);
|
||||
var comboMatch = ComboPattern.Match(maintype);
|
||||
|
||||
VarEntryBase newEntry = null;
|
||||
if (anyMatch.Success)
|
||||
{
|
||||
var type = anyMatch.Groups["type"].Value;
|
||||
newEntry = VarEntryUtility.CreateType(typeof(VarEntryT<>), type,
|
||||
VarEntryUtility.ConvertToObject(type, entryMatch.Groups["value"].Value));
|
||||
newEntry.Name = anyMatch.Groups["name"].Value;
|
||||
this.HasWatchableVarEntries = true;
|
||||
}
|
||||
else if (rangeMatch.Success)
|
||||
{
|
||||
var type = rangeMatch.Groups["type"].Value;
|
||||
newEntry = VarEntryUtility.CreateType(typeof(RangeEntryT<>), type,
|
||||
VarEntryUtility.ConvertToObject(type, entryMatch.Groups["value"].Value),
|
||||
VarEntryUtility.ConvertToObject(type, rangeMatch.Groups["from"].Value),
|
||||
VarEntryUtility.ConvertToObject(type, rangeMatch.Groups["to"].Value));
|
||||
newEntry.Name = rangeMatch.Groups["name"].Value;
|
||||
this.HasWatchableVarEntries = true;
|
||||
}
|
||||
else if (comboMatch.Success)
|
||||
{
|
||||
var type = comboMatch.Groups["type"].Value;
|
||||
var options = comboMatch.Groups["options"].Value
|
||||
.Trim('\"').Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries)
|
||||
.Select(o => VarEntryUtility.ConvertToObject(type, o.Trim()))
|
||||
.ToList();
|
||||
newEntry = VarEntryUtility.CreateType(typeof(ComboEntryT<>), type,
|
||||
VarEntryUtility.ConvertToObject(type, entryMatch.Groups["value"].Value),
|
||||
options);
|
||||
newEntry.Name = comboMatch.Groups["name"].Value;
|
||||
this.HasWatchableVarEntries = true;
|
||||
}
|
||||
|
||||
|
||||
newEntry.OnValueChanged += () => OnValueChanged();
|
||||
|
||||
varEntries.Add(newEntry);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void OnValueChanged()
|
||||
{
|
||||
if (saveTimer != null)
|
||||
return; // save is already pending
|
||||
saveTimer = new Timer();
|
||||
saveTimer.Interval = 1200; // > one second till the save call is progressed
|
||||
saveTimer.Tick += (s, e) => WriteFileContent();
|
||||
saveTimer.Start();
|
||||
}
|
||||
|
||||
public void WriteFileContent()
|
||||
{
|
||||
if (saveTimer != null)
|
||||
{
|
||||
saveTimer.Stop();
|
||||
saveTimer.Dispose();
|
||||
saveTimer = null;
|
||||
}
|
||||
|
||||
using (var streamWriter = new StreamWriter(FilePath, false))
|
||||
{
|
||||
foreach (var entry in varEntries)
|
||||
streamWriter.Write(entry.ToString() + "\r\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static class VarEntryUtility
|
||||
{
|
||||
public static string GetTypeName<T>()
|
||||
{
|
||||
if (typeof(T) == typeof(bool))
|
||||
return "bool";
|
||||
else if (typeof(T) == typeof(int))
|
||||
return "int";
|
||||
else if (typeof(T) == typeof(float))
|
||||
return "float";
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
private static Type GetType(Type baseType, string type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case "int":
|
||||
return baseType.MakeGenericType(typeof(int));
|
||||
case "float":
|
||||
return baseType.MakeGenericType(typeof(float));
|
||||
case "bool":
|
||||
return baseType.MakeGenericType(typeof(bool));
|
||||
default:
|
||||
throw new ArgumentException(type);
|
||||
}
|
||||
}
|
||||
|
||||
public static VarEntryBase CreateType(Type baseType, string type, params object[] args)
|
||||
{
|
||||
return Activator.CreateInstance(GetType(baseType, type), args) as VarEntryBase;
|
||||
}
|
||||
|
||||
public static object ConvertToObject(string type, string rawValue)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case "bool":
|
||||
return bool.Parse(rawValue);
|
||||
case "int":
|
||||
return int.Parse(rawValue);
|
||||
case "float":
|
||||
return float.Parse(rawValue.TrimEnd('f'), CultureInfo.InvariantCulture);
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static string ConvertToString<T>(object rawValue)
|
||||
{
|
||||
if (typeof(T) == typeof(bool))
|
||||
return (bool)rawValue == true ? "true" : "false";
|
||||
if (typeof(T) == typeof(int))
|
||||
return ((int)rawValue).ToString(CultureInfo.InvariantCulture);
|
||||
if (typeof(T) == typeof(float))
|
||||
return ((float)rawValue).ToString(CultureInfo.InvariantCulture);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public class VarEntryBase
|
||||
{
|
||||
public string Name;
|
||||
|
||||
public Action OnValueChanged;
|
||||
|
||||
public virtual Control CreateUi() { return null; }
|
||||
|
||||
public virtual void Reset() {}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return this.Name;
|
||||
}
|
||||
|
||||
public virtual bool HasDefaultValue { get { return false; } }
|
||||
}
|
||||
|
||||
public class VarEntryT<T> : VarEntryBase
|
||||
{
|
||||
public VarEntryT(T defaultValue)
|
||||
{
|
||||
this.CurrentValue = this.DefaultValue = defaultValue;
|
||||
}
|
||||
|
||||
public T CurrentValue;
|
||||
public T DefaultValue;
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return string.Format("ANY({0}, {1}) = {2};",
|
||||
VarEntryUtility.GetTypeName<T>(),
|
||||
this.Name,
|
||||
VarEntryUtility.ConvertToString<T>(this.CurrentValue));
|
||||
}
|
||||
|
||||
protected float ToFloat(object value)
|
||||
{
|
||||
if (value.GetType() == typeof(int))
|
||||
return (float)(int)value;
|
||||
else
|
||||
return (float)value;
|
||||
}
|
||||
|
||||
protected T FromFloat(float value)
|
||||
{
|
||||
if (typeof(T) == typeof(int))
|
||||
return (T)(object)(int)value;
|
||||
else
|
||||
return (T)(object)value; ;
|
||||
}
|
||||
|
||||
|
||||
private CheckBox checkBox;
|
||||
private NumericUpDown numBox;
|
||||
|
||||
public override Control CreateUi()
|
||||
{
|
||||
if (typeof(T) == typeof(bool))
|
||||
{
|
||||
checkBox = new CheckBox();
|
||||
checkBox.Dock = DockStyle.Left;
|
||||
checkBox.Checked = (bool)(object)this.CurrentValue;
|
||||
checkBox.CheckedChanged += (s, e) =>
|
||||
{
|
||||
this.CurrentValue = (T)(object)checkBox.Checked;
|
||||
if (this.OnValueChanged != null)
|
||||
this.OnValueChanged();
|
||||
};
|
||||
return checkBox;
|
||||
}
|
||||
else
|
||||
{
|
||||
numBox = new NumericUpDown();
|
||||
numBox.DecimalPlaces = 6;
|
||||
numBox.Dock = DockStyle.Fill;
|
||||
numBox.Value = (decimal)ToFloat(this.CurrentValue);
|
||||
numBox.ValueChanged += (s, e) =>
|
||||
{
|
||||
var oldValue = this.CurrentValue;
|
||||
this.CurrentValue = FromFloat((float)numBox.Value);
|
||||
if (this.OnValueChanged != null && !oldValue.Equals(this.CurrentValue))
|
||||
this.OnValueChanged();
|
||||
};
|
||||
|
||||
return numBox;
|
||||
}
|
||||
}
|
||||
|
||||
public override void Reset()
|
||||
{
|
||||
this.CurrentValue = this.DefaultValue;
|
||||
|
||||
if (typeof(T) == typeof(bool))
|
||||
checkBox.Checked = (bool)(object)this.CurrentValue;
|
||||
else
|
||||
numBox.Value = (decimal)ToFloat(this.CurrentValue);
|
||||
|
||||
this.OnValueChanged();
|
||||
}
|
||||
|
||||
public override bool HasDefaultValue { get { return this.CurrentValue.Equals(this.DefaultValue); } }
|
||||
}
|
||||
|
||||
public class ComboEntryT<T> : VarEntryT<T>
|
||||
{
|
||||
public IEnumerable<T> Values;
|
||||
|
||||
public ComboEntryT(T defaultValue, IEnumerable<object> values)
|
||||
: base(defaultValue)
|
||||
{
|
||||
this.Values = values.Select(o => (T)o);
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
var options = string.Join(", ", this.Values
|
||||
.Select(o => VarEntryUtility.ConvertToString<T>(o))
|
||||
.ToArray());
|
||||
return string.Format("COMBO({0}, \"{1}\", {2}) = {3};",
|
||||
VarEntryUtility.GetTypeName<T>(),
|
||||
options,
|
||||
this.Name,
|
||||
VarEntryUtility.ConvertToString<T>(this.CurrentValue));
|
||||
}
|
||||
|
||||
private ComboBox comboBox;
|
||||
public override Control CreateUi()
|
||||
{
|
||||
comboBox = new ComboBox();
|
||||
comboBox.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||
foreach (var option in Values)
|
||||
comboBox.Items.Add(option);
|
||||
comboBox.SelectedItem = Values.FirstOrDefault(o => o.Equals(this.CurrentValue));
|
||||
comboBox.Dock = DockStyle.Fill;
|
||||
comboBox.SelectedValueChanged += (s, e) =>
|
||||
{
|
||||
var oldValue = this.CurrentValue;
|
||||
this.CurrentValue = (T)comboBox.SelectedItem;
|
||||
if (OnValueChanged != null && !oldValue.Equals(this.CurrentValue))
|
||||
OnValueChanged();
|
||||
};
|
||||
return comboBox;
|
||||
}
|
||||
|
||||
public override void Reset()
|
||||
{
|
||||
this.CurrentValue = this.DefaultValue;
|
||||
|
||||
comboBox.SelectedItem = Values.FirstOrDefault(o => o.Equals(this.CurrentValue));
|
||||
|
||||
this.OnValueChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public class RangeEntryT<T> : VarEntryT<T>
|
||||
{
|
||||
public T From;
|
||||
public T To;
|
||||
|
||||
public RangeEntryT(T defaultValue, T from, T to)
|
||||
: base(defaultValue)
|
||||
{
|
||||
this.From = from;
|
||||
this.To = to;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return string.Format("RANGE({0}, {1}, {2}, {3}) = {4};",
|
||||
VarEntryUtility.GetTypeName<T>(),
|
||||
VarEntryUtility.ConvertToString<T>(this.From),
|
||||
VarEntryUtility.ConvertToString<T>(this.To),
|
||||
this.Name,
|
||||
VarEntryUtility.ConvertToString<T>(this.CurrentValue));
|
||||
}
|
||||
|
||||
private TrackBar trackBar;
|
||||
|
||||
public override Control CreateUi()
|
||||
{
|
||||
var panel = new Panel();
|
||||
panel.Dock = DockStyle.Fill;
|
||||
panel.Height = 24;
|
||||
|
||||
var textBox = new TextBox();
|
||||
textBox.MaximumSize = new System.Drawing.Size(50, 24);
|
||||
textBox.Enabled = false;
|
||||
textBox.Text = VarEntryUtility.ConvertToString<T>(this.CurrentValue);
|
||||
textBox.Dock = DockStyle.Left;
|
||||
|
||||
trackBar = new TrackBar();
|
||||
trackBar.TickStyle = TickStyle.None;
|
||||
int Multiplicator = 100;
|
||||
trackBar.Minimum = (int)(ToFloat(this.From) * Multiplicator);
|
||||
trackBar.Maximum = (int)(ToFloat(this.To) * Multiplicator);
|
||||
trackBar.Value = (int)(ToFloat(this.CurrentValue) * Multiplicator);
|
||||
|
||||
trackBar.Dock = DockStyle.Fill;
|
||||
trackBar.ValueChanged += (s, e) =>
|
||||
{
|
||||
var oldValue = ToFloat(this.CurrentValue);
|
||||
this.CurrentValue = FromFloat(trackBar.Value / (float)Multiplicator);
|
||||
if (this.OnValueChanged != null && !oldValue.Equals(this.CurrentValue))
|
||||
this.OnValueChanged();
|
||||
|
||||
textBox.Text = VarEntryUtility.ConvertToString<T>(this.CurrentValue);
|
||||
};
|
||||
|
||||
panel.Controls.Add(trackBar);
|
||||
panel.Controls.Add(textBox);
|
||||
|
||||
return panel;
|
||||
}
|
||||
|
||||
public override void Reset()
|
||||
{
|
||||
this.CurrentValue = this.DefaultValue;
|
||||
int Multiplicator = 100;
|
||||
trackBar.Value = (int)(ToFloat(this.CurrentValue) * Multiplicator);
|
||||
|
||||
this.OnValueChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
89
evoke-64k/trunk/Tweaky/Backup/Tweaky/TweakyMainWindow.Designer.cs
generated
Normal file
89
evoke-64k/trunk/Tweaky/Backup/Tweaky/TweakyMainWindow.Designer.cs
generated
Normal file
@@ -0,0 +1,89 @@
|
||||
namespace Tweaky
|
||||
{
|
||||
partial class TweakyMainWindow
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.fileTabControl = new System.Windows.Forms.TabControl();
|
||||
this.descriptionLabel = new System.Windows.Forms.Label();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// fileTabControl
|
||||
//
|
||||
this.fileTabControl.AllowDrop = true;
|
||||
this.fileTabControl.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.fileTabControl.HotTrack = true;
|
||||
this.fileTabControl.Location = new System.Drawing.Point(0, 0);
|
||||
this.fileTabControl.Name = "fileTabControl";
|
||||
this.fileTabControl.SelectedIndex = 0;
|
||||
this.fileTabControl.Size = new System.Drawing.Size(553, 515);
|
||||
this.fileTabControl.TabIndex = 0;
|
||||
this.fileTabControl.DragDrop += new System.Windows.Forms.DragEventHandler(this.TweakyMainWindow_DragDrop);
|
||||
this.fileTabControl.MouseClick += new System.Windows.Forms.MouseEventHandler(this.fileTabControl_MouseClick);
|
||||
this.fileTabControl.DragEnter += new System.Windows.Forms.DragEventHandler(this.TweakyMainWindow_DragEnter);
|
||||
//
|
||||
// descriptionLabel
|
||||
//
|
||||
this.descriptionLabel.AllowDrop = true;
|
||||
this.descriptionLabel.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.descriptionLabel.Location = new System.Drawing.Point(0, 0);
|
||||
this.descriptionLabel.Name = "descriptionLabel";
|
||||
this.descriptionLabel.Size = new System.Drawing.Size(553, 515);
|
||||
this.descriptionLabel.TabIndex = 1;
|
||||
this.descriptionLabel.Text = "Please add new configurable files by drag and drop them into this window.";
|
||||
this.descriptionLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||
this.descriptionLabel.DragDrop += new System.Windows.Forms.DragEventHandler(this.TweakyMainWindow_DragDrop);
|
||||
this.descriptionLabel.DragEnter += new System.Windows.Forms.DragEventHandler(this.TweakyMainWindow_DragEnter);
|
||||
//
|
||||
// TweakyMainWindow
|
||||
//
|
||||
this.AllowDrop = true;
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.AutoScroll = true;
|
||||
this.ClientSize = new System.Drawing.Size(553, 515);
|
||||
this.Controls.Add(this.descriptionLabel);
|
||||
this.Controls.Add(this.fileTabControl);
|
||||
this.Name = "TweakyMainWindow";
|
||||
this.Text = "Tweaky";
|
||||
this.DragDrop += new System.Windows.Forms.DragEventHandler(this.TweakyMainWindow_DragDrop);
|
||||
this.DragEnter += new System.Windows.Forms.DragEventHandler(this.TweakyMainWindow_DragEnter);
|
||||
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.TweakyMainWindow_FormClosing);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.TabControl fileTabControl;
|
||||
private System.Windows.Forms.Label descriptionLabel;
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
104
evoke-64k/trunk/Tweaky/Backup/Tweaky/TweakyMainWindow.cs
Normal file
104
evoke-64k/trunk/Tweaky/Backup/Tweaky/TweakyMainWindow.cs
Normal file
@@ -0,0 +1,104 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using System.IO;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Globalization;
|
||||
|
||||
namespace Tweaky
|
||||
{
|
||||
public partial class TweakyMainWindow : Form
|
||||
{
|
||||
private Dictionary<TabPage, TweakyCore> loadedFilesMap = new Dictionary<TabPage, TweakyCore>();
|
||||
|
||||
public TweakyMainWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
if (Properties.Settings.Default.LastOpenedFiles != null)
|
||||
foreach (var filePath in Properties.Settings.Default.LastOpenedFiles)
|
||||
this.AddFile(filePath);
|
||||
}
|
||||
|
||||
private void fileTabControl_MouseClick(object sender, MouseEventArgs e)
|
||||
{
|
||||
if (e.Button == MouseButtons.Middle)
|
||||
{
|
||||
for (int i = fileTabControl.TabPages.Count - 1; i >= 0; i--)
|
||||
{
|
||||
if (fileTabControl.GetTabRect(i).Contains(e.Location))
|
||||
{
|
||||
var tabPage = (sender as TabControl).TabPages[i];
|
||||
loadedFilesMap.Remove(tabPage);
|
||||
(sender as TabControl).TabPages.Remove(tabPage);
|
||||
|
||||
if (loadedFilesMap.Count == 0)
|
||||
{
|
||||
fileTabControl.Visible = false;
|
||||
descriptionLabel.Visible = true;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void TweakyMainWindow_DragDrop(object sender, DragEventArgs e)
|
||||
{
|
||||
if (e.Data.GetDataPresent(DataFormats.FileDrop))
|
||||
{
|
||||
var filePaths = (string[])(e.Data.GetData(DataFormats.FileDrop));
|
||||
foreach (var fileLoc in filePaths)
|
||||
this.AddFile(fileLoc);
|
||||
}
|
||||
}
|
||||
|
||||
private void AddFile(string filePath)
|
||||
{
|
||||
if (File.Exists(filePath) && !loadedFilesMap.Values.Any(p => p.FilePath == filePath))
|
||||
{
|
||||
var tweakyCore = new TweakyCore(filePath);
|
||||
if (!tweakyCore.HasWatchableVarEntries)
|
||||
return;
|
||||
|
||||
var tabPage = new TabPage(Path.GetFileName(filePath));
|
||||
tabPage.AutoSize = true;
|
||||
tabPage.AutoScroll = true;
|
||||
fileTabControl.TabPages.Add(tabPage);
|
||||
tweakyCore.BuildUiElements(tabPage);
|
||||
|
||||
loadedFilesMap.Add(tabPage, tweakyCore);
|
||||
|
||||
fileTabControl.Visible = true;
|
||||
descriptionLabel.Visible = false;
|
||||
}
|
||||
}
|
||||
|
||||
private void TweakyMainWindow_DragEnter(object sender, DragEventArgs e)
|
||||
{
|
||||
if (e.Data.GetDataPresent(DataFormats.FileDrop))
|
||||
e.Effect = DragDropEffects.Copy;
|
||||
else
|
||||
e.Effect = DragDropEffects.None;
|
||||
}
|
||||
|
||||
private void TweakyMainWindow_FormClosing(object sender, FormClosingEventArgs e)
|
||||
{
|
||||
|
||||
Properties.Settings.Default.LastOpenedFiles = new System.Collections.Specialized.StringCollection();
|
||||
foreach (var tweakyCore in loadedFilesMap.Values)
|
||||
{
|
||||
tweakyCore.WriteFileContent();
|
||||
Properties.Settings.Default.LastOpenedFiles.Add(tweakyCore.FilePath);
|
||||
}
|
||||
|
||||
Properties.Settings.Default.Save();
|
||||
}
|
||||
}
|
||||
}
|
||||
120
evoke-64k/trunk/Tweaky/Backup/Tweaky/TweakyMainWindow.resx
Normal file
120
evoke-64k/trunk/Tweaky/Backup/Tweaky/TweakyMainWindow.resx
Normal file
@@ -0,0 +1,120 @@
|
||||
<?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 ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
5
evoke-64k/trunk/Tweaky/Backup/Tweaky/app.config
Normal file
5
evoke-64k/trunk/Tweaky/Backup/Tweaky/app.config
Normal file
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<configSections>
|
||||
</configSections>
|
||||
</configuration>
|
||||
22
evoke-64k/trunk/Tweaky/Tweaky.sln
Normal file
22
evoke-64k/trunk/Tweaky/Tweaky.sln
Normal file
@@ -0,0 +1,22 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 2013
|
||||
VisualStudioVersion = 12.0.21005.1
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tweaky", "Tweaky\Tweaky.csproj", "{17A0CF60-7011-4715-8241-8499B6D3E130}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{17A0CF60-7011-4715-8241-8499B6D3E130}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{17A0CF60-7011-4715-8241-8499B6D3E130}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{17A0CF60-7011-4715-8241-8499B6D3E130}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{17A0CF60-7011-4715-8241-8499B6D3E130}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
BIN
evoke-64k/trunk/Tweaky/Tweaky.v12.suo
Normal file
BIN
evoke-64k/trunk/Tweaky/Tweaky.v12.suo
Normal file
Binary file not shown.
10
evoke-64k/trunk/Tweaky/Tweaky/Config.h
Normal file
10
evoke-64k/trunk/Tweaky/Tweaky/Config.h
Normal file
@@ -0,0 +1,10 @@
|
||||
#pragma once
|
||||
#include "filemon.h"
|
||||
|
||||
ANY(float, g_DemoTime) = 10.5;
|
||||
RANGE(float, 0, 1, g_Alpha) = 0.96;
|
||||
COMBO(int, "0, 1, 2, 3", g_DemoMode) = 3;
|
||||
ANY(bool, g_Doof) = true;
|
||||
|
||||
//ajdhjashdjsfsdf
|
||||
//sdfgdfgdfg
|
||||
21
evoke-64k/trunk/Tweaky/Tweaky/Program.cs
Normal file
21
evoke-64k/trunk/Tweaky/Tweaky/Program.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Tweaky
|
||||
{
|
||||
static class Program
|
||||
{
|
||||
/// <summary>
|
||||
/// The main entry point for the application.
|
||||
/// </summary>
|
||||
[STAThread]
|
||||
static void Main()
|
||||
{
|
||||
Application.EnableVisualStyles();
|
||||
Application.SetCompatibleTextRenderingDefault(false);
|
||||
Application.Run(new TweakyMainWindow());
|
||||
}
|
||||
}
|
||||
}
|
||||
36
evoke-64k/trunk/Tweaky/Tweaky/Properties/AssemblyInfo.cs
Normal file
36
evoke-64k/trunk/Tweaky/Tweaky/Properties/AssemblyInfo.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("Tweaky")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("Microsoft")]
|
||||
[assembly: AssemblyProduct("Tweaky")]
|
||||
[assembly: AssemblyCopyright("Copyright © Microsoft 2010")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("3b28bafe-1621-4e21-8f5d-dd2cfd18e6ca")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
63
evoke-64k/trunk/Tweaky/Tweaky/Properties/Resources.Designer.cs
generated
Normal file
63
evoke-64k/trunk/Tweaky/Tweaky/Properties/Resources.Designer.cs
generated
Normal file
@@ -0,0 +1,63 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.34003
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Tweaky.Properties {
|
||||
using System;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// A strongly-typed resource class, for looking up localized strings, etc.
|
||||
/// </summary>
|
||||
// This class was auto-generated by the StronglyTypedResourceBuilder
|
||||
// class via a tool like ResGen or Visual Studio.
|
||||
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||
// with the /str option, or rebuild your VS project.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Resources {
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal Resources() {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the cached ResourceManager instance used by this class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||
get {
|
||||
if (object.ReferenceEquals(resourceMan, null)) {
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Tweaky.Properties.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Overrides the current thread's CurrentUICulture property for all
|
||||
/// resource lookups using this strongly typed resource class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture {
|
||||
get {
|
||||
return resourceCulture;
|
||||
}
|
||||
set {
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
117
evoke-64k/trunk/Tweaky/Tweaky/Properties/Resources.resx
Normal file
117
evoke-64k/trunk/Tweaky/Tweaky/Properties/Resources.resx
Normal file
@@ -0,0 +1,117 @@
|
||||
<?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 ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
37
evoke-64k/trunk/Tweaky/Tweaky/Properties/Settings.Designer.cs
generated
Normal file
37
evoke-64k/trunk/Tweaky/Tweaky/Properties/Settings.Designer.cs
generated
Normal file
@@ -0,0 +1,37 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.34003
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Tweaky.Properties {
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "12.0.0.0")]
|
||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
|
||||
|
||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||
|
||||
public static Settings Default {
|
||||
get {
|
||||
return defaultInstance;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
public global::System.Collections.Specialized.StringCollection LastOpenedFiles {
|
||||
get {
|
||||
return ((global::System.Collections.Specialized.StringCollection)(this["LastOpenedFiles"]));
|
||||
}
|
||||
set {
|
||||
this["LastOpenedFiles"] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="Tweaky.Properties" GeneratedClassName="Settings">
|
||||
<Profiles />
|
||||
<Settings>
|
||||
<Setting Name="LastOpenedFiles" Type="System.Collections.Specialized.StringCollection" Scope="User">
|
||||
<Value Profile="(Default)" />
|
||||
</Setting>
|
||||
</Settings>
|
||||
</SettingsFile>
|
||||
103
evoke-64k/trunk/Tweaky/Tweaky/Tweaky.csproj
Normal file
103
evoke-64k/trunk/Tweaky/Tweaky/Tweaky.csproj
Normal file
@@ -0,0 +1,103 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>9.0.21022</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{17A0CF60-7011-4715-8241-8499B6D3E130}</ProjectGuid>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Tweaky</RootNamespace>
|
||||
<AssemblyName>Tweaky</AssemblyName>
|
||||
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<FileUpgradeFlags>
|
||||
</FileUpgradeFlags>
|
||||
<UpgradeBackupLocation>
|
||||
</UpgradeBackupLocation>
|
||||
<OldToolsVersion>3.5</OldToolsVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Xml.Linq">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Data.DataSetExtensions">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Deployment" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="TweakyCore.cs" />
|
||||
<Compile Include="TweakyMainWindow.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="TweakyMainWindow.Designer.cs">
|
||||
<DependentUpon>TweakyMainWindow.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<EmbeddedResource Include="TweakyMainWindow.resx">
|
||||
<DependentUpon>TweakyMainWindow.cs</DependentUpon>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<Compile Include="Properties\Resources.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
<DesignTime>True</DesignTime>
|
||||
</Compile>
|
||||
<None Include="app.config" />
|
||||
<None Include="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
<Compile Include="Properties\Settings.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Config.h">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
453
evoke-64k/trunk/Tweaky/Tweaky/TweakyCore.cs
Normal file
453
evoke-64k/trunk/Tweaky/Tweaky/TweakyCore.cs
Normal file
@@ -0,0 +1,453 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Windows.Forms;
|
||||
using System.IO;
|
||||
using System.Globalization;
|
||||
using System.Data;
|
||||
|
||||
namespace Tweaky
|
||||
{
|
||||
public class TweakyCore
|
||||
{
|
||||
private Regex EntryPattern = new Regex(@"((?<type>ANY\(.*\))|(?<type>RANGE\(.*\))|(?<type>COMBO\(.*\)))\s*\=\s*(?<value>.*)\s*;");
|
||||
private Regex AnyPattern = new Regex(@"ANY\((?<type>\w*),\s*(?<name>.*)\)");
|
||||
private Regex ComboPattern = new Regex(@"COMBO\((?<type>\w*)\s*,\s*(?<options>.*),\s*(?<name>.*)\)");
|
||||
private Regex RangePattern = new Regex(@"RANGE\((?<type>\w*)\s*,\s*(?<from>.*)\s*,\s*(?<to>.*),\s*(?<name>.*)\)");
|
||||
|
||||
private List<VarEntryBase> varEntries = new List<VarEntryBase>();
|
||||
private Timer saveTimer;
|
||||
|
||||
public string FilePath {get; protected set; }
|
||||
public bool HasWatchableVarEntries { get; protected set; }
|
||||
|
||||
public TweakyCore(string filePath)
|
||||
{
|
||||
this.FilePath = filePath;
|
||||
this.ReadFileContent();
|
||||
}
|
||||
|
||||
public void BuildUiElements(Control rootControl)
|
||||
{
|
||||
var table = new TableLayoutPanel();
|
||||
table.AutoSize = true;
|
||||
table.ColumnCount = 3;
|
||||
table.RowCount = varEntries.Count;
|
||||
|
||||
foreach (RowStyle style in table.RowStyles)
|
||||
style.SizeType = SizeType.AutoSize;
|
||||
|
||||
var currentRowIndex = 0;
|
||||
foreach (var entry in varEntries)
|
||||
{
|
||||
var localEntry = entry;
|
||||
|
||||
Control editControl = entry.CreateUi();
|
||||
if (editControl != null)
|
||||
{
|
||||
var nameLabel = new Label();
|
||||
nameLabel.Text = entry.Name;
|
||||
nameLabel.Dock = DockStyle.Fill;
|
||||
nameLabel.AutoSize = true;
|
||||
nameLabel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
|
||||
var resetControl = new Button();
|
||||
resetControl.Text = "Reset";
|
||||
resetControl.Dock = DockStyle.Fill;
|
||||
resetControl.AutoSize = true;
|
||||
resetControl.Click += (s, e) => localEntry.Reset();
|
||||
resetControl.Enabled = false;
|
||||
|
||||
table.Controls.Add(nameLabel, 0, currentRowIndex);
|
||||
table.Controls.Add(editControl, 1, currentRowIndex);
|
||||
table.Controls.Add(resetControl, 2, currentRowIndex);
|
||||
|
||||
localEntry.OnValueChanged += () =>
|
||||
{
|
||||
resetControl.Enabled = !localEntry.HasDefaultValue;
|
||||
};
|
||||
|
||||
currentRowIndex++;
|
||||
}
|
||||
}
|
||||
rootControl.Controls.Add(table);
|
||||
}
|
||||
|
||||
protected void ReadFileContent()
|
||||
{
|
||||
using (var stringReader = new StreamReader(FilePath))
|
||||
{
|
||||
string line;
|
||||
while ((line = stringReader.ReadLine()) != null)
|
||||
{
|
||||
var entryMatch = EntryPattern.Match(line.Trim());
|
||||
if (!entryMatch.Success)
|
||||
{
|
||||
varEntries.Add(new VarEntryBase()
|
||||
{
|
||||
Name = line,
|
||||
});
|
||||
continue;
|
||||
}
|
||||
|
||||
var maintype = entryMatch.Groups["type"].Value;
|
||||
|
||||
var anyMatch = AnyPattern.Match(maintype);
|
||||
var rangeMatch = RangePattern.Match(maintype);
|
||||
var comboMatch = ComboPattern.Match(maintype);
|
||||
|
||||
VarEntryBase newEntry = null;
|
||||
if (anyMatch.Success)
|
||||
{
|
||||
var type = anyMatch.Groups["type"].Value;
|
||||
newEntry = VarEntryUtility.CreateType(typeof(VarEntryT<>), type,
|
||||
VarEntryUtility.ConvertToObject(type, entryMatch.Groups["value"].Value));
|
||||
newEntry.Name = anyMatch.Groups["name"].Value;
|
||||
this.HasWatchableVarEntries = true;
|
||||
}
|
||||
else if (rangeMatch.Success)
|
||||
{
|
||||
var type = rangeMatch.Groups["type"].Value;
|
||||
newEntry = VarEntryUtility.CreateType(typeof(RangeEntryT<>), type,
|
||||
VarEntryUtility.ConvertToObject(type, entryMatch.Groups["value"].Value),
|
||||
VarEntryUtility.ConvertToObject(type, rangeMatch.Groups["from"].Value),
|
||||
VarEntryUtility.ConvertToObject(type, rangeMatch.Groups["to"].Value));
|
||||
newEntry.Name = rangeMatch.Groups["name"].Value;
|
||||
this.HasWatchableVarEntries = true;
|
||||
}
|
||||
else if (comboMatch.Success)
|
||||
{
|
||||
var type = comboMatch.Groups["type"].Value;
|
||||
var options = comboMatch.Groups["options"].Value
|
||||
.Trim('\"').Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries)
|
||||
.Select(o => VarEntryUtility.ConvertToObject(type, o.Trim()))
|
||||
.ToList();
|
||||
newEntry = VarEntryUtility.CreateType(typeof(ComboEntryT<>), type,
|
||||
VarEntryUtility.ConvertToObject(type, entryMatch.Groups["value"].Value),
|
||||
options);
|
||||
newEntry.Name = comboMatch.Groups["name"].Value;
|
||||
this.HasWatchableVarEntries = true;
|
||||
}
|
||||
|
||||
|
||||
newEntry.OnValueChanged += () => OnValueChanged();
|
||||
|
||||
varEntries.Add(newEntry);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void OnValueChanged()
|
||||
{
|
||||
if (saveTimer != null)
|
||||
return; // save is already pending
|
||||
saveTimer = new Timer();
|
||||
saveTimer.Interval = 1200; // > one second till the save call is progressed
|
||||
saveTimer.Tick += (s, e) => WriteFileContent();
|
||||
saveTimer.Start();
|
||||
}
|
||||
|
||||
public void WriteFileContent()
|
||||
{
|
||||
if (saveTimer != null)
|
||||
{
|
||||
saveTimer.Stop();
|
||||
saveTimer.Dispose();
|
||||
saveTimer = null;
|
||||
}
|
||||
|
||||
using (var streamWriter = new StreamWriter(FilePath, false))
|
||||
{
|
||||
foreach (var entry in varEntries)
|
||||
streamWriter.Write(entry.ToString() + "\r\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static class VarEntryUtility
|
||||
{
|
||||
public static string GetTypeName<T>()
|
||||
{
|
||||
if (typeof(T) == typeof(bool))
|
||||
return "bool";
|
||||
else if (typeof(T) == typeof(int))
|
||||
return "int";
|
||||
else if (typeof(T) == typeof(float))
|
||||
return "float";
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
private static Type GetType(Type baseType, string type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case "int":
|
||||
return baseType.MakeGenericType(typeof(int));
|
||||
case "float":
|
||||
return baseType.MakeGenericType(typeof(float));
|
||||
case "bool":
|
||||
return baseType.MakeGenericType(typeof(bool));
|
||||
default:
|
||||
throw new ArgumentException(type);
|
||||
}
|
||||
}
|
||||
|
||||
public static VarEntryBase CreateType(Type baseType, string type, params object[] args)
|
||||
{
|
||||
return Activator.CreateInstance(GetType(baseType, type), args) as VarEntryBase;
|
||||
}
|
||||
|
||||
public static object ConvertToObject(string type, string rawValue)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case "bool":
|
||||
return bool.Parse(rawValue);
|
||||
case "int":
|
||||
return int.Parse(rawValue);
|
||||
case "float":
|
||||
return float.Parse(rawValue.TrimEnd('f'), CultureInfo.InvariantCulture);
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static string ConvertToString<T>(object rawValue)
|
||||
{
|
||||
if (typeof(T) == typeof(bool))
|
||||
return (bool)rawValue == true ? "true" : "false";
|
||||
if (typeof(T) == typeof(int))
|
||||
return ((int)rawValue).ToString(CultureInfo.InvariantCulture);
|
||||
if (typeof(T) == typeof(float))
|
||||
return ((float)rawValue).ToString(CultureInfo.InvariantCulture);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public class VarEntryBase
|
||||
{
|
||||
public string Name;
|
||||
|
||||
public Action OnValueChanged;
|
||||
|
||||
public virtual Control CreateUi() { return null; }
|
||||
|
||||
public virtual void Reset() {}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return this.Name;
|
||||
}
|
||||
|
||||
public virtual bool HasDefaultValue { get { return false; } }
|
||||
}
|
||||
|
||||
public class VarEntryT<T> : VarEntryBase
|
||||
{
|
||||
public VarEntryT(T defaultValue)
|
||||
{
|
||||
this.CurrentValue = this.DefaultValue = defaultValue;
|
||||
}
|
||||
|
||||
public T CurrentValue;
|
||||
public T DefaultValue;
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return string.Format("ANY({0}, {1}) = {2};",
|
||||
VarEntryUtility.GetTypeName<T>(),
|
||||
this.Name,
|
||||
VarEntryUtility.ConvertToString<T>(this.CurrentValue));
|
||||
}
|
||||
|
||||
protected float ToFloat(object value)
|
||||
{
|
||||
if (value.GetType() == typeof(int))
|
||||
return (float)(int)value;
|
||||
else
|
||||
return (float)value;
|
||||
}
|
||||
|
||||
protected T FromFloat(float value)
|
||||
{
|
||||
if (typeof(T) == typeof(int))
|
||||
return (T)(object)(int)value;
|
||||
else
|
||||
return (T)(object)value; ;
|
||||
}
|
||||
|
||||
|
||||
private CheckBox checkBox;
|
||||
private NumericUpDown numBox;
|
||||
|
||||
public override Control CreateUi()
|
||||
{
|
||||
if (typeof(T) == typeof(bool))
|
||||
{
|
||||
checkBox = new CheckBox();
|
||||
checkBox.Dock = DockStyle.Left;
|
||||
checkBox.Checked = (bool)(object)this.CurrentValue;
|
||||
checkBox.CheckedChanged += (s, e) =>
|
||||
{
|
||||
this.CurrentValue = (T)(object)checkBox.Checked;
|
||||
if (this.OnValueChanged != null)
|
||||
this.OnValueChanged();
|
||||
};
|
||||
return checkBox;
|
||||
}
|
||||
else
|
||||
{
|
||||
numBox = new NumericUpDown();
|
||||
numBox.DecimalPlaces = 6;
|
||||
numBox.Dock = DockStyle.Fill;
|
||||
numBox.Value = (decimal)ToFloat(this.CurrentValue);
|
||||
numBox.ValueChanged += (s, e) =>
|
||||
{
|
||||
var oldValue = this.CurrentValue;
|
||||
this.CurrentValue = FromFloat((float)numBox.Value);
|
||||
if (this.OnValueChanged != null && !oldValue.Equals(this.CurrentValue))
|
||||
this.OnValueChanged();
|
||||
};
|
||||
|
||||
return numBox;
|
||||
}
|
||||
}
|
||||
|
||||
public override void Reset()
|
||||
{
|
||||
this.CurrentValue = this.DefaultValue;
|
||||
|
||||
if (typeof(T) == typeof(bool))
|
||||
checkBox.Checked = (bool)(object)this.CurrentValue;
|
||||
else
|
||||
numBox.Value = (decimal)ToFloat(this.CurrentValue);
|
||||
|
||||
this.OnValueChanged();
|
||||
}
|
||||
|
||||
public override bool HasDefaultValue { get { return this.CurrentValue.Equals(this.DefaultValue); } }
|
||||
}
|
||||
|
||||
public class ComboEntryT<T> : VarEntryT<T>
|
||||
{
|
||||
public IEnumerable<T> Values;
|
||||
|
||||
public ComboEntryT(T defaultValue, IEnumerable<object> values)
|
||||
: base(defaultValue)
|
||||
{
|
||||
this.Values = values.Select(o => (T)o);
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
var options = string.Join(", ", this.Values
|
||||
.Select(o => VarEntryUtility.ConvertToString<T>(o))
|
||||
.ToArray());
|
||||
return string.Format("COMBO({0}, \"{1}\", {2}) = {3};",
|
||||
VarEntryUtility.GetTypeName<T>(),
|
||||
options,
|
||||
this.Name,
|
||||
VarEntryUtility.ConvertToString<T>(this.CurrentValue));
|
||||
}
|
||||
|
||||
private ComboBox comboBox;
|
||||
public override Control CreateUi()
|
||||
{
|
||||
comboBox = new ComboBox();
|
||||
comboBox.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||
foreach (var option in Values)
|
||||
comboBox.Items.Add(option);
|
||||
comboBox.SelectedItem = Values.FirstOrDefault(o => o.Equals(this.CurrentValue));
|
||||
comboBox.Dock = DockStyle.Fill;
|
||||
comboBox.SelectedValueChanged += (s, e) =>
|
||||
{
|
||||
var oldValue = this.CurrentValue;
|
||||
this.CurrentValue = (T)comboBox.SelectedItem;
|
||||
if (OnValueChanged != null && !oldValue.Equals(this.CurrentValue))
|
||||
OnValueChanged();
|
||||
};
|
||||
return comboBox;
|
||||
}
|
||||
|
||||
public override void Reset()
|
||||
{
|
||||
this.CurrentValue = this.DefaultValue;
|
||||
|
||||
comboBox.SelectedItem = Values.FirstOrDefault(o => o.Equals(this.CurrentValue));
|
||||
|
||||
this.OnValueChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public class RangeEntryT<T> : VarEntryT<T>
|
||||
{
|
||||
public T From;
|
||||
public T To;
|
||||
|
||||
public RangeEntryT(T defaultValue, T from, T to)
|
||||
: base(defaultValue)
|
||||
{
|
||||
this.From = from;
|
||||
this.To = to;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return string.Format("RANGE({0}, {1}, {2}, {3}) = {4};",
|
||||
VarEntryUtility.GetTypeName<T>(),
|
||||
VarEntryUtility.ConvertToString<T>(this.From),
|
||||
VarEntryUtility.ConvertToString<T>(this.To),
|
||||
this.Name,
|
||||
VarEntryUtility.ConvertToString<T>(this.CurrentValue));
|
||||
}
|
||||
|
||||
private TrackBar trackBar;
|
||||
|
||||
public override Control CreateUi()
|
||||
{
|
||||
var panel = new Panel();
|
||||
panel.Dock = DockStyle.Fill;
|
||||
panel.Height = 24;
|
||||
|
||||
var textBox = new TextBox();
|
||||
textBox.MaximumSize = new System.Drawing.Size(50, 24);
|
||||
textBox.Enabled = false;
|
||||
textBox.Text = VarEntryUtility.ConvertToString<T>(this.CurrentValue);
|
||||
textBox.Dock = DockStyle.Left;
|
||||
|
||||
trackBar = new TrackBar();
|
||||
trackBar.TickStyle = TickStyle.None;
|
||||
int Multiplicator = 100;
|
||||
trackBar.Minimum = (int)(ToFloat(this.From) * Multiplicator);
|
||||
trackBar.Maximum = (int)(ToFloat(this.To) * Multiplicator);
|
||||
trackBar.Value = (int)(ToFloat(this.CurrentValue) * Multiplicator);
|
||||
|
||||
trackBar.Dock = DockStyle.Fill;
|
||||
trackBar.ValueChanged += (s, e) =>
|
||||
{
|
||||
var oldValue = ToFloat(this.CurrentValue);
|
||||
this.CurrentValue = FromFloat(trackBar.Value / (float)Multiplicator);
|
||||
if (this.OnValueChanged != null && !oldValue.Equals(this.CurrentValue))
|
||||
this.OnValueChanged();
|
||||
|
||||
textBox.Text = VarEntryUtility.ConvertToString<T>(this.CurrentValue);
|
||||
};
|
||||
|
||||
panel.Controls.Add(trackBar);
|
||||
panel.Controls.Add(textBox);
|
||||
|
||||
return panel;
|
||||
}
|
||||
|
||||
public override void Reset()
|
||||
{
|
||||
this.CurrentValue = this.DefaultValue;
|
||||
int Multiplicator = 100;
|
||||
trackBar.Value = (int)(ToFloat(this.CurrentValue) * Multiplicator);
|
||||
|
||||
this.OnValueChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
89
evoke-64k/trunk/Tweaky/Tweaky/TweakyMainWindow.Designer.cs
generated
Normal file
89
evoke-64k/trunk/Tweaky/Tweaky/TweakyMainWindow.Designer.cs
generated
Normal file
@@ -0,0 +1,89 @@
|
||||
namespace Tweaky
|
||||
{
|
||||
partial class TweakyMainWindow
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.fileTabControl = new System.Windows.Forms.TabControl();
|
||||
this.descriptionLabel = new System.Windows.Forms.Label();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// fileTabControl
|
||||
//
|
||||
this.fileTabControl.AllowDrop = true;
|
||||
this.fileTabControl.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.fileTabControl.HotTrack = true;
|
||||
this.fileTabControl.Location = new System.Drawing.Point(0, 0);
|
||||
this.fileTabControl.Name = "fileTabControl";
|
||||
this.fileTabControl.SelectedIndex = 0;
|
||||
this.fileTabControl.Size = new System.Drawing.Size(553, 515);
|
||||
this.fileTabControl.TabIndex = 0;
|
||||
this.fileTabControl.DragDrop += new System.Windows.Forms.DragEventHandler(this.TweakyMainWindow_DragDrop);
|
||||
this.fileTabControl.MouseClick += new System.Windows.Forms.MouseEventHandler(this.fileTabControl_MouseClick);
|
||||
this.fileTabControl.DragEnter += new System.Windows.Forms.DragEventHandler(this.TweakyMainWindow_DragEnter);
|
||||
//
|
||||
// descriptionLabel
|
||||
//
|
||||
this.descriptionLabel.AllowDrop = true;
|
||||
this.descriptionLabel.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.descriptionLabel.Location = new System.Drawing.Point(0, 0);
|
||||
this.descriptionLabel.Name = "descriptionLabel";
|
||||
this.descriptionLabel.Size = new System.Drawing.Size(553, 515);
|
||||
this.descriptionLabel.TabIndex = 1;
|
||||
this.descriptionLabel.Text = "Please add new configurable files by drag and drop them into this window.";
|
||||
this.descriptionLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||
this.descriptionLabel.DragDrop += new System.Windows.Forms.DragEventHandler(this.TweakyMainWindow_DragDrop);
|
||||
this.descriptionLabel.DragEnter += new System.Windows.Forms.DragEventHandler(this.TweakyMainWindow_DragEnter);
|
||||
//
|
||||
// TweakyMainWindow
|
||||
//
|
||||
this.AllowDrop = true;
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.AutoScroll = true;
|
||||
this.ClientSize = new System.Drawing.Size(553, 515);
|
||||
this.Controls.Add(this.descriptionLabel);
|
||||
this.Controls.Add(this.fileTabControl);
|
||||
this.Name = "TweakyMainWindow";
|
||||
this.Text = "Tweaky";
|
||||
this.DragDrop += new System.Windows.Forms.DragEventHandler(this.TweakyMainWindow_DragDrop);
|
||||
this.DragEnter += new System.Windows.Forms.DragEventHandler(this.TweakyMainWindow_DragEnter);
|
||||
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.TweakyMainWindow_FormClosing);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.TabControl fileTabControl;
|
||||
private System.Windows.Forms.Label descriptionLabel;
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
104
evoke-64k/trunk/Tweaky/Tweaky/TweakyMainWindow.cs
Normal file
104
evoke-64k/trunk/Tweaky/Tweaky/TweakyMainWindow.cs
Normal file
@@ -0,0 +1,104 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using System.IO;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Globalization;
|
||||
|
||||
namespace Tweaky
|
||||
{
|
||||
public partial class TweakyMainWindow : Form
|
||||
{
|
||||
private Dictionary<TabPage, TweakyCore> loadedFilesMap = new Dictionary<TabPage, TweakyCore>();
|
||||
|
||||
public TweakyMainWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
if (Properties.Settings.Default.LastOpenedFiles != null)
|
||||
foreach (var filePath in Properties.Settings.Default.LastOpenedFiles)
|
||||
this.AddFile(filePath);
|
||||
}
|
||||
|
||||
private void fileTabControl_MouseClick(object sender, MouseEventArgs e)
|
||||
{
|
||||
if (e.Button == MouseButtons.Middle)
|
||||
{
|
||||
for (int i = fileTabControl.TabPages.Count - 1; i >= 0; i--)
|
||||
{
|
||||
if (fileTabControl.GetTabRect(i).Contains(e.Location))
|
||||
{
|
||||
var tabPage = (sender as TabControl).TabPages[i];
|
||||
loadedFilesMap.Remove(tabPage);
|
||||
(sender as TabControl).TabPages.Remove(tabPage);
|
||||
|
||||
if (loadedFilesMap.Count == 0)
|
||||
{
|
||||
fileTabControl.Visible = false;
|
||||
descriptionLabel.Visible = true;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void TweakyMainWindow_DragDrop(object sender, DragEventArgs e)
|
||||
{
|
||||
if (e.Data.GetDataPresent(DataFormats.FileDrop))
|
||||
{
|
||||
var filePaths = (string[])(e.Data.GetData(DataFormats.FileDrop));
|
||||
foreach (var fileLoc in filePaths)
|
||||
this.AddFile(fileLoc);
|
||||
}
|
||||
}
|
||||
|
||||
private void AddFile(string filePath)
|
||||
{
|
||||
if (File.Exists(filePath) && !loadedFilesMap.Values.Any(p => p.FilePath == filePath))
|
||||
{
|
||||
var tweakyCore = new TweakyCore(filePath);
|
||||
if (!tweakyCore.HasWatchableVarEntries)
|
||||
return;
|
||||
|
||||
var tabPage = new TabPage(Path.GetFileName(filePath));
|
||||
tabPage.AutoSize = true;
|
||||
tabPage.AutoScroll = true;
|
||||
fileTabControl.TabPages.Add(tabPage);
|
||||
tweakyCore.BuildUiElements(tabPage);
|
||||
|
||||
loadedFilesMap.Add(tabPage, tweakyCore);
|
||||
|
||||
fileTabControl.Visible = true;
|
||||
descriptionLabel.Visible = false;
|
||||
}
|
||||
}
|
||||
|
||||
private void TweakyMainWindow_DragEnter(object sender, DragEventArgs e)
|
||||
{
|
||||
if (e.Data.GetDataPresent(DataFormats.FileDrop))
|
||||
e.Effect = DragDropEffects.Copy;
|
||||
else
|
||||
e.Effect = DragDropEffects.None;
|
||||
}
|
||||
|
||||
private void TweakyMainWindow_FormClosing(object sender, FormClosingEventArgs e)
|
||||
{
|
||||
|
||||
Properties.Settings.Default.LastOpenedFiles = new System.Collections.Specialized.StringCollection();
|
||||
foreach (var tweakyCore in loadedFilesMap.Values)
|
||||
{
|
||||
tweakyCore.WriteFileContent();
|
||||
Properties.Settings.Default.LastOpenedFiles.Add(tweakyCore.FilePath);
|
||||
}
|
||||
|
||||
Properties.Settings.Default.Save();
|
||||
}
|
||||
}
|
||||
}
|
||||
120
evoke-64k/trunk/Tweaky/Tweaky/TweakyMainWindow.resx
Normal file
120
evoke-64k/trunk/Tweaky/Tweaky/TweakyMainWindow.resx
Normal file
@@ -0,0 +1,120 @@
|
||||
<?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 ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
5
evoke-64k/trunk/Tweaky/Tweaky/app.config
Normal file
5
evoke-64k/trunk/Tweaky/Tweaky/app.config
Normal file
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<configSections>
|
||||
</configSections>
|
||||
</configuration>
|
||||
10
evoke-64k/trunk/Tweaky/Tweaky/bin/Debug/Config.h
Normal file
10
evoke-64k/trunk/Tweaky/Tweaky/bin/Debug/Config.h
Normal file
@@ -0,0 +1,10 @@
|
||||
#pragma once
|
||||
#include "filemon.h"
|
||||
|
||||
ANY(float, g_DemoTime) = 12.5f;
|
||||
RANGE(float, 0.0f, 1.0f, g_Alpha) = 0.5f;
|
||||
COMBO(int, "0, 1, 2, 3", g_DemoMode) = 1;
|
||||
ANY(bool, g_Doof) = true;
|
||||
|
||||
//ajdhjashdjsfsdf
|
||||
//sdfgdfgdfg
|
||||
BIN
evoke-64k/trunk/Tweaky/Tweaky/bin/Debug/Tweaky.exe
Normal file
BIN
evoke-64k/trunk/Tweaky/Tweaky/bin/Debug/Tweaky.exe
Normal file
Binary file not shown.
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<configSections>
|
||||
</configSections>
|
||||
</configuration>
|
||||
BIN
evoke-64k/trunk/Tweaky/Tweaky/bin/Debug/Tweaky.pdb
Normal file
BIN
evoke-64k/trunk/Tweaky/Tweaky/bin/Debug/Tweaky.pdb
Normal file
Binary file not shown.
BIN
evoke-64k/trunk/Tweaky/Tweaky/bin/Debug/Tweaky.vshost.exe
Normal file
BIN
evoke-64k/trunk/Tweaky/Tweaky/bin/Debug/Tweaky.vshost.exe
Normal file
Binary file not shown.
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<configSections>
|
||||
</configSections>
|
||||
</configuration>
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,10 @@
|
||||
E:\blu-flame.org\evoke-64k\trunk\Tweaky\Tweaky\bin\Debug\Tweaky.exe.config
|
||||
E:\blu-flame.org\evoke-64k\trunk\Tweaky\Tweaky\bin\Debug\Config.h
|
||||
E:\blu-flame.org\evoke-64k\trunk\Tweaky\Tweaky\bin\Debug\Tweaky.exe
|
||||
E:\blu-flame.org\evoke-64k\trunk\Tweaky\Tweaky\bin\Debug\Tweaky.pdb
|
||||
E:\blu-flame.org\evoke-64k\trunk\Tweaky\Tweaky\obj\Debug\Tweaky.csprojResolveAssemblyReference.cache
|
||||
E:\blu-flame.org\evoke-64k\trunk\Tweaky\Tweaky\obj\Debug\Tweaky.TweakyMainWindow.resources
|
||||
E:\blu-flame.org\evoke-64k\trunk\Tweaky\Tweaky\obj\Debug\Tweaky.Properties.Resources.resources
|
||||
E:\blu-flame.org\evoke-64k\trunk\Tweaky\Tweaky\obj\Debug\Tweaky.csproj.GenerateResource.Cache
|
||||
E:\blu-flame.org\evoke-64k\trunk\Tweaky\Tweaky\obj\Debug\Tweaky.exe
|
||||
E:\blu-flame.org\evoke-64k\trunk\Tweaky\Tweaky\obj\Debug\Tweaky.pdb
|
||||
Binary file not shown.
Binary file not shown.
BIN
evoke-64k/trunk/Tweaky/Tweaky/obj/Debug/Tweaky.exe
Normal file
BIN
evoke-64k/trunk/Tweaky/Tweaky/obj/Debug/Tweaky.exe
Normal file
Binary file not shown.
BIN
evoke-64k/trunk/Tweaky/Tweaky/obj/Debug/Tweaky.pdb
Normal file
BIN
evoke-64k/trunk/Tweaky/Tweaky/obj/Debug/Tweaky.pdb
Normal file
Binary file not shown.
BIN
evoke-64k/trunk/Tweaky/UpgradeLog.htm
Normal file
BIN
evoke-64k/trunk/Tweaky/UpgradeLog.htm
Normal file
Binary file not shown.
Reference in New Issue
Block a user