예제 #1
0
        /**
         * Copies the map creator file and logFile from assets to a storage.
         */
        private async void PrepareMapCreatorFile()
        {
            string          mapResourcesDirPath = SKMaps.Instance.MapInitSettings.MapResourcesPath;
            DemoApplication app = Application as DemoApplication;
            await Task.Run(() =>
            {
                try
                {
                    bool resAlreadyExist;

                    string mapCreatorFolderPath = mapResourcesDirPath + "MapCreator";
                    // create the folder where you want to copy the json file
                    File mapCreatorFolder = new File(mapCreatorFolderPath);

                    resAlreadyExist = mapCreatorFolder.Exists();
                    if (!resAlreadyExist || _update)
                    {
                        if (!resAlreadyExist)
                        {
                            mapCreatorFolder.Mkdirs();
                        }
                        app.MapCreatorFilePath = mapCreatorFolderPath + "/mapcreatorFile.json";
                        DemoUtils.CopyAsset(Assets, "MapCreator", mapCreatorFolderPath, "mapcreatorFile.json");
                    }

                    // Copies the log file from assets to a storage.
                    string logFolderPath = mapResourcesDirPath + "logFile";
                    File logFolder       = new File(logFolderPath);
                    resAlreadyExist      = logFolder.Exists();
                    if (!resAlreadyExist || _update)
                    {
                        if (!resAlreadyExist)
                        {
                            logFolder.Mkdirs();
                        }
                        DemoUtils.CopyAsset(Assets, "logFile", logFolderPath, "Seattle.log");
                    }
                }
                catch (IOException e)
                {
                    e.PrintStackTrace();
                }
            });
        }