Commit ab408b8d authored by 潘栩锋's avatar 潘栩锋 🚴

数据库 检测 更加万能

parent 2a61cb6c
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
</configSections>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
......@@ -11,6 +11,9 @@
<provider invariantName="System.Data.SQLite.EF6" type="System.Data.SQLite.EF6.SQLiteProviderServices, System.Data.SQLite.EF6" />
</providers>
</entityFramework>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.2" />
</startup>
<system.data>
<DbProviderFactories>
<remove invariant="System.Data.SQLite.EF6" />
......
......@@ -19,4 +19,21 @@ namespace FLY.OBJComponents.Common
{
}
public class PropertyIndexAttribute : Attribute
{
/// <summary>
/// 标识
/// </summary>
public int Index { get; set; }
/// <summary>
///
/// </summary>
/// <param name="index"></param>
public PropertyIndexAttribute(int index)
{
Index = index;
}
}
}
\ No newline at end of file
......@@ -7,6 +7,7 @@ using System.Data.SQLite;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Text.RegularExpressions;
namespace FLY.OBJComponents.Common.SQLite
{
......@@ -132,7 +133,10 @@ namespace FLY.OBJComponents.Common.SQLite
static string GetCreateTableCommandText_fieldText(Type type, IEnumerable<ArrayFieldTypeInfo> arrayFieldTypeInfos)
{
string fieldtext = "";
string total_fieldtext = "";
List<FieldTextIndex> fieldTexts = new List<FieldTextIndex>();
PropertyInfo[] propertyInfos = type.GetProperties();
foreach (var propertyInfo in propertyInfos)
{
......@@ -140,10 +144,12 @@ namespace FLY.OBJComponents.Common.SQLite
if (propertyInfo.GetCustomAttributes(typeof(IgnoreAttribute), false).Count() > 0)
continue;
if (fieldtext != "")
{
fieldtext += ",";
}
FieldTextIndex fieldText = new FieldTextIndex();
fieldTexts.Add(fieldText);
PropertyIndexAttribute propertyIndex = propertyInfo.GetCustomAttribute(typeof(PropertyIndexAttribute)) as PropertyIndexAttribute;
if (propertyIndex != null)
fieldText.index = propertyIndex.Index;//默认index=0
//这个属性 下面的全部属性,是同一个表
if (propertyInfo.GetCustomAttributes(typeof(BortherAttribute), false).Count() > 0)
......@@ -151,9 +157,9 @@ namespace FLY.OBJComponents.Common.SQLite
//从arrayFieldTypeInfos 提取
string startswith = propertyInfo.Name + ".";
var aftis = from afti in arrayFieldTypeInfos
where afti.PropertyName.StartsWith(startswith)
select new ArrayFieldTypeInfo(afti.PropertyName.Substring(startswith.Length), afti.PropertyName.Length);
fieldtext += GetCreateTableCommandText_fieldText(propertyInfo.PropertyType, aftis);
where afti.PropertyName.StartsWith(startswith)
select new ArrayFieldTypeInfo(afti.PropertyName.Substring(startswith.Length), afti.PropertyName.Length);
fieldText.fieldtext = GetCreateTableCommandText_fieldText(propertyInfo.PropertyType, aftis);
continue;
}
......@@ -164,31 +170,51 @@ namespace FLY.OBJComponents.Common.SQLite
Type elementType = propertyInfo.PropertyType.GetElementType();
SQLiteFieldTypeInfo fieldTypeInfo = FieldTypeInfo.Find((fti) => fti.PropertyType == elementType);
string text = "";
for (int i = 0; i < length; i++)
{
if (i != 0)
fieldtext += ",";
text += ",";
fieldtext += string.Format("{0}{1} {2}",
text += string.Format("{0}{1} {2}",
propertyInfo.Name,
i,
fieldTypeInfo.FieldType);
}
fieldText.fieldtext = text;
}
else
{
SQLiteFieldTypeInfo fieldTypeInfo = FieldTypeInfo.Find((fti) => fti.PropertyType == propertyInfo.PropertyType);
fieldtext += string.Format("{0} {1}", propertyInfo.Name, fieldTypeInfo.FieldType);
string text = "";
text += string.Format("{0} {1}", propertyInfo.Name, fieldTypeInfo.FieldType);
//主键
if (propertyInfo.GetCustomAttributes(typeof(KeyAttribute), false).Count() > 0)
fieldtext += " PRIMARY KEY";
text += " PRIMARY KEY";
fieldText.fieldtext = text;
}
}
//从小到大排序
fieldTexts.Sort((fieldTextIndex0, fieldTextIndex1) =>
{
if (fieldTextIndex0.index < fieldTextIndex1.index)
return -1;
if (fieldTextIndex0.index > fieldTextIndex1.index)
return 1;
else
return 0;
});
return fieldtext;
for (int i = 0; i < fieldTexts.Count(); i++)
{
var fieldTextIndex = fieldTexts[i];
if (i != 0)
total_fieldtext += ",";
total_fieldtext += fieldTextIndex.fieldtext;
}
return total_fieldtext;
}
public static string GetCreateTableCommandText(Type type, params ArrayFieldTypeInfo[] arrayFieldTypeInfos)
{
......@@ -205,22 +231,28 @@ namespace FLY.OBJComponents.Common.SQLite
return commandText;
}
class FieldTextIndex
{
public int index = 0;
public string fieldtext = "";
}
static string GetInsertCommandText_fieldText(object cell)
{
Type type = cell.GetType();
string fieldtext = "";
string total_fieldtext = "";
List<FieldTextIndex> fieldTexts = new List<FieldTextIndex>();
PropertyInfo[] propertyInfos = type.GetProperties();
foreach (var propertyInfo in propertyInfos)
{
//忽略
if (propertyInfo.GetCustomAttributes(typeof(IgnoreAttribute), false).Count() > 0)
continue;
if (fieldtext != "")
{
fieldtext += ",";
}
FieldTextIndex fieldText = new FieldTextIndex();
fieldTexts.Add(fieldText);
PropertyIndexAttribute propertyIndex = propertyInfo.GetCustomAttribute(typeof(PropertyIndexAttribute)) as PropertyIndexAttribute;
if (propertyIndex != null)
fieldText.index = propertyIndex.Index;//默认index=0
object o = propertyInfo.GetValue(cell, null);
......@@ -228,7 +260,7 @@ namespace FLY.OBJComponents.Common.SQLite
//这个属性 下面的全部属性,是同一个表
if (propertyInfo.GetCustomAttributes(typeof(BortherAttribute), false).Count() > 0)
{
fieldtext += GetInsertCommandText_fieldText(o);
fieldText.fieldtext = GetInsertCommandText_fieldText(o);
continue;
}
......@@ -239,23 +271,43 @@ namespace FLY.OBJComponents.Common.SQLite
SQLiteFieldTypeInfo fieldTypeInfo = FieldTypeInfo.Find((fti) => fti.PropertyType == elementType);
Array a = o as Array;
string text = "";
for (int i = 0; i < a.Length; i++)
{
if (i != 0)
fieldtext += ",";
text += ",";
fieldtext += fieldTypeInfo.PtoS(a.GetValue(i));
text += fieldTypeInfo.PtoS(a.GetValue(i));
}
fieldText.fieldtext = text;
}
else
{
SQLiteFieldTypeInfo fieldTypeInfo = FieldTypeInfo.Find((fti) => fti.PropertyType == propertyInfo.PropertyType);
fieldtext += fieldTypeInfo.PtoS(o);
fieldText.fieldtext = fieldTypeInfo.PtoS(o);
}
}
return fieldtext;
//从小到大排序
fieldTexts.Sort((fieldTextIndex0, fieldTextIndex1) =>
{
if (fieldTextIndex0.index < fieldTextIndex1.index)
return -1;
if (fieldTextIndex0.index > fieldTextIndex1.index)
return 1;
else
return 0;
});
for (int i = 0; i < fieldTexts.Count(); i++)
{
var fieldTextIndex = fieldTexts[i];
if (i != 0)
total_fieldtext += ",";
total_fieldtext += fieldTextIndex.fieldtext;
}
return total_fieldtext;
}
public static string GetInsertCommandText(object cell)
{
......@@ -538,7 +590,10 @@ namespace FLY.OBJComponents.Common.SQLite
}
/// <summary>
/// 出错代码
/// </summary>
public string ErrorMsg { get; set; }
/// <summary>
/// 输入DDLs 判断这些table都是否合法
/// </summary>
......@@ -569,12 +624,132 @@ namespace FLY.OBJComponents.Common.SQLite
string sql = (string)sqls.First();
if (sql != createtable_sql)
{
isVaild = false;
break;
if (!GetTableInfoFromDDL(sql, out SQLiteTableInfo tableInfo0))
{
ErrorMsg = $"sqlite_master 找到 name = '{tablename}' 的 sql 不能解析";
isVaild = false;
break;
}
if (!GetTableInfoFromDDL(createtable_sql, out SQLiteTableInfo tableInfo1))
{
ErrorMsg = $"程序中 name = '{tablename}' 的 sql 不能解析";
isVaild = false;
break;
}
if (!tableInfo0.Equals(tableInfo1))
{
ErrorMsg = $"sqlite_master 找到 name = '{tablename}' 的 sql 不符合要求, " + tableInfo0.ErrorMsg;
isVaild = false;
break;
}
}
}
}
return isVaild;
}
public bool GetTableInfoFromDDL(string DDL, out SQLiteTableInfo tableInfo)
{
tableInfo = null;
Regex regex_key = new Regex(@"PRIMARY KEY");
//CREATE TABLE boltmap(ID INTEGER PRIMARY KEY, MID INTEGER, RBegin INTEGER, REnd INTEGER)
Regex regex = new Regex(@"CREATE TABLE\s+(\w+)\s+\((.+)\)");
Match match = regex.Match(DDL);
if (!match.Success)
{
ErrorMsg = "不能匹配 CREATE TABLE 的格式";
return false;
}
tableInfo = new SQLiteTableInfo();
tableInfo.Name = match.Groups[1].Value;
string fields_sql = match.Groups[2].Value;
string[] fields_str = fields_sql.Split(',');
foreach (string str in fields_str)
{
SQLiteFieldInfo fieldInfo = new SQLiteFieldInfo();
string str1 = str.Trim();
string[] ss = str1.Split(' ');
if (ss.Length < 2)
{
ErrorMsg = $"{str1} 格式出错";
return false;
}
fieldInfo.Name = ss[0];
fieldInfo.Type = ss[1];
if (regex_key.IsMatch(str1))
fieldInfo.IsKey = true;
tableInfo.FieldInfos.Add(fieldInfo);
}
return true;
}
}
public class SQLiteTableInfo
{
/// <summary>
/// 名称
/// </summary>
public string Name;
public List<SQLiteFieldInfo> FieldInfos = new List<SQLiteFieldInfo>();
public override bool Equals(object obj)
{
SQLiteTableInfo tableinfo = obj as SQLiteTableInfo;
if (tableinfo.Name != Name)
{
ErrorMsg = $"名称不相等 期待.{tableinfo.Name}!=数据库.{Name}";
return false;
}
if (tableinfo.FieldInfos.Count() != FieldInfos.Count())
{
ErrorMsg = $"field 数量不同 期待.{tableinfo.FieldInfos.Count()}!=数据库.{FieldInfos.Count()}";
return false;
}
for (int i = 0; i < FieldInfos.Count(); i++)
{
if (!FieldInfos[i].Equals(tableinfo.FieldInfos[i]))
{
ErrorMsg = $"field 不同 期待.({tableinfo.FieldInfos[i]})!=数据库.({FieldInfos[i]})";
return false;
}
}
ErrorMsg = "OK";
return true;
}
public string ErrorMsg { get; set; }
}
public class SQLiteFieldInfo
{
/// <summary>
/// 类型
/// </summary>
public string Type;
/// <summary>
/// 名称
/// </summary>
public string Name;
/// <summary>
/// 是主键?
/// </summary>
public bool IsKey;
public override bool Equals(object obj)
{
SQLiteFieldInfo fieldInfo = obj as SQLiteFieldInfo;
if (Type != fieldInfo.Type)
return false;
if (Name != fieldInfo.Name)
return false;
if (IsKey != fieldInfo.IsKey)
return false;
return true;
}
public override string ToString()
{
string s = $"{Name} As {Type}";
if (IsKey)
s += " IsKey";
return s;
}
}
}
<?xml version="1.0" encoding="utf-8" ?>
<Weavers>
<PropertyChanged2 />
</Weavers>
<?xml version="1.0" encoding="utf-8"?>
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
<PropertyChanged />
</Weavers>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<!-- This file was generated by Fody. Manual changes to this file will be lost when your project is rebuild. -->
<xs:element name="Weavers">
<xs:complexType>
<xs:all>
<xs:element name="PropertyChanged" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:attribute name="InjectOnPropertyNameChanged" type="xs:boolean">
<xs:annotation>
<xs:documentation>Used to control if the On_PropertyName_Changed feature is enabled.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="EventInvokerNames" type="xs:string">
<xs:annotation>
<xs:documentation>Used to change the name of the method that fires the notify event. This is a string that accepts multiple values in a comma separated form.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="CheckForEquality" type="xs:boolean">
<xs:annotation>
<xs:documentation>Used to control if equality checks should be inserted. If false, equality checking will be disabled for the project.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="CheckForEqualityUsingBaseEquals" type="xs:boolean">
<xs:annotation>
<xs:documentation>Used to control if equality checks should use the Equals method resolved from the base class.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="UseStaticEqualsFromBase" type="xs:boolean">
<xs:annotation>
<xs:documentation>Used to control if equality checks should use the static Equals method resolved from the base class.</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
</xs:element>
</xs:all>
<xs:attribute name="VerifyAssembly" type="xs:boolean">
<xs:annotation>
<xs:documentation>'true' to run assembly verification on the target assembly after all weavers have been finished.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="VerifyIgnoreCodes" type="xs:string">
<xs:annotation>
<xs:documentation>A comma separated list of error codes that can be safely ignored in assembly verification.</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
</xs:element>
</xs:schema>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\..\packages\PropertyChanged2.Fody.2.5.13\build\PropertyChanged2.Fody.props" Condition="Exists('..\..\packages\PropertyChanged2.Fody.2.5.13\build\PropertyChanged2.Fody.props')" />
<Import Project="..\..\..\Project.FLY.Thick.Normal\packages\PropertyChanged.Fody.2.6.0\build\PropertyChanged.Fody.props" Condition="Exists('..\..\..\Project.FLY.Thick.Normal\packages\PropertyChanged.Fody.2.6.0\build\PropertyChanged.Fody.props')" />
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
......@@ -10,11 +10,12 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>FLY.OBJComponents</RootNamespace>
<AssemblyName>FLY.OBJComponents</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
......@@ -24,6 +25,7 @@
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
......@@ -32,31 +34,32 @@
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
<HintPath>..\..\..\Project.FLY.Thick.Normal\packages\EntityFramework.6.2.0\lib\net40\EntityFramework.dll</HintPath>
<HintPath>..\..\..\Project.FLY.Thick.Normal\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.dll</HintPath>
</Reference>
<Reference Include="EntityFramework.SqlServer, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
<HintPath>..\..\..\Project.FLY.Thick.Normal\packages\EntityFramework.6.2.0\lib\net40\EntityFramework.SqlServer.dll</HintPath>
<HintPath>..\..\..\Project.FLY.Thick.Normal\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.SqlServer.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\..\packages\Newtonsoft.Json.12.0.1\lib\net40\Newtonsoft.Json.dll</HintPath>
<HintPath>..\..\..\Project.FLY.Thick.Normal\packages\Newtonsoft.Json.12.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="PropertyChanged2, Version=2.5.13.0, Culture=neutral, PublicKeyToken=ee3ee20bcf148ddd, processorArchitecture=MSIL">
<HintPath>..\..\packages\PropertyChanged2.Fody.2.5.13\lib\net40\PropertyChanged2.dll</HintPath>
<Reference Include="PropertyChanged, Version=2.6.0.0, Culture=neutral, PublicKeyToken=ee3ee20bcf148ddd, processorArchitecture=MSIL">
<HintPath>..\..\..\Project.FLY.Thick.Normal\packages\PropertyChanged.Fody.2.6.0\lib\net452\PropertyChanged.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Core" />
<Reference Include="System.Data.SQLite, Version=1.0.109.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=MSIL">
<HintPath>..\..\..\Project.FLY.Thick.Normal\packages\System.Data.SQLite.Core.1.0.109.2\lib\net40\System.Data.SQLite.dll</HintPath>
<HintPath>..\..\..\Project.FLY.Thick.Normal\packages\System.Data.SQLite.Core.1.0.109.2\lib\net46\System.Data.SQLite.dll</HintPath>
</Reference>
<Reference Include="System.Data.SQLite.EF6, Version=1.0.109.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=MSIL">
<HintPath>..\..\..\Project.FLY.Thick.Normal\packages\System.Data.SQLite.EF6.1.0.109.0\lib\net40\System.Data.SQLite.EF6.dll</HintPath>
<HintPath>..\..\..\Project.FLY.Thick.Normal\packages\System.Data.SQLite.EF6.1.0.109.0\lib\net46\System.Data.SQLite.EF6.dll</HintPath>
</Reference>
<Reference Include="System.Data.SQLite.Linq, Version=1.0.109.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=MSIL">
<HintPath>..\..\..\Project.FLY.Thick.Normal\packages\System.Data.SQLite.Linq.1.0.109.0\lib\net40\System.Data.SQLite.Linq.dll</HintPath>
<HintPath>..\..\..\Project.FLY.Thick.Normal\packages\System.Data.SQLite.Linq.1.0.109.0\lib\net46\System.Data.SQLite.Linq.dll</HintPath>
</Reference>
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
......@@ -103,11 +106,6 @@
<Compile Include="Server\PLCProxySystem.cs" />
<Compile Include="Server\WarningSystem.cs" />
</ItemGroup>
<ItemGroup>
<Content Include="FodyWeavers.xml">
<SubType>Designer</SubType>
</Content>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Project.FLY.FObjSys\FObjSys\FObjBase.csproj">
<Project>{abfe87d4-b692-4ae9-a8c0-1f470b8acbb8}</Project>
......@@ -127,14 +125,14 @@
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="..\..\packages\Fody.3.2.13\build\Fody.targets" Condition="Exists('..\..\packages\Fody.3.2.13\build\Fody.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>这台计算机上缺少此项目引用的 NuGet 程序包。使用“NuGet 程序包还原”可下载这些程序包。有关更多信息,请参见 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\..\packages\Fody.3.2.13\build\Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Fody.3.2.13\build\Fody.targets'))" />
<Error Condition="!Exists('..\..\packages\PropertyChanged2.Fody.2.5.13\build\PropertyChanged2.Fody.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\PropertyChanged2.Fody.2.5.13\build\PropertyChanged2.Fody.props'))" />
<Error Condition="!Exists('..\..\..\Project.FLY.Thick.Normal\packages\System.Data.SQLite.Core.1.0.109.2\build\net40\System.Data.SQLite.Core.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\Project.FLY.Thick.Normal\packages\System.Data.SQLite.Core.1.0.109.2\build\net40\System.Data.SQLite.Core.targets'))" />
<Error Condition="!Exists('..\..\..\Project.FLY.Thick.Normal\packages\System.Data.SQLite.Core.1.0.109.2\build\net46\System.Data.SQLite.Core.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\Project.FLY.Thick.Normal\packages\System.Data.SQLite.Core.1.0.109.2\build\net46\System.Data.SQLite.Core.targets'))" />
<Error Condition="!Exists('..\..\..\Project.FLY.Thick.Normal\packages\Fody.3.3.2\build\Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\Project.FLY.Thick.Normal\packages\Fody.3.3.2\build\Fody.targets'))" />
<Error Condition="!Exists('..\..\..\Project.FLY.Thick.Normal\packages\PropertyChanged.Fody.2.6.0\build\PropertyChanged.Fody.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\Project.FLY.Thick.Normal\packages\PropertyChanged.Fody.2.6.0\build\PropertyChanged.Fody.props'))" />
</Target>
<Import Project="..\..\..\Project.FLY.Thick.Normal\packages\System.Data.SQLite.Core.1.0.109.2\build\net40\System.Data.SQLite.Core.targets" Condition="Exists('..\..\..\Project.FLY.Thick.Normal\packages\System.Data.SQLite.Core.1.0.109.2\build\net40\System.Data.SQLite.Core.targets')" />
<Import Project="..\..\..\Project.FLY.Thick.Normal\packages\System.Data.SQLite.Core.1.0.109.2\build\net46\System.Data.SQLite.Core.targets" Condition="Exists('..\..\..\Project.FLY.Thick.Normal\packages\System.Data.SQLite.Core.1.0.109.2\build\net46\System.Data.SQLite.Core.targets')" />
<Import Project="..\..\..\Project.FLY.Thick.Normal\packages\Fody.3.3.2\build\Fody.targets" Condition="Exists('..\..\..\Project.FLY.Thick.Normal\packages\Fody.3.3.2\build\Fody.targets')" />
</Project>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="EntityFramework" version="6.2.0" targetFramework="net40" />
<package id="Fody" version="3.2.13" targetFramework="net40" developmentDependency="true" />
<package id="Newtonsoft.Json" version="12.0.1" targetFramework="net40" />
<package id="PropertyChanged2.Fody" version="2.5.13" targetFramework="net40" />
<package id="System.Data.SQLite" version="1.0.109.2" targetFramework="net40" />
<package id="System.Data.SQLite.Core" version="1.0.109.2" targetFramework="net40" />
<package id="System.Data.SQLite.EF6" version="1.0.109.0" targetFramework="net40" />
<package id="System.Data.SQLite.Linq" version="1.0.109.0" targetFramework="net40" />
<package id="EntityFramework" version="6.2.0" targetFramework="net462" />
<package id="Fody" version="3.3.2" targetFramework="net462" developmentDependency="true" />
<package id="Newtonsoft.Json" version="12.0.1" targetFramework="net462" />
<package id="PropertyChanged.Fody" version="2.6.0" targetFramework="net462" />
<package id="System.Data.SQLite" version="1.0.109.2" targetFramework="net462" />
<package id="System.Data.SQLite.Core" version="1.0.109.2" targetFramework="net462" />
<package id="System.Data.SQLite.EF6" version="1.0.109.0" targetFramework="net462" />
<package id="System.Data.SQLite.Linq" version="1.0.109.0" targetFramework="net462" />
</packages>
\ No newline at end of file
......@@ -134,9 +134,7 @@ namespace FLY.Thick.Base.Server
if (v > 0)
{
RCnt++;
double p = RCnt * MmOfR / 1000.0 + BaseFilmPosition;
if (FilmPosition < p)
FilmPosition = p;
FilmPosition = RCnt * MmOfR / 1000.0 + BaseFilmPosition;
}
}
......@@ -182,7 +180,7 @@ namespace FLY.Thick.Base.Server
double p1 = RCnt * MmOfR / 1000.0;
double p2 = (dt - dtRound).TotalMinutes * FilmVelocity;
if (p2 <= MmOfR / 1000.0)
if (p2 > MmOfR / 1000.0)
p2 = MmOfR / 1000.0;
p1 += p2;
if (FilmPosition < p1)
......@@ -210,11 +208,10 @@ namespace FLY.Thick.Base.Server
}
else
{
FilmPosition = 0;
RCnt = 0;
}
BaseFilmPosition = filmPosition;
FilmPosition = BaseFilmPosition;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment