Skip to content

Commit 47da7fd

Browse files
authored
Merge pull request #31 from RapidScada/develop
Merge Develop to Master
2 parents 3f9d0b1 + 8c78652 commit 47da7fd

File tree

284 files changed

+4530
-762
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

284 files changed

+4530
-762
lines changed

Base/data/ScadaBase_4.2_en.sdf

0 Bytes
Binary file not shown.

Base/data/ScadaBase_4.2_ru.sdf

0 Bytes
Binary file not shown.

Report/RepBuilder/ExcelRepBuilder.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1505,7 +1505,8 @@ protected bool FindDirective(string s, string attrName, out string attrVal, out
15051505
/// </summary>
15061506
protected void SetNodeTextWithBreak(XmlNode xmlNode, string text, string textBreak)
15071507
{
1508-
if (text == null) text = "";
1508+
if (text == null)
1509+
text = "";
15091510
xmlNode.InnerText = text.Replace(textBreak, Break);
15101511
textBroken = true;
15111512
}

ScadaComm/OpenKPs/AddressBook/LibPhrases.cs renamed to ScadaComm/OpenKPs/AddressBook/AbPhrases.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,22 +16,22 @@
1616
*
1717
* Product : Rapid SCADA
1818
* Module : AddressBook
19-
* Summary : The phrases used by the library
19+
* Summary : The phrases used by the address book
2020
*
2121
* Author : Mikhail Shiryaev
2222
* Created : 2016
2323
* Modified : 2016
2424
*/
2525

26-
namespace Scada.Comm.Devices.AddressBook
26+
namespace Scada.Comm.Devices.AB
2727
{
2828
/// <summary>
29-
/// The phrases used by the library
30-
/// <para>Фразы, используемые библиотекой</para>
29+
/// The phrases used by the address book
30+
/// <para>Фразы, используемые адресной книгой</para>
3131
/// </summary>
32-
internal static class LibPhrases
32+
internal static class AbPhrases
3333
{
34-
static LibPhrases()
34+
static AbPhrases()
3535
{
3636
SetToDefault();
3737
}
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
/*
2+
* Copyright 2016 Mikhail Shiryaev
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*
16+
*
17+
* Product : Rapid SCADA
18+
* Module : AddressBook
19+
* Summary : The class contains utility methods for the address book
20+
*
21+
* Author : Mikhail Shiryaev
22+
* Created : 2016
23+
* Modified : 2016
24+
*/
25+
26+
using System.Collections.Generic;
27+
using System.IO;
28+
using Utils;
29+
30+
namespace Scada.Comm.Devices.AB
31+
{
32+
/// <summary>
33+
/// The class contains utility methods for the address book
34+
/// <para>Класс, содержащий вспомогательные методы для адресной книги</para>
35+
/// </summary>
36+
public static class AbUtils
37+
{
38+
/// <summary>
39+
/// Загрузить адресную книгу из файла
40+
/// </summary>
41+
public static bool LoadAddressBook(string configDir, Log.WriteLineDelegate writeToLog,
42+
out AddressBook addressBook)
43+
{
44+
addressBook = new AddressBook();
45+
46+
string fileName = configDir + AddressBook.DefFileName;
47+
if (File.Exists(fileName))
48+
{
49+
writeToLog(Localization.UseRussian ?
50+
"Загрузка адресной книги" :
51+
"Loading address book");
52+
string errMsg;
53+
54+
if (addressBook.Load(fileName, out errMsg))
55+
{
56+
return true;
57+
}
58+
else
59+
{
60+
writeToLog(errMsg);
61+
return false;
62+
}
63+
}
64+
else
65+
{
66+
writeToLog(Localization.UseRussian ?
67+
"Адресная книга отсутствует" :
68+
"Address book is missing");
69+
return false;
70+
}
71+
}
72+
73+
/// <summary>
74+
/// Загрузить адресную книгу из файла или получить её из общих свойств линии связи Коммуникатора
75+
/// </summary>
76+
public static AddressBook GetAddressBook(string configDir, SortedList<string, object> commonProps,
77+
Log.WriteLineDelegate writeToLog)
78+
{
79+
AddressBook addressBook;
80+
object addrBookObj;
81+
82+
if (commonProps.TryGetValue("AddressBook", out addrBookObj))
83+
{
84+
addressBook = addrBookObj as AddressBook;
85+
}
86+
else
87+
{
88+
LoadAddressBook(configDir, writeToLog, out addressBook);
89+
commonProps.Add("AddressBook", addressBook);
90+
}
91+
92+
return addressBook;
93+
}
94+
}
95+
}

ScadaComm/OpenKPs/AddressBook/AddressBook.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
using System.Collections.Generic;
2929
using System.Xml;
3030

31-
namespace Scada.Comm.Devices.AddressBook
31+
namespace Scada.Comm.Devices.AB
3232
{
3333
/// <summary>
3434
/// Address book
@@ -460,7 +460,7 @@ public bool Load(string fileName, out string errMsg)
460460
}
461461
catch (Exception ex)
462462
{
463-
errMsg = LibPhrases.LoadAddressBookError + ":" + Environment.NewLine + ex.Message;
463+
errMsg = AbPhrases.LoadAddressBookError + ":" + Environment.NewLine + ex.Message;
464464
return false;
465465
}
466466
}
@@ -509,7 +509,7 @@ public bool Save(string fileName, out string errMsg)
509509
}
510510
catch (Exception ex)
511511
{
512-
errMsg = LibPhrases.SaveAddressBookError + ":" + Environment.NewLine + ex.Message;
512+
errMsg = AbPhrases.SaveAddressBookError + ":" + Environment.NewLine + ex.Message;
513513
return false;
514514
}
515515
}

