File Manager source code

namespace File_Explorer
{
    using GoogleAds;
    using Microsoft.Phone.Controls;
    using Microsoft.Phone.Shell;
    using Microsoft.Phone.Tasks;
    using SharpCompress.Archive;
    using SharpCompress.Archive.Zip;
    using SharpCompress.Common;
    using SharpCompress.Compressor.Deflate;
    using System;
    using System.Collections.Generic;
    using System.Collections.ObjectModel;
    using System.ComponentModel;
    using System.Diagnostics;
    using System.IO;
    using System.IO.IsolatedStorage;
    using System.Linq;
    using System.Runtime.CompilerServices;
    using System.Runtime.InteropServices;
    using System.Runtime.InteropServices.WindowsRuntime;
    using System.Threading.Tasks;
    using System.Windows;
    using System.Windows.Controls;
    using System.Windows.Input;
    using System.Windows.Media;
    using System.Windows.Media.Animation;
    using System.Windows.Media.Imaging;
    using System.Windows.Navigation;
    using System.Windows.Threading;
    using Windows.ApplicationModel.DataTransfer;
    using Windows.Foundation;
    using Windows.Storage;
    using Windows.System;

    public class MainPage : PhoneApplicationPage
    {
        private bool _contentLoaded;
        private MarketplaceDetailTask _marketPlaceDetailTask = new MarketplaceDetailTask();
        private bool AdLoaded;
        internal Grid AdRoot;
        private ApplicationBarIconButton appbarcopy;
        private ApplicationBarIconButton appbarcut;
        private ApplicationBarIconButton appbarsearch;
        private ApplicationBarIconButton appbarshare;
        private bool cancel;
        internal Grid ContentPanel;
        private string CurrentPath = "";
        private ApplicationBarIconButton delete;
        internal TextBlock emptyFolder;
        internal LongListSelector explorer;
        internal Storyboard HideOperationBox;
        internal Storyboard HideOperationDetails;
        private bool IsBusy;
        private bool IsOpen;
        private bool IsSearchEnabled;
        private int itemsRemaining;
        internal Grid LayoutRoot;
        internal Button Navigate_Button;
        private File_Explorer.NavigationType NavigationMode;
        private string NextPath = "";
        internal Button Operation_Cancel;
        internal TextBlock Operation_Left;
        internal TextBlock Operation_Name;
        internal TextBlock Operation_Status;
        internal TextBlock Operation_Title;
        internal Grid OperationBox;
        internal StackPanel OperationDetails;
        private ApplicationBarMenuItem paste;
        internal Grid pathBackground;
        internal ScrollViewer pathScrollViewer;
        internal TextBox PathText;
        private string phonePath = @"C:\Data\Users\Public";
        internal ProgressBar Progress;
        private string SearchText;
        internal ProgressBar secondaryProgress;
        private ApplicationBarIconButton select;
        private ApplicationBarMenuItem selectall;
        private File_Explorer.StorageItem selectedItem;
        internal Storyboard ShowOperationBox;
        internal Storyboard ShowOperationDetails;
        internal Storyboard storyboard;
        internal StackPanel TitlePanel;
        internal TranslateTransform transform;
        internal Button UpDown;

        public MainPage()
        {
            ApplicationBarIconButton button = new ApplicationBarIconButton(new Uri(@"Assets\ApplicationBar.Select.png", UriKind.Relative));
            button.set_Text("select");
            this.select = button;
            ApplicationBarIconButton button2 = new ApplicationBarIconButton(new Uri(@"Assets\ApplicationBar.Delete.png", UriKind.Relative));
            button2.set_Text("delete");
            this.delete = button2;
            ApplicationBarIconButton button3 = new ApplicationBarIconButton(new Uri(@"Assets\Copy.png", UriKind.Relative));
            button3.set_Text("copy");
            this.appbarcopy = button3;
            ApplicationBarIconButton button4 = new ApplicationBarIconButton(new Uri(@"Assets\Cut.png", UriKind.Relative));
            button4.set_Text("cut");
            this.appbarcut = button4;
            ApplicationBarIconButton button5 = new ApplicationBarIconButton(new Uri(@"Assets\feature.search.png", UriKind.Relative));
            button5.set_Text("search");
            this.appbarsearch = button5;
            ApplicationBarIconButton button6 = new ApplicationBarIconButton(new Uri(@"Assets\ApplicationBar.Share.png", UriKind.Relative));
            button6.set_Text("share");
            this.appbarshare = button6;
            ApplicationBarMenuItem item = new ApplicationBarMenuItem("Paste");
            item.set_IsEnabled(false);
            this.paste = item;
            this.selectall = new ApplicationBarMenuItem("Select all");
            this.SearchText = "";
            this.InitializeComponent();
            this.explorer.set_LayoutMode((File_Explorer.App.ViewModel.ViewMode == 0) ? ((LongListSelectorLayoutMode) 0) : ((LongListSelectorLayoutMode) 1));
            this.explorer.set_ItemTemplate((DataTemplate) base.get_Resources().get_Item((File_Explorer.App.ViewModel.ViewMode == 0) ? "ListTemplate" : "GridTemplate"));
            base.set_DataContext(File_Explorer.App.ViewModel);
            this.Init();
            this.BuildLocalizedApplicationBar();
            File_Explorer.FileOperator.ProgressChanged += new EventHandler<File_Explorer.FileOperationProgressChangedEventArgs>(this.FileOperator_ProgressChanged);
        }

        private async void AddItem(string path, bool IsFolder)
        {
            Func<File_Explorer.StorageItem, bool> predicate = null;
            Func<File_Explorer.StorageItem, bool> asyncVariable5 = null;
            if (this.PathEquals(Path.GetDirectoryName(path), this.CurrentPath) && !this.cancel)
            {
                if (IsFolder)
                {
                    try
                    {
                        File_Explorer.StorageItem expressionStack_2FD_0;
                        ObservableCollection<File_Explorer.StorageItem> expressionStack_2FD_1;
                        File_Explorer.StorageItem expressionStack_22D_0;
                        ObservableCollection<File_Explorer.StorageItem> expressionStack_22D_1;
                        File_Explorer.StorageItem expressionStack_212_0;
                        ObservableCollection<File_Explorer.StorageItem> expressionStack_212_1;
                        ObservableCollection<File_Explorer.StorageItem> storageSource;
                        File_Explorer.StorageItem expressionStack_269_0;
                        ObservableCollection<File_Explorer.StorageItem> expressionStack_269_1;
                        File_Explorer.StorageItem expressionStack_263_0;
                        ObservableCollection<File_Explorer.StorageItem> expressionStack_263_1;
                        File_Explorer.StorageItem expressionStack_289_0;
                        ObservableCollection<File_Explorer.StorageItem> expressionStack_289_1;
                        ObservableCollection<File_Explorer.StorageItem> expressionStack_E5_0;
                        if (this.cancel)
                        {
                            return;
                        }
                        if (predicate != null)
                        {
                            storageSource = File_Explorer.App.ViewModel.StorageSource;
                            break;
                        }
                        else
                        {
                            expressionStack_E5_0 = File_Explorer.App.ViewModel.StorageSource;
                        }
                        predicate = x => x.IsFolder && this.PathEquals(x.Path, path);
                        storageSource = expressionStack_E5_0;
                        if (storageSource.SingleOrDefault<File_Explorer.StorageItem>(predicate) != null)
                        {
                            return;
                        }
                        StorageFolder asyncVariable0 = await StorageFolder.GetFolderFromPathAsync(path);
                        File_Explorer.StorageItem item = new File_Explorer.StorageItem {
                            FileName = asyncVariable0.get_Name(),
                            IsFolder = true,
                            Path = asyncVariable0.get_Path(),
                            Description = asyncVariable0.get_DateCreated().ToString()
                        };
                        if (this.explorer.get_LayoutMode() == null)
                        {
                            expressionStack_22D_1 = File_Explorer.App.ViewModel.StorageSource;
                            expressionStack_22D_0 = item;
                            goto Label_022D;
                        }
                        else
                        {
                            expressionStack_212_1 = File_Explorer.App.ViewModel.StorageSource;
                            expressionStack_212_0 = item;
                        }
                        ObservableCollection<File_Explorer.StorageItem> expressionStack_246_2 = expressionStack_212_1;
                        File_Explorer.StorageItem expressionStack_246_1 = expressionStack_212_0;
                        Style expressionStack_246_0 = (Style) Application.get_Current().get_Resources().get_Item("Folder");
                        goto Label_0246;
                    Label_022D:
                        expressionStack_246_2 = expressionStack_22D_1;
                        expressionStack_246_1 = expressionStack_22D_0;
                        expressionStack_246_0 = (Style) Application.get_Current().get_Resources().get_Item("File");
                    Label_0246:
                        expressionStack_246_1.Style = expressionStack_246_0;
                        if (this.explorer.get_LayoutMode() == null)
                        {
                            expressionStack_269_1 = expressionStack_246_2;
                            expressionStack_269_0 = item;
                            goto Label_0269;
                        }
                        else
                        {
                            expressionStack_263_1 = expressionStack_246_2;
                            expressionStack_263_0 = item;
                        }
                        ObservableCollection<File_Explorer.StorageItem> expressionStack_311_2 = expressionStack_263_1;
                        File_Explorer.StorageItem expressionStack_311_1 = expressionStack_263_0;
                        BitmapImage expressionStack_311_0 = null;
                        goto Label_0311;
                    Label_0269:
                        if (awaiter3.IsCompleted)
                        {
                            expressionStack_2FD_1 = expressionStack_269_1;
                            expressionStack_2FD_0 = expressionStack_269_0;
                            goto Label_02FD;
                        }
                        else
                        {
                            expressionStack_289_1 = expressionStack_269_1;
                            expressionStack_289_0 = expressionStack_269_0;
                        }
                        Tuple<ObservableCollection<File_Explorer.StorageItem>, File_Explorer.StorageItem> tuple = new Tuple<ObservableCollection<File_Explorer.StorageItem>, File_Explorer.StorageItem>(expressionStack_289_1, expressionStack_289_0);
                        this.<>t__stack = tuple;
                        this.<>1__state = 1;
                        AsyncVoidMethodBuilder.Create().AwaitUnsafeOnCompleted<TaskAwaiter<ImageSource>, <AddItem>d__d8>(ref awaiter3, ref this);
                        return;
                        Tuple<ObservableCollection<File_Explorer.StorageItem>, File_Explorer.StorageItem> tuple2 = (Tuple<ObservableCollection<File_Explorer.StorageItem>, File_Explorer.StorageItem>) this.<>t__stack;
                        this.<>t__stack = null;
                        expressionStack_2FD_1 = tuple2.Item1;
                        expressionStack_2FD_0 = tuple2.Item2;
                    Label_02FD:
                        ImageSource introduced36 = await GetIcon("Folder", "", null);
                        expressionStack_311_2 = expressionStack_2FD_1;
                        expressionStack_311_1 = expressionStack_2FD_0;
                        expressionStack_311_0 = (BitmapImage) introduced36;
                    Label_0311:
                        expressionStack_311_1.ThumbSource = expressionStack_311_0;
                        expressionStack_311_2.Add(item);
                    }
                    catch
                    {
                    }
                }
                else
                {
                    try
                    {
                        StorageFile asyncVariable2;
                        string subdesc;
                        string extension;
                        File_Explorer.StorageItem asyncVariable3;
                        string expressionStack_6A2_0;
                        File_Explorer.StorageItem expressionStack_7EB_0;
                        ObservableCollection<File_Explorer.StorageItem> expressionStack_7EB_1;
                        if (!this.cancel)
                        {
                            ObservableCollection<File_Explorer.StorageItem> expressionStack_38A_0;
                            string expressionStack_63F_0;
                            ObservableCollection<File_Explorer.StorageItem> expressionStack_373_0;
                            if (asyncVariable5 != null)
                            {
                                expressionStack_38A_0 = File_Explorer.App.ViewModel.StorageSource;
                                break;
                            }
                            else
                            {
                                expressionStack_373_0 = File_Explorer.App.ViewModel.StorageSource;
                            }
                            asyncVariable5 = x => !x.IsFolder && this.PathEquals(x.Path, path);
                            expressionStack_38A_0 = expressionStack_373_0;
                            if (expressionStack_38A_0.SingleOrDefault<File_Explorer.StorageItem>(asyncVariable5) != null)
                            {
                                return;
                            }
                            asyncVariable2 = await StorageFile.GetFileFromPathAsync(path);
                            subdesc = "";
                            extension = Path.GetExtension(asyncVariable2.get_Name()).ToLower();
                            if ((((extension == ".mp4") || (extension == ".wav")) || ((extension == ".mpg") || (extension == ".mp3"))) || ((extension == ".wma") || (extension == ".wmv")))
                            {
                                StorageFile introduced39 = await StorageFile.GetFileFromPathAsync(asyncVariable2.get_Path());
                                MusicProperties introduced40 = await introduced39.get_Properties().GetMusicPropertiesAsync();
                                TimeSpan duration = introduced40.get_Duration();
                                subdesc = "Duration: " + duration.Hours.ToString("00") + ":" + duration.Minutes.ToString("00") + ":" + duration.Seconds.ToString("00");
                            }
                            if (awaiter11.IsCompleted)
                            {
                                expressionStack_6A2_0 = "Size: ";
                                goto Label_06A2;
                            }
                            else
                            {
                                expressionStack_63F_0 = "Size: ";
                            }
                            string str = expressionStack_63F_0;
                            this.<>t__stack = str;
                            this.<>1__state = 5;
                            AsyncVoidMethodBuilder.Create().AwaitUnsafeOnCompleted<TaskAwaiter<BasicProperties>, <AddItem>d__d8>(ref awaiter11, ref this);
                        }
                        return;
                        string str2 = (string) this.<>t__stack;
                        this.<>t__stack = null;
                        expressionStack_6A2_0 = str2;
                    Label_06A2:
                        BasicProperties introduced41 = await asyncVariable2.GetBasicPropertiesAsync();
                        string filesize = expressionStack_6A2_0 + FormatBytes((double) introduced41.get_Size());
                        if (!this.cancel)
                        {
                            File_Explorer.StorageItem expressionStack_777_0;
                            ObservableCollection<File_Explorer.StorageItem> expressionStack_777_1;
                            asyncVariable3 = new File_Explorer.StorageItem {
                                FileName = asyncVariable2.get_Name(),
                                IsFolder = false,
                                Path = asyncVariable2.get_Path(),
                                Description = filesize + " " + subdesc
                            };
                            if (awaiter13.IsCompleted)
                            {
                                expressionStack_7EB_1 = File_Explorer.App.ViewModel.StorageSource;
                                expressionStack_7EB_0 = asyncVariable3;
                                goto Label_07EB;
                            }
                            else
                            {
                                expressionStack_777_1 = File_Explorer.App.ViewModel.StorageSource;
                                expressionStack_777_0 = asyncVariable3;
                            }
                            Tuple<ObservableCollection<File_Explorer.StorageItem>, File_Explorer.StorageItem> tuple3 = new Tuple<ObservableCollection<File_Explorer.StorageItem>, File_Explorer.StorageItem>(expressionStack_777_1, expressionStack_777_0);
                            this.<>t__stack = tuple3;
                            this.<>1__state = 6;
                            AsyncVoidMethodBuilder.Create().AwaitUnsafeOnCompleted<TaskAwaiter<ImageSource>, <AddItem>d__d8>(ref awaiter13, ref this);
                        }
                        return;
                        Tuple<ObservableCollection<File_Explorer.StorageItem>, File_Explorer.StorageItem> tuple4 = (Tuple<ObservableCollection<File_Explorer.StorageItem>, File_Explorer.StorageItem>) this.<>t__stack;
                        this.<>t__stack = null;
                        expressionStack_7EB_1 = tuple4.Item1;
                        expressionStack_7EB_0 = tuple4.Item2;
                    Label_07EB:
                        ImageSource introduced42 = await GetIcon(extension, asyncVariable2.get_Path(), null);
                        expressionStack_7EB_0.ThumbSource = (BitmapImage) introduced42;
                        asyncVariable3.Style = (Style) Application.get_Current().get_Resources().get_Item("File");
                        asyncVariable3.IsMedia = IsMediaFile(Path.GetExtension(asyncVariable2.get_Name()));
                        expressionStack_7EB_1.Add(asyncVariable3);
                    }
                    catch (Exception exception)
                    {
                        MessageBox.Show(exception.Message);
                    }
                }
            }
        }

