Exemple #1
0
        public void DeletePackageFiles(UFramePackage package)
        {
            var packagePath = Path.Combine(Path.Combine(ApplicationPath, "uFramePackages"), package.Id);

            ThreadingUtils.DispatchOnMainThread(() =>
            {
                FileUtil.DeleteFileOrDirectory(packagePath);
            });
        }
Exemple #2
0
        public void Execute(PingServerCommand command)
        {
            WWW      ping    = null;
            DateTime timeOut = DateTime.Now.AddSeconds(15);

            GlobalProgressMessage = "Contacting Koinonia Servers....";

            var d = ThreadingUtils.WaitOnMainThread(() =>
            {
                ping = ping ?? new WWW(command.Server);
                return(ping.isDone);
            });

            while (!d.Done)
            {
                if (DateTime.Now > timeOut) //time outs
                {
                    ThreadingUtils.DispatchOnMainThread(() =>
                    {
                        IsRemoteServerAvailable = string.IsNullOrEmpty(ping.error);
                        GlobalProgressMessage   = null;
                        ping.Dispose();
                    });
                    return;
                }
                else
                {
                    Thread.Sleep(100);
                }
            }

            ThreadingUtils.DispatchOnMainThread(() =>
            {
                IsRemoteServerAvailable = string.IsNullOrEmpty(ping.error);
                GlobalProgressMessage   = null;
                ping.Dispose();
            });
        }
Exemple #3
0
        private void ServePackagesToUninstall()
        {
            GlobalProgressMessage = string.Format("Removing packages...");

            var packagesToUnisntall = KoinoniaSettings.PackagesToUninstall
                                      .Where(id => InstalledPackages.FirstOrDefault(p => p.Id == id) != null)
                                      .Select(id => InstalledPackages.FirstOrDefault(p => p.Id == id)).ToArray();

            foreach (var package in packagesToUnisntall)
            {
                package.Uninstall();
            }

            KoinoniaSettings.PackagesToUninstall.Clear();
            Settings.Commit();

            foreach (var package in packagesToUnisntall)
            {
                DeletePackageFiles(package);
            }

            ThreadingUtils.DispatchOnMainThread(AssetDatabase.Refresh);
        }