ScadaComm/OpenKPs/AddressBook/AddressBook.csproj

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<ProjectGuid>{CB3BC544-51CB-4A40-8CF0-4B769C01F996}</ProjectGuid>
88
<OutputType>Library</OutputType>
99
<AppDesignerFolder>Properties</AppDesignerFolder>
10-
<RootNamespace>Scada.Comm.Devices.AddressBook</RootNamespace>
10+
<RootNamespace>Scada.Comm.Devices.AB</RootNamespace>
1111
<AssemblyName>AddressBook</AssemblyName>
1212
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
1313
<FileAlignment>512</FileAlignment>
@@ -29,8 +29,13 @@
2929
<DefineConstants>TRACE</DefineConstants>
3030
<ErrorReport>prompt</ErrorReport>
3131
<WarningLevel>4</WarningLevel>
32+
<DocumentationFile>bin\Release\AddressBook.XML</DocumentationFile>
3233
</PropertyGroup>
3334
<ItemGroup>
35+
<Reference Include="Log, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
36+
<SpecificVersion>False</SpecificVersion>
37+
<HintPath>..\..\..\Log\bin\Release\Log.dll</HintPath>
38+
</Reference>
3439
<Reference Include="ScadaCommCommon, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
3540
<SpecificVersion>False</SpecificVersion>
3641
<HintPath>..\..\ScadaCommCommon\bin\Release\ScadaCommCommon.dll</HintPath>
@@ -45,14 +50,15 @@
4550
<Reference Include="System.Xml" />
4651
</ItemGroup>
4752
<ItemGroup>
53+
<Compile Include="AbUtils.cs" />
4854
<Compile Include="AddressBook.cs" />
4955
<Compile Include="FrmAddressBook.cs">
5056
<SubType>Form</SubType>
5157
</Compile>
5258
<Compile Include="FrmAddressBook.designer.cs">
5359
<DependentUpon>FrmAddressBook.cs</DependentUpon>
5460
</Compile>
55-
<Compile Include="LibPhrases.cs" />
61+
<Compile Include="AbPhrases.cs" />
5662
<Compile Include="Properties\AssemblyInfo.cs" />
5763
<Compile Include="Properties\Resources.Designer.cs">
5864
<AutoGen>True</AutoGen>

