예제 #1
0
        internal PersonalCloud(ILogger l, IPCService pcsrv, List <StorageProviderInfo> storageProviderInfos)
        {
            CachedNodes = new List <NodeInfoForPC>();
            RootFS      = new RootFileSystem(pcsrv);
            StorageProviderInstances = new List <StorageProviderInstance>();

            if (storageProviderInfos != null)
            {
                foreach (var info in storageProviderInfos)
                {
                    try
                    {
                        if (info.Type == StorageProviderInstance.TypeAliYun)
                        {
                            StorageProviderInstances.Add(new StorageProviderInstance_AliyunOSS(info));
                        }
                        else if (info.Type == StorageProviderInstance.TypeAzure)
                        {
                            StorageProviderInstances.Add(new StorageProviderInstance_AzureBlob(info));
                        }
                    }
                    catch
                    {
                        // Ignore any errors
                    }
                }
            }
            logger     = l;
            Apps       = new List <AppLauncher>();
            httpClient = new Lazy <HttpClient>(() => new HttpClient());
        }
예제 #2
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.cloud_browser);
            SupportActionBar.SetTitle(Resource.String.move_to);
            R = new cloud_browser(this);

            fileSystem = Globals.CloudManager.PersonalClouds[0].RootFS;
            RootPath   = Intent.GetStringExtra(ExtraRootPath);
            if (string.IsNullOrEmpty(RootPath))
            {
                throw new InvalidOperationException("Internal error: IO operation root not provided.");
            }
            RootPath    = RootPath.TrimEnd(Path.AltDirectorySeparatorChar);
            workingPath = RootPath;

            adapter = new FlexibleAdapter(null, this);
            adapter.SetAnimationOnForwardScrolling(true);
            layoutManager = new SmoothScrollLinearLayoutManager(this);
            R.list_recycler.SetLayoutManager(layoutManager);
            R.list_recycler.SetAdapter(adapter);
            R.list_recycler.AddItemDecoration(new FlexibleItemDecoration(this).WithDefaultDivider());
            R.list_reloader.SetColorSchemeResources(Resource.Color.colorAccent);
            R.list_reloader.Refresh += RefreshDirectory;
            EmptyViewHelper.Create(adapter, R.list_empty);

            RefreshDirectory(this, EventArgs.Empty);
        }
 public override void ViewDidLoad()
 {
     base.ViewDidLoad();
     fileSystem = Globals.CloudManager.PersonalClouds[0].RootFS;
     NavigationItem.LeftBarButtonItem.Clicked += ShowHelp;
     IsEnablingBackupBtnCache = null;
 }
예제 #4
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            HomeItem      = new UIBarButtonItem(UIImage.FromBundle("Home"), UIBarButtonItemStyle.Bordered, GoHome);
            NewFolderItem = new UIBarButtonItem(UIImage.FromBundle("NewFolder"), UIBarButtonItemStyle.Bordered, CreateFolder);
            NewFileItem   = new UIBarButtonItem(UIImage.FromBundle("NewFile"), UIBarButtonItemStyle.Bordered, UploadFile);
            HelpItem      = new UIBarButtonItem(UIImage.FromBundle("Help"), UIBarButtonItemStyle.Bordered, ShowHelp);
            AddDeviceItem = new UIBarButtonItem(UIBarButtonSystemItem.Add, AddDeviceOrService);

            lastNotificationTime          = new DateTime(2020, 3, 1, 0, 0, 0, DateTimeKind.Local);
            Globals.CloudManager.OnError += OnPersonalCloudError;
            cloud      = Globals.CloudManager.PersonalClouds[0];
            fileSystem = cloud.RootFS;

            RefreshControl = new UIRefreshControl();
            RefreshControl.ValueChanged += RefreshDirectory;
            GoHome(this, EventArgs.Empty);
        }
