public void RefreshIcon()
        {
            if (CommandModel.IsChecked)
            {
                Icon = null;
            }
            if (CommandModel.HeaderIconExtractor != null)
            {
                byte[] bytes = AsyncUtils.RunSync(() =>
                                                  CommandModel.HeaderIconExtractor.GetIconBytesForModelAsync(CommandModel,
                                                                                                             CancellationToken.None));

                if (bytes != null && bytes.Length > 0)
                {
                    Icon = new System.Windows.Controls.Image()
                    {
                        Source =
                            BitmapSourceUtils.CreateBitmapSourceFromBitmap(bytes),
                        MaxWidth  = 16,
                        MaxHeight = 16
                    }
                }
                ;
            }
        }
        public string Dispatch <TMessage>(TMessage msg)
            where TMessage : class, IMessage
        {
            var dispatchMode = msg.MessageDispatchModeEnum;

            if (dispatchMode == MessageDispatchModeEnum.DistributedSend)
            {
                AsyncUtils.RunSync(ObjectContainer.Resolve <IDistributedMessageBus>().SendAsync(msg));
            }
            else if (dispatchMode == MessageDispatchModeEnum.DistributedPublish)
            {
                AsyncUtils.RunSync(ObjectContainer.Resolve <IDistributedMessageBus>().PublishAsync(msg));
            }
            else if (dispatchMode == MessageDispatchModeEnum.DistributedRequest)
            {
                var msgCode = AsyncUtils.RunSync(ObjectContainer.Resolve <IDistributedMessageBus>().RequestAsync(msg));
                return(msgCode);
            }
            else if (dispatchMode == MessageDispatchModeEnum.Local)
            {
                string msgCode;
                try
                {
                    msgCode = AsyncUtils.RunSync(_localMessageBus.ExecuteAsync(msg));
                }
                catch (System.Exception ex)
                {
                    msgCode = ex.GetBaseException().Message;
                }

                return(msgCode);
            }
            return("");
        }
        public void NotifyPrepareDrop(VirtualDataObject sender, string format)
        {
            FileDropDataObject dataObject = sender as FileDropDataObject;

            foreach (var m in _models)
            {
                if (m.Profile is IDiskProfile)
                {
                    var mapping = (m.Profile as IDiskProfile).DiskIO.Mapper[m];
                    if (mapping != null && !mapping.IsCached)
                    {
                        AsyncUtils.RunSync(() => (m.Profile as IDiskProfile).DiskIO
                                           .WriteToCacheAsync(m, CancellationToken.None)
                                           );
                    }
                }
            }

            //AsyncUtils.RunSync(() => Task.Run(async () =>
            //    {
            //        foreach (var m in _models)
            //            if (m.Profile is IDiskProfile)
            //            {
            //                var mapping = (m.Profile as IDiskProfile).DiskIO.Mapper[m];
            //                if (mapping != null && !mapping.IsCached)
            //                    await (m.Profile as IDiskProfile).DiskIO.WriteToCacheAsync(m, CancellationToken.None);
            //            }
            //    }));
        }
        protected override void NotifyOfPropertyChanged(string propertyName)
        {
            base.NotifyOfPropertyChanged(propertyName);

            switch (propertyName)
            {
            case "ExtraCommandProviders":
                if (propertyName == "ExtraCommandProviders")
                {
                    CommandModels.IsLoaded = false;     //Reset CommandModels
                }
                break;

            case "AppliedModels":
                AsyncUtils.RunSync(() => CommandModels.LoadAsync(UpdateMode.Replace, false));
                if (AppliedModels != null)
                {
                    foreach (var commandVM in CommandModels.AllNonBindable)
                    {
                        commandVM.CommandModel.NotifySelectionChanged(AppliedModels);
                    }
                }
                break;
            }
        }
 public static WebFileStream OpenWrite(IEntryModel entryModel)
 {
     return(new WebFileStream(entryModel, null, (m, s) =>
     {
         AsyncUtils.RunSync(() => updateSourceAsync(s));
     }));
 }
