Exemple #1
0
        protected static void RegisterExisting()
        {
            var env = MvcApplication.Environment;

            if (!Directory.Exists(env.LMPoolPath))
            {
                return;
            }

            foreach (var path in Directory.GetDirectories(env.LMPoolPath))
            {
                try
                {
                    var directory = new DirectoryInfo(path);
                    var lm        = new LISpMiner.LISpMiner(directory, env);

                    if (!env.Exists(lm.Id))
                    {
                        env.Register(lm);
                    }
                }
                catch
                {
                    continue;
                }
            }
        }
Exemple #2
0
        private static void Remove()
        {
            var env = new LMConnect.Environment
            {
                //LMPoolPath = String.Format(@"{0}", @"C:\LMs\"),
                LMPoolPath = String.Format(@"{0}", @"c:\LMs"),
                LMPath     = String.Format("{0}/../{1}", System.AppDomain.CurrentDomain.BaseDirectory, "LISp Miner"),
            };

            foreach (var path in Directory.GetDirectories(env.LMPoolPath))
            {
                try
                {
                    var directory = new DirectoryInfo(path);
                    var lm        = new LISpMiner.LISpMiner(directory, env);

                    lm.Dispose();

                    System.Console.WriteLine(lm.Id);
                }
                catch (Exception ex)
                {
                    System.Console.WriteLine(String.Format("skipping {0} {1}", path, ex.Message));
                }
            }
        }
Exemple #3
0
        public RegistrationResponse Post(RegistrationRequest request)
        {
            var id    = ShortGuid.NewGuid();
            var user  = this.GetLMConnectUser();
            var miner = new LISpMiner.LISpMiner(Config.Environment, id.ToString(), request.DbConnection, request.Metabase, request.SharedBinaries);

            Config.Environment.Register(miner);

            // is user authenticated
            if (user == null)
            {
                var owner = request.Owner;

                if (owner != null)
                {
                    // user to be registered
                    user = new LMConnect.Key.User
                    {
                        Username = owner.Username,
                        Password = owner.Password
                    };

                    this.Repository.Add(user);
                }
                else
                {
                    // use anon user
                    user = this.GetAnonymousUser();
                }
            }

            user.Miners.Add(new LMConnect.Key.Miner
            {
                Owner   = user,
                MinerId = miner.Id,
                Path    = miner.LMPrivatePath
            });

            this.Repository.Save(user);

            return(new RegistrationResponse {
                Id = id
            });
        }
        public RegistrationResponse Post(RegistrationRequest request)
        {
            var id = ShortGuid.NewGuid();
            var user = this.GetLMConnectUser();
            var miner = new LISpMiner.LISpMiner(Config.Environment, id.ToString(), request.DbConnection, request.Metabase, request.SharedBinaries);

            Config.Environment.Register(miner);

            // is user authenticated
            if (user == null)
            {
                var owner = request.Owner;

                if (owner != null)
                {
                    // user to be registered
                    user = new LMConnect.Key.User
                    {
                        Username = owner.Username,
                        Password = owner.Password
                    };

                    this.Repository.Add(user);
                }
                else
                {
                    // use anon user
                    user = this.GetAnonymousUser();
                }
            }

            user.Miners.Add(new LMConnect.Key.Miner
            {
                Owner = user,
                MinerId = miner.Id,
                Path = miner.LMPrivatePath
            });

            this.Repository.Save(user);

            return new RegistrationResponse { Id = id };
        }
 public LISpMinerResponse(LISpMiner.LISpMiner miner)
 {
     this.LISpMiner = miner;
 }
Exemple #6
0
 internal MinerViewModel(LISpMiner.LISpMiner miner, string owner)
 {
     this.Miner = miner;
     this.Owner = owner;
 }
        protected static void RegisterExisting()
        {
            var env = MvcApplication.Environment;

            if (!Directory.Exists(env.LMPoolPath)) return;

            foreach (var path in Directory.GetDirectories(env.LMPoolPath))
            {
                try
                {
                    var directory = new DirectoryInfo(path);
                    var lm = new LISpMiner.LISpMiner(directory, env);

                    if (!env.Exists(lm.Id))
                    {
                        env.Register(lm);
                    }
                }
                catch
                {
                    continue;
                }
            }
        }
Exemple #8
0
		private static void Remove()
		{
			var env = new LMConnect.Environment
					{
						//LMPoolPath = String.Format(@"{0}", @"C:\LMs\"),
						LMPoolPath = String.Format(@"{0}", @"c:\LMs"),
						LMPath = String.Format("{0}/../{1}", System.AppDomain.CurrentDomain.BaseDirectory, "LISp Miner"),
					};

			foreach (var path in Directory.GetDirectories(env.LMPoolPath))
			{
				try
				{
					var directory = new DirectoryInfo(path);
					var lm = new LISpMiner.LISpMiner(directory, env);

					lm.Dispose();

					System.Console.WriteLine(lm.Id);
				}
				catch (Exception ex)
				{
					System.Console.WriteLine(String.Format("skipping {0} {1}", path, ex.Message));
				}
			}
		}