private void copyMaps()
        {
            if (!File.Exists(_paths.MobileDB))
            {
                return;
            }

            string mobileMapsPath = Path.GetDirectoryName(_paths.MobileDB) + "\\maps";
            string localMapsPath  = ApplicationPathManager.getFolderPath(ApplicationFolder.Maps);

            if (!Directory.Exists(mobileMapsPath))
            {
                Directory.CreateDirectory(mobileMapsPath);
            }
            if (Directory.Exists(localMapsPath) && Directory.Exists(mobileMapsPath))
            {
                foreach (var file in Directory.GetFiles(localMapsPath, "*.png"))
                {
                    var xmlFile  = file.Replace(".png", ".xml");
                    var pngLPath = String.Format("{0}\\{1}", localMapsPath, file);
                    var pngMPath = String.Format("{0}\\{1}", mobileMapsPath, file);
                    var xmlLPath = String.Format("{0}\\{1}", localMapsPath, xmlFile);
                    var xmlMPath = String.Format("{0}\\{1}", mobileMapsPath, xmlFile);
                    if (File.Exists(xmlLPath))
                    {
                        copyFile(pngLPath, pngMPath);
                        copyFile(xmlLPath, xmlMPath);
                    }
                }
            }
        }
        private static IOrderedEnumerable <string> sessionListAsc()
        {
            var sessions = Directory.GetDirectories(ApplicationPathManager.getFolderPath(ApplicationFolder.Sessions));

            return(from dir in sessions
                   orderby dir ascending
                   select dir);
        }
Exemplo n.º 3
0
        private string localPath()
        {
            StringBuilder builder = new StringBuilder();

            builder.Append(ApplicationPathManager.getFolderPath(ApplicationFolder.Maps));
            builder.Append(@"\");
            builder.Append(_mapMetadata.Name);

            return(builder.ToString());
        }
        static LogManager()
        {
            log4net.Config.XmlConfigurator.Configure(new FileInfo(ApplicationPathManager.getFolderPath(ApplicationFolder.Application) + "\\log4net.config"));

            var globalAppender = getFileAppender("GlobalLogFileAppender");

            globalAppender.File = ApplicationPathManager.getFolderPath(ApplicationFolder.ApplicationData) + @"\log.txt";
            globalAppender.ActivateOptions();

            Global = log4net.LogManager.GetLogger("GlobalLog");
            Global.Info("Logging initialized");
        }
Exemplo n.º 5
0
            private void configureUploadANSL()
            {
                var syncList = new ObjectSyncList();

                foreach (Type t in uploadTypes())
                {
                    syncList.Load(t, _mobileDB);
                }
                syncList.initialize(LookupSynchronizationInformation.getFieldDataList(), LookupSynchronizationInformation.getReflexiveReferences(), LookupSynchronizationInformation.getReflexiveIDFields());
                var snsb = new SNSBPictureTransfer(_userNo, _projectID, _mobileDB, ApplicationPathManager.getFolderPath(ApplicationFolder.Pictures));

                _ansl = new AnalyzeSyncObjectList(syncList, _mobileDB, _repository, _sync, snsb);
            }
        private void copyPictures()
        {
            if (!File.Exists(_paths.MobileDB))
            {
                return;
            }

            string mobilePictureDirectory = Path.GetDirectoryName(_paths.MobileDB) + "\\pictures";

            if (Directory.Exists(mobilePictureDirectory))
            {
                var pictureDir = ApplicationPathManager.getFolderPath(ApplicationFolder.Pictures);
                foreach (var picture in Directory.GetFiles(mobilePictureDirectory))
                {
                    copyFile(picture, pictureDir + "\\" + Path.GetFileName(picture));
                }
            }
        }
        public void startSession()
        {
            if (State == SessionState.Uninitialized)
            {
                MessengerInstance.Send <StatusNotification>("Services_Session_NewSession");
                //Example: 2010-10-08 2102
                var currentSession = DateTime.Now.ToString("yyyy-MM-dd HHmm");
                _currentSessionFolder = ApplicationPathManager.getFolderPath(ApplicationFolder.Sessions) + @"\" + currentSession;
                Directory.CreateDirectory(_currentSessionFolder);
                updateLogger();
                _Log.InfoFormat("Session started! [{0}]", currentSession);

                cleanUpOldSessions();

                State = SessionState.New;
            }
            else
            {
                _Log.Error("Cannot open new Session, while old one is still open");
            }
        }
 public UserOptionsService()
 {
     _optionsPath = ApplicationPathManager.getFolderPath(ApplicationFolder.ApplicationData) + '\\' + ApplicationPathManager.USEROPTIONS_FILE;
     _serializer  = new XmlSerializer(typeof(DiversityUserOptions));
     _Log         = log4net.LogManager.GetLogger(typeof(UserOptionsService));
 }