ScadaComm/OpenKPs/AddressBook/FrmAddressBook.cs

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
using System.Net.Mail;
3232
using System.Windows.Forms;
3333

34-
namespace Scada.Comm.Devices.AddressBook
34+
namespace Scada.Comm.Devices.AB
3535
{
3636
/// <summary>
3737
/// Address book form
@@ -231,9 +231,9 @@ private void FrmAddressBook_Load(object sender, EventArgs e)
231231
{
232232
if (Localization.LoadDictionaries(appDirs.LangDir, "AddressBook", out errMsg))
233233
{
234-
Translator.TranslateForm(this, "Scada.Comm.Devices.AddressBook.FrmAddressBook");
235-
LibPhrases.Init();
236-
rootNode.Text = LibPhrases.AddressBookNode;
234+
Translator.TranslateForm(this, "Scada.Comm.Devices.AB.FrmAddressBook");
235+
AbPhrases.Init();
236+
rootNode.Text = AbPhrases.AddressBookNode;
237237
}
238238
else
239239
{
@@ -258,7 +258,7 @@ private void FrmAddressBook_FormClosing(object sender, FormClosingEventArgs e)
258258
{
259259
if (Modified)
260260
{
261-
DialogResult result = MessageBox.Show(LibPhrases.SavePhonebookConfirm,
261+
DialogResult result = MessageBox.Show(AbPhrases.SavePhonebookConfirm,
262262
CommonPhrases.QuestionCaption, MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
263263

264264
switch (result)
@@ -284,7 +284,7 @@ private void FrmAddressBook_FormClosing(object sender, FormClosingEventArgs e)
284284
private void btnAddContactGroup_Click(object sender, EventArgs e)
285285
{
286286
// добавление группы контактов
287-
AddressBook.ContactGroup contactGroup = new AddressBook.ContactGroup(LibPhrases.NewContactGroup);
287+
AddressBook.ContactGroup contactGroup = new AddressBook.ContactGroup(AbPhrases.NewContactGroup);
288288
TreeNode contactGroupNode = CreateContactGroupNode(contactGroup);
289289

290290
treeView.Add(rootNode, contactGroupNode);
@@ -298,7 +298,7 @@ private void btnAddContact_Click(object sender, EventArgs e)
298298
TreeNode contactGroupNode = treeView.FindClosest(typeof(AddressBook.ContactGroup));
299299
if (contactGroupNode != null)
300300
{
301-
AddressBook.Contact contact = new AddressBook.Contact(LibPhrases.NewContact);
301+
AddressBook.Contact contact = new AddressBook.Contact(AbPhrases.NewContact);
302302
TreeNode contactNode = CreateContactNode(contact);
303303

304304
treeView.Add(contactGroupNode, contactNode);
@@ -313,7 +313,7 @@ private void btnAddPhoneNumber_Click(object sender, EventArgs e)
313313
TreeNode contactNode = treeView.FindClosest(typeof(AddressBook.Contact));
314314
if (contactNode != null)
315315
{
316-
AddressBook.PhoneNumber phoneNumber = new AddressBook.PhoneNumber(LibPhrases.NewPhoneNumber);
316+
AddressBook.PhoneNumber phoneNumber = new AddressBook.PhoneNumber(AbPhrases.NewPhoneNumber);
317317
TreeNode phoneNumberNode = CreatePhoneNumberNode(phoneNumber);
318318

319319
treeView.Add(contactNode, phoneNumberNode);
@@ -328,7 +328,7 @@ private void btnAddEmail_Click(object sender, EventArgs e)
328328
TreeNode contactNode = treeView.FindClosest(typeof(AddressBook.Contact));
329329
if (contactNode != null)
330330
{
331-
AddressBook.Email email = new AddressBook.Email(LibPhrases.NewEmail);
331+
AddressBook.Email email = new AddressBook.Email(AbPhrases.NewEmail);
332332
TreeNode emailNode = CreateEmailNode(email);
333333

334334
treeView.Add(contactNode, emailNode);
@@ -400,7 +400,7 @@ private void treeView_AfterLabelEdit(object sender, NodeLabelEditEventArgs e)
400400
if (newVal == "")
401401
{
402402
e.CancelEdit = true;
403-
ScadaUiUtils.ShowError(LibPhrases.EmptyValueNotAllowed);
403+
ScadaUiUtils.ShowError(AbPhrases.EmptyValueNotAllowed);
404404
e.Node.BeginEdit();
405405
}
406406
else if (!oldVal.Equals(newVal, StringComparison.Ordinal))
@@ -420,14 +420,14 @@ private void treeView_AfterLabelEdit(object sender, NodeLabelEditEventArgs e)
420420
newInd = FindInsertIndex<AddressBook.ContactGroup>(
421421
(List<AddressBook.ContactGroup>)list, curInd, out duplicated);
422422
if (duplicated)
423-
errMsg = LibPhrases.ContactGroupExists;
423+
errMsg = AbPhrases.ContactGroupExists;
424424
}
425425
else if (bookItem is AddressBook.Contact)
426426
{
427427
newInd = FindInsertIndex<AddressBook.Contact>(
428428
(List<AddressBook.Contact>)list, curInd, out duplicated);
429429
if (duplicated)
430-
errMsg = LibPhrases.ContactExists;
430+
errMsg = AbPhrases.ContactExists;
431431
}
432432
else if (bookItem is AddressBook.ContactRecord)
433433
{
@@ -437,14 +437,14 @@ private void treeView_AfterLabelEdit(object sender, NodeLabelEditEventArgs e)
437437
if (bookItem is AddressBook.PhoneNumber)
438438
{
439439
if (duplicated)
440-
errMsg = LibPhrases.PhoneNumberExists;
440+
errMsg = AbPhrases.PhoneNumberExists;
441441
}
442442
else
443443
{
444444
if (duplicated)
445-
errMsg = LibPhrases.EmailExists;
445+
errMsg = AbPhrases.EmailExists;
446446
if (!CheckEmail(newVal))
447-
errMsg = LibPhrases.IncorrectEmail;
447+
errMsg = AbPhrases.IncorrectEmail;
448448
}
449449
}
450450

ScadaComm/OpenKPs/AddressBook/FrmAddressBook.designer.cs

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ScadaComm/OpenKPs/AddressBook/Lang/AddressBook.en-GB.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
<?xml version="1.0" encoding="utf-8" ?>
22
<AddressBookDictionaries>
3-
<Dictionary key="Scada.Comm.Devices.AddressBook">
3+
<Dictionary key="Scada.Comm.Devices.AB">
44
<Phrase key="LoadAddressBookError">Error loading address book</Phrase>
55
<Phrase key="SaveAddressBookError">Error saving address book</Phrase>
66
</Dictionary>
7-
<Dictionary key="Scada.Comm.Devices.AddressBook.FrmAddressBook">
7+
<Dictionary key="Scada.Comm.Devices.AB.FrmAddressBook">
88
<Phrase key="this">Address Book</Phrase>
99
<Phrase key="btnAddContactGroup.ToolTip">Add contact group</Phrase>
1010
<Phrase key="btnAddContact.ToolTip">Add contact</Phrase>

ScadaComm/OpenKPs/AddressBook/Properties/Resources.Designer.cs

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ScadaComm/OpenKPs/KpEmail/FrmConfig.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
* Modified : 2016
2424
*/
2525

26-
using Scada.Comm.Devices.AddressBook;
26+
using Scada.Comm.Devices.AB;
2727
using Scada.UI;
2828
using System;
2929
using System.IO;

0 commit comments

Comments
 (0)