-
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b1cdcf1
commit 5c25403
Showing
11 changed files
with
258 additions
and
47 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
[Settings] | ||
Path=default | ||
ResetRibbon=false |
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,58 @@ | ||
using Relay.Utilities; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using System.Linq; | ||
using System.Reflection; | ||
using System.Runtime.InteropServices; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace Relay.Classes | ||
{ | ||
internal class RelayIniFile | ||
{ | ||
string Path; | ||
bool ResetRibbon; | ||
string EXE = Assembly.GetExecutingAssembly().GetName().Name; | ||
|
||
[DllImport("kernel32", CharSet = CharSet.Unicode)] | ||
static extern long WritePrivateProfileString(string Section, string Key, string Value, string FilePath); | ||
|
||
[DllImport("kernel32", CharSet = CharSet.Unicode)] | ||
static extern int GetPrivateProfileString(string Section, string Key, string Default, StringBuilder RetVal, int Size, string FilePath); | ||
|
||
public RelayIniFile() | ||
{ | ||
Path = new FileInfo(Globals.ExecutingPath + "//RelaySettings.ini").FullName; | ||
} | ||
|
||
public string Read(string Key, string Section = null) | ||
{ | ||
var RetVal = new StringBuilder(255); | ||
GetPrivateProfileString(Section ?? EXE, Key, "", RetVal, 255, Path); | ||
return RetVal.ToString(); | ||
} | ||
|
||
public void Write(string Key, string Value, string Section = null) | ||
{ | ||
WritePrivateProfileString(Section ?? EXE, Key, Value, Path); | ||
} | ||
|
||
public void DeleteKey(string Key, string Section = null) | ||
{ | ||
Write(Key, null, Section ?? EXE); | ||
} | ||
|
||
public void DeleteSection(string Section = null) | ||
{ | ||
Write(null, null, Section ?? EXE); | ||
} | ||
|
||
public bool KeyExists(string Key, string Section = null) | ||
{ | ||
return Read(Key, Section).Length > 0; | ||
} | ||
|
||
} | ||
} |
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
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 |
---|---|---|
@@ -1,24 +1,28 @@ | ||
using System; | ||
using System.IO; | ||
using System.Linq; | ||
using System.IO; | ||
using System.Reflection; | ||
|
||
namespace Relay.Utilities | ||
{ | ||
public partial class Globals | ||
{ | ||
public static readonly string Version = | ||
System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString(); | ||
public static string ExecutingPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); | ||
public static Assembly ExecutingAssembly = Assembly.GetExecutingAssembly(); | ||
public static readonly string Version = ExecutingAssembly.GetName().Version.ToString(); | ||
|
||
public static string ExecutingPath = Path.GetDirectoryName(ExecutingAssembly.Location); | ||
public static string BasePath { get; set; } = ExecutingPath; | ||
|
||
public static string UserTemp = Environment.GetEnvironmentVariable("TMP", EnvironmentVariableTarget.User); | ||
public static string RevitVersion { get; set; } | ||
public static Assembly ExecutingAssembly = Assembly.GetExecutingAssembly(); | ||
|
||
public static string[] EmbeddedLibraries = ExecutingAssembly.GetManifestResourceNames().Where(x => x.EndsWith(".dll")).ToArray(); | ||
public static string[] PotentialTabDirectories { get; set; } | ||
public static string RibbonTabName = "Relay"; | ||
public static string RelayGraphs = Path.Combine(Globals.ExecutingPath, RibbonTabName); | ||
|
||
public static string RibbonTabName { get; set; } = "Relay"; | ||
public static string RelayGraphs = Path.Combine(ExecutingPath, RibbonTabName); | ||
|
||
public static string CurrentGraphToRun { get; set; } = ""; | ||
|
||
public static bool ResetRibbonOnSync { get; set; } = false; | ||
|
||
} | ||
} |
Oops, something went wrong.