예제 #5
0
        /// <summary>
        /// Parse through all .scs files and retreive all necessary files
        /// </summary>
        public void Parse()
        {
            var startTime = DateTime.Now.Ticks;

            if (!Directory.Exists(_gameDir))
            {
                Log.Msg("Could not find Game directory.");
                return;
            }

            Rfs = new RootFileSystem(_gameDir);

            _mods.Reverse(); // Highest priority mods (top) need to be loaded last

            foreach (var mod in _mods)
            {
                if (mod.Load)
                {
                    Rfs.AddSourceFile(mod.ModPath);
                }
            }

            Log.Msg($"Loaded all .scs files in {(DateTime.Now.Ticks - startTime) / TimeSpan.TicksPerMillisecond}ms");

            ReadLocalizationOptions();

            ParseDefFiles();
            ParseMapFiles();


            if (_sectorFiles == null)
            {
                return;
            }

            var preMapParseTime = DateTime.Now.Ticks;

            Sectors = _sectorFiles.Select(file => new TsSector(this, file)).ToList();
            Sectors.ForEach(sec => sec.Parse());
            Sectors.ForEach(sec => sec.ClearFileData());
            Log.Msg($"It took {(DateTime.Now.Ticks - preMapParseTime) / TimeSpan.TicksPerMillisecond} ms to parse all (*.base)" +
                    $" map files and {(DateTime.Now.Ticks - startTime) / TimeSpan.TicksPerMillisecond} ms total.");
        }
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Android.OS.Bundle savedInstanceState)
        {
            var view = inflater.Inflate(Resource.Layout.fragment_finder, container, false);

            R = new fragment_finder(view);

            adapter = new FlexibleAdapter(null, this);
            adapter.SetAnimationOnForwardScrolling(true);
            layoutManager = new SmoothScrollLinearLayoutManager(Context);
            R.list_recycler.SetLayoutManager(layoutManager);
            R.list_recycler.SetAdapter(adapter);
            R.list_recycler.AddItemDecoration(new FlexibleItemDecoration(Context).WithDefaultDivider());
            R.list_reloader.SetColorSchemeResources(Resource.Color.colorAccent);
            R.list_reloader.Refresh += RefreshDirectory;
            EmptyViewHelper.Create(adapter, R.list_empty);

            workingPath = "/";
            fileSystem  = Globals.CloudManager.PersonalClouds[0].RootFS;

            HasOptionsMenu = true;
            return(view);
        }
예제 #7
0
        /// <summary>
        /// Parse through all .scs files and retreive all necessary files
        /// </summary>
        public void Parse()
        {
            var startTime = DateTime.Now.Ticks;

            Log.Msg("Loading elements...");
            if (!Directory.Exists(_gameDir))
            {
                Log.Msg("Could not find Game directory.");
                return;
            }

            try
            {
                Rfs = new RootFileSystem(_gameDir);
            }
            catch (FileNotFoundException e)
            {
                Log.Msg(e.Message);
                return;
            }


            ParseDefFiles();
            ParseMapFiles();


            if (_sectorFiles == null)
            {
                return;
            }

            var preMapParseTime = DateTime.Now.Ticks;

            Sectors = _sectorFiles.Select(file => new TsSector(this, file)).ToList();
            Sectors.ForEach(sec => sec.Parse());
            Sectors.ForEach(sec => sec.ClearFileData());
            SetItems();
            SetForwardBackward();

            Log.Msg("Loading navigation data...");
            LoadNavigation();

            Random r       = new Random();
            int    firstP  = r.Next(Prefabs.Count);
            int    secondP = r.Next(Prefabs.Count);

            while (Prefabs[firstP].Hidden || Prefabs[firstP].Navigation.Count < 1)
            {
                firstP++;
            }
            while (Prefabs[secondP].Hidden || Prefabs[secondP].Navigation.Count < 1)
            {
                secondP++;
            }
            Log.Msg("Starting Calculating Path...");
            CalculatePath(Prefabs[firstP], Prefabs[secondP]);
            Log.Msg("Starting Calculating Path inside Prefabs...");
            CalculatePrefabsPath();

            Log.Msg("Selected Roads: " + RouteRoads.Count + " - Selected Prefabs: " + PrefabNav.Count);
            Log.Msg("Start Location: X -> " + Prefabs[firstP].X + ";Z -> " + Prefabs[firstP].Z);
            Log.Msg("End Location: X -> " + Prefabs[secondP].X + ";Z -> " + Prefabs[secondP].Z);
            Log.Msg($"It took {(DateTime.Now.Ticks - preMapParseTime) / TimeSpan.TicksPerMillisecond} ms to parse all (*.base)" +
                    $" map files and {(DateTime.Now.Ticks - startTime) / TimeSpan.TicksPerMillisecond} ms total.");
        }