1: using System;
2:
3: namespace Ia.Cl.Model.Db
4: {
5: ////////////////////////////////////////////////////////////////////////////
6:
7: /// <summary publish="true">
8: /// Text Database support class. This handles storing and retrieving text storage.
9: /// </summary>
10: /// <remarks>
11: /// Copyright © 2001-2020 Jasem Y. Al-Shamlan (info@ia.com.kw), Integrated Applications - Kuwait. All Rights Reserved.
12: ///
13: /// This library is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by
14: /// the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
15: ///
16: /// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
17: /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
18: ///
19: /// You should have received a copy of the GNU General Public License along with this library. If not, see http://www.gnu.org/licenses.
20: ///
21: /// Copyright notice: This notice may not be removed or altered from any source distribution.
22: /// </remarks>
23:
24: public static class Text
25: {
26: ////////////////////////////////////////////////////////////////////////////
27:
28: /// <summary>
29: ///
30: /// </summary>
31: public static bool Save(string name, string text)
32: {
33: bool b;
34: string r, filePath;
35:
36: filePath = Ia.Cl.Model.Default.AbsolutePath() + name;
37:
38: try
39: {
40: System.IO.File.WriteAllText(filePath + ".text.xml", text);
41:
42: b = true;
43: }
44: catch (Exception ex)
45: {
46: b = false;
47: #if DEBUG
48: r = "Error: " + ex.ToString();
49: #else
50: r = "Error: " + ex.Message;
51: #endif
52: }
53: finally
54: {
55: }
56:
57: return b;
58: }
59:
60: ////////////////////////////////////////////////////////////////////////////
61:
62: /// <summary>
63: ///
64: /// </summary>
65: public static string Read(string name)
66: {
67: string text, filePath;
68:
69: filePath = Ia.Cl.Model.Default.AbsolutePath() + name;
70:
71: text = System.IO.File.ReadAllText(filePath + ".text.xml");
72:
73: return text;
74: }
75:
76: ////////////////////////////////////////////////////////////////////////////
77: ////////////////////////////////////////////////////////////////////////////
78: }
79:
80: ////////////////////////////////////////////////////////////////////////////
81: ////////////////////////////////////////////////////////////////////////////
82: }
83: