Example #1
0
        /// <summary>
        /// Gets general info for LASzip (.las, .laz) file.
        /// </summary>
        public static PointFileInfo LaszipInfo(string filename, ParseConfig config)
        {
            var fileSizeInBytes = new FileInfo(filename).Length;
            var info            = LASZip.Parser.ReadInfo(filename);

            return(new PointFileInfo(filename, LaszipFormat, fileSizeInBytes, info.Count, info.Bounds));
        }
    public Task ClearCurrentConfigAsync() {
      return taskQueue.Enqueue(toAwait => toAwait.ContinueWith(_ => {
        currentConfig = null;

        return storageController.LoadAsync().OnSuccess(t => t.Result.RemoveAsync(CurrentConfigKey));
      }).Unwrap().Unwrap(), CancellationToken.None);
    }
Example #3
0
 public Task TestGetConfig()
 {
     return(ParseConfig.GetAsync().ContinueWith(t => {
         Assert.AreEqual("testValue", t.Result["testKey"]);
         Assert.AreEqual("testValue", t.Result.Get <string>("testKey"));
     }));
 }
Example #4
0
        public void TestCurrentConfig()
        {
            ParseConfig config = ParseConfig.CurrentConfig;

            Assert.AreEqual("testValue", config["testKey"]);
            Assert.AreEqual("testValue", config.Get <string>("testKey"));
        }
Example #5
0
        public static bool RegisterEmail(string userEmail, long userId, string activateCode, out string message)
        {
            string activateUrl = $"api/v1/user/ActivateEmailUser?";
            string apiHost;

            ParseConfig.ParseInfo("DeploySystem\\ApiHost", out apiHost);

            string registerTemplate = File.ReadAllText(@"wwwroot/EmailTemplate/RegisterTemplate.html");
            string body             = registerTemplate.
                                      Replace("[UserEmail]", userEmail).
                                      Replace("[ApiHost]", apiHost).
                                      Replace("[ApiAddress]", activateUrl).
                                      Replace("[ActivateParameter]", $"userId={userId}&secret={activateCode}").
                                      Replace("[ActivateRandom]", Guid.NewGuid().ToString());

            EmailMsg msg = new EmailMsg(userEmail, "Register new account activate email", body);
            //同步发送邮件
            bool result = msg.Send(out message);

            return(result);

            //异步邮件
            //msg.SendEmailByThread();
            //message = string.Empty;
            //return true;
        }
 public Task ClearCurrentConfigAsync()
 {
     return(taskQueue.Enqueue(toAwait => toAwait.ContinueWith(_ => {
         currentConfig = null;
         ParseClient.ApplicationSettings.Remove(CurrentConfigKey);
     }), CancellationToken.None));
 }
Example #7
0
        /// <summary>
        /// Parses .e57 file.
        /// </summary>
        public static IEnumerable <Chunk> Chunks(string filename, ParseConfig config)
        {
            var fileSizeInBytes = new FileInfo(filename).Length;
            var stream          = File.Open(filename, FileMode.Open, FileAccess.Read, FileShare.Read);

            return(Chunks(stream, fileSizeInBytes, config));
        }
Example #8
0
        public Task TestGetConfigCancel()
        {
            CancellationTokenSource tokenSource = new CancellationTokenSource();

            tokenSource.Cancel();
            return(ParseConfig.GetAsync(tokenSource.Token).ContinueWith(t => Assert.IsTrue(t.IsCanceled)));
        }
Example #9
0
    private void Start()
    {
        DataObj.isFree = false;
        Application.targetFrameRate = 60;

        ParseConfig.GetAsync().ContinueWith(t =>
        {
            ParseConfig config = t.Result;
            getConfigNow       = true;
        });



        DataObj.cachePath = Application.persistentDataPath + "/";

        //if (Application.platform == RuntimePlatform.Android || Application.platform == RuntimePlatform.IPhonePlayer)
        //{
        //    DataObj.cachePath = Application.dataPath + "/Resources/";
        //}else{
        //    DataObj.cachePath = Application.persistentDataPath + "/Resources/Cache/";
        //}

        //Advertisement.Initialize("2801060", true);
        if (DataObj.isFree)
        {
            dpEntry.SetActive(false);
        }

        languageNow = PlayerPrefs.GetString("language");
        changeAllText();
    }
 public Task ClearCurrentConfigInMemoryAsync()
 {
     return(taskQueue.Enqueue(toAwait => toAwait.ContinueWith(_ =>
     {
         currentConfig = null;
     }), CancellationToken.None));
 }
