/// <summary> /// Initializes the directories based on the executable file directory and common application data directory. /// </summary> /// <remarks>Common application data directory should be writable.</remarks> public virtual void Init(string exeDir, string commonDataDir) { if (string.IsNullOrEmpty(exeDir)) { throw new ArgumentException("Executable directory must not be empty.", nameof(exeDir)); } string dataDir = string.IsNullOrEmpty(commonDataDir) ? exeDir : Path.Combine(commonDataDir, new DirectoryInfo(exeDir).Name); ExeDir = ScadaUtils.NormalDir(exeDir); InstanceDir = ScadaUtils.NormalDir(Path.GetFullPath(Path.Combine(exeDir, ".."))); CmdDir = AppendDir(dataDir, "Cmd"); ConfigDir = AppendDir(dataDir, "Config"); LangDir = AppendDir(exeDir, "Lang"); LogDir = AppendDir(dataDir, "Log"); StorageDir = AppendDir(dataDir, "Storage"); TempDir = AppendDir(dataDir, "Temp"); }
/// <summary> /// Получить имя файла словаря для заданной культуры /// </summary> public static string GetFileName(string directory, string fileNamePrefix, string cultureName) { return(ScadaUtils.NormalDir(directory) + fileNamePrefix + (string.IsNullOrEmpty(cultureName) ? "" : "." + cultureName) + ".xml"); }
/// <summary> /// Appends the child directory to the parent directory. /// </summary> protected virtual string AppendDir(string parentDir, string childDir) { return(ScadaUtils.NormalDir(Path.Combine(parentDir, Lowercase ? childDir.ToLowerInvariant() : childDir))); }