        private void appbarsearch_Click(object sender, EventArgs e)
        {
            if (!this.IsSearchEnabled)
            {
                this.IsSearchEnabled = true;
                File_Explorer.App.ViewModel.StorageSource.Clear();
                this.PathText.set_Text("");
                this.PathText.Focus();
                this.Navigate_Button.set_Content("");
            }
        }

        private async void Border_Tap_1(object sender, GestureEventArgs e)
        {
            try
            {
                File_Explorer.StorageItem Item = (sender as FrameworkElement).get_DataContext() as File_Explorer.StorageItem;
                if (this.SelectionEnabled)
                {
                    Item.IsSelected = !Item.IsSelected;
                }
                else if (Item.IsFolder)
                {
                    this.StartNavigate(Item.Path, File_Explorer.NavigationType.Forward);
                }
                else
                {
                    StorageFile asyncVariable0 = await StorageFile.GetFileFromPathAsync(Item.Path);
                    LauncherOptions asyncVariable1 = new LauncherOptions();
                    asyncVariable1.put_DisplayApplicationPicker(true);
                    await Launcher.LaunchFileAsync(asyncVariable0, asyncVariable1);
                }
            }
            catch (Exception exception)
            {
                try
                {
                    if (exception.HResult == -2147024891)
                    {
                        MessageBox.Show("You dont have permission to access this file", "Access is denied", 0);
                    }
                }
                catch
                {
                }
            }
        }

        private void BuildLocalizedApplicationBar()
        {
            try
            {
                if (base.get_ApplicationBar() == null)
                {
                    base.set_ApplicationBar(new ApplicationBar());
                    base.get_ApplicationBar().set_Mode(1);
                    ApplicationBarMenuItem item = new ApplicationBarMenuItem("New Folder");
                    ApplicationBarMenuItem item2 = new ApplicationBarMenuItem("Settings");
                    ApplicationBarMenuItem item3 = new ApplicationBarMenuItem("exit");
                    base.get_ApplicationBar().get_MenuItems().Add(item);
                    base.get_ApplicationBar().get_MenuItems().Add(this.selectall);
                    base.get_ApplicationBar().get_MenuItems().Add(this.paste);
                    base.get_ApplicationBar().get_MenuItems().Add(item2);
                    base.get_ApplicationBar().get_MenuItems().Add(item3);
                    base.get_ApplicationBar().get_Buttons().Add(this.select);
                    base.get_ApplicationBar().get_Buttons().Add(this.appbarsearch);
                    this.select.add_Click(new EventHandler(this.select_Click));
                    this.delete.add_Click(new EventHandler(this.delete_Click));
                    item.add_Click(new EventHandler(this.newfolder_Click));
                    item2.add_Click(new EventHandler(this.settings_Click));
                    this.paste.add_Click(new EventHandler(this.paste_Click));
                    this.selectall.add_Click(new EventHandler(this.selectall_Click));
                    this.appbarcopy.add_Click(new EventHandler(this.copy_Click));
                    this.appbarcut.add_Click(new EventHandler(this.cut_Click));
                    this.appbarsearch.add_Click(new EventHandler(this.appbarsearch_Click));
                    this.appbarshare.add_Click(new EventHandler(this.shareMenuItem_Click));
                    item3.add_Click((param0, param1) => Application.get_Current().Terminate());
                    base.get_ApplicationBar().set_IsVisible(true);
                    base.get_ApplicationBar().set_BackgroundColor((Application.get_Current().get_Resources().get_Item("PhoneAccentBrush") as SolidColorBrush).get_Color());
                    base.get_ApplicationBar().set_Opacity(1.0);
                    base.get_ApplicationBar().set_ForegroundColor(Colors.get_White());
                }
            }
            catch
            {
            }
        }

        private async Task<int> Compress(string zipPath, string Path, List<File_Explorer.StorageItem> selectedItems)
        {
            Stream ZipStream;
            <>c__DisplayClass90 class3 = class2;
            Stream introduced24 = await File_Explorer.StorageExtension.OpenWriteAsync(zipPath);
            class3.ZipStream = introduced24;
            ZipArchive Zip = ZipArchive.Create();
            Zip.DeflateCompressionLevel = CompressionLevel.BestCompression;
            List<Stream> streams = new List<Stream>();
            List<File_Explorer.StorageItem>.Enumerator enumerator = selectedItems.GetEnumerator();
            try
            {
                while (enumerator.MoveNext())
                {
                    File_Explorer.StorageItem current = enumerator.Current;
                    if (!current.IsFolder)
                    {
                        Stream source = await File_Explorer.StorageExtension.OpenReadAsync(current.Path);
                        DateTime? modified = null;
                        Zip.AddEntry(current.Path.Replace(Path, ""), source, true, 0L, modified);
                        continue;
                    }
                    List<StorageFile> introduced26 = await File_Explorer.StorageExtension.GetAllFilesAsync(current.Path);
                    List<StorageFile>.Enumerator asyncVariable4 = introduced26.GetEnumerator();
                    try
                    {
                        while (asyncVariable4.MoveNext())
                        {
                            StorageFile windowsRuntimeFile = asyncVariable4.Current;
                            try
                            {
                                Stream item = await windowsRuntimeFile.OpenStreamForReadAsync();
                                streams.Add(item);
                                DateTime? nullable2 = null;
                                Zip.AddEntry(windowsRuntimeFile.get_Path().Replace(Path, ""), item, true, 0L, nullable2);
                                continue;
                            }
                            catch
                            {
                                continue;
                            }
                        }
                        continue;
                    }
                    finally
                    {
                        asyncVariable4.Dispose();
                    }
                }
            }
            finally
            {
                enumerator.Dispose();
            }
            return await Task<int>.Factory.StartNew(delegate {
                int num = 0;
                try
                {
                    Zip.SaveTo(ZipStream, 4);
                    ZipStream.Close();
                    Zip.Dispose();
                    num = 1;
                    foreach (Stream stream in streams)
                    {
                        try
                        {
                            stream.Close();
                            stream.Dispose();
                        }
                        catch
                        {
                        }
                    }
                    streams.Clear();
                }
                catch
                {
                    num = 0;
                    foreach (Stream stream2 in streams)
                    {
                        try
                        {
                            stream2.Dispose();
                        }
                        catch
                        {
                        }
                    }
                    streams.Clear();
                }
                GC.Collect();
                return num;
            });
        }

        private void compress_Click(object sender, RoutedEventArgs e)
        {
            if (File_Explorer.FileOperation.OperationInProgress)
            {
                MessageBox.Show("Another operation is already in progress", "Error", 0);
            }
            else
            {
                List<File_Explorer.StorageItem> selectedItems = new List<File_Explorer.StorageItem>();
                foreach (File_Explorer.StorageItem item in from x in File_Explorer.App.ViewModel.StorageSource
                    where x.IsSelected
                    select x)
                {
                    selectedItems.Add(item);
                }
                this.Selection(false, false);
                this.StartCompress(selectedItems, "zip");
            }
        }

        private CustomMessageBox ConflictMessageBox()
        {
            CustomMessageBox box = new CustomMessageBox {
                IsFullScreen = false
            };
            box.set_Background((SolidColorBrush) Application.get_Current().get_Resources().get_Item("PhoneChromeBrush"));
            File_Explorer.CustomMessageBox_Conflict conflict = new File_Explorer.CustomMessageBox_Conflict();
            box.set_Content(conflict);
            return box;
        }

        private void copy_Click(object sender, EventArgs e)
        {
            try
            {
                File_Explorer.FileOperation.OperationType = File_Explorer.FileOperationType.Copy;
                File_Explorer.FileOperation.FileList.Clear();
                foreach (File_Explorer.StorageItem item in from x in File_Explorer.App.ViewModel.StorageSource
                    where x.IsSelected
                    select x)
                {
                    File_Explorer.FileOperation.FileList.Add(item);
                }
                this.Selection(false, false);
                this.paste.set_IsEnabled(true);
            }
            catch
            {
            }
        }

        private void cut_Click(object sender, EventArgs e)
        {
            try
            {
                File_Explorer.FileOperation.OperationType = File_Explorer.FileOperationType.Move;
                File_Explorer.FileOperation.FileList.Clear();
                foreach (File_Explorer.StorageItem item in from x in File_Explorer.App.ViewModel.StorageSource
                    where x.IsSelected
                    select x)
                {
                    File_Explorer.FileOperation.FileList.Add(item);
                }
                this.Selection(false, false);
                this.paste.set_IsEnabled(true);
            }
            catch
            {
            }
        }

        private async void delete_Click(object sender, EventArgs e)
        {
            try
            {
                if (File_Explorer.FileOperation.OperationInProgress)
                {
                    MessageBox.Show("Another operation is already in progress", "Error", 0);
                    return;
                }
                File_Explorer.FileOperation.OperationInProgress = true;
                string deleteText = "this file?";
                List<File_Explorer.StorageItem> source = new List<File_Explorer.StorageItem>();
                source = (from x in File_Explorer.App.ViewModel.StorageSource
                    where x.IsSelected
                    select x).ToList<File_Explorer.StorageItem>();
                this.Selection(false, false);
                bool error = false;
                this.secondaryProgress.set_IsIndeterminate(true);
                if (source.Count <= 0)
                {
                    goto Label_0658;
                }
                if (source.Count == 1)
                {
                    deleteText = source.FirstOrDefault<File_Explorer.StorageItem>().IsFolder ? "this folder?" : "this file?";
                }
                else
                {
                    deleteText = "these " + source.Count + " items?";
                }
                if (MessageBox.Show("Are you sure you want to permanently delete " + deleteText, "Delete", 1) == 1)
                {
                    List<File_Explorer.StorageItem>.Enumerator enumerator = source.GetEnumerator();
                    try
                    {
                        while (enumerator.MoveNext())
                        {
                            File_Explorer.StorageItem current = enumerator.Current;
                            if (this.IsSystemFolder(current))
                            {
                                MessageBox.Show("Cannot delete this item", "Access is denied", 0);
                                goto Label_063A;
                            }
                            try
                            {
                                if (current.IsFolder)
                                {
                                    try
                                    {
                                        List<StorageFile> introduced25 = await File_Explorer.StorageExtension.GetAllFilesAsync(current.Path);
                                        List<StorageFile>.Enumerator asyncVariable1 = introduced25.GetEnumerator();
                                        try
                                        {
                                            while (asyncVariable1.MoveNext())
                                            {
                                                StorageFile file = asyncVariable1.Current;
                                                try
                                                {
                                                    await file.DeleteAsync();
                                                    continue;
                                                }
                                                catch
                                                {
                                                    error = true;
                                                    continue;
                                                }
                                            }
                                        }
                                        finally
                                        {
                                            asyncVariable1.Dispose();
                                        }
                                        List<StorageFolder> introduced27 = await File_Explorer.StorageExtension.GetAllFoldersAsync(current.Path);
                                        List<StorageFolder>.Enumerator asyncVariable2 = introduced27.GetEnumerator();
                                        try
                                        {
                                            while (asyncVariable2.MoveNext())
                                            {
                                                StorageFolder folder = asyncVariable2.Current;
                                                await folder.DeleteAsync(1);
                                            }
                                        }
                                        finally
                                        {
                                            asyncVariable2.Dispose();
                                        }
                                        try
                                        {
                                            File_Explorer.App.ViewModel.StorageSource.Remove(current);
                                        }
                                        catch
                                        {
                                        }
                                    }
                                    catch
                                    {
                                        error = true;
                                    }
                                    continue;
                                }
                                try
                                {
                                    StorageFile introduced30 = await StorageFile.GetFileFromPathAsync(current.Path);
                                    await introduced30.DeleteAsync(1);
                                    try
                                    {
                                        File_Explorer.App.ViewModel.StorageSource.Remove(current);
                                    }
                                    catch
                                    {
                                    }
                                    continue;
                                }
                                catch
                                {
                                    error = true;
                                }
                            }
                            catch
                            {
                                error = true;
                            }
                        }
                    }
                    finally
                    {
                        enumerator.Dispose();
                    }
                }
            Label_063A:
                if (error)
                {
                    MessageBox.Show("Some items could not be deleted", "Error", 0);
                }
            }
            catch
            {
            }
        Label_0658:
            File_Explorer.FileOperation.OperationInProgress = false;
            this.secondaryProgress.set_IsIndeterminate(false);
        }

        private CustomMessageBox EditMessageBox()
        {
            CustomMessageBox box = new CustomMessageBox {
                IsFullScreen = true
            };
            box.set_Background((SolidColorBrush) Application.get_Current().get_Resources().get_Item("PhoneChromeBrush"));
            File_Explorer.TextEditor editor = new File_Explorer.TextEditor();
            box.set_Content(editor);
            return box;
        }

