-
Notifications
You must be signed in to change notification settings - Fork 311
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #31 from RapidScada/develop
Merge Develop to Master
- Loading branch information
Showing
284 changed files
with
4,530 additions
and
762 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
/* | ||
* Copyright 2016 Mikhail Shiryaev | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
* | ||
* Product : Rapid SCADA | ||
* Module : AddressBook | ||
* Summary : The class contains utility methods for the address book | ||
* | ||
* Author : Mikhail Shiryaev | ||
* Created : 2016 | ||
* Modified : 2016 | ||
*/ | ||
|
||
using System.Collections.Generic; | ||
using System.IO; | ||
using Utils; | ||
|
||
namespace Scada.Comm.Devices.AB | ||
{ | ||
/// <summary> | ||
/// The class contains utility methods for the address book | ||
/// <para>Класс, содержащий вспомогательные методы для адресной книги</para> | ||
/// </summary> | ||
public static class AbUtils | ||
{ | ||
/// <summary> | ||
/// Загрузить адресную книгу из файла | ||
/// </summary> | ||
public static bool LoadAddressBook(string configDir, Log.WriteLineDelegate writeToLog, | ||
out AddressBook addressBook) | ||
{ | ||
addressBook = new AddressBook(); | ||
|
||
string fileName = configDir + AddressBook.DefFileName; | ||
if (File.Exists(fileName)) | ||
{ | ||
writeToLog(Localization.UseRussian ? | ||
"Загрузка адресной книги" : | ||
"Loading address book"); | ||
string errMsg; | ||
|
||
if (addressBook.Load(fileName, out errMsg)) | ||
{ | ||
return true; | ||
} | ||
else | ||
{ | ||
writeToLog(errMsg); | ||
return false; | ||
} | ||
} | ||
else | ||
{ | ||
writeToLog(Localization.UseRussian ? | ||
"Адресная книга отсутствует" : | ||
"Address book is missing"); | ||
return false; | ||
} | ||
} | ||
|
||
/// <summary> | ||
/// Загрузить адресную книгу из файла или получить её из общих свойств линии связи Коммуникатора | ||
/// </summary> | ||
public static AddressBook GetAddressBook(string configDir, SortedList<string, object> commonProps, | ||
Log.WriteLineDelegate writeToLog) | ||
{ | ||
AddressBook addressBook; | ||
object addrBookObj; | ||
|
||
if (commonProps.TryGetValue("AddressBook", out addrBookObj)) | ||
{ | ||
addressBook = addrBookObj as AddressBook; | ||
} | ||
else | ||
{ | ||
LoadAddressBook(configDir, writeToLog, out addressBook); | ||
commonProps.Add("AddressBook", addressBook); | ||
} | ||
|
||
return addressBook; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
ScadaComm/OpenKPs/AddressBook/Properties/Resources.Designer.cs
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.