Exemple #6
0
 public GoogleDriveProfile(IEventAggregator events,
                           Stream clientSecretStream,
                           string aliasMask      = "{0}'s GoogleDrive",
                           string rootAccessPath = "/gdrive")
     : this(events, AsyncUtils.RunSync(() => GoogleDriveProfile.GetCredentialAsync(clientSecretStream)),
            aliasMask, rootAccessPath)
 {
 }
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            //AsyncUtils.RunSync(() => ScriptCommandTests.UnitTest());



            AsyncUtils.RunSync(() => ScriptCommandTests.Test_DownloadFile());
        }
 protected EntryModelBase(IProfile profile)
 {
     Profile           = profile;
     _isRenamable      = false;
     _parentFunc       = () => AsyncUtils.RunSync(() => Profile.ParseAsync(Profile.Path.GetDirectoryName(FullPath)));
     CreationTimeUtc   = DateTime.MinValue;
     LastUpdateTimeUtc = DateTime.MinValue;
 }
 public BookmarkProfile(IDiskProfile store, string fileName, IProfile[] profiles)
     : this(null)
 {
     _store      = store;
     _fileName   = fileName;
     ProfileName = String.Format("Bookmarks {0}", _fileName);
     _profiles   = profiles;
     AsyncUtils.RunSync(() => LoadSettingsAsync());
 }
        public static async Task <WebFileStream> OpenReadWriteAsync(IEntryModel entryModel, CancellationToken ct)
        {
            var contents = await WebUtils.DownloadToBytesAsync((entryModel as SkyDriveItemModel).SourceUrl, () => new HttpClient(), ct);

            return(new WebFileStream(entryModel, contents, (m, s) =>
            {
                AsyncUtils.RunSync(() => updateSourceAsync(s));
            }));
        }
        //public string FileFilter { get { return _fileFilter; } set { _fileFilter = value; NotifyOfPropertyChange(() => FileFilter); } }

        #endregion

        public Bootstrapper()
        {
            InitializeComponent();
            _profile   = new FileSystemInfoProfile(_events);
            _profileEx = new FileSystemInfoExProfile(_events, _windowManager, new FileExplorer.Models.SevenZipSharp.SzsProfile(_events));

            Func <string> loginSkyDrive = () =>
            {
                var login = new SkyDriveLogin(AuthorizationKeys.SkyDrive_Client_Id);
                if (_windowManager.ShowDialog(new LoginViewModel(login)).Value)
                {
                    return(login.AuthCode);
                }
                return(null);
            };

            if (AuthorizationKeys.SkyDrive_Client_Secret != null)
            {
                _profileSkyDrive = new SkyDriveProfile(_events, AuthorizationKeys.SkyDrive_Client_Id, loginSkyDrive, skyDriveAliasMask);
            }


            Func <UserLogin> loginDropBox = () =>
            {
                var login = new DropBoxLogin(AuthorizationKeys.DropBox_Client_Id,
                                             AuthorizationKeys.DropBox_Client_Secret);
                if (_windowManager.ShowDialog(new LoginViewModel(login)).Value)
                {
                    return(login.AccessToken);
                }
                return(null);
            };

            if (AuthorizationKeys.DropBox_Client_Secret != null)
            {
                _profileDropBox = new DropBoxProfile(_events,
                                                     AuthorizationKeys.DropBox_Client_Id,
                                                     AuthorizationKeys.DropBox_Client_Secret,
                                                     loginDropBox);
            }

            if (System.IO.File.Exists("gapi_client_secret.json"))
            {
                using (var gapi_secret_stream = System.IO.File.OpenRead("gapi_client_secret.json")) //For demo only.
                {
                    _profileGoogleDrive = new GoogleDriveProfile(_events, gapi_secret_stream);
                }
            }


            RootModels.Add(AsyncUtils.RunSync(() => _profileEx.ParseAsync(System.IO.DirectoryInfoEx.DesktopDirectory.FullName)));


            _profiles = new IProfile[] {
                _profileEx, _profileSkyDrive, _profileDropBox, _profileGoogleDrive
            }.Where(p => p != null).ToArray();
        }
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            FileExplorer.Models.FileSystemInfoExProfile profile =
                new FileExplorer.Models.FileSystemInfoExProfile(null, null);
            var desktopDir = AsyncUtils.RunSync(() => profile.ParseAsync(""));

            explorer.RootDirectories = new FileExplorer.Models.IEntryModel[] { desktopDir };
        }
        public static async Task <WebFileStream> OpenReadWriteAsync(IEntryModel entryModel, CancellationToken ct)
        {
            var fileModel = entryModel as DropBoxItemModel;
            var profile   = fileModel.Profile as DropBoxProfile;
            var contents  = (await profile.GetClient().GetFileTask(fileModel.RemotePath)).RawBytes;

            return(new WebFileStream(entryModel, contents, (m, s) =>
            {
                AsyncUtils.RunSync(() => updateSourceAsync(s));
            }));
        }
        public ToolWindowDemo()
        {
            InitializeComponent();


            FileExplorer.Models.FileSystemInfoExProfile profile =
                new FileExplorer.Models.FileSystemInfoExProfile(null, null);
            var desktopDir = AsyncUtils.RunSync(() => profile.ParseAsync(""));

            _rootDirs     = new FileExplorer.Models.IEntryModel[] { desktopDir };
            _mask         = "Texts (.txt)|*.txt|Pictures (.jpg, .png)|*.jpg,*.png|Songs (.mp3)|*.mp3|All Files (*.*)|*.*";
            _selectedPath = "c:\\";
        }
