Пример #1
0
        [Admin] public static TM_FileStorage   set_Path_SiteData(this TM_FileStorage tmFileStorage)
        {
            UserRole.Admin.demand();
            var siteData_Config = tmFileStorage.tmServer().siteData_Config();

            if (siteData_Config.isNull() || siteData_Config.Name.notValid())
            {
                "[TM_FileStorage][set_Path_SiteData] set_Path_SiteData or its name was null or empty, so going to to use the default value of: {0}".debug(TMConsts.TM_SERVER_DEFAULT_NAME_USERDATA);
                siteData_Config = new TM_Server.Config()
                {
                    Name = TMConsts.TM_SERVER_DEFAULT_NAME_SITEDATA
                };
            }

            var xmlDatabasePath = tmFileStorage.path_XmlDatabase();                  // all files are relative to this path

            var siteDataPath = xmlDatabasePath.pathCombine(siteData_Config.Name);    // use the userData_Config.Name as the name of the folder to put UserData files

            siteDataPath.createDir();                                                // create if needed
            if (siteDataPath.dirExists())
            {
                tmFileStorage.Path_SiteData = siteDataPath.createDir();
                "[TM_FileStorage] [set_Path_SiteData] TMConfig.Current.UserDataPath: {0}".debug(siteDataPath);
            }
            else
            {
                tmFileStorage.Path_SiteData = null;
                "[TM_FileStorage] [set_Path_SiteData] failed to create the folder: {0}".error(siteDataPath);
            }

            return(tmFileStorage);
        }
Пример #2
0
        [Admin] public static TM_FileStorage   set_Path_UserData(this TM_FileStorage tmFileStorage)
        {
            admin.demand();
            var tmXmlDatabase = tmFileStorage.tmXmlDatabase();

            //var userData = tmFileStorage.userData();

            if (tmXmlDatabase.isNull())
            {
                return(tmFileStorage);
            }

            var userData_Config = tmFileStorage.tmServer().userData_Config();

            if (userData_Config.isNull() || userData_Config.Name.notValid())
            {
                "[TM_Xml_Database][set_Path_UserData] userData_Config or its name was null or empty, so going to to use the default value of: {0}".debug(TMConsts.TM_SERVER_DEFAULT_NAME_USERDATA);
                userData_Config = new TM_Server.Config()
                {
                    Name = TMConsts.TM_SERVER_DEFAULT_NAME_USERDATA
                };
            }

            var xmlDatabasePath = tmFileStorage.path_XmlDatabase();                 // all files are relative to this path

            var userDataPath = xmlDatabasePath.pathCombine(userData_Config.Name);   // use the userData_Config.Name as the name of the folder to put UserData files

            tmFileStorage.Path_UserData = userDataPath;                             // needed by Git Clone
            "TeamMentor.Git".assembly()
            .type("TM_UserData_Git_ExtensionMethods")
            .invokeStatic("setup_UserData_Git_Support", tmFileStorage);


            userDataPath.createDir();                                                // create if needed
            if (userDataPath.dirExists())
            {
                tmFileStorage.Path_UserData = userDataPath.createDir();
                "[TM_Xml_Database] [set_Path_UserData] TMConfig.Current.UserDataPath: {0}".debug(userDataPath);
            }
            else
            {
                tmFileStorage.Path_UserData = null;
                "[TM_Xml_Database] [set_Path_UserData] failed to create the folder: {0}".error(userDataPath);
            }

            return(tmFileStorage);
        }