コード例 #1
0
ファイル: IOHelper.cs プロジェクト: mkalinov/DMM365
        /// <summary>
        /// Obsolete
        /// Returns abolute path to project folder selected by folder param.
        /// Appends directory name or file name with/without extention
        /// </summary>
        /// <param name="settings"></param>
        /// <param name="folder"></param>
        /// <returns></returns>
        internal static string getProjectSubfolderPathOld(AllSettings settings, subFolders folder, bool appendFileName = true, string extensionAttach = "")
        {
            string dir = Path.Combine(settings.ProjectPath, folder.ToString());

            if (Directory.Exists(dir))
            {
                string fileName = folder.ToString();
                if (GlobalHelper.isValidString(fileName) && appendFileName)
                {
                    return(Path.Combine(dir, fileName + extensionAttach));
                }
                else
                {
                    return(dir);
                }
            }

            return(string.Empty);
        }
コード例 #2
0
ファイル: IOHelper.cs プロジェクト: mkalinov/DMM365
        internal static string getProjectSubfolderPath(AllSettings settings, subFolders folder, fileName extentionSelector, string fileNameAndExt = "")
        {
            string result = string.Empty;
            string dir    = Path.Combine(settings.ProjectPath, folder.ToString());

            if (Directory.Exists(dir))
            {
                string fileName = folder.ToString();

                switch (extentionSelector.ToString())
                {
                case "pathToFolderFromProjectRoot": result = dir; break;

                case "appendFolderNameNoExt": result = Path.Combine(dir, fileName); break;

                case "appendFolderNameDotXml": result = Path.Combine(dir, fileName + ".xml"); break;

                case "appendFolderNameDotZip": result = Path.Combine(dir, fileName + ".zip"); break;

                case "appendfolderNameDotPSscript": result = Path.Combine(dir, fileName + ".ps1"); break;

                case "dataFileXml": result = Path.Combine(dir, "data.xml"); break;

                case "dataSchemaXml": result = Path.Combine(dir, "data_schema.xml"); break;

                case "contentTypesXml": result = Path.Combine(dir, @"[Content_Types].xml"); break;

                case "log": result = Path.Combine(dir, "Log_" + DateTime.Now.ToLocalTime() + ".txt"); break;

                default:
                    if (GlobalHelper.isValidString(fileNameAndExt))
                    {
                        result = Path.Combine(dir, fileNameAndExt);
                    }
                    break;
                }
            }
            return(result);
        }