        private async void extract_Click(object sender, RoutedEventArgs e)
        {
            if (File_Explorer.FileOperation.OperationInProgress)
            {
                MessageBox.Show("Another operation is already in progress", "Error", 0);
            }
            else
            {
                try
                {
                    this.secondaryProgress.set_IsIndeterminate(true);
                    File_Explorer.FileOperation.OperationInProgress = true;
                    this.Selection(false, false);
                    Stream stream = await File_Explorer.StorageExtension.OpenReadAsync(this.selectedItem.Path);
                    IArchive acvhive = ArchiveFactory.Open(stream, Options.None);
                    string path = this.selectedItem.Path.Replace(Path.GetExtension(this.selectedItem.Path), "");
                    StorageFolder introduced29 = await StorageFolder.GetFolderFromPathAsync(Path.GetDirectoryName(path));
                    await introduced29.CreateFolderAsync(Path.GetFileName(path), 3);
                    this.AddItem(path, true);
                    File_Explorer.CollisionMode none = File_Explorer.CollisionMode.None;
                    foreach (IArchiveEntry entry in acvhive.Entries)
                    {
                        try
                        {
                            if (entry.IsDirectory)
                            {
                                continue;
                            }
                            string directoryName = Path.GetDirectoryName(entry.FilePath);
                            string fullPath = this.GetFullPath(path + @"\" + directoryName + @"\" + Path.GetFileName(entry.FilePath));
                            if (directoryName.Length != 0)
                            {
                                try
                                {
                                    StorageFolder introduced30 = await StorageFolder.GetFolderFromPathAsync(path);
                                    await introduced30.CreateFolderAsync(directoryName);
                                }
                                catch
                                {
                                }
                            }
                            try
                            {
                                await StorageFile.GetFileFromPathAsync(fullPath);
                                if ((none != File_Explorer.CollisionMode.ReplaceAll) && (none != File_Explorer.CollisionMode.SkipAll))
                                {
                                    none = await this.ShowConflictMessageBox(Path.GetFileName(fullPath));
                                }
                            }
                            catch
                            {
                            }
                            switch (none)
                            {
                                case File_Explorer.CollisionMode.Skip:
                                case File_Explorer.CollisionMode.SkipAll:
                                {
                                    continue;
                                }
                            }
                            Stream asyncVariable0 = await File_Explorer.StorageExtension.OpenWriteAsync(fullPath);
                            entry.WriteTo(asyncVariable0);
                            asyncVariable0.Close();
                            continue;
                        }
                        catch
                        {
                            continue;
                        }
                    }
                    stream.Close();
                    this.secondaryProgress.set_IsIndeterminate(false);
                }
                catch
                {
                    this.secondaryProgress.set_IsIndeterminate(false);
                }
                File_Explorer.FileOperation.OperationInProgress = false;
            }
        }

        private void FileOperator_ProgressChanged(object sender, File_Explorer.FileOperationProgressChangedEventArgs e)
        {
            File_Explorer.App.RootFrame.get_Dispatcher().BeginInvoke(delegate {
                this.Progress.set_Value(this.Progress.get_Value() + e.ChangedSize);
                this.Operation_Left.set_Text(string.Concat(new object[] { "Items remaining: ", this.itemsRemaining, " (", FormatBytes(this.Progress.get_Maximum() - this.Progress.get_Value()), ")" }));
                this.Operation_Status.set_Text(string.Format("{0:0}", (this.Progress.get_Value() * 100.0) / this.Progress.get_Maximum()) + "% Completed");
            });
        }

        public static string FormatBytes(double Bytes)
        {
            if (Bytes <= 1024.0)
            {
                return (string.Format("{0:0}", Bytes) + " Bytes");
            }
            if (Bytes <= 1048576.0)
            {
                return (string.Format("{0:0}", Bytes / 1024.0) + " KB");
            }
            if (Bytes <= 1073741824.0)
            {
                return (string.Format("{0:0}", (Bytes / 1024.0) / 1024.0) + " MB");
            }
            return (string.Format("{0:0.00}", ((Bytes / 1024.0) / 1024.0) / 1024.0) + " GB");
        }

        private async Task<string> GenerateUniqueFilePath(string Path, string FileName)
        {
            string newName = FileName;
            try
            {
                await StorageFile.GetFileFromPathAsync(this.GetFullPath(Path + @"\" + FileName));
                string extension = Path.GetExtension(FileName);
                string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(FileName);
                int i = 1;
                while (true)
                {
                    newName = string.Concat(new object[] { fileNameWithoutExtension, " - (", i, ")", extension });
                    try
                    {
                        await StorageFile.GetFileFromPathAsync(this.GetFullPath(Path + @"\" + newName));
                    }
                    catch
                    {
                        goto Label_0233;
                    }
                    i++;
                }
            }
            catch
            {
            }
        Label_0233:
            return await Task<string>.Factory.StartNew(() => this.GetFullPath(Path + @"\" + newName));
        }

        private async Task<string> GenerateUniqueFolderPath(string Path, string FileName)
        {
            string newName = FileName;
            try
            {
                await StorageFolder.GetFolderFromPathAsync(this.GetFullPath(Path + @"\" + newName));
                int i = 1;
                while (true)
                {
                    newName = string.Concat(new object[] { FileName, " (", i, ")" });
                    try
                    {
                        await StorageFolder.GetFolderFromPathAsync(this.GetFullPath(Path + @"\" + newName));
                    }
                    catch
                    {
                        goto Label_01E0;
                    }
                    i++;
                }
            }
            catch
            {
            }
        Label_01E0:
            return await Task<string>.Factory.StartNew(() => newName);
        }

        private string GetFullPath(string Path)
        {
            string source = Path;
            while (source.First<char>() == '\\')
            {
                source = source.Remove(0, 1);
            }
            while (source.Contains(@"\"))
            {
                source = source.Replace(@"\", "*");
            }
            while (source.Contains("/"))
            {
                source = source.Replace("/", "*");
            }
            while (source.Contains("**"))
            {
                source = source.Replace("**", @"\");
            }
            while (source.Contains("***"))
            {
                source = source.Replace("***", @"\");
            }
            while (source.Contains("*"))
            {
                source = source.Replace("*", @"\");
            }
            while ((source.Last<char>() == '\\') || (source.Last<char>() == '/'))
            {
                source = source.Remove(source.Length - 1);
            }
            if (source.Last<char>() == ':')
            {
                source = source + @"\";
            }
            return source;
        }

        public async static Task<ImageSource> GetIcon(string extension, string Path, StorageFile sfile = null)
        {
            BitmapImage thumbSource = null;
            if (File_Explorer.App.ViewModel.IsThumbnailEnabled)
            {
                thumbSource = new BitmapImage();
                thumbSource.set_DecodePixelHeight(100);
                thumbSource.set_DecodePixelWidth(100);
                thumbSource.set_DecodePixelType(1);
                thumbSource.set_CreateOptions(0x10);
                if (extension == "Drive")
                {
                    thumbSource.set_UriSource(new Uri(@"Assets\Icons\Drive.png", UriKind.Relative));
                }
                else if (extension == "Folder")
                {
                    thumbSource.set_UriSource(new Uri(@"Assets\Icons\Folder.png", UriKind.Relative));
                }
                else if ((((extension.ToLower() == ".jpg") || (extension.ToLower() == ".png")) || ((extension.ToLower() == ".gif") || (extension.ToLower() == ".bmp"))) || ((((extension.ToLower() == ".jpeg") || (extension.ToLower() == ".mp4")) || ((extension.ToLower() == ".3gp") || (extension.ToLower() == ".mpg"))) || ((extension.ToLower() == ".wmv") || (extension.ToLower() == ".mov"))))
                {
                    if (thumbSource.get_PixelHeight() > thumbSource.get_PixelWidth())
                    {
                        thumbSource.set_DecodePixelWidth(100);
                        thumbSource.set_DecodePixelHeight(0);
                    }
                    else
                    {
                        thumbSource.set_DecodePixelHeight(100);
                        thumbSource.set_DecodePixelWidth(0);
                    }
                    if (sfile == null)
                    {
                        StorageFile file = await StorageFile.GetFileFromPathAsync(Path);
                        sfile = file;
                    }
                    BitmapImage image2 = thumbSource;
                    StorageItemThumbnail windowsRuntimeStream = await sfile.GetThumbnailAsync(4);
                    image2.SetSource(windowsRuntimeStream.AsStream());
                }
                else if (((extension.ToLower() == ".mp3") || (extension.ToLower() == ".aac")) || ((extension.ToLower() == ".wav") || (extension.ToLower() == ".wma")))
                {
                    thumbSource.set_UriSource(new Uri(@"Assets\Icons\mp3.png", UriKind.Relative));
                }
                else if (extension.ToLower() == ".zip")
                {
                    thumbSource.set_UriSource(new Uri(@"Assets\Icons\zip.png", UriKind.Relative));
                }
                else if (extension.ToLower() == ".rar")
                {
                    thumbSource.set_UriSource(new Uri(@"Assets\Icons\rar.png", UriKind.Relative));
                }
                else if (((extension.ToLower() == ".doc") || (extension.ToLower() == ".docx")) || ((extension.ToLower() == ".dot") || (extension.ToLower() == ".dotx")))
                {
                    thumbSource.set_UriSource(new Uri(@"Assets\Icons\doc.png", UriKind.Relative));
                }
                else if (((extension.ToLower() == ".xls") || (extension.ToLower() == ".xlsx")) || ((extension.ToLower() == ".xlt") || (extension.ToLower() == ".xltx")))
                {
                    thumbSource.set_UriSource(new Uri(@"Assets\Icons\xls.png", UriKind.Relative));
                }
                else if ((extension.ToLower() == ".ppt") || (extension.ToLower() == ".pptx"))
                {
                    thumbSource.set_UriSource(new Uri(@"Assets\Icons\ppt.png", UriKind.Relative));
                }
                else if (((extension.ToLower() == ".txt") || (extension.ToLower() == ".rtf")) || (extension.ToLower() == ".xml"))
                {
                    thumbSource.set_UriSource(new Uri(@"Assets\Icons\txt.png", UriKind.Relative));
                }
                else if (extension.ToLower() == ".pdf")
                {
                    thumbSource.set_UriSource(new Uri(@"Assets\Icons\pdf.png", UriKind.Relative));
                }
                else
                {
                    thumbSource.set_UriSource(new Uri(@"Assets\Icons\File.png", UriKind.Relative));
                }
            }
            return await Task<ImageSource>.Factory.StartNew(() => thumbSource);
        }

        private async Task<File_Explorer.FoldeProperies> GetItemsProperties(List<File_Explorer.StorageItem> Items)
        {
            ulong Size = 0L;
            List<StorageFile> Files = new List<StorageFile>();
            List<StorageFolder> Folders = new List<StorageFolder>();
            List<File_Explorer.StorageItem>.Enumerator asyncVariable2 = Items.GetEnumerator();
            try
            {
                while (asyncVariable2.MoveNext())
                {
                    <>c__DisplayClass1c asyncVariable1;
                    File_Explorer.StorageItem Item = asyncVariable2.Current;
                    if (Item.IsFolder)
                    {
                        File_Explorer.FoldeProperies properties = await File_Explorer.StorageExtension.GetFolderPropertiesAsync(Item.Path);
                        Size += properties.Size;
                        List<StorageFile>.Enumerator enumerator = properties.Files.GetEnumerator();
                        try
                        {
                            while (enumerator.MoveNext())
                            {
                                StorageFile current = enumerator.Current;
                                Files.Add(current);
                            }
                        }
                        finally
                        {
                            enumerator.Dispose();
                        }
                        List<StorageFolder>.Enumerator enumerator2 = properties.Folders.GetEnumerator();
                        try
                        {
                            while (enumerator2.MoveNext())
                            {
                                StorageFolder item = enumerator2.Current;
                                Folders.Add(item);
                            }
                            continue;
                        }
                        finally
                        {
                            enumerator2.Dispose();
                        }
                    }
                    StorageFile asyncVariable0 = await StorageFile.GetFileFromPathAsync(Item.Path);
                    Tuple<<>c__DisplayClass1c, ulong> tuple2 = new Tuple<<>c__DisplayClass1c, ulong>(asyncVariable1, Size);
                    BasicProperties introduced23 = await asyncVariable0.GetBasicPropertiesAsync();
                    tuple2.Item1.Size = tuple2.Item2 + introduced23.get_Size();
                    Files.Add(asyncVariable0);
                }
            }
            finally
            {
                asyncVariable2.Dispose();
            }
            return await Task<File_Explorer.FoldeProperies>.Factory.StartNew(() => new File_Explorer.FoldeProperies { Files = Files, Folders = Folders, Size = Size });
        }

        private void Grid_Hold_1(object sender, GestureEventArgs e)
        {
            try
            {
                File_Explorer.StorageItem item = this.selectedItem = (File_Explorer.StorageItem) (sender as FrameworkElement).get_DataContext();
                this.Selection(true, false);
                item.IsSelected = true;
                ContextMenu menu = new ContextMenu {
                    IsZoomEnabled = false
                };
                MenuItem item2 = new MenuItem {
                    Header = "Copy"
                };
                MenuItem item3 = new MenuItem {
                    Header = "Paste"
                };
                MenuItem item4 = new MenuItem {
                    Header = "Cut"
                };
                MenuItem item5 = new MenuItem {
                    Header = "Delete"
                };
                MenuItem item6 = new MenuItem {
                    Header = "Rename"
                };
                MenuItem item7 = new MenuItem {
                    Header = "Share"
                };
                MenuItem item8 = new MenuItem {
                    Header = "Compress"
                };
                MenuItem item9 = new MenuItem {
                    Header = "Extract"
                };
                MenuItem item10 = new MenuItem {
                    Header = "Properties"
                };
                item2.Click += new RoutedEventHandler(this, (IntPtr) this.copy_Click);
                item3.Click += new RoutedEventHandler(this, (IntPtr) this.paste_Click);
                item4.Click += new RoutedEventHandler(this, (IntPtr) this.cut_Click);
                item5.Click += new RoutedEventHandler(this, (IntPtr) this.delete_Click);
                item6.Click += new RoutedEventHandler(this, (IntPtr) this.renameMenuItem_Click);
                item8.Click += new RoutedEventHandler(this, (IntPtr) this.compress_Click);
                item9.Click += new RoutedEventHandler(this, (IntPtr) this.extract_Click);
                item10.Click += new RoutedEventHandler(this, (IntPtr) this.propertiesMenuItem_Click);
                item7.Click += new RoutedEventHandler(this, (IntPtr) this.shareMenuItem_Click);
                if (!this.IsSystemFolder(item))
                {
                    menu.get_Items().Add(item2);
                    menu.get_Items().Add(item4);
                    menu.get_Items().Add(item5);
                    menu.get_Items().Add(item6);
                    menu.get_Items().Add(item7);
                    menu.get_Items().Add(item8);
                    if (!this.selectedItem.IsFolder && this.IsArchive(this.selectedItem.Path))
                    {
                        menu.get_Items().Add(item9);
                    }
                }
                menu.get_Items().Add(item10);
                menu.Opened += new RoutedEventHandler(this, (IntPtr) this.Menu_Opened);
                ContextMenuService.SetContextMenu(sender as DependencyObject, menu);
            }
            catch
            {
            }
        }

        private void HideOperationBox_Completed_1(object sender, EventArgs e)
        {
        }

        private async void Image_Tap(object sender, GestureEventArgs e)
        {
            await Launcher.LaunchUriAsync(new Uri("zune:search?publisher=Annan Zubair", UriKind.RelativeOrAbsolute));
        }

        private void Init()
        {
            try
            {
                File_Explorer.FileOperation.FileList = new List<File_Explorer.StorageItem>();
                this.Navigate("");
            }
            catch
            {
            }
        }

        [DebuggerNonUserCode]
        public void InitializeComponent()
        {
            if (!this._contentLoaded)
            {
                this._contentLoaded = true;
                Application.LoadComponent(this, new Uri("/File%20Explorer;component/MainPage.xaml", UriKind.Relative));
                this.storyboard = (Storyboard) base.FindName("storyboard");
                this.ShowOperationBox = (Storyboard) base.FindName("ShowOperationBox");
                this.HideOperationBox = (Storyboard) base.FindName("HideOperationBox");
                this.ShowOperationDetails = (Storyboard) base.FindName("ShowOperationDetails");
                this.HideOperationDetails = (Storyboard) base.FindName("HideOperationDetails");
                this.LayoutRoot = (Grid) base.FindName("LayoutRoot");
                this.secondaryProgress = (ProgressBar) base.FindName("secondaryProgress");
                this.emptyFolder = (TextBlock) base.FindName("emptyFolder");
                this.TitlePanel = (StackPanel) base.FindName("TitlePanel");
                this.pathBackground = (Grid) base.FindName("pathBackground");
                this.pathScrollViewer = (ScrollViewer) base.FindName("pathScrollViewer");
                this.PathText = (TextBox) base.FindName("PathText");
                this.Navigate_Button = (Button) base.FindName("Navigate_Button");
                this.ContentPanel = (Grid) base.FindName("ContentPanel");
                this.transform = (TranslateTransform) base.FindName("transform");
                this.explorer = (LongListSelector) base.FindName("explorer");
                this.AdRoot = (Grid) base.FindName("AdRoot");
                this.OperationBox = (Grid) base.FindName("OperationBox");
                this.OperationDetails = (StackPanel) base.FindName("OperationDetails");
                this.Operation_Title = (TextBlock) base.FindName("Operation_Title");
                this.Operation_Name = (TextBlock) base.FindName("Operation_Name");
                this.Operation_Left = (TextBlock) base.FindName("Operation_Left");
                this.Progress = (ProgressBar) base.FindName("Progress");
                this.Operation_Status = (TextBlock) base.FindName("Operation_Status");
                this.Operation_Cancel = (Button) base.FindName("Operation_Cancel");
                this.UpDown = (Button) base.FindName("UpDown");
            }
        }

        private bool IsArchive(string p)
        {
            if ((!Path.GetExtension(p).Equals(".zip", StringComparison.OrdinalIgnoreCase) && !Path.GetExtension(p).Equals(".rar", StringComparison.OrdinalIgnoreCase)) && (!Path.GetExtension(p).Equals(".7z", StringComparison.OrdinalIgnoreCase) && !Path.GetExtension(p).Equals(".gzip", StringComparison.OrdinalIgnoreCase)))
            {
                return Path.GetExtension(p).Equals(".zip", StringComparison.OrdinalIgnoreCase);
            }
            return true;
        }

        public static bool IsMediaFile(string extension)
        {
            if ((!(extension.ToLower() == ".mp4") && !(extension.ToLower() == ".3gp")) && (!(extension.ToLower() == ".mpg") && !(extension.ToLower() == ".wmv")))
            {
                return (extension.ToLower() == ".mov");
            }
            return true;
        }

        private bool IsSystemFolder(File_Explorer.StorageItem Item)
        {
            if (((!this.PathEquals(Item.Path, this.phonePath + @"\Documents") && !this.PathEquals(Item.Path, this.phonePath + @"\Music")) && (!this.PathEquals(Item.Path, this.phonePath + @"\Pictures") && !this.PathEquals(Item.Path, this.phonePath + @"\Videos"))) && !(Item.FileName == "D:"))
            {
                return (Item.FileName == "C:");
            }
            return true;
        }

        private void Menu_Opened(object sender, RoutedEventArgs e)
        {
            try
            {
                (sender as ContextMenu).set_Style(Application.get_Current().get_Resources().get_Item("ContextMenuStyle") as Style);
            }
            catch
            {
            }
        }

        private async void Navigate(string Path)
        {
            try
            {
                bool flag2;
                bool flag3;
                bool flag4;
                this.cancel = false;
                if (this.IsBusy)
                {
                    goto Label_147E;
                }
                this.IsBusy = true;
                this.appbarshare.set_IsEnabled(flag2 = true);
                this.appbarcut.set_IsEnabled(flag3 = flag2);
                this.appbarcopy.set_IsEnabled(flag4 = flag3);
                this.delete.set_IsEnabled(flag4);
                this.emptyFolder.set_Visibility(1);
                File_Explorer.App.ViewModel.StorageSource.Clear();
                IReadOnlyList<StorageFile> source = new List<StorageFile>();
                if ((Path.ContainsPath(@"c:\pictures") || Path.ContainsPath(@"c:\documents")) || (Path.ContainsPath(@"c:\videos") || Path.ContainsPath(@"c:\music")))
                {
                    Path = this.phonePath + Path.Remove(0, 2);
                }
                else if (this.PathEquals(Path, "This Phone"))
                {
                    Path = "";
                }
                this.CurrentPath = Path;
                try
                {
                    this.CurrentPath = this.GetFullPath(Path);
                }
                catch
                {
                }
                this.PathText.set_Text(this.CurrentPath);
                if (this.CurrentPath.ContainsPath(this.phonePath))
                {
                    this.PathText.set_Text(this.CurrentPath.Replace(this.phonePath, "C:"));
                }
                if (this.CurrentPath == "")
                {
                    bool flag5;
                    bool flag6;
                    bool flag7;
                    this.appbarshare.set_IsEnabled(flag5 = false);
                    this.appbarcut.set_IsEnabled(flag6 = flag5);
                    this.appbarcopy.set_IsEnabled(flag7 = flag6);
                    this.delete.set_IsEnabled(flag7);
                    this.PathText.set_Text("This Phone");
                    string str = "";
                    File_Explorer.StorageItem item = new File_Explorer.StorageItem {
                        FileName = "C:",
                        IsFolder = true,
                        Path = "C:",
                        Description = "Phone" + str,
                        Style = (this.explorer.get_LayoutMode() == null) ? ((Style) Application.get_Current().get_Resources().get_Item("File")) : ((Style) Application.get_Current().get_Resources().get_Item("Folder"))
                    };
                    File_Explorer.App.ViewModel.StorageSource.Add(item);
                    File_Explorer.StorageItem item2 = new File_Explorer.StorageItem {
                        FileName = "D:",
                        IsFolder = true,
                        Path = "D:",
                        Description = "SD Card" + str,
                        Style = (this.explorer.get_LayoutMode() == null) ? ((Style) Application.get_Current().get_Resources().get_Item("File")) : ((Style) Application.get_Current().get_Resources().get_Item("Folder"))
                    };
                    File_Explorer.App.ViewModel.StorageSource.Add(item2);
                    goto Label_0BAE;
                }
                if (this.PathEquals(this.GetFullPath(this.CurrentPath), @"c:\") || this.PathEquals(this.CurrentPath, this.phonePath))
                {
                    bool flag8;
                    bool flag9;
                    bool flag10;
                    this.PathText.set_Text(@"C:\");
                    this.appbarshare.set_IsEnabled(flag8 = false);
                    this.appbarcut.set_IsEnabled(flag9 = flag8);
                    this.appbarcopy.set_IsEnabled(flag10 = flag9);
                    this.delete.set_IsEnabled(flag10);
                    File_Explorer.StorageItem asyncVariable0 = new File_Explorer.StorageItem {
                        FileName = "Music",
                        IsFolder = true,
                        Path = @"C:\Data\Users\Public\Music",
                        Description = "",
                        Style = (this.explorer.get_LayoutMode() == null) ? ((Style) Application.get_Current().get_Resources().get_Item("File")) : ((Style) Application.get_Current().get_Resources().get_Item("Folder"))
                    };
                    File_Explorer.App.ViewModel.StorageSource.Add(asyncVariable0);
                    File_Explorer.StorageItem asyncVariable1 = new File_Explorer.StorageItem {
                        FileName = "Pictures",
                        IsFolder = true,
                        Path = @"C:\Data\Users\Public\Pictures",
                        Description = "",
                        Style = (this.explorer.get_LayoutMode() == null) ? ((Style) Application.get_Current().get_Resources().get_Item("File")) : ((Style) Application.get_Current().get_Resources().get_Item("Folder"))
                    };
                    File_Explorer.App.ViewModel.StorageSource.Add(asyncVariable1);
                    File_Explorer.StorageItem asyncVariable2 = new File_Explorer.StorageItem {
                        FileName = "Videos",
                        IsFolder = true,
                        Path = @"C:\Data\Users\Public\Videos",
                        Description = "",
                        Style = (this.explorer.get_LayoutMode() == null) ? ((Style) Application.get_Current().get_Resources().get_Item("File")) : ((Style) Application.get_Current().get_Resources().get_Item("Folder"))
                    };
                    File_Explorer.App.ViewModel.StorageSource.Add(asyncVariable2);
                    try
                    {
                        using (IEnumerator<File_Explorer.StorageItem> asyncVariable5 = File_Explorer.App.ViewModel.StorageSource.GetEnumerator())
                        {
                            while (asyncVariable5.MoveNext())
                            {
                                File_Explorer.StorageItem Item = asyncVariable5.Current;
                                File_Explorer.StorageItem item6 = Item;
                                StorageFolder introduced62 = await StorageFolder.GetFolderFromPathAsync(Item.Path);
                                item6.Description = introduced62.get_DateCreated().ToString();
                            }
                        }
                    }
                    catch
                    {
                    }
                    goto Label_0BAE;
                }
                try
                {
                    StorageFolder introduced64 = await StorageFolder.GetFolderFromPathAsync(this.CurrentPath);
                    IReadOnlyList<StorageFolder> list = await introduced64.GetFoldersAsync();
                    IEnumerable<StorageFolder> Folders = list;
                    using (IEnumerator<StorageFolder> enumerator = Folders.GetEnumerator())
                    {
                        while (enumerator.MoveNext())
                        {
                            StorageFolder current = enumerator.Current;
                            try
                            {
                                if (this.cancel)
                                {
                                    goto Label_09CB;
                                }
                                File_Explorer.StorageItem item3 = new File_Explorer.StorageItem {
                                    FileName = current.get_Name(),
                                    IsFolder = true,
                                    Path = current.get_Path(),
                                    Description = current.get_DateCreated().ToString(),
                                    ThumbSource = null,
                                    Style = (this.explorer.get_LayoutMode() == null) ? ((Style) Application.get_Current().get_Resources().get_Item("File")) : ((Style) Application.get_Current().get_Resources().get_Item("Folder"))
                                };
                                File_Explorer.App.ViewModel.StorageSource.Add(item3);
                                continue;
                            }
                            catch
                            {
                                continue;
                            }
                        }
                    }
                }
                catch
                {
                }
            Label_09CB:
                try
                {
                    StorageFolder introduced68 = await StorageFolder.GetFolderFromPathAsync(this.CurrentPath);
                    source = await introduced68.GetFilesAsync();
                    using (IEnumerator<StorageFile> enumerator2 = source.GetEnumerator())
                    {
                        while (enumerator2.MoveNext())
                        {
                            StorageFile file = enumerator2.Current;
                            try
                            {
                                if (this.cancel)
                                {
                                    goto Label_0BAE;
                                }
                                if (!this.cancel)
                                {
                                    File_Explorer.StorageItem item4 = new File_Explorer.StorageItem {
                                        FileName = file.get_Name(),
                                        IsFolder = false,
                                        Path = file.get_Path(),
                                        Description = "",
                                        Style = (Style) Application.get_Current().get_Resources().get_Item("File"),
                                        IsMedia = IsMediaFile(Path.GetExtension(file.get_Name()))
                                    };
                                    File_Explorer.App.ViewModel.StorageSource.Add(item4);
                                }
                                continue;
                            }
                            catch
                            {
                                continue;
                            }
                        }
                    }
                }
                catch
                {
                }
            Label_0BAE:
                if ((File_Explorer.App.ViewModel.StorageSource.Count == 0) && !this.cancel)
                {
                    this.emptyFolder.set_Visibility(0);
                }
                if (this.NavigationMode == File_Explorer.NavigationType.Forward)
                {
                    IEasingFunction function;
                    ExponentialEase ease = new ExponentialEase();
                    ease.set_EasingMode(0);
                    ease.set_Exponent(5.0);
                    (this.storyboard.get_Children().get_Item(1) as DoubleAnimation).set_EasingFunction(function = ease);
                    (this.storyboard.get_Children().get_Item(0) as DoubleAnimation).set_EasingFunction(function);
                    (this.storyboard.get_Children().get_Item(0) as DoubleAnimation).set_From(new double?(Application.get_Current().get_Host().get_Content().get_ActualWidth()));
                    (this.storyboard.get_Children().get_Item(0) as DoubleAnimation).set_To(0.0);
                    (this.storyboard.get_Children().get_Item(1) as DoubleAnimation).set_From(0.0);
                    (this.storyboard.get_Children().get_Item(1) as DoubleAnimation).set_To(1.0);
                    this.NavigationMode = File_Explorer.NavigationType.None;
                    this.storyboard.Begin();
                }
                else if (this.NavigationMode == File_Explorer.NavigationType.Backward)
                {
                    IEasingFunction function2;
                    ExponentialEase ease2 = new ExponentialEase();
                    ease2.set_EasingMode(0);
                    ease2.set_Exponent(5.0);
                    (this.storyboard.get_Children().get_Item(1) as DoubleAnimation).set_EasingFunction(function2 = ease2);
                    (this.storyboard.get_Children().get_Item(0) as DoubleAnimation).set_EasingFunction(function2);
                    (this.storyboard.get_Children().get_Item(0) as DoubleAnimation).set_From(new double?(-Application.get_Current().get_Host().get_Content().get_ActualWidth()));
                    (this.storyboard.get_Children().get_Item(0) as DoubleAnimation).set_To(0.0);
                    (this.storyboard.get_Children().get_Item(1) as DoubleAnimation).set_From(0.0);
                    (this.storyboard.get_Children().get_Item(1) as DoubleAnimation).set_To(1.0);
                    this.NavigationMode = File_Explorer.NavigationType.None;
                    this.storyboard.Begin();
                }
                for (int j = 0; j < File_Explorer.App.ViewModel.StorageSource.Count; j++)
                {
                    Func<StorageFile, bool> predicate = null;
                    if (this.cancel)
                    {
                        break;
                    }
                    File_Explorer.StorageItem Item = null;
                    try
                    {
                        Item = File_Explorer.App.ViewModel.StorageSource[j];
                    }
                    catch
                    {
                    }
                    if (Item != null)
                    {
                        BitmapImage thumbSource = null;
                        try
                        {
                            if (!Item.IsFolder)
                            {
                                string extension = Path.GetExtension(Item.FileName).ToLower();
                                string subdesc = "";
                                if (predicate == null)
                                {
                                    predicate = x => x.get_Path().Equals(Item.Path);
                                }
                                StorageFile sfile = source.Where<StorageFile>(predicate).FirstOrDefault<StorageFile>();
                                if (this.explorer.get_LayoutMode() == null)
                                {
                                    switch (extension)
                                    {
                                        case ".mp4":
                                        case ".wav":
                                        case ".mpg":
                                        case ".mp3":
                                        case ".wma":
                                        case ".wmv":
                                        {
                                            MusicProperties introduced73 = await sfile.get_Properties().GetMusicPropertiesAsync();
                                            TimeSpan duration = introduced73.get_Duration();
                                            subdesc = " Duration: " + ((duration.Hours > 0) ? (duration.Hours.ToString("00") + ":") : "") + duration.Minutes.ToString("00") + ":" + duration.Seconds.ToString("00");
                                            break;
                                        }
                                    }
                                    BasicProperties introduced74 = await sfile.GetBasicPropertiesAsync();
                                    double bytes = introduced74.get_Size();
                                    string filesize = "Size: " + FormatBytes(bytes);
                                    Item.Description = filesize + subdesc;
                                }
                                if (File_Explorer.App.ViewModel.IsThumbnailEnabled)
                                {
                                    ImageSource introduced75 = await GetIcon(extension, Item.Path, sfile);
                                    BitmapImage image = (BitmapImage) introduced75;
                                    thumbSource = image;
                                }
                            }
                            else if (File_Explorer.App.ViewModel.IsThumbnailEnabled && (this.explorer.get_LayoutMode() == null))
                            {
                                if (Item.FileName.Equals("C:") || Item.FileName.Equals("D:"))
                                {
                                    ImageSource introduced76 = await GetIcon("Drive", Item.Path, null);
                                    image = (BitmapImage) introduced76;
                                    thumbSource = image;
                                }
                                else
                                {
                                    ImageSource introduced77 = await GetIcon("Folder", Item.Path, null);
                                    image = (BitmapImage) introduced77;
                                    thumbSource = image;
                                }
                            }
                            if (!this.cancel)
                            {
                                Item.ThumbSource = thumbSource;
                            }
                        }
                        catch
                        {
                        }
                    }
                }
            }
            catch
            {
            }
        Label_147E:
            this.IsBusy = false;
        }

        private void Navigate_Button_Click(object sender, RoutedEventArgs e)
        {
            if (this.PathText.get_Text().Contains("36101-4042035-5-free"))
            {
                IsolatedStorageSettings.get_ApplicationSettings().set_Item("IsTrial", false);
                IsolatedStorageSettings.get_ApplicationSettings().Save();
            }
            else if (this.PathText.get_Text().Contains("36101-4042035-5-trial"))
            {
                IsolatedStorageSettings.get_ApplicationSettings().set_Item("IsTrial", true);
                IsolatedStorageSettings.get_ApplicationSettings().Save();
            }
            else if (this.PathText.get_Text().Contains("36101-4042035-5-en-1"))
            {
                File_Explorer.App.ViewModel.NotifyError = true;
            }
            else if (this.PathText.get_Text().Contains("36101-4042035-5-en-0"))
            {
                File_Explorer.App.ViewModel.NotifyError = false;
            }
            if ((((string) this.Navigate_Button.get_Content()) == "") || (((string) this.Navigate_Button.get_Content()) == ""))
            {
                this.Navigate(this.PathText.get_Text());
            }
            else if (((string) this.Navigate_Button.get_Content()) == "")
            {
                this.StopSearch();
            }
            else
            {
                this.StartSearch();
            }
        }

        private async void newfolder_Click(object sender, EventArgs e)
        {
            try
            {
                <>c__DisplayClassc8 asyncVariable0;
                TextBox box2;
                CustomMessageBox Input = this.TextInputMessageBox();
                File_Explorer.CustomMessageBox_Input Content = Input.get_Content() as File_Explorer.CustomMessageBox_Input;
                string result = await this.GenerateUniqueFolderPath(this.CurrentPath, "New Folder");
                box2.set_Text(result);
                Content.OK_Button.add_Click(new RoutedEventHandler(asyncVariable0, (IntPtr) this.<newfolder_Click>b__c7));
                Input.Show();
                this.IsOpen = true;
            }
            catch
            {
            }
        }

        private void OnAdReceived(object sender, AdEventArgs e)
        {
            this.AdLoaded = true;
            (sender as AdView).set_Height(80.0);
        }

        protected override void OnBackKeyPress(CancelEventArgs e)
        {
            try
            {
                if (this.IsOpen)
                {
                    e.Cancel = true;
                    this.IsOpen = false;
                    this.Selection(false, false);
                }
                else if (this.SelectionEnabled)
                {
                    e.Cancel = true;
                    this.Selection(false, false);
                }
                else if (this.IsSearchEnabled)
                {
                    e.Cancel = true;
                    this.cancel = true;
                    this.IsSearchEnabled = false;
                    this.StopSearch();
                    this.Navigate_Button.set_Content("");
                    this.StartNavigate(this.CurrentPath, File_Explorer.NavigationType.Backward);
                }
                else if (this.CurrentPath.Length > 0)
                {
                    e.Cancel = true;
                    this.cancel = true;
                    string directoryName = "";
                    try
                    {
                        directoryName = Path.GetDirectoryName(this.CurrentPath);
                    }
                    catch
                    {
                        directoryName = "";
                    }
                    if (directoryName == null)
                    {
                        directoryName = "";
                    }
                    if (this.PathEquals(directoryName, this.phonePath))
                    {
                        this.StartNavigate("C:", File_Explorer.NavigationType.Backward);
                    }
                    else
                    {
                        this.StartNavigate(directoryName, File_Explorer.NavigationType.Backward);
                    }
                }
            }
            catch
            {
            }
            base.OnBackKeyPress(e);
        }

        private void OnFailedToReceiveAd(object sender, AdErrorEventArgs e)
        {
            if (!this.AdLoaded)
            {
                (sender as AdView).set_Height(0.0);
            }
        }

        protected override void OnNavigatedFrom(NavigationEventArgs e)
        {
            File_Explorer.App.ViewModel.PropertyChanged -= new PropertyChangedEventHandler(this.ViewModel_PropertyChanged);
            base.OnNavigatedFrom(e);
        }

        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            if ((Application.get_Current() as File_Explorer.App).IsTrial)
            {
                try
                {
                    if (e.get_NavigationMode() == null)
                    {
                        AdView bannerAd = new AdView {
                            Format = 0,
                            AdUnitID = "ca-app-pub-3104681457180931/7671789409"
                        };
                        bannerAd.set_Width(480.0);
                        bannerAd.set_Height(80.0);
                        bannerAd.set_VerticalAlignment(2);
                        bannerAd.set_HorizontalAlignment(2);
                        bannerAd.ReceivedAd += new EventHandler<AdEventArgs>(this.OnAdReceived);
                        bannerAd.FailedToReceiveAd += new EventHandler<AdErrorEventArgs>(this.OnFailedToReceiveAd);
                        this.AdRoot.get_Children().Add(bannerAd);
                        AdRequest adRequest = new AdRequest();
                        bannerAd.LoadAd(adRequest);
                        DispatcherTimer timer2 = new DispatcherTimer();
                        timer2.set_Interval(TimeSpan.FromMinutes(1.0));
                        DispatcherTimer timer = timer2;
                        timer.add_Tick(delegate (object param0, EventArgs param1) {
                            adRequest = new AdRequest();
                            bannerAd.LoadAd(adRequest);
                        });
                        timer.Start();
                    }
                }
                catch
                {
                }
            }
            else
            {
                this.AdRoot.set_Visibility(1);
            }
            File_Explorer.App.ViewModel.PropertyChanged += new PropertyChangedEventHandler(this.ViewModel_PropertyChanged);
            if (base.get_ApplicationBar() != null)
            {
                base.get_ApplicationBar().set_BackgroundColor((Application.get_Current().get_Resources().get_Item("PhoneAccentBrush") as SolidColorBrush).get_Color());
            }
            base.OnNavigatedTo(e);
        }

        private void Operation_Cancel_Click_1(object sender, RoutedEventArgs e)
        {
            File_Explorer.FileOperation.CancelOperation();
            base.get_Dispatcher().BeginInvoke(() => this.HideOperationBox.Begin());
        }

        private CustomMessageBox OperationMessageBox()
        {
            CustomMessageBox box = new CustomMessageBox();
            box.set_Background((SolidColorBrush) Application.get_Current().get_Resources().get_Item("PhoneChromeBrush"));
            File_Explorer.CustomMessageBox_FileOperation operation = new File_Explorer.CustomMessageBox_FileOperation();
            box.set_Content(operation);
            return box;
        }

        private void paste_Click(object sender, EventArgs e)
        {
            if (File_Explorer.FileOperation.OperationInProgress)
            {
                MessageBox.Show("Another operation is already in progress", "Error", 0);
            }
            else
            {
                this.Operation_Title.set_Text("Calculating items...");
                this.Operation_Left.set_Text("Item remaining: Calculating");
                this.Operation_Status.set_Text("0% Complete");
                this.Operation_Name.set_Text("Name: ");
                this.Progress.set_Value(0.0);
                this.Progress.set_IsIndeterminate(true);
                this.ShowOperationBox.Begin();
                this.StartPaste();
                File_Explorer.FileOperation.OperationInProgress = false;
            }
        }

        private bool PathEquals(string Path1, string Path2)
        {
            string str = Path1.ToLower();
            string str2 = Path2.ToLower();
            try
            {
                while (str.Contains(@"\"))
                {
                    str = str.Replace(@"\", "");
                }
                while (str2.Contains(@"\"))
                {
                    str2 = str2.Replace(@"\", "");
                }
                while (str.Contains("/"))
                {
                    str = str.Replace("/", "");
                }
                while (str2.Contains("/"))
                {
                    str2 = str2.Replace("/", "");
                }
            }
            catch
            {
            }
            return (str == str2);
        }

        private void PathText_GotFocus(object sender, RoutedEventArgs e)
        {
            this.Navigate_Button.set_Foreground((SolidColorBrush) Application.get_Current().get_Resources().get_Item(!File_Explorer.App.ViewModel.IsLightTheme ? "PhoneBackgroundBrush" : "PhoneForegroundBrush"));
            this.pathBackground.set_Background((SolidColorBrush) Application.get_Current().get_Resources().get_Item("PhoneTextBoxEditBackgroundBrush"));
            if (!this.IsSearchEnabled)
            {
                this.Navigate_Button.set_Content("");
            }
        }

        private void PathText_LostFocus(object sender, RoutedEventArgs e)
        {
            this.Navigate_Button.set_Foreground((SolidColorBrush) Application.get_Current().get_Resources().get_Item("PhoneForegroundBrush"));
            this.pathBackground.set_Background(null);
            if (!this.IsSearchEnabled)
            {
                this.Navigate_Button.set_Content("");
            }
        }

        private void PhoneTextBox_ActionIconTapped(object sender, EventArgs e)
        {
            MessageBox.Show((sender as TextBox).get_Text());
        }

        private async void propertiesMenuItem_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                <>c__DisplayClassa9 asyncVariable0;
                string text1;
                IEnumerable<File_Explorer.StorageItem> enumerable;
                IEnumerable<File_Explorer.StorageItem> enumerable2;
                Visibility visibility;
                Visibility visibility4;
                Visibility visibility5;
                Visibility visibility6;
                Visibility visibility7;
                Visibility visibility8;
                Visibility visibility9;
                TextBlock itemCreated;
                TextBlock itemModified;
                TextBlock expressionStack_810_0;
                TextBlock itemType;
                TextBlock expressionStack_420_0;
                List<File_Explorer.StorageItem> selectedItems;
                List<File_Explorer.StorageItem> expressionStack_90D_0;
                TextBlock expressionStack_43E_0;
                TextBlock expressionStack_437_0;
                List<File_Explorer.StorageItem> expressionStack_94D_0;
                List<File_Explorer.StorageItem> expressionStack_93C_0;
                TextBlock expressionStack_A6F_0;
                TextBlock expressionStack_A65_0;
                TextBlock expressionStack_A82_0;
                TextBlock expressionStack_A79_0;
                TextBlock expressionStack_AC7_0;
                TextBlock expressionStack_59F_0;
                TextBlock expressionStack_ACC_1;
                TextBlock expressionStack_A89_0;
                TextBlock expressionStack_AA6_0;
                TextBlock expressionStack_A9F_0;
                TextBlock expressionStack_ABF_1;
                List<File_Explorer.StorageItem> selectedItems = new List<File_Explorer.StorageItem>();
                if (this.selectedItem.FileName == "C:")
                {
                    File_Explorer.StorageItem item = new File_Explorer.StorageItem {
                        FileName = "Music",
                        IsFolder = true,
                        Path = @"C:\Data\Users\Public\Music",
                        Description = ""
                    };
                    selectedItems.Add(item);
                    File_Explorer.StorageItem item2 = new File_Explorer.StorageItem {
                        FileName = "Pictures",
                        IsFolder = true,
                        Path = @"C:\Data\Users\Public\Pictures",
                        Description = ""
                    };
                    selectedItems.Add(item2);
                    File_Explorer.StorageItem item3 = new File_Explorer.StorageItem {
                        FileName = "Videos",
                        IsFolder = true,
                        Path = @"C:\Data\Users\Public\Videos",
                        Description = ""
                    };
                    selectedItems.Add(item3);
                }
                else
                {
                    ObservableCollection<File_Explorer.StorageItem> storageSource;
                    ObservableCollection<File_Explorer.StorageItem> expressionStack_15C_0;
                    if (CS$<>9__CachedAnonymousMethodDelegatea6 != null)
                    {
                        storageSource = File_Explorer.App.ViewModel.StorageSource;
                        break;
                    }
                    else
                    {
                        expressionStack_15C_0 = File_Explorer.App.ViewModel.StorageSource;
                    }
                    expressionStack_15C_0 = "";
                    CS$<>9__CachedAnonymousMethodDelegatea6 = x => x.IsSelected;
                    storageSource = expressionStack_15C_0;
                    using (IEnumerator<File_Explorer.StorageItem> enumerator = storageSource.Where<File_Explorer.StorageItem>(CS$<>9__CachedAnonymousMethodDelegatea6).GetEnumerator())
                    {
                        while (enumerator.MoveNext())
                        {
                            File_Explorer.StorageItem current = enumerator.Current;
                            selectedItems.Add(current);
                        }
                    }
                }
                this.Selection(false, false);
                CustomMessageBox Properties = this.PropertiesMessageBox();
                Properties.Dismissed += delegate (object param0, DismissedEventArgs param1) {
                    selectedItems.Clear();
                    this.IsOpen = false;
                };
                File_Explorer.CustomMessageBox_Properties Content = (File_Explorer.CustomMessageBox_Properties) Properties.get_Content();
                Content.set_Height(Application.get_Current().get_Host().get_Content().get_ActualHeight() - 10.0);
                Content.ContentPanel.set_Visibility(1);
                Content.Progress.set_IsIndeterminate(true);
                Content.Button_OK.add_Click(new RoutedEventHandler(asyncVariable0, (IntPtr) this.<propertiesMenuItem_Click>b__a2));
                Properties.Show();
                this.IsOpen = true;
                File_Explorer.FoldeProperies properties = await this.GetItemsProperties(selectedItems);
                double size = properties.Size;
                string Size = FormatBytes(size);
                string SizeBytes = " (" + size + " bytes)";
                if ((selectedItems.Count != 1) || !selectedItems.FirstOrDefault<File_Explorer.StorageItem>().IsFolder)
                {
                    goto Label_0630;
                }
                File_Explorer.StorageItem Item = selectedItems.FirstOrDefault<File_Explorer.StorageItem>();
                Content.ItemModified.set_Visibility((Visibility) (visibility = 1));
                Content.Header_Modified.set_Visibility(visibility);
                Content.Header_Name.set_Text("Folder:");
                Content.ItemName.set_Text(Item.FileName);
                if (Item.FileName == "D:")
                {
                    itemType = Content.ItemType;
                    goto Label_0445;
                }
                else
                {
                    expressionStack_420_0 = Content.ItemType;
                }
                if (Item.FileName == "C:")
                {
                    expressionStack_43E_0 = expressionStack_420_0;
                    goto Label_043E;
                }
                else
                {
                    expressionStack_437_0 = expressionStack_420_0;
                }
                TextBlock expressionStack_44A_1 = expressionStack_437_0;
                string expressionStack_44A_0 = "File Folder";
                goto Label_044A;
            Label_043E:
                expressionStack_44A_1 = expressionStack_43E_0;
                expressionStack_44A_0 = "Phone";
                goto Label_044A;
            Label_0445:
                expressionStack_44A_1 = itemType;
                expressionStack_44A_0 = "SD Card";
            Label_044A:
                expressionStack_44A_1.set_Text(expressionStack_44A_0);
                if ((Item.FileName == "C:") || (Item.FileName == "D:"))
                {
                    Visibility visibility2;
                    Content.Header_Location.set_Visibility((Visibility) (visibility2 = 1));
                    Content.ItemLocation.set_Visibility(visibility2);
                }
                try
                {
                    Content.ItemLocation.set_Text(Path.GetDirectoryName(Item.Path));
                }
                catch
                {
                    Visibility visibility3;
                    Content.Header_Location.set_Visibility((Visibility) (visibility3 = 1));
                    Content.ItemLocation.set_Visibility(visibility3);
                }
                Content.ItemSize.set_Text(Size + SizeBytes);
                Content.ItemContains.set_Text(string.Concat(new object[] { properties.Files.Count, " Files, ", properties.Folders.Count - 1, " Folders" }));
                if (awaiter3.IsCompleted)
                {
                    itemCreated = Content.ItemCreated;
                    goto Label_0603;
                }
                else
                {
                    expressionStack_59F_0 = Content.ItemCreated;
                }
                TextBlock block = expressionStack_59F_0;
                this.<>t__stack = block;
                this.<>1__state = 1;
                AsyncVoidMethodBuilder.Create().AwaitUnsafeOnCompleted<TaskAwaiter<StorageFolder>, <propertiesMenuItem_Click>d__ad>(ref awaiter3, ref this);
                return;
                TextBlock block2 = (TextBlock) this.<>t__stack;
                this.<>t__stack = null;
                itemCreated = block2;
            Label_0603:
                StorageFolder introduced44 = await StorageFolder.GetFolderFromPathAsync(Item.Path);
                itemCreated.set_Text(introduced44.get_DateCreated().ToString());
                goto Label_0B26;
            Label_0630:
                if ((selectedItems.Count != 1) || selectedItems.FirstOrDefault<File_Explorer.StorageItem>().IsFolder)
                {
                    goto Label_08A1;
                }
                File_Explorer.StorageItem Item = selectedItems.FirstOrDefault<File_Explorer.StorageItem>();
                StorageFile storagefile = null;
                storagefile = await StorageFile.GetFileFromPathAsync(Item.Path);
                Content.Header_Contains.set_Visibility((Visibility) (visibility4 = 1));
                Content.ItemContains.set_Visibility(visibility4);
                Content.Header_Name.set_Text("File:");
                Content.ItemName.set_Text(Item.FileName);
                Content.ItemType.set_Text(Path.GetExtension(Item.Path).Replace(".", ""));
                Content.ItemLocation.set_Text(Path.GetDirectoryName(Item.Path));
                Content.ItemSize.set_Text(Size + SizeBytes);
                Content.ItemCreated.set_Text(storagefile.get_DateCreated().ToString());
                if (awaiter7.IsCompleted)
                {
                    itemModified = Content.ItemModified;
                    goto Label_0874;
                }
                else
                {
                    expressionStack_810_0 = Content.ItemModified;
                }
                TextBlock block3 = expressionStack_810_0;
                this.<>t__stack = block3;
                this.<>1__state = 3;
                AsyncVoidMethodBuilder.Create().AwaitUnsafeOnCompleted<TaskAwaiter<BasicProperties>, <propertiesMenuItem_Click>d__ad>(ref awaiter7, ref this);
                return;
                TextBlock block4 = (TextBlock) this.<>t__stack;
                this.<>t__stack = null;
                itemModified = block4;
            Label_0874:
                BasicProperties introduced46 = await storagefile.GetBasicPropertiesAsync();
                itemModified.set_Text(introduced46.get_DateModified().ToString());
                goto Label_0B26;
            Label_08A1:
                if (selectedItems.Count <= 1)
                {
                    goto Label_0B26;
                }
                int count = properties.Folders.Count;
                int num2 = properties.Files.Count;
                string fileExtension = "";
                if (CS$<>9__CachedAnonymousMethodDelegatea7 != null)
                {
                    selectedItems = selectedItems;
                    goto Label_091E;
                }
                else
                {
                    expressionStack_90D_0 = selectedItems;
                }
                CS$<>9__CachedAnonymousMethodDelegatea7 = x => x.IsFolder;
                selectedItems = expressionStack_90D_0;
            Label_091E:
                enumerable = selectedItems.Where<File_Explorer.StorageItem>(CS$<>9__CachedAnonymousMethodDelegatea7);
                if (CS$<>9__CachedAnonymousMethodDelegatea8 != null)
                {
                    expressionStack_94D_0 = selectedItems;
                    goto Label_094D;
                }
                else
                {
                    expressionStack_93C_0 = selectedItems;
                }
                CS$<>9__CachedAnonymousMethodDelegatea8 = x => !x.IsFolder;
                expressionStack_94D_0 = expressionStack_93C_0;
            Label_094D:
                enumerable2 = expressionStack_94D_0.Where<File_Explorer.StorageItem>(CS$<>9__CachedAnonymousMethodDelegatea8);
                if (enumerable2.Count<File_Explorer.StorageItem>() > 0)
                {
                    fileExtension = Path.GetExtension(enumerable2.FirstOrDefault<File_Explorer.StorageItem>().Path);
                }
                Content.Header_Contains.set_Visibility((Visibility) (visibility5 = 1));
                Content.ItemContains.set_Visibility(visibility6 = visibility5);
                Content.Header_Modified.set_Visibility(visibility7 = visibility6);
                Content.ItemModified.set_Visibility(visibility8 = visibility7);
                Content.Header_Created.set_Visibility(visibility9 = visibility8);
                Content.ItemCreated.set_Visibility(visibility9);
                Content.Header_Name.set_Text("Items:");
                Content.ItemName.set_Text(string.Concat(new object[] { num2, " files, ", count, " folders" }));
                if (enumerable2.Count<File_Explorer.StorageItem>() != 0)
                {
                    expressionStack_A6F_0 = Content.ItemType;
                    goto Label_0A6F;
                }
                else
                {
                    expressionStack_A65_0 = Content.ItemType;
                }
                if (enumerable.Count<File_Explorer.StorageItem>() > 0)
                {
                    expressionStack_AC7_0 = expressionStack_A65_0;
                    goto Label_0AC7;
                }
                else
                {
                    expressionStack_A6F_0 = expressionStack_A65_0;
                }
            Label_0A6F:
                if (enumerable2.Count<File_Explorer.StorageItem>() <= 0)
                {
                    expressionStack_A82_0 = expressionStack_A6F_0;
                    goto Label_0A82;
                }
                else
                {
                    expressionStack_A79_0 = expressionStack_A6F_0;
                }
                if (enumerable.Count<File_Explorer.StorageItem>() == 0)
                {
                    expressionStack_A89_0 = expressionStack_A79_0;
                    goto Label_0A89;
                }
                else
                {
                    expressionStack_A82_0 = expressionStack_A79_0;
                }
            Label_0A82:
                expressionStack_ACC_1 = expressionStack_A82_0;
                string expressionStack_ACC_0 = "Multiple Types";
                goto Label_0ACC;
            Label_0A89:
                if (enumerable2.All<File_Explorer.StorageItem>(x => new FileInfo(x.Path).Extension.Equals(fileExtension)))
                {
                    expressionStack_AA6_0 = expressionStack_A89_0;
                    goto Label_0AA6;
                }
                else
                {
                    expressionStack_A9F_0 = expressionStack_A89_0;
                }
                expressionStack_ACC_1 = expressionStack_A9F_0;
                expressionStack_ACC_0 = "Multiple Types";
                goto Label_0ACC;
            Label_0AA6:
                text1 = fileExtension.Replace(".", "");
                if (text1 != null)
                {
                    expressionStack_ACC_1 = expressionStack_AA6_0;
                    expressionStack_ACC_0 = text1;
                    goto Label_0ACC;
                }
                else
                {
                    expressionStack_ABF_1 = expressionStack_AA6_0;
                    string expressionStack_ABF_0 = text1;
                }
                expressionStack_ACC_1 = expressionStack_ABF_1;
                expressionStack_ACC_0 = "";
                goto Label_0ACC;
            Label_0AC7:
                expressionStack_ACC_1 = expressionStack_AC7_0;
                expressionStack_ACC_0 = "File folder";
            Label_0ACC:
                expressionStack_ACC_1.set_Text(expressionStack_ACC_0);
                Content.ItemLocation.set_Text("All in " + Path.GetDirectoryName(selectedItems.FirstOrDefault<File_Explorer.StorageItem>().Path));
                Content.ItemSize.set_Text(Size + SizeBytes);
            Label_0B26:
                Content.ContentPanel.set_Visibility(0);
                Content.Progress.set_IsIndeterminate(false);
            }
            catch
            {
            }
        }

        private CustomMessageBox PropertiesMessageBox()
        {
            CustomMessageBox box = new CustomMessageBox {
                IsFullScreen = true
            };
            box.set_Background((SolidColorBrush) Application.get_Current().get_Resources().get_Item("PhoneChromeBrush"));
            File_Explorer.CustomMessageBox_Properties properties = new File_Explorer.CustomMessageBox_Properties();
            box.set_Content(properties);
            return box;
        }

        private void Refresh()
        {
            this.Navigate(this.CurrentPath);
        }

        private void renameMenuItem_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (this.selectedItem != null)
                {
                    <>c__DisplayClassbc classbc;
                    this.Selection(false, false);
                    CustomMessageBox Input = this.TextInputMessageBox();
                    File_Explorer.CustomMessageBox_Input Content = Input.get_Content() as File_Explorer.CustomMessageBox_Input;
                    Content.Input.set_Text(this.selectedItem.FileName);
                    Content.OK_Button.add_Click(new RoutedEventHandler(classbc, (IntPtr) this.<renameMenuItem_Click>b__bb));
                    Input.Show();
                    this.IsOpen = true;
                }
            }
            catch
            {
            }
        }

        public static string ReplacePath(string Source, int startIndex, string oldValue, string newValue)
        {
            string str = Source.ToLower();
            while (str.Contains(@"\"))
            {
                str = str.Replace(@"\", "*");
            }
            while (str.Contains("/"))
            {
                str = str.Replace("/", "*");
            }
            while (str.Contains("**"))
            {
                str = str.Replace("**", @"\");
            }
            while (str.Contains("***"))
            {
                str = str.Replace("***", @"\");
            }
            while (str.Contains("*"))
            {
                str = str.Replace("*", @"\");
            }
            if (str.Length > (startIndex + oldValue.Length))
            {
                str = newValue + str.Remove(startIndex, oldValue.Length);
            }
            return str;
        }

        private void SearchCompleated(IAsyncAction asyncInfo, AsyncStatus asyncStatus)
        {
            if (this.IsSearchEnabled)
            {
                this.Navigate_Button.set_Content("");
            }
            this.secondaryProgress.set_IsIndeterminate(false);
        }

        private void select_Click(object sender, EventArgs e)
        {
            this.Selection(true, true);
        }

        private void selectall_Click(object sender, EventArgs e)
        {
            this.Selection(true, true);
            foreach (File_Explorer.StorageItem item in File_Explorer.App.ViewModel.StorageSource)
            {
                item.IsSelected = true;
            }
        }

        private void Selection(bool selection, bool showAppBar)
        {
            this.SelectionEnabled = selection;
            if (showAppBar)
            {
                base.get_ApplicationBar().get_Buttons().Clear();
                base.get_ApplicationBar().get_Buttons().Add(this.appbarcopy);
                base.get_ApplicationBar().get_Buttons().Add(this.appbarcut);
                base.get_ApplicationBar().get_Buttons().Add(this.delete);
                base.get_ApplicationBar().get_Buttons().Add(this.appbarshare);
                base.get_ApplicationBar().set_Mode(0);
            }
            else
            {
                base.get_ApplicationBar().set_Mode(1);
                base.get_ApplicationBar().get_Buttons().Clear();
                base.get_ApplicationBar().get_Buttons().Add(this.select);
                base.get_ApplicationBar().get_Buttons().Add(this.appbarsearch);
            }
            if (!selection)
            {
                foreach (File_Explorer.StorageItem item in File_Explorer.App.ViewModel.StorageSource)
                {
                    if (item.IsSelected)
                    {
                        item.IsSelected = false;
                    }
                }
            }
        }

        private CustomMessageBox Settings()
        {
            CustomMessageBox box = new CustomMessageBox {
                IsFullScreen = false
            };
            box.add_Loaded(new RoutedEventHandler(this, (IntPtr) this.<Settings>b__12));
            box.Dismissed += delegate (object param0, DismissedEventArgs param1) {
                this.IsOpen = false;
            };
            File_Explorer.Settings Content = new File_Explorer.Settings();
            Content.themeSwitch.set_Content(File_Explorer.App.ViewModel.IsLightTheme ? "Light" : "Dark");
            Content.themeSwitch.Checked += delegate (object param0, RoutedEventArgs param1) {
                Content.themeSwitch.set_Content("Light");
            };
            Content.themeSwitch.Unchecked += delegate (object param0, RoutedEventArgs param1) {
                Content.themeSwitch.set_Content("Dark");
            };
            Content.set_Height(Application.get_Current().get_Host().get_Content().get_ActualHeight() - 10.0);
            box.set_Background((SolidColorBrush) Application.get_Current().get_Resources().get_Item("PhoneBackgroundBrush"));
            box.set_Content(Content);
            return box;
        }

        private void settings_Click(object sender, EventArgs e)
        {
            this.Settings().Show();
        }

        private async void shareMenuItem_Click(object sender, EventArgs e)
        {
            TypedEventHandler<DataTransferManager, DataRequestedEventArgs> handler = null;
            if (!File_Explorer.FileOperation.OperationInProgress)
            {
                this.secondaryProgress.set_IsIndeterminate(true);
            }
            List<StorageFile> selectedItems = new List<StorageFile>();
            using (IEnumerator<File_Explorer.StorageItem> asyncVariable2 = (from x in File_Explorer.App.ViewModel.StorageSource
                where x.IsSelected
                select x).GetEnumerator())
            {
                while (asyncVariable2.MoveNext())
                {
                    File_Explorer.StorageItem Item = asyncVariable2.Current;
                    if (Item.IsFolder)
                    {
                        List<StorageFile> introduced13 = await File_Explorer.StorageExtension.GetAllFilesAsync(Item.Path);
                        List<StorageFile>.Enumerator enumerator = introduced13.GetEnumerator();
                        try
                        {
                            while (enumerator.MoveNext())
                            {
                                StorageFile current = enumerator.Current;
                                selectedItems.Add(current);
                            }
                            continue;
                        }
                        finally
                        {
                            enumerator.Dispose();
                        }
                    }
                    List<StorageFile> list2 = selectedItems;
                    StorageFile item = await StorageFile.GetFileFromPathAsync(Item.Path);
                    list2.Add(item);
                }
            }
            if (!File_Explorer.FileOperation.OperationInProgress)
            {
                this.secondaryProgress.set_IsIndeterminate(false);
            }
            this.Selection(false, false);
            if (selectedItems.Count > 0)
            {
                DataTransferManager forCurrentView = DataTransferManager.GetForCurrentView();
                if (handler == null)
                {
                    <>c__DisplayClass70 asyncVariable1;
                    handler = new TypedEventHandler<DataTransferManager, DataRequestedEventArgs>(asyncVariable1, (IntPtr) this.<shareMenuItem_Click>b__6d);
                }
                WindowsRuntimeMarshal.AddEventHandler<TypedEventHandler<DataTransferManager, DataRequestedEventArgs>>(new Func<TypedEventHandler<DataTransferManager, DataRequestedEventArgs>, EventRegistrationToken>(forCurrentView.add_DataRequested), new Action<EventRegistrationToken>(forCurrentView.remove_DataRequested), handler);
                DataTransferManager.ShowShareUI();
            }
        }

        private async Task<File_Explorer.CollisionMode> ShowConflictMessageBox(string Name)
        {
            <>c__DisplayClass108 asyncVariable0;
            bool close = false;
            File_Explorer.CollisionMode Mode = File_Explorer.CollisionMode.Replace;
            CustomMessageBox messageBox = this.ConflictMessageBox();
            messageBox.Dismissed += delegate (object param0, DismissedEventArgs param1) {
                close = true;
                this.IsOpen = false;
            };
            File_Explorer.CustomMessageBox_Conflict Content = messageBox.get_Content() as File_Explorer.CustomMessageBox_Conflict;
            Content.Replace.add_Click(new RoutedEventHandler(asyncVariable0, (IntPtr) this.<ShowConflictMessageBox>b__105));
            Content.Skip.add_Click(new RoutedEventHandler(asyncVariable0, (IntPtr) this.<ShowConflictMessageBox>b__106));
            Content.Title.set_Text("The destination already has a file name \"" + Name + "\"");
            messageBox.Show();
            return await Task<File_Explorer.CollisionMode>.Factory.StartNew(delegate {
                while (!close)
                {
                }
                return Mode;
            });
        }

        private void ShowOperationBox_Completed_1(object sender, EventArgs e)
        {
        }

        private async void StartCompress(List<File_Explorer.StorageItem> selectedItems, string archive)
        {
            this.secondaryProgress.set_IsIndeterminate(true);
            File_Explorer.FileOperation.OperationInProgress = true;
            try
            {
                string destinationPath;
                string directoryName = Path.GetDirectoryName(this.selectedItem.Path);
                if (this.selectedItem.IsFolder)
                {
                    destinationPath = await this.GenerateUniqueFilePath(directoryName, this.selectedItem.FileName + "." + archive);
                }
                else
                {
                    destinationPath = await this.GenerateUniqueFilePath(directoryName, Path.GetFileNameWithoutExtension(this.selectedItem.Path) + "." + archive);
                }
                await this.Compress(destinationPath, directoryName, selectedItems);
                this.secondaryProgress.set_IsIndeterminate(false);
                selectedItems.Clear();
                this.AddItem(destinationPath, false);
                GC.Collect();
            }
            catch
            {
                this.secondaryProgress.set_IsIndeterminate(false);
            }
            File_Explorer.FileOperation.OperationInProgress = false;
        }

        private async void StartNavigate(string Path, File_Explorer.NavigationType navigationType)
        {
            Action action = null;
            try
            {
                this.cancel = true;
                if (this.IsBusy)
                {
                    if (action == null)
                    {
                        action = delegate {
                            while (this.IsBusy)
                            {
                            }
                        };
                    }
                }
                else
                {
                    goto Label_00D0;
                }
                await Task.Factory.StartNew(action);
            Label_00D0:
                if (navigationType == File_Explorer.NavigationType.Forward)
                {
                    IEasingFunction function;
                    this.NextPath = Path;
                    this.NavigationMode = File_Explorer.NavigationType.Forward;
                    ExponentialEase ease = new ExponentialEase();
                    ease.set_EasingMode(1);
                    ease.set_Exponent(5.0);
                    (this.storyboard.get_Children().get_Item(1) as DoubleAnimation).set_EasingFunction(function = ease);
                    (this.storyboard.get_Children().get_Item(0) as DoubleAnimation).set_EasingFunction(function);
                    (this.storyboard.get_Children().get_Item(0) as DoubleAnimation).set_From(0.0);
                    (this.storyboard.get_Children().get_Item(0) as DoubleAnimation).set_To(new double?(-Application.get_Current().get_Host().get_Content().get_ActualWidth()));
                    (this.storyboard.get_Children().get_Item(1) as DoubleAnimation).set_From(1.0);
                    (this.storyboard.get_Children().get_Item(1) as DoubleAnimation).set_To(0.0);
                    this.storyboard.Begin();
                }
                else if (navigationType == File_Explorer.NavigationType.Backward)
                {
                    IEasingFunction function2;
                    this.NextPath = Path;
                    this.NavigationMode = File_Explorer.NavigationType.Backward;
                    ExponentialEase ease2 = new ExponentialEase();
                    ease2.set_EasingMode(1);
                    ease2.set_Exponent(5.0);
                    (this.storyboard.get_Children().get_Item(1) as DoubleAnimation).set_EasingFunction(function2 = ease2);
                    (this.storyboard.get_Children().get_Item(0) as DoubleAnimation).set_EasingFunction(function2);
                    (this.storyboard.get_Children().get_Item(0) as DoubleAnimation).set_From(0.0);
                    (this.storyboard.get_Children().get_Item(0) as DoubleAnimation).set_To(new double?(Application.get_Current().get_Host().get_Content().get_ActualWidth()));
                    (this.storyboard.get_Children().get_Item(1) as DoubleAnimation).set_From(1.0);
                    (this.storyboard.get_Children().get_Item(1) as DoubleAnimation).set_To(0.0);
                    this.storyboard.Begin();
                }
            }
            catch
            {
            }
        }

        private async void StartPaste()
        {
            try
            {
                File_Explorer.FileOperation.OperationInProgress = true;
                File_Explorer.CollisionMode none = File_Explorer.CollisionMode.None;
                string currentPath = this.CurrentPath;
                File_Explorer.FileOperation.Clear();
                File_Explorer.FileOperator.BufferSize = 0xffff;
                int count = File_Explorer.FileOperation.FileList.Count;
                File_Explorer.FoldeProperies itemsProperties = await this.GetItemsProperties(File_Explorer.FileOperation.FileList);
                if (count <= 0)
                {
                    return;
                }
                double size = itemsProperties.Size;
                int totalcount = itemsProperties.Files.Count + itemsProperties.Folders.Count;
                this.itemsRemaining = totalcount;
                string Size = FormatBytes(size);
                if (File_Explorer.FileOperation.OperationType == File_Explorer.FileOperationType.Copy)
                {
                    this.Operation_Title.set_Text(string.Concat(new object[] { "Copying ", totalcount, " Items (", Size, ")" }));
                }
                else
                {
                    this.Operation_Title.set_Text(string.Concat(new object[] { "Moving ", totalcount, " Items (", Size, ")" }));
                }
                this.Progress.set_IsIndeterminate(false);
                this.Progress.set_Maximum(size);
                this.Operation_Left.set_Text(string.Concat(new object[] { "Items remaining: ", this.itemsRemaining, " (", FormatBytes(this.Progress.get_Maximum() - this.Progress.get_Value()), ")" }));
                this.Operation_Status.set_Text(string.Format("{0:0}", (this.Progress.get_Value() * 100.0) / this.Progress.get_Maximum()) + "% Completed");
                List<File_Explorer.StorageItem>.Enumerator asyncVariable1 = File_Explorer.FileOperation.FileList.GetEnumerator();
                try
                {
                    while (asyncVariable1.MoveNext())
                    {
                        File_Explorer.StorageItem Item = asyncVariable1.Current;
                        if (File_Explorer.FileOperation.Cancel)
                        {
                            goto Label_1E71;
                        }
                        try
                        {
                            string fileName;
                            File_Explorer.CollisionMode mode;
                            if (!Item.IsFolder)
                            {
                                goto Label_12C5;
                            }
                            if (currentPath.ContainsPath(Item.Path))
                            {
                                MessageBox.Show("The destination folder is a subfolder of the source folder");
                                continue;
                            }
                            if (this.PathEquals(currentPath + @"\" + Item.FileName, Item.Path))
                            {
                                MessageBox.Show("The destination folder is same as the source folder");
                                continue;
                            }
                            List<StorageFolder> folders = await File_Explorer.StorageExtension.GetAllFoldersAsync(Item.Path);
                            folders.Reverse();
                            List<StorageFolder>.Enumerator asyncVariable2 = folders.GetEnumerator();
                            try
                            {
                                while (asyncVariable2.MoveNext())
                                {
                                    StorageFolder _folder = asyncVariable2.Current;
                                    if (File_Explorer.FileOperation.Cancel)
                                    {
                                        goto Label_1067;
                                    }
                                    try
                                    {
                                        string fullPath = this.GetFullPath(Path.GetDirectoryName(Item.Path).ToLower());
                                        string destinationpath = this.GetFullPath(_folder.get_Path().ToLower().Replace(fullPath, ""));
                                        try
                                        {
                                            StorageFolder introduced71 = await StorageFolder.GetFolderFromPathAsync(currentPath);
                                            await introduced71.CreateFolderAsync(destinationpath);
                                        }
                                        catch
                                        {
                                        }
                                        List<StorageFile> files = new List<StorageFile>();
                                        IReadOnlyList<StorageFile> introduced73 = await _folder.GetFilesAsync();
                                        using (IEnumerator<StorageFile> enumerator = introduced73.GetEnumerator())
                                        {
                                            while (enumerator.MoveNext())
                                            {
                                                StorageFile item = enumerator.Current;
                                                files.Add(item);
                                            }
                                        }
                                        List<StorageFile>.Enumerator asyncVariable3 = files.GetEnumerator();
                                        try
                                        {
                                            while (asyncVariable3.MoveNext())
                                            {
                                                StorageFile current = asyncVariable3.Current;
                                                if (!File_Explorer.FileOperation.Cancel)
                                                {
                                                    try
                                                    {
                                                        string name = current.get_Name();
                                                        this.Operation_Name.set_Text("Name: " + name);
                                                        bool introduced74 = await File_Explorer.StorageExtension.Exists(this.GetFullPath(currentPath + @"\" + destinationpath + @"\" + name), false);
                                                        if (introduced74)
                                                        {
                                                            if ((none != File_Explorer.CollisionMode.ReplaceAll) && (none != File_Explorer.CollisionMode.SkipAll))
                                                            {
                                                                mode = await this.ShowConflictMessageBox(name);
                                                                none = mode;
                                                            }
                                                            if ((none == File_Explorer.CollisionMode.Replace) || (none == File_Explorer.CollisionMode.ReplaceAll))
                                                            {
                                                                if (File_Explorer.FileOperation.OperationType == File_Explorer.FileOperationType.Move)
                                                                {
                                                                    await File_Explorer.FileOperator.Move(current, this.GetFullPath(currentPath + @"\" + destinationpath + @"\" + name));
                                                                }
                                                                else
                                                                {
                                                                    await File_Explorer.FileOperator.Copy(current, this.GetFullPath(currentPath + @"\" + destinationpath + @"\" + name));
                                                                }
                                                            }
                                                            else
                                                            {
                                                                switch (none)
                                                                {
                                                                    case File_Explorer.CollisionMode.Skip:
                                                                    case File_Explorer.CollisionMode.SkipAll:
                                                                    {
                                                                        ProgressBar progress = this.Progress;
                                                                        Tuple<ProgressBar, double> tuple2 = new Tuple<ProgressBar, double>(progress, progress.get_Value());
                                                                        BasicProperties introduced76 = await current.GetBasicPropertiesAsync();
                                                                        tuple2.Item1.set_Value(tuple2.Item2 + introduced76.get_Size());
                                                                        break;
                                                                    }
                                                                }
                                                            }
                                                        }
                                                        else if (File_Explorer.FileOperation.OperationType == File_Explorer.FileOperationType.Move)
                                                        {
                                                            await File_Explorer.FileOperator.Move(current, this.GetFullPath(currentPath + @"\" + destinationpath + @"\" + name));
                                                        }
                                                        else
                                                        {
                                                            await File_Explorer.FileOperator.Copy(current, this.GetFullPath(currentPath + @"\" + destinationpath + @"\" + name));
                                                        }
                                                        if (!File_Explorer.FileOperation.Cancel)
                                                        {
                                                            this.itemsRemaining--;
                                                            this.Operation_Left.set_Text(string.Concat(new object[] { "Items remaining: ", this.itemsRemaining, " (", FormatBytes(this.Progress.get_Maximum() - this.Progress.get_Value()), ")" }));
                                                            this.Operation_Status.set_Text(string.Format("{0:0}", (this.Progress.get_Value() * 100.0) / this.Progress.get_Maximum()) + "% Completed");
                                                        }
                                                        if ((File_Explorer.FileOperation.Exception != null) && (File_Explorer.FileOperation.Exception.HResult == -2147024784))
                                                        {
                                                            this.StopOperation();
                                                            MessageBox.Show(File_Explorer.FileOperation.Exception.Message, "Error", 0);
                                                        }
                                                        continue;
                                                    }
                                                    catch (Exception exception)
                                                    {
                                                        if (MessageBox.Show(exception.Message, "Error", 1) == 2)
                                                        {
                                                            this.StopOperation();
                                                        }
                                                        continue;
                                                    }
                                                }
                                            }
                                        }
                                        finally
                                        {
                                            asyncVariable3.Dispose();
                                        }
                                        continue;
                                    }
                                    catch (Exception exception2)
                                    {
                                        if (MessageBox.Show(exception2.Message, "Error", 1) == 2)
                                        {
                                            this.StopOperation();
                                        }
                                        continue;
                                    }
                                }
                            }
                            finally
                            {
                                asyncVariable2.Dispose();
                            }
                        Label_1067:
                            if (File_Explorer.FileOperation.Cancel || (File_Explorer.FileOperation.OperationType != File_Explorer.FileOperationType.Move))
                            {
                                continue;
                            }
                            StorageFolder _folder = null;
                            try
                            {
                                folders.Reverse();
                                List<StorageFolder>.Enumerator asyncVariable4 = folders.GetEnumerator();
                                try
                                {
                                    while (asyncVariable4.MoveNext())
                                    {
                                        StorageFolder folder = asyncVariable4.Current;
                                        _folder = folder;
                                        IReadOnlyList<StorageFile> introduced79 = await folder.GetFilesAsync();
                                        if (introduced79.Count == 0)
                                        {
                                            IReadOnlyList<StorageFolder> introduced80 = await folder.GetFoldersAsync();
                                            if (introduced80.Count == 0)
                                            {
                                                await folder.DeleteAsync(1);
                                            }
                                        }
                                    }
                                }
                                finally
                                {
                                    asyncVariable4.Dispose();
                                }
                                continue;
                            }
                            catch
                            {
                                MessageBox.Show("Cannot delete folder \"" + _folder.get_Name() + "\"", "Access is denied", 0);
                                this.HideOperationBox.Begin();
                                continue;
                            }
                        Label_12C5:
                            fileName = Path.GetFileName(Item.Path);
                            string oldValue = Path.GetExtension(Item.Path);
                            StorageFile source = await StorageFile.GetFileFromPathAsync(Item.Path);
                            BasicProperties introduced83 = await source.GetBasicPropertiesAsync();
                            ulong fileSize = introduced83.get_Size();
                            this.Operation_Name.set_Text("Name: " + fileName);
                            try
                            {
                                if (File_Explorer.FileOperation.OperationType == File_Explorer.FileOperationType.Copy)
                                {
                                    bool introduced84 = await File_Explorer.StorageExtension.Exists(this.GetFullPath(currentPath + @"\" + fileName), false);
                                    if (introduced84)
                                    {
                                        if (this.PathEquals(currentPath, Item.Path.Replace(fileName, "")))
                                        {
                                            string newName = fileName.Replace(oldValue, "") + " - Copy" + oldValue;
                                            bool introduced85 = await File_Explorer.StorageExtension.Exists(this.GetFullPath(currentPath + @"\" + newName), false);
                                            if (!introduced85)
                                            {
                                                await File_Explorer.FileOperator.Copy(source, this.GetFullPath(currentPath + @"\" + newName));
                                                goto Label_1CDD;
                                            }
                                            int i = 0;
                                            while (true)
                                            {
                                                newName = string.Concat(new object[] { Path.GetFileNameWithoutExtension(fileName), " - Copy (", i, ")", oldValue });
                                                bool introduced86 = await File_Explorer.StorageExtension.Exists(this.GetFullPath(currentPath + @"\" + newName), false);
                                                if (!introduced86)
                                                {
                                                    try
                                                    {
                                                        await File_Explorer.FileOperator.Copy(source, currentPath + @"\" + newName);
                                                    }
                                                    catch
                                                    {
                                                    }
                                                    goto Label_1CDD;
                                                }
                                                i++;
                                            }
                                        }
                                        if ((none != File_Explorer.CollisionMode.ReplaceAll) && (none != File_Explorer.CollisionMode.SkipAll))
                                        {
                                            mode = await this.ShowConflictMessageBox(fileName);
                                            none = mode;
                                        }
                                        switch (none)
                                        {
                                            case File_Explorer.CollisionMode.Replace:
                                            case File_Explorer.CollisionMode.ReplaceAll:
                                                await File_Explorer.FileOperator.Copy(source, this.GetFullPath(currentPath + @"\" + fileName));
                                                break;

                                            case File_Explorer.CollisionMode.Skip:
                                            case File_Explorer.CollisionMode.SkipAll:
                                                this.Progress.set_Value(this.Progress.get_Value() + fileSize);
                                                break;
                                        }
                                    }
                                    else
                                    {
                                        await File_Explorer.FileOperator.Copy(source, this.GetFullPath(currentPath + @"\" + fileName));
                                    }
                                }
                                else if (File_Explorer.FileOperation.OperationType == File_Explorer.FileOperationType.Move)
                                {
                                    bool introduced89 = await File_Explorer.StorageExtension.Exists(this.GetFullPath(currentPath + @"\" + fileName), false);
                                    if (introduced89)
                                    {
                                        if (!this.PathEquals(currentPath, Path.GetDirectoryName(Item.Path)))
                                        {
                                            if ((none != File_Explorer.CollisionMode.ReplaceAll) && (none != File_Explorer.CollisionMode.SkipAll))
                                            {
                                                mode = await this.ShowConflictMessageBox(fileName);
                                                none = mode;
                                            }
                                            if ((none == File_Explorer.CollisionMode.Replace) || (none == File_Explorer.CollisionMode.ReplaceAll))
                                            {
                                                await File_Explorer.FileOperator.Move(source, this.GetFullPath(currentPath + @"\" + fileName));
                                            }
                                            else if ((none == File_Explorer.CollisionMode.Skip) || (none == File_Explorer.CollisionMode.SkipAll))
                                            {
                                                this.Progress.set_Value(this.Progress.get_Value() + fileSize);
                                            }
                                        }
                                    }
                                    else
                                    {
                                        await File_Explorer.FileOperator.Move(source, this.GetFullPath(currentPath + @"\" + fileName));
                                    }
                                }
                            Label_1CDD:
                                if (!File_Explorer.FileOperation.Cancel)
                                {
                                    this.itemsRemaining--;
                                    this.Operation_Left.set_Text(string.Concat(new object[] { "Items remaining: ", this.itemsRemaining, " (", FormatBytes(this.Progress.get_Maximum() - this.Progress.get_Value()), ")" }));
                                    this.Operation_Status.set_Text(string.Format("{0:0}", (this.Progress.get_Value() * 100.0) / this.Progress.get_Maximum()) + "% Completed");
                                }
                                if ((File_Explorer.FileOperation.Exception != null) && (File_Explorer.FileOperation.Exception.HResult == -2147024784))
                                {
                                    this.StopOperation();
                                    MessageBox.Show(File_Explorer.FileOperation.Exception.Message, "Error", 0);
                                }
                            }
                            catch (Exception exception3)
                            {
                                if (MessageBox.Show(exception3.Message, "Error", 1) == 2)
                                {
                                    this.StopOperation();
                                }
                            }
                            continue;
                        }
                        catch (Exception exception4)
                        {
                            if (MessageBox.Show(exception4.Message, "Error", 1) == 2)
                            {
                                this.StopOperation();
                            }
                            continue;
                        }
                    }
                }
                finally
                {
                    asyncVariable1.Dispose();
                }
            Label_1E71:
                this.StopOperation();
            }
            catch (Exception exception5)
            {
                if (MessageBox.Show(exception5.Message, "Error", 1) == 2)
                {
                    this.StopOperation();
                }
            }
        }

        private void StartSearch()
        {
            File_Explorer.App.ViewModel.StorageSource.Clear();
            this.secondaryProgress.set_IsIndeterminate(true);
            this.Navigate_Button.set_Content("");
            this.SearchText = this.PathText.get_Text();
            ObservableCollection<File_Explorer.StorageItem> result = new ObservableCollection<File_Explorer.StorageItem>();
            result.CollectionChanged += delegate (object s, NotifyCollectionChangedEventArgs e) {
                foreach (File_Explorer.StorageItem item in e.NewItems)
                {
                    File_Explorer.App.ViewModel.StorageSource.Add(item);
                }
            };
            File_Explorer.StorageExtension.SearchFilesAsync(this.CurrentPath, this.SearchText, result).AsAsyncAction().put_Completed(new AsyncActionCompletedHandler(this, (IntPtr) this.SearchCompleated));
        }

        private void StopOperation()
        {
            File_Explorer.FileOperation.CancelOperation();
            this.Progress.set_Value(0.0);
            this.HideOperationBox.Begin();
            if (File_Explorer.FileOperation.OperationType == File_Explorer.FileOperationType.Move)
            {
                File_Explorer.FileOperation.FileList.Clear();
                this.paste.set_IsEnabled(false);
            }
            File_Explorer.FileOperation.OperationInProgress = false;
            this.Refresh();
        }

        private void StopSearch()
        {
            this.Navigate_Button.set_Content("");
            File_Explorer.StorageExtension.Cancel = true;
        }

        private void storyboard_Completed_1(object sender, EventArgs e)
        {
            try
            {
                if (this.NavigationMode != File_Explorer.NavigationType.None)
                {
                    File_Explorer.App.ViewModel.StorageSource.Clear();
                    this.Navigate(this.NextPath);
                }
            }
            catch
            {
            }
        }

        private CustomMessageBox TextInputMessageBox()
        {
            <>c__DisplayClass10 class2;
            CustomMessageBox box = new CustomMessageBox {
                IsFullScreen = true
            };
            box.set_Background((SolidColorBrush) Application.get_Current().get_Resources().get_Item("PhoneChromeBrush"));
            box.Caption = "Enter Name";
            File_Explorer.CustomMessageBox_Input Content = new File_Explorer.CustomMessageBox_Input();
            box.set_Content(Content);
            box.add_Loaded(new RoutedEventHandler(class2, (IntPtr) this.<TextInputMessageBox>b__f));
            return box;
        }

        private void UpDown_Click_1(object sender, RoutedEventArgs e)
        {
            base.get_Dispatcher().BeginInvoke(delegate {
                if (((string) ((Button) sender).get_Content()) == "")
                {
                    ((Button) sender).set_Content("");
                    this.ShowOperationDetails.Begin();
                }
                else
                {
                    ((Button) sender).set_Content("");
                    this.HideOperationDetails.Begin();
                }
            });
        }

        private void ViewModel_PropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            if (e.PropertyName == "ViewMode")
            {
                this.explorer.set_LayoutMode((File_Explorer.App.ViewModel.ViewMode == 0) ? ((LongListSelectorLayoutMode) 0) : ((LongListSelectorLayoutMode) 1));
                this.explorer.set_ItemTemplate((DataTemplate) base.get_Resources().get_Item((File_Explorer.App.ViewModel.ViewMode == 0) ? "ListTemplate" : "GridTemplate"));
                foreach (File_Explorer.StorageItem item in File_Explorer.App.ViewModel.StorageSource)
                {
                    if (item.IsFolder)
                    {
                        item.ThumbSource = null;
                        item.Style = (this.explorer.get_LayoutMode() == null) ? ((Style) Application.get_Current().get_Resources().get_Item("File")) : ((Style) Application.get_Current().get_Resources().get_Item("Folder"));
                    }
                }
            }
        }

        private bool SelectionEnabled { get; set; }

    }
}

Comments

  1. Can you please share the full project of file manager ???

    ReplyDelete

Post a Comment

Popular posts from this blog

How to use PROXY to download all OEM apps.

How to make free license Applications and Games on Windows Phone 8.1

UnfollowSpy is the Twitter and Instagram stat tracker client for free the three days