Exemple #15
0
        /// <summary>
        /// If LazyExistenceCheck = true, same as Belongs(virtualPath). Otherwise also performs actual BlobExists() call.
        /// </summary>
        /// <param name="virtualPath"></param>
        /// <param name="queryString"></param>
        /// <returns></returns>
        public bool FileExists(string virtualPath, NameValueCollection queryString)
        {
            var belongs = Belongs(virtualPath);

            if (LazyExistenceCheck)
            {
                return(belongs);
            }
            else
            {
                return(belongs && AsyncUtils.RunSync <bool>(() => BlobExistsAsync(virtualPath, queryString)));
            }
        }
Exemple #16
0
        public AppViewModel()
        {
            LogManagerFactory.DefaultConfiguration.AddTarget(LogLevel.Info, LogLevel.Fatal, new ConsoleTarget());
            LogManagerFactory.DefaultConfiguration.IsEnabled = true;

            LogManagerFactory.DefaultLogManager.GetLogger <AppViewModel>().Log(LogLevel.Debug, "Test");
            //AsyncUtils.RunSync(() => ScriptCommandTests.Test_DownloadFile());


            //        IScriptCommand diskTransferCommand =
            //ScriptCommands.ParsePath("{SourceFile}", "{Source}",
            //ScriptCommands.DiskParseOrCreateFolder("{DestinationDirectory}", "{Destination}",
            //IOScriptCommands.DiskTransfer("{Source}", "{Destination}", false, false)));

            //await ScriptRunner.RunScriptAsync(new ParameterDic() {
            //                { "Profile", FileSystemInfoExProfile.CreateNew() },
            //                { "SourceFile", srcFile },
            //                { "DestinationFile", destFile }
            //            }, copyCommand);


            //string tempDirectory = "C:\\Temp";
            //string destDirectory = "C:\\Temp\\Destination1";
            //string srcFile = System.IO.Path.Combine(tempDirectory, "file1.txt");
            //string destFile = System.IO.Path.Combine(destDirectory, "file2.txt");

            //AsyncUtils.RunSync(() => ScriptRunner.RunScriptAsync(new ParameterDic() {
            //    { "Profile", FileExplorer.Models.FileSystemInfoExProfile.CreateNew() },
            //    { "SourceFile", srcFile },
            //    { "DestinationDirectory", destDirectory }
            //}, diskTransferCommand));

            string tempDirectory = "C:\\Temp";
            string destDirectory = "C:\\Temp\\Debug2";
            string srcDirectory  = "C:\\Temp\\aaaaabc";


            IScriptCommand diskTransferCommand =
                CoreScriptCommands.ParsePath("{Profile}", srcDirectory, "{Source}",
                                             CoreScriptCommands.DiskParseOrCreateFolder("{Profile}", destDirectory, "{Destination}",
                                                                                        IOScriptCommands.DiskTransfer("{Source}", "{Destination}", null, false, false)));

            AsyncUtils.RunSync(() => ScriptRunner.RunScriptAsync(new ParameterDic()
            {
                { "Profile", FileSystemInfoExProfile.CreateNew() }
            }, diskTransferCommand));
        }
        public IEnumerable <ICommandModel> GetCommands(FileSystemInfoExModel appliedModel)
        {
            if (!appliedModel.IsDirectory)
            {
                string ext = PathEx.GetExtension(appliedModel.Name);
                foreach (OpenWithInfo info in FileTypeInfoProvider.GetFileTypeInfo(ext).OpenWithList)
                {
                    if (info.OpenCommand != null)
                    {
                        string executePath = OpenWithInfo.GetExecutablePath(info.OpenCommand);
                        string exeName     = Path.GetFileNameWithoutExtension(executePath);

                        if (info.OpenCommand != null && File.Exists(executePath))
                        {
                            IEntryModel exeModel = AsyncUtils.RunSync(() => _profile.ParseAsync(executePath));
                            if (exeModel != null)
                            {
                                yield return new CommandModel(new OpenWithScriptCommand(info))
                                       {
                                           Header              = String.Format("{0} ({1})", exeName, info.KeyName),
                                           ToolTip             = info.Description,
                                           HeaderIconExtractor =
                                               ModelIconExtractor <ICommandModel>
                                               .FromTaskFunc(t =>
                                                             _profile.GetIconExtractSequence(exeModel)
                                                             .Last().GetIconBytesForModelAsync(exeModel,
                                                                                               CancellationToken.None)),
                                           IsEnabled = true
                                       }
                            }
                            ;
                        }
                    }
                }

                yield return(new CommandModel(new OpenWithScriptCommand(OpenWithInfo.OpenAs))
                {
                    Header = "Open with...",
                    IsEnabled = true
                });
            }
        }
    }
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            IEventAggregator _events        = new EventAggregator();
            IWindowManager   _windowManager = new AppWindowManager();
            IProfile         _exProfile     = new FileSystemInfoExProfile(_events, _windowManager);
            IProfile         _ioProfile     = new FileSystemInfoProfile(_events);

            IProfile[]    _profiles = new IProfile[] { _exProfile, _ioProfile };
            IEntryModel[] _rootDirs = new IEntryModel[] { AsyncUtils.RunSync(() => _exProfile.ParseAsync("")) };

            explorer.WindowManager         = _windowManager;
            explorer.ViewModel.Initializer =
                new ScriptCommandInitializer()
            {
                OnModelCreated    = ScriptCommands.Run("{OnModelCreated}"),
                OnViewAttached    = ScriptCommands.Run("{OnViewAttached}"),
                RootModels        = _rootDirs,
                WindowManager     = _windowManager,
                StartupParameters = new ParameterDic()
                {
                    { "Profiles", _profiles },
                    { "RootDirectories", _rootDirs },
                    { "GlobalEvents", _events },
                    { "WindowManager", _windowManager },
                    { "StartupPath", "" },
                    { "ViewMode", "List" },
                    { "ItemSize", 16 },
                    { "EnableDrag", true },
                    { "EnableDrop", true },
                    { "FileListNewWindowCommand", NullScriptCommand.Instance },      //Disable NewWindow Command.
                    { "EnableMultiSelect", true },
                    { "ShowToolbar", true },
                    { "ShowGridHeader", true },
                    { "OnModelCreated", IOInitializeHelpers.Explorer_Initialize_Default },
                    { "OnViewAttached", UIScriptCommands.ExplorerGotoStartupPathOrFirstRoot() }
                }
            };

            cbCommand.ItemsSource = ScriptCommandDictionary.CommandList;
        }