Example #11
0
    public static Config Convert(ParseConfig config)
    {
        Config convert_config = new Config();

        foreach (KeyValuePair <object, JObject> pair in config)
        {
            object key;
            int    ret;
            if (int.TryParse(pair.Key.ToString(), out ret))
            {
                key = ret;
            }
            else
            {
                key = pair.Key.ToString();
            }

            ConfigItem config_item = new ConfigItem();
            foreach (KeyValuePair <string, JToken> json_pair in pair.Value)
            {
                config_item[json_pair.Key] = json_pair.Value;
            }
            convert_config.Add(key, config_item);
        }
        return(convert_config);
    }
 public Task ClearCurrentConfigInMemoryAsync()
 {
     return(taskQueue.Enqueue(toAwait => toAwait.ContinueWith(_ =>
     {
         currentConfig = null;
     }, Parse.ParseClient.DefaultTaskContinuationOptions), CancellationToken.None));
 }
        public Task <ParseConfig> GetCurrentConfigAsync()
        {
            return(taskQueue.Enqueue(toAwait => toAwait.ContinueWith(_ =>
            {
                if (currentConfig == null)
                {
                    return storageController.LoadAsync().OnSuccess(t =>
                    {
                        object tmp;
                        t.Result.TryGetValue(CurrentConfigKey, out tmp);

                        string propertiesString = tmp as string;
                        if (propertiesString != null)
                        {
                            var dictionary = ParseClient.DeserializeJsonString(propertiesString);
                            currentConfig = new ParseConfig(dictionary);
                        }
                        else
                        {
                            currentConfig = new ParseConfig();
                        }

                        return currentConfig;
                    });
                }

                return Task.FromResult(currentConfig);
            }), CancellationToken.None).Unwrap());
        }
        public Task ClearCurrentConfigAsync()
        {
            return(taskQueue.Enqueue(toAwait => toAwait.ContinueWith(_ => {
                currentConfig = null;

                return storageController.LoadAsync().OnSuccess(t => t.Result.RemoveAsync(CurrentConfigKey));
            }).Unwrap().Unwrap(), CancellationToken.None));
        }
Example #15
0
        public void Test_GetDefaultConfigValueNoGroup()
        {
            ParseConfig config = new ParseConfig(TestHelper.GetNodeConfigPath());

            string value = config.GetValue("not existant", "not existant", "Value");

            Assert.AreEqual("Value", value);
        }
Example #16
0
        public void Test_GetConfigKeys()
        {
            ParseConfig config = new ParseConfig(TestHelper.GetNodeConfigPath());

            string[] keys = config.GetKeys("");

            Assert.IsNotNull(keys.Select(k => k == "CONFIG_VALUE").Count() > 0);
        }
Example #17
0
        public void Test_GetSectionConfigValue()
        {
            ParseConfig config = new ParseConfig(TestHelper.GetNodeConfigPath());

            string value = config.GetValue("CONFIG_VALUE", "Test Group");

            Assert.AreEqual("testing", value);
        }
Example #18
0
        public void Test_GetConfigSectionsConfig()
        {
            ParseConfig config = new ParseConfig(TestHelper.GetNodeConfigPath());

            string[] sections = config.GetSections();

            Assert.IsNotNull(sections.Count() == 1);
        }
Example #19
0
        public void Test_GetCategoryConfigKeys()
        {
            ParseConfig config = new ParseConfig(TestHelper.GetNodeConfigPath());

            string[] keys = config.GetKeys("Test Group");

            Assert.IsNotNull(keys.Count() == 1);
        }
