не удачная синхронизация
This commit is contained in:
parent
bff2ecb330
commit
7676d47374
|
|
@ -48,7 +48,7 @@ namespace Reseter2
|
|||
this.Close();
|
||||
}
|
||||
|
||||
|
||||
|
||||
InitializeComponent();
|
||||
checkControl1.updateCheck += CheckControl1_updateCheck;
|
||||
flowLayoutPanel1.AutoScrollMinSize = new Size(0, 683) ;
|
||||
|
|
@ -60,6 +60,7 @@ namespace Reseter2
|
|||
|
||||
treeView1.Nodes.AddRange(WordsList.ListNodes());
|
||||
|
||||
treeView1.SelectedNode.
|
||||
//treeView1.MouseCaptureChanged.;
|
||||
tabControl1.SelectedIndex = 1;
|
||||
|
||||
|
|
|
|||
|
|
@ -75,6 +75,7 @@
|
|||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="reseter.cs" />
|
||||
<Compile Include="ReseteTask.cs" />
|
||||
<Compile Include="Setting\SettingWords.cs" />
|
||||
<Compile Include="Shutdown.cs" />
|
||||
<Compile Include="StatusCanceled.cs" />
|
||||
<Compile Include="StatusReboot.cs" />
|
||||
|
|
@ -92,6 +93,7 @@
|
|||
<Compile Include="TewTreeView.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Setting\SGlobalSetting.cs" />
|
||||
<Compile Include="Words\BilderWords.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,76 @@
|
|||
using Reseter2.Words;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.Serialization.Formatters.Binary;
|
||||
using System.Security.Policy;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Reseter2.Setting
|
||||
{
|
||||
[Serializable]
|
||||
internal static class SGlobalSetting
|
||||
{
|
||||
public static SettingHistory settingHistory
|
||||
public static SettingWords settingWords = new SettingWords();
|
||||
|
||||
public static void LoadSetting()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public static bool Load(string path)
|
||||
{
|
||||
BinaryFormatter binaryFormatter = new BinaryFormatter();
|
||||
FileStream file = null;
|
||||
try
|
||||
{
|
||||
file = new FileStream(path, FileMode.Open);
|
||||
WordsList.MainCategory = (WordsCategory)binaryFormatter.Deserialize(file);
|
||||
file.Close();
|
||||
file.Dispose();
|
||||
return true;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static object Clone(object input)
|
||||
{
|
||||
object output;
|
||||
BinaryFormatter binaryFormatter = new BinaryFormatter();
|
||||
MemoryStream Memory = new MemoryStream();
|
||||
binaryFormatter.Serialize(Memory, input);
|
||||
Memory.Position = 0;
|
||||
if (input is WordsCategory) settingWords.HashSumm(Memory);
|
||||
Memory.Position = 0;
|
||||
output = binaryFormatter.Deserialize(Memory);
|
||||
Memory.Dispose();
|
||||
Memory.Close();
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
public static WordsCategory Clone(WordsCategory input)
|
||||
{
|
||||
return (WordsCategory)Clone((object)input);
|
||||
}
|
||||
|
||||
public static IComp Clone(IComp input)
|
||||
{
|
||||
return (IComp)Clone((object)input);
|
||||
}
|
||||
|
||||
public static void Save()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
using Reseter2.Words;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.Serialization.Formatters.Binary;
|
||||
using System.Security.Cryptography;
|
||||
using System.Security.Policy;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using static System.Net.WebRequestMethods;
|
||||
|
||||
namespace Reseter2.Setting
|
||||
{
|
||||
[Serializable]
|
||||
internal class SettingWords
|
||||
{
|
||||
public string PathBase { get; set; }
|
||||
[NonSerialized]
|
||||
private MD5 Hash = MD5.Create();
|
||||
[NonSerialized]
|
||||
private byte[] hash;
|
||||
public SettingWords()
|
||||
{
|
||||
PathBase = "base.dat";
|
||||
}
|
||||
|
||||
public SettingWords(string pathBase)
|
||||
{
|
||||
PathBase = pathBase;
|
||||
}
|
||||
|
||||
public void HashSumm(MemoryStream memory)
|
||||
{
|
||||
hash = Hash.ComputeHash(memory);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -1,4 +1,5 @@
|
|||
using Reseter2.History;
|
||||
using Reseter2.Setting;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
|
|
@ -36,39 +37,16 @@ namespace Reseter2.Words
|
|||
public BilderWords(IComp comp)
|
||||
{
|
||||
LoadForm();
|
||||
BinaryFormatter binaryFormatter = new BinaryFormatter();
|
||||
MemoryStream memory = new MemoryStream();
|
||||
binaryFormatter.Serialize(memory, comp);
|
||||
memory.Position = 0;
|
||||
CompId compId = (CompId)binaryFormatter.Deserialize(memory);
|
||||
memory.Close();
|
||||
memory.Dispose();
|
||||
//TreeNode treeNode = new TreeNode();
|
||||
WordsComp item = new WordsComp(compId);
|
||||
WordsList.AddItem(item, ChangeCategory);
|
||||
|
||||
|
||||
CompId compId = (CompId)SGlobalSetting.Clone(comp);
|
||||
WordsComp item = new WordsComp(compId);
|
||||
WordsList.AddItem(item, ChangeCategory);
|
||||
treeView1.Nodes.AddRange(WordsList.ListNodes(ChangeCategory));
|
||||
//treeNode.ImageIndex = 1;
|
||||
//treeNode.Text = item.NameNode();
|
||||
//treeNode.Tag = item;
|
||||
//treeView1.Nodes.Add(treeNode);
|
||||
}
|
||||
|
||||
private void LoadForm()
|
||||
{
|
||||
BinaryFormatter binaryFormatter = new BinaryFormatter();
|
||||
MemoryStream Memory = new MemoryStream();
|
||||
binaryFormatter.Serialize(Memory, WordsList.MainCategory);
|
||||
Memory.Position = 0;
|
||||
hash = Hash.ComputeHash(Memory);
|
||||
Memory.Position = 0;
|
||||
ChangeCategory = (WordsCategory)binaryFormatter.Deserialize(Memory);
|
||||
Memory.Dispose();
|
||||
Memory.Close();
|
||||
|
||||
ChangeCategory = SGlobalSetting.Clone(WordsList.MainCategory);
|
||||
InitializeComponent();
|
||||
|
||||
cb_create.Items.Add("Категория");
|
||||
cb_create.Items.Add("Компьютер");
|
||||
cb_create.SelectedIndex = 0;
|
||||
|
|
@ -76,9 +54,6 @@ namespace Reseter2.Words
|
|||
treeView1.DragEnter += new DragEventHandler(TreeView1_DragEnter);
|
||||
treeView1.DragOver += new DragEventHandler(TreeView1_DragOver);
|
||||
treeView1.DragDrop += new DragEventHandler(TreeView1_DragDrop);
|
||||
|
||||
|
||||
this.DialogResult = DialogResult.Abort;
|
||||
}
|
||||
private void TreeView1_ItemDrag(object sender, ItemDragEventArgs e)
|
||||
{
|
||||
|
|
@ -87,7 +62,6 @@ namespace Reseter2.Words
|
|||
{
|
||||
DoDragDrop(e.Item, DragDropEffects.Move);
|
||||
}
|
||||
//throw new NotImplementedException();
|
||||
}
|
||||
|
||||
private void TreeView1_DragEnter(object sender, DragEventArgs e)
|
||||
|
|
|
|||
Loading…
Reference in New Issue