Exemple #19
0
        public static async Task <WebFileStream> OpenReadWriteAsync(IEntryModel entryModel, CancellationToken ct)
        {
            byte[]        bytes          = new byte[] { };
            var           profile        = entryModel.Profile as SzsProfile;
            ISzsItemModel entryItemModel = entryModel as ISzsItemModel;
            IEntryModel   rootModel      = entryItemModel.Root.ReferencedFile;

            using (Stream stream = await(rootModel.Profile as IDiskProfile).DiskIO.OpenStreamAsync(rootModel, Defines.FileAccess.Read, ct))
            {
                MemoryStream ms = new MemoryStream();
                if (profile.Wrapper.ExtractOne(stream, entryItemModel.RelativePath, null, ms))
                {
                    bytes = ms.ToByteArray();
                }
            }

            return(new WebFileStream(entryModel, bytes, (m, s) =>
            {
                AsyncUtils.RunSync(() => updateSourceAsync(s));
            }));
        }
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            //Install-Package Google.Apis.Authentication.OAuth2 -Version 1.2.4696.27634
            //Install-Package DotNetOpenAuth -Version 4.3.4.13329

            var provider = new NativeApplicationClient(WindowsLiveDescription);

            provider.ClientIdentifier = "0000000040112888";
            //provider.ClientSecret = "qIueVYvFCKEQ0-43jC9qkVzbXAkHwnMr";
            var auth = new OAuth2Authenticator <NativeApplicationClient>(provider, GetAuthorization);

            //var plus = new PlusService(auth);
            //plus.Key = "BLAH";
            //var me = plus.People.Get("me").Fetch();
            //Console.WriteLine(me.DisplayName);

            //    var client = new WindowsLiveClient()
            //    {
            //        //ClientIdentifier = "0000000040112888",
            //        //ClientCredentialApplicator = ClientCredentialApplicator.PostParameter("qIueVYvFCKEQ0-43jC9qkVzbXAkHwnMr"),
            //    };
            //    //client.ClientCredentialApplicator = ClientCredentialApplicator.NetworkCredential(
            //    //client.ClientCredentialApplicator = ClientCredentialApplicator.PostParameter("0000000040112888");
            //    var state = client.ExchangeUserCredentialForToken("*****@*****.**", "p@ssw0rd123",
            //        new[] { WindowsLiveClient.Scopes.Basic });

            AsyncUtils.RunSync(() => testUpload());
            //SkyDriveLogin login;
            //lc.LoginInfo = login = new SkyDriveLogin( "0000000040112888");
            //lc.AddHandler(LoginControl.CompletedEvent, (RoutedEventHandler)((o, e) =>
            //    {
            //        //login.AuthCode
            //        initAuth(login.AuthCode);
            //    }));
        }