Example #20
0
        public void Test_GetConfigComents()
        {
            ParseConfig config = new ParseConfig(TestHelper.GetNodeConfigPath());

            string value = config.GetValue("MOTD_FILE");

            Assert.AreEqual(value, "");
        }
Example #21
0
        public void Test_GetConfigValue()
        {
            ParseConfig config = new ParseConfig(TestHelper.GetNodeConfigPath());

            string value = config.GetValue("CLOUD_DOMAIN");

            Assert.AreEqual("example.com", value);
        }
Example #22
0
        private bool IsEnableInviteCode()
        {
            string msg = "";

            ParseConfig.ParseInfo("EnableInviteCode", out msg);
            bool result = Convert.ToBoolean(msg);

            return(result);
        }
Example #23
0
 public Task TestGetConfig()
 {
     return(ParseConfig.GetAsync().ContinueWith(t => {
         if (t.Result.TryGetValue("testKey", out string result) == true)
         {
             Assert.AreEqual("testValue", result);
         }
         Assert.AreEqual("testValue", t.Result.Get <string>("testKey"));
     }));
 }
Example #24
0
        public RedisInstance()
        {
            string redisServer, dbName;

            ParseConfig.ParseInfo("RedisConfig\\Redis_Default\\Connection", out redisServer);
            ParseConfig.ParseInfo("RedisConfig\\Redis_Default\\DataBase", out dbName);
            _connStr = string.Format("{0}, {1}", redisServer, dbName);
            _conn    = ConnectionMultiplexer.Connect(_connStr);
            redlock  = new Redlock(_conn);
        }
Example #25
0
        public void TestCurrentConfig()
        {
            ParseConfig config = ParseConfig.CurrentConfig;

            if (config.TryGetValue("testKey", out string result) == true)
            {
                Assert.AreEqual("testValue", result);
            }
            Assert.AreEqual("testValue", config.Get <string>("testKey"));
        }
Example #26
0
 public void UpdateConfig(Action callback)
 {
     ParseConfig.GetAsync().ContinueWith(t =>
     {
         lock (threadCallMutex)
         {
             mainThreadCalls.Add(callback);
         }
     });
 }
    public Task SetCurrentConfigAsync(ParseConfig config) {
      return taskQueue.Enqueue(toAwait => toAwait.ContinueWith(_ => {
        currentConfig = config;

        var jsonObject = ((IJsonConvertible)config).ToJSON();
        var jsonString = ParseClient.SerializeJsonString(jsonObject);

        return storageController.LoadAsync().OnSuccess(t => t.Result.AddAsync(CurrentConfigKey, jsonString));
      }).Unwrap().Unwrap(), CancellationToken.None);
    }
    public Task SetCurrentConfigAsync(ParseConfig config) {
      return taskQueue.Enqueue(toAwait => toAwait.ContinueWith(_ => { 
        currentConfig = config;

        var jsonObject = ((IJsonConvertible)config).ToJSON();
        var jsonString = ParseClient.SerializeJsonString(jsonObject);

        ParseClient.ApplicationSettings[CurrentConfigKey] = jsonString;
      }), CancellationToken.None);
    }
        public Task SetCurrentConfigAsync(ParseConfig config)
        {
            return(taskQueue.Enqueue(toAwait => toAwait.ContinueWith(_ => {
                currentConfig = config;

                var jsonObject = ((IJsonConvertible)config).ToJSON();
                var jsonString = ParseClient.SerializeJsonString(jsonObject);

                return storageController.LoadAsync().OnSuccess(t => t.Result.AddAsync(CurrentConfigKey, jsonString));
            }).Unwrap().Unwrap(), CancellationToken.None));
        }
        public Task SetCurrentConfigAsync(ParseConfig config)
        {
            return(taskQueue.Enqueue(toAwait => toAwait.ContinueWith(_ => {
                currentConfig = config;

                var jsonObject = ((IJsonConvertible)config).ToJSON();
                var jsonString = ParseClient.SerializeJsonString(jsonObject);

                ParseClient.ApplicationSettings[CurrentConfigKey] = jsonString;
            }), CancellationToken.None));
        }
