This commit is contained in:
2026-04-17 14:55:32 -04:00
commit bc3ac1d4c9
18017 changed files with 4371742 additions and 0 deletions

View File

@@ -0,0 +1 @@
12

View File

@@ -0,0 +1 @@
12

View File

@@ -0,0 +1,108 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace ConfigToDb.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", "17.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("ConfigToDb.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;
}
}
/// <summary>
/// Looks up a localized string similar to applicationSettings.
/// </summary>
internal static string ApplicationSettings {
get {
return ResourceManager.GetString("ApplicationSettings", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Warning: DataPRO.exe.config was not updated because config settings from previously-installed version of DataPRO could not be found: {0}; {1}.
/// </summary>
internal static string OldSettingsCouldNotBeFound {
get {
return ResourceManager.GetString("OldSettingsCouldNotBeFound", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Warning: DataPRO.exe.config was not updated because config settings from previously-installed version of DataPRO could not be processed..
/// </summary>
internal static string OldSettingsCouldNotBeProcessed {
get {
return ResourceManager.GetString("OldSettingsCouldNotBeProcessed", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to DataPRO.exe.
/// </summary>
internal static string RegistryDataPROExe {
get {
return ResourceManager.GetString("RegistryDataPROExe", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to userSettings.
/// </summary>
internal static string UserSettings {
get {
return ResourceManager.GetString("UserSettings", resourceCulture);
}
}
}
}

View File

@@ -0,0 +1,433 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ConfigToDb.Properties;
using DTS.Common.Storage;
using DTS.Slice.Users.UserSettings;
namespace ConfigToDb
{
public class ConfigToDbMigrator
{
public bool migrateConfigToDb(string nextLowerPath, out string result)
{
var oldUserSettings = new SettingElementCollection();
var oldApplicationSettings = new SettingElementCollection();
GetOldConfigSettings(Resources.UserSettings, nextLowerPath, out result, out oldUserSettings);
if (!result.Contains(Resources.OldSettingsCouldNotBeFound) && !result.Contains(Resources.OldSettingsCouldNotBeProcessed))
{
GetOldConfigSettings(Resources.ApplicationSettings, nextLowerPath, out result, out oldApplicationSettings);
if (InsertConfigSettingsIntoDb(oldUserSettings, oldApplicationSettings, out result))
{
return true;
}
}
return false;
}
//private SettingElementCollection GetOldConfigSettings(string settingsType, string nextLowerPath, out string result)
//{
// var oldSettings = new SettingElementCollection();
// GetOldSettings(settingsType, nextLowerPath, out result, out oldSettings);
// return oldSettings;
//}
/// <summary>
/// Gets the settings from the old config file
/// </summary>
/// <param name="settingsType">Either UserSettings or ApplicationSettings.</param>
/// <param name="nextLowerPath">The path to the old config file.</param>
/// <param name="result">Text describing the success/failure of the config migration.</param>
/// <param name="oldSettings">The settings from the old config file</param>
/// <returns>True if the settings were successfully found and processed, false if not.</returns>
private void GetOldConfigSettings(string settingsType, string nextLowerPath, out string result, out SettingElementCollection oldSettings)
{
result = string.Empty;
oldSettings = null;
var oldPath = string.Empty;
try
{
//Open the config file from the most-recently installed version of DataPRO - this assumes that it was installed in the default folder!!!
oldPath = nextLowerPath + Resources.RegistryDataPROExe;
var oldConfig = ConfigurationManager.OpenExeConfiguration(@oldPath);
oldSettings = GetConfigSettings(settingsType, oldConfig);
if (oldSettings == null)
{
result = Resources.OldSettingsCouldNotBeProcessed;
}
}
catch (System.Exception ex)
{
result = string.Format(Resources.OldSettingsCouldNotBeFound, ex.Message, oldPath);
}
}
/// <summary>
/// Gets the settings in a section group of the config file.
/// </summary>
/// <param name="settingsType">Examples include "userSettings" and "applicationSettings"</param>
/// <param name="config">The config file to be interrogated.</param>
/// <returns>A collection of settings from the requested section of the config file.</returns>
private SettingElementCollection GetConfigSettings(string settingsType, Configuration config)
{
var clientSettingsSection = new ClientSettingsSection();
var configurationSectionGroup = config.SectionGroups[settingsType];
if ((configurationSectionGroup != null) && (configurationSectionGroup.Sections[0] != null))
{
clientSettingsSection = configurationSectionGroup.Sections[0] as System.Configuration.ClientSettingsSection;
}
return clientSettingsSection != null ? clientSettingsSection.Settings : null;
}
private bool InsertConfigSettingsIntoDb(SettingElementCollection oldUserSettings, SettingElementCollection oldApplicationSettings, out string result)
{
result = string.Empty;
var oldUserSettingsDictionary = oldUserSettings.Cast<SettingElement>().ToDictionary(oldSetting => oldSetting.Name, oldSetting => oldSetting.Value.ValueXml.InnerXml);
foreach (var setting in oldUserSettingsDictionary)
{
switch (setting.Key)
{
case "LastUsedSampleRate":
StoreInDb((int)PropertyEnums.PropertyIds.LastUsedSampleRate, setting.Value);
break;
case "RealtimeChartWidthInSeconds":
StoreInDb((int)PropertyEnums.PropertyIds.RealtimeChartWidthInSeconds, setting.Value);
break;
case "LastRunTestSetup":
StoreInDb((int)PropertyEnums.PropertyIds.LastRunTestSetup, setting.Value);
break;
case "DefaultSuppressMissingSensorsWarning":
StoreInDb((int)PropertyEnums.PropertyIds.DefaultSuppressMissingSensorsWarning, setting.Value);
break;
case "UsersCurrentTestSetup":
StoreInDb((int)PropertyEnums.PropertyIds.UsersCurrentTestSetup, setting.Value);
break;
}
}
var oldApplicationSettingsDictionary = oldApplicationSettings.Cast<SettingElement>().ToDictionary(oldSetting => oldSetting.Name, oldSetting => oldSetting.Value.ValueXml.InnerXml);
foreach (var setting in oldApplicationSettingsDictionary)
{
switch (setting.Key)
{
case "DefaultUploadFolder":
StoreInDb((int)PropertyEnums.PropertyIds.DefaultUploadFolder, setting.Value);
break;
case "DefaultUploadEnabled":
StoreInDb((int)PropertyEnums.PropertyIds.DefaultUploadEnabled, setting.Value);
break;
case "DefaultTestSampleRate":
StoreInDb((int)PropertyEnums.PropertyIds.DefaultTestSampleRate, setting.Value);
break;
case "DefaultPostTriggerSeconds":
StoreInDb((int)PropertyEnums.PropertyIds.DefaultPostTriggerSeconds, setting.Value);
break;
case "DefaultNumberOfEvents":
StoreInDb((int)PropertyEnums.PropertyIds.DefaultNumberOfEvents, setting.Value);
break;
case "DefaultPreTriggerSeconds":
StoreInDb((int)PropertyEnums.PropertyIds.DefaultPreTriggerSeconds, setting.Value);
break;
case "ArmTriggerDiagnosticsRunOnNextStep":
StoreInDb((int)PropertyEnums.PropertyIds.ArmTriggerDiagnosticsRunOnNextStep, setting.Value);
break;
case "DefaultTestTriggerCheckStep":
StoreInDb((int)PropertyEnums.PropertyIds.DefaultTriggerCheckStep, setting.Value);
break;
case "DefaultTestRealtimeModeGraphCount":
StoreInDb((int)PropertyEnums.PropertyIds.DefaultRealtimeGraphCount, setting.Value);
break;
case "DefaultTestROIStart":
StoreInDb((int)PropertyEnums.PropertyIds.DefaultROIStart, setting.Value);
break;
case "DefaultTestROIEnd":
StoreInDb((int)PropertyEnums.PropertyIds.DefaultROIEnd, setting.Value);
break;
case "DefaultTestDownloadROI":
StoreInDb((int)PropertyEnums.PropertyIds.DefaultDownloadROI, setting.Value);
break;
case "DefaultTestViewROI":
StoreInDb((int)PropertyEnums.PropertyIds.DefaultViewROI, setting.Value);
break;
case "DefaultTestDownloadAll":
StoreInDb((int)PropertyEnums.PropertyIds.DefaultDownloadAll, setting.Value);
break;
case "DefaultTestViewAll":
StoreInDb((int)PropertyEnums.PropertyIds.DefaultViewAll, setting.Value);
break;
case "DefaultTestTreeModeDiagnostics":
StoreInDb((int)PropertyEnums.PropertyIds.DefaultTreeModeDiagnostics, setting.Value);
break;
case "DefaultTestRequireAllUnitsPassDiagnostics":
StoreInDb((int)PropertyEnums.PropertyIds.DefaultRequireAllUnitsPassDiagnostics, setting.Value);
break;
case "DefaultTestRequireUserConfirmationOnErrors":
StoreInDb((int)PropertyEnums.PropertyIds.DefaultRequireUserConfirmationOnErrors, setting.Value);
break;
case "DefaultTestAllowMissingSensors":
StoreInDb((int)PropertyEnums.PropertyIds.DefaultAllowMissingSensors, setting.Value);
break;
case "DefaultTestExcitationWarmupMS":
double seconds = Convert.ToDouble(setting.Value) / 1000;
StoreInDb((int)PropertyEnums.PropertyIds.DefaultTestExcitationWarmupSeconds, seconds.ToString(System.Globalization.CultureInfo.InvariantCulture));
break;
case "DefaultTestExcitationTOMWarmupDelayMS":
StoreInDb((int)PropertyEnums.PropertyIds.DefaultTestExcitationTOMWarmupDelayMS, setting.Value);
break;
case "DefaultTestExcitationIEPEWarmupDelayMS":
StoreInDb((int)PropertyEnums.PropertyIds.DefaultTestExcitationIEPEWarmupDelayMS, setting.Value);
break;
case "DefaultTestRunPostTestDiagnostics":
StoreInDb((int)PropertyEnums.PropertyIds.DefaultRunPostTestDiagnostics, setting.Value);
break;
case "DefaultTriggerCheckStep":
StoreInDb((int)PropertyEnums.PropertyIds.DefaultTriggerCheckStep, setting.Value);
break;
case "DefaultTestArmCheckListStep":
StoreInDb((int)PropertyEnums.PropertyIds.DefaultArmCheckListStep, setting.Value);
break;
case "DefaultTestCheckListInputVoltageCheck":
StoreInDb((int)PropertyEnums.PropertyIds.DefaultCheckListInputVoltageCheck, setting.Value);
break;
case "DefaultTestCheckListBatteryVoltageCheck":
StoreInDb((int)PropertyEnums.PropertyIds.DefaultCheckListBatteryVoltageCheck, setting.Value);
break;
case "DefaultTestCheckListSquibResistanceCheck":
StoreInDb((int)PropertyEnums.PropertyIds.DefaultCheckListSquibResistanceCheck, setting.Value);
break;
case "DefaultTestCheckListSensorIDCheck":
StoreInDb((int)PropertyEnums.PropertyIds.DefaultCheckListSensorIdCheck, setting.Value);
break;
case "DefaultTestCheckListTriggerStartCheck":
StoreInDb((int)PropertyEnums.PropertyIds.DefaultCheckListTriggerStartCheck, setting.Value);
break;
case "DefaultTestCheckListMustPass":
StoreInDb((int)PropertyEnums.PropertyIds.DefaultCheckListMustPass, setting.Value);
break;
case "DefaultTestAllowSensorIdToBlankChannel":
StoreInDb((int)PropertyEnums.PropertyIds.DefaultRequireSensorIdFound, setting.Value);
break;
case "DefaultTestViewRealtime":
StoreInDb((int)PropertyEnums.PropertyIds.DefaultViewRealtime, setting.Value);
break;
case "DefaultTestExport":
StoreInDb((int)PropertyEnums.PropertyIds.DefaultExport, setting.Value);
break;
case "DefaultTestArmChecklistRequireUserConfirmationOnErrors":
StoreInDb((int)PropertyEnums.PropertyIds.DefaultRequireUserConfirmationOnErrors, setting.Value);
break;
case "DefaultTestExportFormat":
if (ExportDesired(SupportedExportFormatBitFlags.csvunfiltered, Convert.ToInt32(setting.Value)))
{
StoreInDb((int)PropertyEnums.PropertyIds.ExportCSVUnfiltered, true.ToString());
}
if (ExportDesired(SupportedExportFormatBitFlags.diademadc, Convert.ToInt32(setting.Value)))
{
StoreInDb((int)PropertyEnums.PropertyIds.ExportDiademADC, true.ToString());
}
if (ExportDesired(SupportedExportFormatBitFlags.isounfiltered, Convert.ToInt32(setting.Value)))
{
StoreInDb((int)PropertyEnums.PropertyIds.ExportISOUnFiltered, true.ToString());
}
if (ExportDesired(SupportedExportFormatBitFlags.somatunfiltered, Convert.ToInt32(setting.Value)))
{
StoreInDb((int)PropertyEnums.PropertyIds.ExportSomatUnfiltered, true.ToString());
}
if (ExportDesired(SupportedExportFormatBitFlags.tdmsadc, Convert.ToInt32(setting.Value)))
{
StoreInDb((int)PropertyEnums.PropertyIds.ExportTDMSADC, true.ToString());
}
if (ExportDesired(SupportedExportFormatBitFlags.toyotaunfiltered, Convert.ToInt32(setting.Value)))
{
StoreInDb((int)PropertyEnums.PropertyIds.ExportToyotaUnfiltered, true.ToString());
}
if (ExportDesired(SupportedExportFormatBitFlags.tsvunfiltered, Convert.ToInt32(setting.Value)))
{
StoreInDb((int)PropertyEnums.PropertyIds.ExportTSVUnfiltered, true.ToString());
}
if (ExportDesired(SupportedExportFormatBitFlags.csvfiltered, Convert.ToInt32(setting.Value)))
{
StoreInDb((int)PropertyEnums.PropertyIds.ExportCSVFiltered, true.ToString());
}
if (ExportDesired(SupportedExportFormatBitFlags.isofiltered, Convert.ToInt32(setting.Value)))
{
StoreInDb((int)PropertyEnums.PropertyIds.ExportISOFiltered, true.ToString());
}
if (ExportDesired(SupportedExportFormatBitFlags.somatfiltered, Convert.ToInt32(setting.Value)))
{
StoreInDb((int)PropertyEnums.PropertyIds.ExportSomatFiltered, true.ToString());
}
if (ExportDesired(SupportedExportFormatBitFlags.tdasadc, Convert.ToInt32(setting.Value)))
{
StoreInDb((int)PropertyEnums.PropertyIds.ExportTDASADC, true.ToString());
}
if (ExportDesired(SupportedExportFormatBitFlags.toyotafiltered, Convert.ToInt32(setting.Value)))
{
StoreInDb((int)PropertyEnums.PropertyIds.ExportToyotaFiltered, true.ToString());
}
if (ExportDesired(SupportedExportFormatBitFlags.tsvfiltered, Convert.ToInt32(setting.Value)))
{
StoreInDb((int)PropertyEnums.PropertyIds.ExportTSVFiltered, true.ToString());
}
if (ExportDesired(SupportedExportFormatBitFlags.rdfadc, Convert.ToInt32(setting.Value)))
{
StoreInDb((int)PropertyEnums.PropertyIds.ExportRDFADC, true.ToString());
}
if (ExportDesired(SupportedExportFormatBitFlags.ChryslerDDAS, Convert.ToInt32(setting.Value)))
{
StoreInDb((int)PropertyEnums.PropertyIds.ExportChryslerDDAS, true.ToString());
}
if (ExportDesired(SupportedExportFormatBitFlags.HDFUnfiltered, Convert.ToInt32(setting.Value)))
{
StoreInDb((int)PropertyEnums.PropertyIds.ExportHDFUnfiltered, true.ToString());
}
if (ExportDesired(SupportedExportFormatBitFlags.HDFFiltered, Convert.ToInt32(setting.Value)))
{
StoreInDb((int)PropertyEnums.PropertyIds.ExportHDFFiltered, true.ToString());
}
if (ExportDesired(SupportedExportFormatBitFlags.HDFMV, Convert.ToInt32(setting.Value)))
{
StoreInDb((int)PropertyEnums.PropertyIds.ExportHDFMV, true.ToString());
}
if (ExportDesired(SupportedExportFormatBitFlags.HDFADC, Convert.ToInt32(setting.Value)))
{
StoreInDb((int)PropertyEnums.PropertyIds.ExportHDFADC, true.ToString());
}
if (ExportDesired(SupportedExportFormatBitFlags.xlsxfiltered, Convert.ToInt32(setting.Value)))
{
StoreInDb((int)PropertyEnums.PropertyIds.ExportXLSXFiltered, true.ToString());
}
if (ExportDesired(SupportedExportFormatBitFlags.xlsxunfiltered, Convert.ToInt32(setting.Value)))
{
StoreInDb((int)PropertyEnums.PropertyIds.ExportXLSXUnfiltered, true.ToString());
}
break;
case "DefaultTestQuitTestWithoutWarning":
StoreInDb((int)PropertyEnums.PropertyIds.SupressQuitTestWarning, setting.Value);
break;
case "DefaultTestSuppressNotAllChannelsViewedWarningRealTime":
StoreInDb((int)PropertyEnums.PropertyIds.SuppressViewAllRealtime, setting.Value);
break;
case "DefaultTestSuppressNotAllChannelsViewedWarningViewer":
StoreInDb((int)PropertyEnums.PropertyIds.SupressViewAllViewer, setting.Value);
break;
}
}
return true;
}
public enum SupportedExportFormatBitFlags
{
none = 0x0,
csvunfiltered = 0x1,
diademadc = 0x2,
isounfiltered = 0x4,
somatunfiltered = 0x8,
tdmsadc = 0x10,
toyotaunfiltered = 0x20,
tsvunfiltered = 0x40,
csvfiltered = 0x80,
//diademfiltered = 0x100, //unused & available
isofiltered = 0x200,
somatfiltered = 0x400,
tdasadc = 0x800,
toyotafiltered = 0x1000,
tsvfiltered = 0x2000,
rdfadc = 0x4000,
ChryslerDDAS = 0x8000,
HDFUnfiltered = 0x10000,
HDFFiltered = 0x20000,
HDFMV = 0x40000,
HDFADC = 0x80000,
xlsxfiltered = 0x100000,
xlsxunfiltered = 0x200000
}
public bool ExportDesired(SupportedExportFormatBitFlags exportType, int settingValue)
{
bool desired = false;
desired = ((SupportedExportFormatBitFlags)settingValue & exportType) == exportType;
return desired;
}
private void StoreInDb(int propertyId, string settingValue)
{
var userIds = GetAllUserIds();
foreach (var userId in userIds)
{
using (var cmd = DatabaseImport.DbOperations.GetSQLCommand(true))
{
try
{
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = "sp_UserPropertiesUpdateInsert";
cmd.Parameters.Add(new SqlParameter("@UserId", SqlDbType.Int) { Value = userId });
cmd.Parameters.Add(new SqlParameter("@PropertyId", SqlDbType.Int) { Value = propertyId });
cmd.Parameters.Add(new SqlParameter("@PropertyValue", SqlDbType.NVarChar) { Value = settingValue });
var errorNumberParam =
new SqlParameter("@errorNumber", SqlDbType.Int) { Direction = ParameterDirection.Output };
cmd.Parameters.Add(errorNumberParam);
var errorMessageParam =
new SqlParameter("@errorMessage", SqlDbType.NVarChar, 250)
{
Direction = ParameterDirection.Output
};
cmd.Parameters.Add(errorMessageParam);
cmd.ExecuteNonQuery();
if (int.Parse(errorNumberParam.Value.ToString()) != 0)
{
//errorMessageParam.Value
}
}
finally
{
cmd.Connection.Dispose();
}
}
}
}
private List<int> GetAllUserIds()
{
var userIdList = new List<int>();
try
{
using (var cmd = DatabaseImport.DbOperations.GetSQLCommand(true))
{
try
{
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = DbOperationsEnum.StoredProcedure.sp_UserGetIdsAll.ToString(); //Only used in DataPROPre20.mdf, not DataPRO.mdf
using (var ds = DatabaseImport.DbOperations.Connection.QueryDataSet(cmd))
{
if (ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
{
foreach (DataRow dr in ds.Tables[0].Rows)
{
userIdList.Add(Convert.ToInt32(dr[DbOperations.Users.UserFields.ID.ToString()]));
}
}
}
}
finally
{
cmd.Connection.Dispose();
}
}
}
catch (Exception)
{
//APILogger.Log("problem getting user", ex);
}
return userIdList;
}
}
}

View 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("ConfigToDb")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ConfigToDb")]
[assembly: AssemblyCopyright("Copyright © 2018")]
[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("98a0afb3-7bbf-4e43-8c5b-552d69c8d3a9")]
// 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")]

View File

@@ -0,0 +1,94 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{98A0AFB3-7BBF-4E43-8C5B-552D69C8D3A9}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>ConfigToDb</RootNamespace>
<AssemblyName>ConfigToDb</AssemblyName>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>bin\x64\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x86\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<OutputPath>bin\x86\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.configuration" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="ConfigToDbMigrator.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\..\Common\DTS.Common.Storage\DTS.Common.Storage.csproj">
<Project>{e3be457c-0ac7-4a9c-bc81-eafeb3217878}</Project>
<Name>DTS.Common.Storage</Name>
</ProjectReference>
<ProjectReference Include="..\..\..\Users\Users.csproj">
<Project>{be8d217d-6da9-4bca-b62a-a82325b33979}</Project>
<Name>Users</Name>
</ProjectReference>
<ProjectReference Include="..\DatabaseImport\DatabaseImport.csproj">
<Project>{00b5442e-2279-47ae-8015-6db0ffeb6d88}</Project>
<Name>DatabaseImport</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View File

@@ -0,0 +1,135 @@
<?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=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="ApplicationSettings" xml:space="preserve">
<value>applicationSettings</value>
</data>
<data name="OldSettingsCouldNotBeFound" xml:space="preserve">
<value>Warning: DataPRO.exe.config was not updated because config settings from previously-installed version of DataPRO could not be found: {0}; {1}</value>
</data>
<data name="OldSettingsCouldNotBeProcessed" xml:space="preserve">
<value>Warning: DataPRO.exe.config was not updated because config settings from previously-installed version of DataPRO could not be processed.</value>
</data>
<data name="RegistryDataPROExe" xml:space="preserve">
<value>DataPRO.exe</value>
</data>
<data name="UserSettings" xml:space="preserve">
<value>userSettings</value>
</data>
</root>

Binary file not shown.

View File

@@ -0,0 +1,94 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{98A0AFB3-7BBF-4E43-8C5B-552D69C8D3A9}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>ConfigToDb</RootNamespace>
<AssemblyName>ConfigToDb</AssemblyName>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>bin\x64\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x86\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<OutputPath>bin\x86\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.configuration" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="ConfigToDbMigrator.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\..\Common\DTS.Common.Storage\DTS.Common.Storage.csproj">
<Project>{e3be457c-0ac7-4a9c-bc81-eafeb3217878}</Project>
<Name>DTS.Common.Storage</Name>
</ProjectReference>
<ProjectReference Include="..\..\..\Users\Users.csproj">
<Project>{be8d217d-6da9-4bca-b62a-a82325b33979}</Project>
<Name>Users</Name>
</ProjectReference>
<ProjectReference Include="..\DatabaseImport\DatabaseImport.csproj">
<Project>{00b5442e-2279-47ae-8015-6db0ffeb6d88}</Project>
<Name>DatabaseImport</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View File

@@ -0,0 +1,433 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ConfigToDb.Properties;
using DTS.Common.Storage;
using DTS.Slice.Users.UserSettings;
namespace ConfigToDb
{
public class ConfigToDbMigrator
{
public bool migrateConfigToDb(string nextLowerPath, out string result)
{
var oldUserSettings = new SettingElementCollection();
var oldApplicationSettings = new SettingElementCollection();
GetOldConfigSettings(Resources.UserSettings, nextLowerPath, out result, out oldUserSettings);
if (!result.Contains(Resources.OldSettingsCouldNotBeFound) && !result.Contains(Resources.OldSettingsCouldNotBeProcessed))
{
GetOldConfigSettings(Resources.ApplicationSettings, nextLowerPath, out result, out oldApplicationSettings);
if (InsertConfigSettingsIntoDb(oldUserSettings, oldApplicationSettings, out result))
{
return true;
}
}
return false;
}
//private SettingElementCollection GetOldConfigSettings(string settingsType, string nextLowerPath, out string result)
//{
// var oldSettings = new SettingElementCollection();
// GetOldSettings(settingsType, nextLowerPath, out result, out oldSettings);
// return oldSettings;
//}
/// <summary>
/// Gets the settings from the old config file
/// </summary>
/// <param name="settingsType">Either UserSettings or ApplicationSettings.</param>
/// <param name="nextLowerPath">The path to the old config file.</param>
/// <param name="result">Text describing the success/failure of the config migration.</param>
/// <param name="oldSettings">The settings from the old config file</param>
/// <returns>True if the settings were successfully found and processed, false if not.</returns>
private void GetOldConfigSettings(string settingsType, string nextLowerPath, out string result, out SettingElementCollection oldSettings)
{
result = string.Empty;
oldSettings = null;
var oldPath = string.Empty;
try
{
//Open the config file from the most-recently installed version of DataPRO - this assumes that it was installed in the default folder!!!
oldPath = nextLowerPath + Resources.RegistryDataPROExe;
var oldConfig = ConfigurationManager.OpenExeConfiguration(@oldPath);
oldSettings = GetConfigSettings(settingsType, oldConfig);
if (oldSettings == null)
{
result = Resources.OldSettingsCouldNotBeProcessed;
}
}
catch (System.Exception ex)
{
result = string.Format(Resources.OldSettingsCouldNotBeFound, ex.Message, oldPath);
}
}
/// <summary>
/// Gets the settings in a section group of the config file.
/// </summary>
/// <param name="settingsType">Examples include "userSettings" and "applicationSettings"</param>
/// <param name="config">The config file to be interrogated.</param>
/// <returns>A collection of settings from the requested section of the config file.</returns>
private SettingElementCollection GetConfigSettings(string settingsType, Configuration config)
{
var clientSettingsSection = new ClientSettingsSection();
var configurationSectionGroup = config.SectionGroups[settingsType];
if ((configurationSectionGroup != null) && (configurationSectionGroup.Sections[0] != null))
{
clientSettingsSection = configurationSectionGroup.Sections[0] as System.Configuration.ClientSettingsSection;
}
return clientSettingsSection != null ? clientSettingsSection.Settings : null;
}
private bool InsertConfigSettingsIntoDb(SettingElementCollection oldUserSettings, SettingElementCollection oldApplicationSettings, out string result)
{
result = string.Empty;
var oldUserSettingsDictionary = oldUserSettings.Cast<SettingElement>().ToDictionary(oldSetting => oldSetting.Name, oldSetting => oldSetting.Value.ValueXml.InnerXml);
foreach (var setting in oldUserSettingsDictionary)
{
switch (setting.Key)
{
case "LastUsedSampleRate":
StoreInDb((int)PropertyEnums.PropertyIds.LastUsedSampleRate, setting.Value);
break;
case "RealtimeChartWidthInSeconds":
StoreInDb((int)PropertyEnums.PropertyIds.RealtimeChartWidthInSeconds, setting.Value);
break;
case "LastRunTestSetup":
StoreInDb((int)PropertyEnums.PropertyIds.LastRunTestSetup, setting.Value);
break;
case "DefaultSuppressMissingSensorsWarning":
StoreInDb((int)PropertyEnums.PropertyIds.DefaultSuppressMissingSensorsWarning, setting.Value);
break;
case "UsersCurrentTestSetup":
StoreInDb((int)PropertyEnums.PropertyIds.UsersCurrentTestSetup, setting.Value);
break;
}
}
var oldApplicationSettingsDictionary = oldApplicationSettings.Cast<SettingElement>().ToDictionary(oldSetting => oldSetting.Name, oldSetting => oldSetting.Value.ValueXml.InnerXml);
foreach (var setting in oldApplicationSettingsDictionary)
{
switch (setting.Key)
{
case "DefaultUploadFolder":
StoreInDb((int)PropertyEnums.PropertyIds.DefaultUploadFolder, setting.Value);
break;
case "DefaultUploadEnabled":
StoreInDb((int)PropertyEnums.PropertyIds.DefaultUploadEnabled, setting.Value);
break;
case "DefaultTestSampleRate":
StoreInDb((int)PropertyEnums.PropertyIds.DefaultTestSampleRate, setting.Value);
break;
case "DefaultPostTriggerSeconds":
StoreInDb((int)PropertyEnums.PropertyIds.DefaultPostTriggerSeconds, setting.Value);
break;
case "DefaultNumberOfEvents":
StoreInDb((int)PropertyEnums.PropertyIds.DefaultNumberOfEvents, setting.Value);
break;
case "DefaultPreTriggerSeconds":
StoreInDb((int)PropertyEnums.PropertyIds.DefaultPreTriggerSeconds, setting.Value);
break;
case "ArmTriggerDiagnosticsRunOnNextStep":
StoreInDb((int)PropertyEnums.PropertyIds.ArmTriggerDiagnosticsRunOnNextStep, setting.Value);
break;
case "DefaultTestTriggerCheckStep":
StoreInDb((int)PropertyEnums.PropertyIds.DefaultTriggerCheckStep, setting.Value);
break;
case "DefaultTestRealtimeModeGraphCount":
StoreInDb((int)PropertyEnums.PropertyIds.DefaultRealtimeGraphCount, setting.Value);
break;
case "DefaultTestROIStart":
StoreInDb((int)PropertyEnums.PropertyIds.DefaultROIStart, setting.Value);
break;
case "DefaultTestROIEnd":
StoreInDb((int)PropertyEnums.PropertyIds.DefaultROIEnd, setting.Value);
break;
case "DefaultTestDownloadROI":
StoreInDb((int)PropertyEnums.PropertyIds.DefaultDownloadROI, setting.Value);
break;
case "DefaultTestViewROI":
StoreInDb((int)PropertyEnums.PropertyIds.DefaultViewROI, setting.Value);
break;
case "DefaultTestDownloadAll":
StoreInDb((int)PropertyEnums.PropertyIds.DefaultDownloadAll, setting.Value);
break;
case "DefaultTestViewAll":
StoreInDb((int)PropertyEnums.PropertyIds.DefaultViewAll, setting.Value);
break;
case "DefaultTestTreeModeDiagnostics":
StoreInDb((int)PropertyEnums.PropertyIds.DefaultTreeModeDiagnostics, setting.Value);
break;
case "DefaultTestRequireAllUnitsPassDiagnostics":
StoreInDb((int)PropertyEnums.PropertyIds.DefaultRequireAllUnitsPassDiagnostics, setting.Value);
break;
case "DefaultTestRequireUserConfirmationOnErrors":
StoreInDb((int)PropertyEnums.PropertyIds.DefaultRequireUserConfirmationOnErrors, setting.Value);
break;
case "DefaultTestAllowMissingSensors":
StoreInDb((int)PropertyEnums.PropertyIds.DefaultAllowMissingSensors, setting.Value);
break;
case "DefaultTestExcitationWarmupMS":
double seconds = Convert.ToDouble(setting.Value) / 1000;
StoreInDb((int)PropertyEnums.PropertyIds.DefaultTestExcitationWarmupSeconds, seconds.ToString(System.Globalization.CultureInfo.InvariantCulture));
break;
case "DefaultTestExcitationTOMWarmupDelayMS":
StoreInDb((int)PropertyEnums.PropertyIds.DefaultTestExcitationTOMWarmupDelayMS, setting.Value);
break;
case "DefaultTestExcitationIEPEWarmupDelayMS":
StoreInDb((int)PropertyEnums.PropertyIds.DefaultTestExcitationIEPEWarmupDelayMS, setting.Value);
break;
case "DefaultTestRunPostTestDiagnostics":
StoreInDb((int)PropertyEnums.PropertyIds.DefaultRunPostTestDiagnostics, setting.Value);
break;
case "DefaultTriggerCheckStep":
StoreInDb((int)PropertyEnums.PropertyIds.DefaultTriggerCheckStep, setting.Value);
break;
case "DefaultTestArmCheckListStep":
StoreInDb((int)PropertyEnums.PropertyIds.DefaultArmCheckListStep, setting.Value);
break;
case "DefaultTestCheckListInputVoltageCheck":
StoreInDb((int)PropertyEnums.PropertyIds.DefaultCheckListInputVoltageCheck, setting.Value);
break;
case "DefaultTestCheckListBatteryVoltageCheck":
StoreInDb((int)PropertyEnums.PropertyIds.DefaultCheckListBatteryVoltageCheck, setting.Value);
break;
case "DefaultTestCheckListSquibResistanceCheck":
StoreInDb((int)PropertyEnums.PropertyIds.DefaultCheckListSquibResistanceCheck, setting.Value);
break;
case "DefaultTestCheckListSensorIDCheck":
StoreInDb((int)PropertyEnums.PropertyIds.DefaultCheckListSensorIdCheck, setting.Value);
break;
case "DefaultTestCheckListTriggerStartCheck":
StoreInDb((int)PropertyEnums.PropertyIds.DefaultCheckListTriggerStartCheck, setting.Value);
break;
case "DefaultTestCheckListMustPass":
StoreInDb((int)PropertyEnums.PropertyIds.DefaultCheckListMustPass, setting.Value);
break;
case "DefaultTestAllowSensorIdToBlankChannel":
StoreInDb((int)PropertyEnums.PropertyIds.DefaultRequireSensorIdFound, setting.Value);
break;
case "DefaultTestViewRealtime":
StoreInDb((int)PropertyEnums.PropertyIds.DefaultViewRealtime, setting.Value);
break;
case "DefaultTestExport":
StoreInDb((int)PropertyEnums.PropertyIds.DefaultExport, setting.Value);
break;
case "DefaultTestArmChecklistRequireUserConfirmationOnErrors":
StoreInDb((int)PropertyEnums.PropertyIds.DefaultRequireUserConfirmationOnErrors, setting.Value);
break;
case "DefaultTestExportFormat":
if (ExportDesired(SupportedExportFormatBitFlags.csvunfiltered, Convert.ToInt32(setting.Value)))
{
StoreInDb((int)PropertyEnums.PropertyIds.ExportCSVUnfiltered, true.ToString());
}
if (ExportDesired(SupportedExportFormatBitFlags.diademadc, Convert.ToInt32(setting.Value)))
{
StoreInDb((int)PropertyEnums.PropertyIds.ExportDiademADC, true.ToString());
}
if (ExportDesired(SupportedExportFormatBitFlags.isounfiltered, Convert.ToInt32(setting.Value)))
{
StoreInDb((int)PropertyEnums.PropertyIds.ExportISOUnFiltered, true.ToString());
}
if (ExportDesired(SupportedExportFormatBitFlags.somatunfiltered, Convert.ToInt32(setting.Value)))
{
StoreInDb((int)PropertyEnums.PropertyIds.ExportSomatUnfiltered, true.ToString());
}
if (ExportDesired(SupportedExportFormatBitFlags.tdmsadc, Convert.ToInt32(setting.Value)))
{
StoreInDb((int)PropertyEnums.PropertyIds.ExportTDMSADC, true.ToString());
}
if (ExportDesired(SupportedExportFormatBitFlags.toyotaunfiltered, Convert.ToInt32(setting.Value)))
{
StoreInDb((int)PropertyEnums.PropertyIds.ExportToyotaUnfiltered, true.ToString());
}
if (ExportDesired(SupportedExportFormatBitFlags.tsvunfiltered, Convert.ToInt32(setting.Value)))
{
StoreInDb((int)PropertyEnums.PropertyIds.ExportTSVUnfiltered, true.ToString());
}
if (ExportDesired(SupportedExportFormatBitFlags.csvfiltered, Convert.ToInt32(setting.Value)))
{
StoreInDb((int)PropertyEnums.PropertyIds.ExportCSVFiltered, true.ToString());
}
if (ExportDesired(SupportedExportFormatBitFlags.isofiltered, Convert.ToInt32(setting.Value)))
{
StoreInDb((int)PropertyEnums.PropertyIds.ExportISOFiltered, true.ToString());
}
if (ExportDesired(SupportedExportFormatBitFlags.somatfiltered, Convert.ToInt32(setting.Value)))
{
StoreInDb((int)PropertyEnums.PropertyIds.ExportSomatFiltered, true.ToString());
}
if (ExportDesired(SupportedExportFormatBitFlags.tdasadc, Convert.ToInt32(setting.Value)))
{
StoreInDb((int)PropertyEnums.PropertyIds.ExportTDASADC, true.ToString());
}
if (ExportDesired(SupportedExportFormatBitFlags.toyotafiltered, Convert.ToInt32(setting.Value)))
{
StoreInDb((int)PropertyEnums.PropertyIds.ExportToyotaFiltered, true.ToString());
}
if (ExportDesired(SupportedExportFormatBitFlags.tsvfiltered, Convert.ToInt32(setting.Value)))
{
StoreInDb((int)PropertyEnums.PropertyIds.ExportTSVFiltered, true.ToString());
}
if (ExportDesired(SupportedExportFormatBitFlags.rdfadc, Convert.ToInt32(setting.Value)))
{
StoreInDb((int)PropertyEnums.PropertyIds.ExportRDFADC, true.ToString());
}
if (ExportDesired(SupportedExportFormatBitFlags.ChryslerDDAS, Convert.ToInt32(setting.Value)))
{
StoreInDb((int)PropertyEnums.PropertyIds.ExportChryslerDDAS, true.ToString());
}
if (ExportDesired(SupportedExportFormatBitFlags.HDFUnfiltered, Convert.ToInt32(setting.Value)))
{
StoreInDb((int)PropertyEnums.PropertyIds.ExportHDFUnfiltered, true.ToString());
}
if (ExportDesired(SupportedExportFormatBitFlags.HDFFiltered, Convert.ToInt32(setting.Value)))
{
StoreInDb((int)PropertyEnums.PropertyIds.ExportHDFFiltered, true.ToString());
}
if (ExportDesired(SupportedExportFormatBitFlags.HDFMV, Convert.ToInt32(setting.Value)))
{
StoreInDb((int)PropertyEnums.PropertyIds.ExportHDFMV, true.ToString());
}
if (ExportDesired(SupportedExportFormatBitFlags.HDFADC, Convert.ToInt32(setting.Value)))
{
StoreInDb((int)PropertyEnums.PropertyIds.ExportHDFADC, true.ToString());
}
if (ExportDesired(SupportedExportFormatBitFlags.xlsxfiltered, Convert.ToInt32(setting.Value)))
{
StoreInDb((int)PropertyEnums.PropertyIds.ExportXLSXFiltered, true.ToString());
}
if (ExportDesired(SupportedExportFormatBitFlags.xlsxunfiltered, Convert.ToInt32(setting.Value)))
{
StoreInDb((int)PropertyEnums.PropertyIds.ExportXLSXUnfiltered, true.ToString());
}
break;
case "DefaultTestQuitTestWithoutWarning":
StoreInDb((int)PropertyEnums.PropertyIds.SupressQuitTestWarning, setting.Value);
break;
case "DefaultTestSuppressNotAllChannelsViewedWarningRealTime":
StoreInDb((int)PropertyEnums.PropertyIds.SuppressViewAllRealtime, setting.Value);
break;
case "DefaultTestSuppressNotAllChannelsViewedWarningViewer":
StoreInDb((int)PropertyEnums.PropertyIds.SupressViewAllViewer, setting.Value);
break;
}
}
return true;
}
public enum SupportedExportFormatBitFlags
{
none = 0x0,
csvunfiltered = 0x1,
diademadc = 0x2,
isounfiltered = 0x4,
somatunfiltered = 0x8,
tdmsadc = 0x10,
toyotaunfiltered = 0x20,
tsvunfiltered = 0x40,
csvfiltered = 0x80,
//diademfiltered = 0x100, //unused & available
isofiltered = 0x200,
somatfiltered = 0x400,
tdasadc = 0x800,
toyotafiltered = 0x1000,
tsvfiltered = 0x2000,
rdfadc = 0x4000,
ChryslerDDAS = 0x8000,
HDFUnfiltered = 0x10000,
HDFFiltered = 0x20000,
HDFMV = 0x40000,
HDFADC = 0x80000,
xlsxfiltered = 0x100000,
xlsxunfiltered = 0x200000
}
public bool ExportDesired(SupportedExportFormatBitFlags exportType, int settingValue)
{
bool desired = false;
desired = ((SupportedExportFormatBitFlags)settingValue & exportType) == exportType;
return desired;
}
private void StoreInDb(int propertyId, string settingValue)
{
var userIds = GetAllUserIds();
foreach (var userId in userIds)
{
using (var cmd = DatabaseImport.DbOperations.GetSQLCommand(true))
{
try
{
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = "sp_UserPropertiesUpdateInsert";
cmd.Parameters.Add(new SqlParameter("@UserId", SqlDbType.Int) { Value = userId });
cmd.Parameters.Add(new SqlParameter("@PropertyId", SqlDbType.Int) { Value = propertyId });
cmd.Parameters.Add(new SqlParameter("@PropertyValue", SqlDbType.NVarChar) { Value = settingValue });
var errorNumberParam =
new SqlParameter("@errorNumber", SqlDbType.Int) { Direction = ParameterDirection.Output };
cmd.Parameters.Add(errorNumberParam);
var errorMessageParam =
new SqlParameter("@errorMessage", SqlDbType.NVarChar, 250)
{
Direction = ParameterDirection.Output
};
cmd.Parameters.Add(errorMessageParam);
cmd.ExecuteNonQuery();
if (int.Parse(errorNumberParam.Value.ToString()) != 0)
{
//errorMessageParam.Value
}
}
finally
{
cmd.Connection.Dispose();
}
}
}
}
private List<int> GetAllUserIds()
{
var userIdList = new List<int>();
try
{
using (var cmd = DatabaseImport.DbOperations.GetSQLCommand(true))
{
try
{
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = DbOperationsEnum.StoredProcedure.sp_UserGetIdsAll.ToString(); //Only used in DataPROPre20.mdf, not DataPRO.mdf
using (var ds = DatabaseImport.DbOperations.Connection.QueryDataSet(cmd))
{
if (ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
{
foreach (DataRow dr in ds.Tables[0].Rows)
{
userIdList.Add(Convert.ToInt32(dr[DbOperations.Users.UserFields.ID.ToString()]));
}
}
}
}
finally
{
cmd.Connection.Dispose();
}
}
}
catch (Exception)
{
//APILogger.Log("problem getting user", ex);
}
return userIdList;
}
}
}

View 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("ConfigToDb")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ConfigToDb")]
[assembly: AssemblyCopyright("Copyright © 2018")]
[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("98a0afb3-7bbf-4e43-8c5b-552d69c8d3a9")]
// 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")]

View File

@@ -0,0 +1,108 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace ConfigToDb.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", "17.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("ConfigToDb.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;
}
}
/// <summary>
/// Looks up a localized string similar to applicationSettings.
/// </summary>
internal static string ApplicationSettings {
get {
return ResourceManager.GetString("ApplicationSettings", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Warning: DataPRO.exe.config was not updated because config settings from previously-installed version of DataPRO could not be found: {0}; {1}.
/// </summary>
internal static string OldSettingsCouldNotBeFound {
get {
return ResourceManager.GetString("OldSettingsCouldNotBeFound", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Warning: DataPRO.exe.config was not updated because config settings from previously-installed version of DataPRO could not be processed..
/// </summary>
internal static string OldSettingsCouldNotBeProcessed {
get {
return ResourceManager.GetString("OldSettingsCouldNotBeProcessed", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to DataPRO.exe.
/// </summary>
internal static string RegistryDataPROExe {
get {
return ResourceManager.GetString("RegistryDataPROExe", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to userSettings.
/// </summary>
internal static string UserSettings {
get {
return ResourceManager.GetString("UserSettings", resourceCulture);
}
}
}
}

View File

@@ -0,0 +1,135 @@
<?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=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="ApplicationSettings" xml:space="preserve">
<value>applicationSettings</value>
</data>
<data name="OldSettingsCouldNotBeFound" xml:space="preserve">
<value>Warning: DataPRO.exe.config was not updated because config settings from previously-installed version of DataPRO could not be found: {0}; {1}</value>
</data>
<data name="OldSettingsCouldNotBeProcessed" xml:space="preserve">
<value>Warning: DataPRO.exe.config was not updated because config settings from previously-installed version of DataPRO could not be processed.</value>
</data>
<data name="RegistryDataPROExe" xml:space="preserve">
<value>DataPRO.exe</value>
</data>
<data name="UserSettings" xml:space="preserve">
<value>userSettings</value>
</data>
</root>

View File

@@ -0,0 +1,4 @@
// <autogenerated />
using System;
using System.Reflection;
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.8", FrameworkDisplayName = "")]

View File

@@ -0,0 +1,4 @@
// <autogenerated />
using System;
using System.Reflection;
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]