Exemple #21
0
 public Stream Open()
 {
     return(AsyncUtils.RunSync <Stream>(() => stream()));
 }
 protected override void Upload(string virtualPath, MemoryStream memoryStream, NameValueCollection queryString)
 {
     AsyncUtils.RunSync(() => UploadAsync(virtualPath, memoryStream, queryString));
 }
 protected IBlobMetadata FetchMetadata(string virtualPath, NameValueCollection queryString)
 {
     return(AsyncUtils.RunSync(() => FetchMetadataAsync(virtualPath, queryString)));
 }
 private ICloudBlob GetBlobRef(string virtualPath)
 {
     return(AsyncUtils.RunSync(() => GetBlobRefAsync(virtualPath)));
 }
        public override async Task <IEnumerable <IMetadata> > GetMetadataAsync(IEnumerable <IEntryModel> selectedModels, int modelCount, IEntryModel parentModel)
        {
            List <IMetadata> retList = new List <IMetadata>();


            if (selectedModels.Count() == 1)
            {
                #region addExifVal
                Action <ExifReader, ExifTags> addExifVal = (reader, tag) =>
                {
                    object val = null;
                    switch (tag)
                    {
                    case ExifTags.FNumber:
                    case ExifTags.FocalLength:
                    case ExifTags.XResolution:
                    case ExifTags.YResolution:
                        int[] rational;
                        if (reader.GetTagValue(tag, out rational))
                        {
                            val = rational[0];
                        }
                        break;

                    case ExifTags.DateTime:
                    case ExifTags.DateTimeDigitized:
                    case ExifTags.DateTimeOriginal:
                        if (reader.GetTagValue <object>(tag, out val))
                        {
                            val = DateTime.ParseExact((string)val, "yyyy:MM:dd HH:mm:ss", CultureInfo.InvariantCulture);
                        }
                        break;

                    default:
                        reader.GetTagValue <object>(tag, out val);
                        break;
                    }

                    if (val != null)
                    {
                        DisplayType displayType = DisplayType.Auto;
                        switch (val.GetType().Name)
                        {
                        case "DateTime":
                            displayType = DisplayType.TimeElapsed;
                            break;

                        case "Double":
                        case "Float":
                            val         = Math.Round(Convert.ToDouble(val), 2).ToString();
                            displayType = DisplayType.Text;
                            break;

                        default:
                            displayType = DisplayType.Text;
                            val         = val.ToString();
                            break;
                        }
                        retList.Add(new Metadata(displayType, MetadataStrings.strImage, tag.ToString(),
                                                 val)
                        {
                            IsVisibleInSidebar = true
                        });
                    }
                };
                #endregion
                try
                {
                    var diskModel = selectedModels.First() as DiskEntryModelBase;
                    if (diskModel != null)
                    {
                        if (diskModel.IsFileWithExtension(FileExtensions.ExifExtensions))
                        {
                            using (var stream = await diskModel.DiskProfile.DiskIO.OpenStreamAsync(diskModel,
                                                                                                   FileExplorer.Defines.FileAccess.Read, CancellationToken.None))
                                using (ExifReader reader = new ExifReader(stream))
                                {
                                    var thumbnailBytes = reader.GetJpegThumbnailBytes();
                                    if (thumbnailBytes != null && thumbnailBytes.Length > 0)
                                    {
                                        retList.Add(new Metadata(DisplayType.Image, MetadataStrings.strImage, MetadataStrings.strThumbnail,
                                                                 W32ConverterUtils.ToBitmapImage(thumbnailBytes))
                                        {
                                            IsVisibleInSidebar = true
                                        });
                                    }
                                    else
                                    {
                                        retList.Add(new Metadata(DisplayType.Image, MetadataStrings.strImage, MetadataStrings.strThumbnail,
                                                                 W32ConverterUtils.ToBitmapImage(stream.ToByteArray()))
                                        {
                                            IsVisibleInSidebar = true
                                        });
                                    }

                                    UInt16 width, height;
                                    if (reader.GetTagValue(ExifTags.PixelXDimension, out width) &&
                                        reader.GetTagValue(ExifTags.PixelYDimension, out height))
                                    {
                                        string dimension = String.Format("{0} x {1}", width, height);
                                        retList.Add(new Metadata(DisplayType.Text, MetadataStrings.strImage, MetadataStrings.strDimension,
                                                                 dimension)
                                        {
                                            IsVisibleInSidebar = true
                                        });
                                    }

                                    //foreach (var tag in RecognizedExifTags)
                                    //    addExifVal(reader, tag);
                                }
                        }
                    }
                }
                catch
                {
                    return(AsyncUtils.RunSync(() => (new ImageMetadataProvider()
                                                     .GetMetadataAsync(selectedModels, modelCount, parentModel))));
                }
            }



            return(retList);
        }
        public AppViewModel(IEventAggregator events, IWindowManager windowManager)
        {
            //FileExplorer.Models.Bookmark.BookmarkSerializeTest.Test();
            _windowManager = windowManager;
            _events        = events;

            _events.Subscribe(this);

            _profile   = new FileSystemInfoProfile(_events);
            _profileEx = new FileSystemInfoExProfile(_events, _windowManager, new FileExplorer.Models.SevenZipSharp.SzsProfile(_events));

            Func <string> loginSkyDrive = () =>
            {
                var login = new SkyDriveLogin(AuthorizationKeys.SkyDrive_Client_Id);
                if (_windowManager.ShowDialog(new LoginViewModel(login)).Value)
                {
                    return(login.AuthCode);
                }
                return(null);
            };

            if (AuthorizationKeys.SkyDrive_Client_Secret != null)
            {
                _profileSkyDrive = new SkyDriveProfile(_events, AuthorizationKeys.SkyDrive_Client_Id, loginSkyDrive, skyDriveAliasMask);
            }


            Func <UserLogin> loginDropBox = () =>
            {
                var login = new DropBoxLogin(AuthorizationKeys.DropBox_Client_Id,
                                             AuthorizationKeys.DropBox_Client_Secret);
                if (_windowManager.ShowDialog(new LoginViewModel(login)).Value)
                {
                    return(login.AccessToken);
                }
                return(null);
            };

            if (AuthorizationKeys.DropBox_Client_Secret != null)
            {
                _profileDropBox = new DropBoxProfile(_events,
                                                     AuthorizationKeys.DropBox_Client_Id,
                                                     AuthorizationKeys.DropBox_Client_Secret,
                                                     loginDropBox);
            }

            if (System.IO.File.Exists("gapi_client_secret.json"))
            {
                using (var gapi_secret_stream = System.IO.File.OpenRead("gapi_client_secret.json")) //For demo only.
                {
                    _profileGoogleDrive = new GoogleDriveProfile(_events, gapi_secret_stream);
                }
            }


            string appDataPath = Environment.ExpandEnvironmentVariables("%AppData%\\FileExplorer3");

            System.IO.Directory.CreateDirectory(appDataPath);
            string bookmarkPath = Path.Combine(appDataPath, "Bookmarks.xml");

            _profileBm = new BookmarkProfile(_profileEx as IDiskProfile, bookmarkPath,
                                             new IProfile[] { _profileEx, _profileSkyDrive, _profileDropBox, _profileGoogleDrive });


            RootModels.Add((_profileBm as BookmarkProfile).RootModel);
            RootModels.Add(AsyncUtils.RunSync(() => _profileEx.ParseAsync(System.IO.DirectoryInfoEx.DesktopDirectory.FullName)));

            _profiles = new IProfile[] {
                _profileBm, _profileEx, _profileSkyDrive, _profileDropBox, _profileGoogleDrive
            }.Where(p => p != null).ToArray();
        }
        public void AddDirectoryInfoEx()
        {
            var rootModel = new[] { AsyncUtils.RunSync(() => _profileEx.ParseAsync("")) };

            pickAndAdd(rootModel);
        }
 public DiskParameterDicStore(string fileName)
     : base(StringComparer.CurrentCultureIgnoreCase)
 {
     _fileName = fileName;
     AsyncUtils.RunSync(() => LoadAsync());
 }
Exemple #29
0
 public Stream Open()
 {
     return(AsyncUtils.RunSync <Stream>(() => Provider.OpenAsync(VirtualPath, Query)));
 }
Exemple #30
0
 public virtual IScriptCommand Execute(ParameterDic pm)
 {
     return(AsyncUtils.RunSync(() => ExecuteAsync(pm)));
 }