Example #31
0
 /// <summary>
 /// Parses file.
 /// Format is guessed based on file extension.
 /// </summary>
 public static IEnumerable <Chunk> Parse(string filename, ParseConfig config)
 {
     if (filename == null)
     {
         throw new ArgumentNullException(nameof(filename));
     }
     if (!File.Exists(filename))
     {
         throw new FileNotFoundException($"File does not exit ({filename}).", filename);
     }
     return(PointCloudFileFormat.FromFileName(filename).ParseFile(filename, config));
 }
Example #32
0
        public void Test_LoadConfigFile()
        {
            ParseConfig config;

            try
            {
                config = new ParseConfig(TestHelper.GetNodeConfigPath());
            }
            catch (Exception ex)
            {
                Assert.Fail(ex.ToString());
            }
        }
        /// <summary>
        /// Gets general info for .pts file.
        /// </summary>
        public static PointFileInfo PtsInfo(string filename, ParseConfig config)
        {
            var filesize    = new FileInfo(filename).Length;
            var pointCount  = 0L;
            var pointBounds = Box3d.Invalid;

            foreach (var chunk in Chunks(filename, ParseConfig.Default))
            {
                pointCount += chunk.Count;
                pointBounds.ExtendBy(chunk.BoundingBox);
            }
            return(new PointFileInfo(filename, PtsFormat, filesize, pointCount, pointBounds));
        }
    public Task<ParseConfig> GetCurrentConfigAsync() {
      return taskQueue.Enqueue(toAwait => toAwait.ContinueWith(_ => {
        if (currentConfig == null) {
          object tmp;
          ParseClient.ApplicationSettings.TryGetValue(CurrentConfigKey, out tmp);

          string propertiesString = tmp as string;
          if (propertiesString != null) {
            var dictionary = ParseClient.DeserializeJsonString(propertiesString);
            currentConfig = new ParseConfig(dictionary);
          } else {
            currentConfig = new ParseConfig();
          }
        }

        return currentConfig;
      }), CancellationToken.None);
    }
    public Task<ParseConfig> GetCurrentConfigAsync() {
      return taskQueue.Enqueue(toAwait => toAwait.ContinueWith(_ => {
        if (currentConfig == null) {
          return storageController.LoadAsync().OnSuccess(t => {
            object tmp;
            t.Result.TryGetValue(CurrentConfigKey, out tmp);

            string propertiesString = tmp as string;
            if (propertiesString != null) {
              var dictionary = ParseClient.DeserializeJsonString(propertiesString);
              currentConfig = new ParseConfig(dictionary);
            } else {
              currentConfig = new ParseConfig();
            }

            return currentConfig;
          });
        }

        return Task.FromResult(currentConfig);
      }), CancellationToken.None).Unwrap();
    }
Example #36
0
        public async Task<String> getParseConfigElement(string keyName)
        {
            try
            {
                config = await ParseConfig.GetAsync();
            }
            catch (Exception e)
            {
                System.Diagnostics.Debug.WriteLine(e.Message);
                config = ParseConfig.CurrentConfig;
            }

            String parseConfigText = null;
            bool searchResult = config.TryGetValue<String>(keyName, out parseConfigText);

            if (searchResult)
            {
                return parseConfigText;
            } else
            {
                return null;
            }
        }
 public Task ClearCurrentConfigAsync() {
   return taskQueue.Enqueue(toAwait => toAwait.ContinueWith(_ => {
     currentConfig = null;
     ParseClient.ApplicationSettings.Remove(CurrentConfigKey);
   }), CancellationToken.None);
 }
 public Task ClearCurrentConfigInMemoryAsync() {
   return taskQueue.Enqueue(toAwait => toAwait.ContinueWith(_ => {
     currentConfig = null;
   }), CancellationToken.None);
 }