Exemple #1
0
        static void Main(string[] args)
        {
            try
            {
                ICloud cloud = GetCloudType();
                ThreadPool.QueueUserWorkItem(cloud.ConnectToDrive, workerLocker);
                Console.WriteLine("Waiting...");
                lock (workerLocker)
                {
                    while (run > 0)
                    {
                        Monitor.Wait(workerLocker);
                    }
                }
            }
            catch (Exception ex)
            {
                using (FileStream fs = new FileStream(Environment.CurrentDirectory + "log.txt", FileMode.OpenOrCreate))
                {
                    using (StreamWriter sw = new StreamWriter(fs))
                    {
                        sw.WriteLine("=========Main=============" + Environment.NewLine);
                        sw.WriteLine("-----" + DateTime.Now.ToShortDateString() + "-----" + Environment.NewLine);
                        sw.WriteLine(ex.Message);
                    }
                }
            }

            //Console.WriteLine("End... The end!");
        }
        void TestCloud()
        {
            ICloud cloud = null;
            RemoteStoragePlatform remoteStorrage = RemoteStoragePlatform.All;

            cloud.CloudFileShareResult   += (CloudFileShareResult x, bool y) => { };
            cloud.CloudDownloadUGCResult += (CloudDownloadUGCResult x, bool y) => { };
            b = cloud.Write(s, ba);
            i = cloud.Read(s, ba);
            b = cloud.Forget(s);
            b = cloud.Delete(s);
            cloud.Share(s);
            b = cloud.SetSyncPlatforms(s, remoteStorrage);
            b = cloud.Exists(s);
            b = cloud.Persisted(s);
            i = cloud.GetSize(s);
            l = cloud.Timestamp(s);
            remoteStorrage = cloud.GetSyncPlatforms(s);
            i = cloud.GetFileCount();
            s = cloud.GetFileNameAndSize(i, out i);
            b = cloud.GetQuota(out i, out i);
            b = cloud.IsEnabledForAccount();
            b = cloud.IsEnabledForApplication();
            cloud.SetEnabledForApplication(b);
            cloud.UGCDownload(ugcHandle);
            b         = cloud.GetUGCDetails(ugcHandle, out appID, out s, out i, out steamID);
            i         = cloud.UGCRead(ugcHandle, ba);
            i         = cloud.GetCachedUGCCount();
            ugcHandle = cloud.GetUGCHandle(i);
        }
Exemple #3
0
 public Migrate(ICloud cloud, ICloud local)
 {
     this.cloud     = cloud;
     this.local     = local;
     transactionLog = new TransactionLogFile();
     fileQueue      = new Queue <Containers.Directory>();
     downloadList   = new List <Containers.File>();
 }
Exemple #4
0
        public static ICloud getInstance()
        {
            if (instance == null)
            {
                instance = new Cloud();
            }

            return instance;
        }
        public HostAuthViewModel(HostAuthState state, ICloud provider)
        {
            this.ValidationRule(
                x => x.Username,
                name => !string.IsNullOrWhiteSpace(name),
                "User name shouldn't be null or white space.");

            this.ValidationRule(
                x => x.Password,
                pass => !string.IsNullOrWhiteSpace(pass),
                "Password shouldn't be null or white space.");

            this.ValidationRule(
                x => x.Address,
                host => !string.IsNullOrWhiteSpace(host),
                "Host address shouldn't be null or white space.");

            this.ValidationRule(
                x => x.Port,
                port => int.TryParse(port, out _),
                "Port should be a valid integer.");

            Login = ReactiveCommand.CreateFromTask(
                () => provider.HostAuth(Address, int.Parse(Port), Username, Password),
                this.IsValid());

            _isBusy = Login
                      .IsExecuting
                      .ToProperty(this, x => x.IsBusy);

            _errorMessage = Login
                            .ThrownExceptions
                            .Select(exception => exception.Message)
                            .Log(this, $"Host auth error occured in {provider.Name}")
                            .ToProperty(this, x => x.ErrorMessage);

            _hasErrorMessage = Login
                               .ThrownExceptions
                               .Select(exception => true)
                               .Merge(Login.Select(unit => false))
                               .ToProperty(this, x => x.HasErrorMessage);

            Username = state.Username;
            Password = state.Password;
            Address  = state.Address;
            Port     = state.Port;

            this.WhenAnyValue(x => x.Username)
            .Subscribe(name => state.Username = name);
            this.WhenAnyValue(x => x.Password)
            .Subscribe(name => state.Password = name);
            this.WhenAnyValue(x => x.Address)
            .Subscribe(name => state.Address = name);
            this.WhenAnyValue(x => x.Port)
            .Subscribe(name => state.Port = name);
        }
Exemple #6
0
 public AuthPage(int cloudId)
 {
     InitializeComponent();
     switch (cloudId)
     {
     case 0:    //DropBox
         cloudController = new DropBoxController();
         break;
     }
 }
 public HomeTabController()
 {
     mainWindowinstance      = MainWindow.instance;
     boxController           = new OneDriveController();
     databaseService         = new DatabaseService();
     dropBoxController       = new DropBoxController();
     this.listViewPlansQueue = mainWindowinstance.ListViewBackupQueue;
     mainWindowinstance.ButtonAddCloud.Click      += buttonAddCloud_Click;
     mainWindowinstance.ButtonAddBackupPlan.Click += buttonAddBackupPlan_Click;
     backgroundWorkerLoadClouds = new BackgroundWorker();
     backgroundWorkerLoadClouds.WorkerReportsProgress = true;
     backgroundWorkerLoadClouds.ProgressChanged      += backgroundWorkerLoadClouds_ProgressChanged;
     backgroundWorkerLoadClouds.DoWork += backgroundWorkerLoadClouds_DoWork;
 }
        void SteamTest()
        {
            steam = Steam.Initialize();
            steam = Steam.Instance;

            b     = steam.IsAvailable;
            appID = steam.AppID;
            Settings setting = steam.Settings;
            ICloud   cloud   = steam.Cloud;
            IStats   stats   = steam.Stats;
            IUser    user    = steam.User;

            steam.Shutdown();
            steam.Update();
            steam.ReleaseManagedResources();
        }
Exemple #9
0
    public OAuthViewModel(ICloud provider)
    {
        Login = ReactiveCommand.CreateFromTask(provider.OAuth);

        _isBusy = Login
                  .IsExecuting
                  .ToProperty(this, x => x.IsBusy);

        _errorMessage = Login
                        .ThrownExceptions
                        .Select(exception => exception.Message)
                        .Log(this, $"OAuth error occured in {provider.Name}")
                        .ToProperty(this, x => x.ErrorMessage);

        _hasErrorMessage = Login
                           .ThrownExceptions
                           .Select(exception => true)
                           .Merge(Login.Select(unit => false))
                           .ToProperty(this, x => x.HasErrorMessage);
    }
Exemple #10
0
        static ICloud GetCloudType()
        {
            string cloudName = ConfigurationManager.AppSettings["CloudName"];
            ICloud cloud     = null;

            switch (cloudName.ToUpper())
            {
            case "MEGA":
                cloud = new Mega();
                break;

            case "YANDEX":
                cloud = new Yandex();
                break;

            case "YANDEX_V2":
                cloud = new Yandex_v2();
                break;
            }
            return(cloud);
        }
Exemple #11
0
 private void listViewCloudsType_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (listViewCloudsType.SelectedItems.Count == 1)
     {
         if (listViewCloudsType.SelectedIndices[0] == 0)
         {
             cloudController = new DropBoxController();
             cloudType       = (int)CloudsEnum.DropBox;
         }
         else
         {
             cloudController = new OneDriveController();
             cloudType       = (int)CloudsEnum.OneDrive;
         }
         buttonNext.Enabled = true;
     }
     else
     {
         buttonNext.Enabled = false;
     }
 }
        public static Cloud NativePluginInstance(ICloud cloudObject)
        {
            Cloud plugin;

            // Get plugin class for the actual platform.
                        #if UNITY_IPHONE
            plugin = (Application.isEditor)
                                ? (Cloud) new Cloud_Editor()
                                : (Cloud) new Cloud_iOS();
                        #elif UNITY_ANDROID
            plugin = (Application.isEditor)
                                ? (Cloud) new Cloud_Editor()
                                : (Cloud) new Cloud_Android();
                        #else
            plugin = (Cloud) new Cloud_Editor();
                        #endif

            plugin.cloudObject = cloudObject;

            return(plugin);
        }
    public DirectAuthViewModel(DirectAuthState state, ICloud provider)
    {
        this.ValidationRule(
            x => x.Username,
            name => !string.IsNullOrWhiteSpace(name),
            "User name shouldn't be null or white space.");

        this.ValidationRule(
            x => x.Password,
            pass => !string.IsNullOrWhiteSpace(pass),
            "Password shouldn't be null or white space.");

        Login = ReactiveCommand.CreateFromTask(
            () => provider.DirectAuth(Username, Password),
            this.IsValid());

        _isBusy = Login
                  .IsExecuting
                  .ToProperty(this, x => x.IsBusy);

        _errorMessage = Login
                        .ThrownExceptions
                        .Select(exception => exception.Message)
                        .Log(this, $"Direct auth error occured in {provider.Name}")
                        .ToProperty(this, x => x.ErrorMessage);

        _hasErrorMessage = Login
                           .ThrownExceptions
                           .Select(exception => true)
                           .Merge(Login.Select(unit => false))
                           .ToProperty(this, x => x.HasErrorMessage);

        Username = state.Username;
        Password = state.Password;

        this.WhenAnyValue(x => x.Username)
        .Subscribe(name => state.Username = name);
        this.WhenAnyValue(x => x.Password)
        .Subscribe(pass => state.Password = pass);
    }
Exemple #14
0
        private void ListBoxClouds_SelectedIndexChanged(object sender, EventArgs e)
        {
            isInPlanFolder = false;
            if (((System.Windows.Forms.ListBox)sender).Text.Equals(""))
            {
                return;
            }
            listViewCloudFiles.Items.Clear();
            System.Web.UI.WebControls.ListItem selectedItem = (System.Web.UI.WebControls.ListItem)((System.Windows.Forms.ListBox)sender).SelectedItem;
            Cloud cloud = databaseService.GetCloud(selectedItem.Value);

            currentCLoud = cloud;
            if (currentCLoud.cloudType.Equals("dropbox"))
            {
                cloudController = new DropBoxController();
            }
            else
            {
                cloudController = new OneDriveController();
            }
            cloudController.GetFilesList(cloud.token, LoadFilesCallback, "/");
        }
Exemple #15
0
        public AuthViewModel(
            IDirectAuthViewModel direct,
            IHostAuthViewModel host,
            IOAuthViewModel open,
            ICloud provider)
        {
            OAuth      = open;
            HostAuth   = host;
            DirectAuth = direct;
            _provider  = provider;

            _isAuthenticated = _provider
                               .IsAuthorized
                               .DistinctUntilChanged()
                               .Log(this, $"Authentication state changed for {provider.Name}")
                               .ObserveOn(RxApp.MainThreadScheduler)
                               .ToProperty(this, x => x.IsAuthenticated);

            _isAnonymous = this
                           .WhenAnyValue(x => x.IsAuthenticated)
                           .Select(authenticated => !authenticated)
                           .ToProperty(this, x => x.IsAnonymous);
        }
        private async void Encode(List <FrameInfo> listFrames, int id, Parameters param, CancellationTokenSource tokenSource)
        {
            var processing = this.DispatcherStringResource("Encoder.Processing");

            try
            {
                switch (param.Type)
                {
                case Export.Gif:

                    #region Gif

                    #region Cut/Paint Unchanged Pixels

                    if (param.EncoderType == GifEncoderType.Legacy || param.EncoderType == GifEncoderType.ScreenToGif)
                    {
                        if (param.DetectUnchangedPixels)
                        {
                            Update(id, 0, FindResource("Encoder.Analyzing").ToString());

                            if (param.DummyColor.HasValue)
                            {
                                var color = Color.FromArgb(param.DummyColor.Value.R, param.DummyColor.Value.G, param.DummyColor.Value.B);

                                listFrames = ImageMethods.PaintTransparentAndCut(listFrames, color, id, tokenSource);
                            }
                            else
                            {
                                listFrames = ImageMethods.CutUnchanged(listFrames, id, tokenSource);
                            }
                        }
                        else
                        {
                            var size = listFrames[0].Path.ScaledSize();
                            listFrames.ForEach(x => x.Rect = new Int32Rect(0, 0, (int)size.Width, (int)size.Height));
                        }
                    }

                    #endregion

                    switch (param.EncoderType)
                    {
                    case GifEncoderType.ScreenToGif:

                        #region Improved encoding

                        using (var stream = new MemoryStream())
                        {
                            using (var encoder = new GifFile(stream, param.RepeatCount))
                            {
                                encoder.UseGlobalColorTable = param.UseGlobalColorTable;
                                encoder.TransparentColor    = param.DummyColor;
                                encoder.MaximumNumberColor  = param.MaximumNumberColors;

                                for (var i = 0; i < listFrames.Count; i++)
                                {
                                    if (!listFrames[i].HasArea && param.DetectUnchangedPixels)
                                    {
                                        continue;
                                    }

                                    if (listFrames[i].Delay == 0)
                                    {
                                        listFrames[i].Delay = 10;
                                    }

                                    encoder.AddFrame(listFrames[i].Path, listFrames[i].Rect, listFrames[i].Delay);

                                    Update(id, i, string.Format(processing, i));

                                    #region Cancellation

                                    if (tokenSource.Token.IsCancellationRequested)
                                    {
                                        SetStatus(Status.Canceled, id);
                                        break;
                                    }

                                    #endregion
                                }
                            }

                            try
                            {
                                using (var fileStream = new FileStream(param.Filename, FileMode.Create, FileAccess.Write, FileShare.None, 4096))
                                    stream.WriteTo(fileStream);
                            }
                            catch (Exception ex)
                            {
                                SetStatus(Status.Error, id);
                                LogWriter.Log(ex, "Improved Encoding");
                            }
                        }

                        #endregion

                        break;

                    case GifEncoderType.Legacy:

                        #region Legacy Encoding

                        using (var encoder = new AnimatedGifEncoder())
                        {
                            if (param.DummyColor.HasValue)
                            {
                                var color = Color.FromArgb(param.DummyColor.Value.R,
                                                           param.DummyColor.Value.G, param.DummyColor.Value.B);

                                encoder.SetTransparent(color);
                                encoder.SetDispose(1);         //Undraw Method, "Leave".
                            }

                            encoder.Start(param.Filename);
                            encoder.SetQuality(param.Quality);
                            encoder.SetRepeat(param.RepeatCount);

                            var numImage = 0;
                            foreach (var frame in listFrames)
                            {
                                #region Cancellation

                                if (tokenSource.Token.IsCancellationRequested)
                                {
                                    SetStatus(Status.Canceled, id);
                                    break;
                                }

                                #endregion

                                if (!frame.HasArea && param.DetectUnchangedPixels)
                                {
                                    continue;
                                }

                                var bitmapAux = new Bitmap(frame.Path);

                                encoder.SetDelay(frame.Delay);
                                encoder.AddFrame(bitmapAux, frame.Rect.X, frame.Rect.Y);

                                bitmapAux.Dispose();

                                Update(id, numImage, string.Format(processing, numImage));
                                numImage++;
                            }
                        }

                        #endregion

                        break;

                    case GifEncoderType.PaintNet:

                        #region paint.NET encoding

                        using (var stream = new MemoryStream())
                        {
                            using (var encoder = new GifEncoder(stream, null, null, param.RepeatCount))
                            {
                                for (var i = 0; i < listFrames.Count; i++)
                                {
                                    var bitmapAux = new Bitmap(listFrames[i].Path);
                                    encoder.AddFrame(bitmapAux, 0, 0, TimeSpan.FromMilliseconds(listFrames[i].Delay));
                                    bitmapAux.Dispose();

                                    Update(id, i, string.Format(processing, i));

                                    #region Cancellation

                                    if (tokenSource.Token.IsCancellationRequested)
                                    {
                                        SetStatus(Status.Canceled, id);

                                        break;
                                    }

                                    #endregion
                                }
                            }

                            stream.Position = 0;

                            try
                            {
                                using (var fileStream = new FileStream(param.Filename, FileMode.Create, FileAccess.Write, FileShare.None, Constants.BufferSize, false))
                                    stream.WriteTo(fileStream);
                            }
                            catch (Exception ex)
                            {
                                SetStatus(Status.Error, id);
                                LogWriter.Log(ex, "Encoding with paint.Net.");
                            }
                        }

                        #endregion

                        break;

                    case GifEncoderType.FFmpeg:

                        #region FFmpeg encoding

                        SetStatus(Status.Processing, id, null, true);

                        if (!Util.Other.IsFfmpegPresent())
                        {
                            throw new ApplicationException("FFmpeg not present.");
                        }

                        if (File.Exists(param.Filename))
                        {
                            File.Delete(param.Filename);
                        }

                        #region Generate concat

                        var concat = new StringBuilder();
                        foreach (var frame in listFrames)
                        {
                            concat.AppendLine("file '" + frame.Path + "'");
                            concat.AppendLine("duration " + (frame.Delay / 1000d).ToString(CultureInfo.InvariantCulture));
                        }

                        var concatPath = Path.GetDirectoryName(listFrames[0].Path) ?? Path.GetTempPath();
                        var concatFile = Path.Combine(concatPath, "concat.txt");

                        if (!Directory.Exists(concatPath))
                        {
                            Directory.CreateDirectory(concatPath);
                        }

                        if (File.Exists(concatFile))
                        {
                            File.Delete(concatFile);
                        }

                        File.WriteAllText(concatFile, concat.ToString());

                        #endregion

                        param.Command = string.Format(param.Command, concatFile, param.ExtraParameters.Replace("{H}", param.Height.ToString()).Replace("{W}", param.Width.ToString()), param.Filename);

                        var process = new ProcessStartInfo(UserSettings.All.FfmpegLocation)
                        {
                            Arguments             = param.Command,
                            CreateNoWindow        = true,
                            ErrorDialog           = false,
                            UseShellExecute       = false,
                            RedirectStandardError = true
                        };

                        var pro = Process.Start(process);

                        var str = pro.StandardError.ReadToEnd();

                        var fileInfo = new FileInfo(param.Filename);

                        if (!fileInfo.Exists || fileInfo.Length == 0)
                        {
                            throw new Exception("Error while encoding the gif with FFmpeg.")
                                  {
                                      HelpLink = $"Command:\n\r{param.Command}\n\rResult:\n\r{str}"
                                  }
                        }
                        ;

                        #endregion

                        break;

                    case GifEncoderType.Gifski:

                        #region Gifski encoding

                        SetStatus(Status.Processing, id, null, true);

                        if (!Util.Other.IsGifskiPresent())
                        {
                            throw new ApplicationException("Gifski not present.");
                        }

                        if (File.Exists(param.Filename))
                        {
                            File.Delete(param.Filename);
                        }

                        var gifski = new GifskiInterop();
                        var handle = gifski.Start(UserSettings.All.GifskiQuality, UserSettings.All.Looped);

                        ThreadPool.QueueUserWorkItem(delegate
                        {
                            Thread.Sleep(500);
                            SetStatus(Status.Processing, id, null, false);

                            for (var i = 0; i < listFrames.Count; i++)
                            {
                                Update(id, i, string.Format(processing, i));
                                gifski.AddFrame(handle, (uint)i, listFrames[i].Path, listFrames[i].Delay);
                            }

                            gifski.EndAdding(handle);
                        }, null);

                        gifski.End(handle, param.Filename);

                        var fileInfo2 = new FileInfo(param.Filename);

                        if (!fileInfo2.Exists || fileInfo2.Length == 0)
                        {
                            throw new Exception("Error while encoding the gif with Gifski.", new Win32Exception())
                                  {
                                      HelpLink = $"Command:\n\r{param.Command}\n\rResult:\n\r{Marshal.GetLastWin32Error()}"
                                  }
                        }
                        ;

                        #endregion

                        break;

                    default:
                        throw new Exception("Undefined Gif encoder type");
                    }

                    #endregion

                    break;

                case Export.Apng:

                    #region Apng

                    #region Cut/Paint Unchanged Pixels

                    if (param.DetectUnchangedPixels)
                    {
                        Update(id, 0, FindResource("Encoder.Analyzing").ToString());

                        if (param.DummyColor.HasValue)
                        {
                            var color = Color.FromArgb(param.DummyColor.Value.A, param.DummyColor.Value.R, param.DummyColor.Value.G, param.DummyColor.Value.B);
                            listFrames = ImageMethods.PaintTransparentAndCut(listFrames, color, id, tokenSource);
                        }
                        else
                        {
                            listFrames = ImageMethods.CutUnchanged(listFrames, id, tokenSource);
                        }
                    }
                    else
                    {
                        var size = listFrames[0].Path.ScaledSize();
                        listFrames.ForEach(x => x.Rect = new Int32Rect(0, 0, (int)size.Width, (int)size.Height));
                    }

                    #endregion

                    #region Encoding

                    using (var stream = new MemoryStream())
                    {
                        var frameCount = listFrames.Count(x => x.HasArea);

                        using (var encoder = new Apng(stream, frameCount, param.RepeatCount))
                        {
                            for (var i = 0; i < listFrames.Count; i++)
                            {
                                if (!listFrames[i].HasArea && param.DetectUnchangedPixels)
                                {
                                    continue;
                                }

                                if (listFrames[i].Delay == 0)
                                {
                                    listFrames[i].Delay = 10;
                                }

                                encoder.AddFrame(listFrames[i].Path, listFrames[i].Rect, listFrames[i].Delay);

                                Update(id, i, string.Format(processing, i));

                                #region Cancellation

                                if (tokenSource.Token.IsCancellationRequested)
                                {
                                    SetStatus(Status.Canceled, id);
                                    break;
                                }

                                #endregion
                            }
                        }

                        try
                        {
                            using (var fileStream = new FileStream(param.Filename, FileMode.Create, FileAccess.Write, FileShare.None, 4096))
                                stream.WriteTo(fileStream);
                        }
                        catch (Exception ex)
                        {
                            SetStatus(Status.Error, id);
                            LogWriter.Log(ex, "Apng Encoding");
                        }
                    }

                    #endregion

                    #endregion

                    break;

                case Export.Video:

                    #region Video

                    switch (param.VideoEncoder)
                    {
                    case VideoEncoderType.AviStandalone:

                        #region Avi Standalone

                        var image = listFrames[0].Path.SourceFrom();

                        if (File.Exists(param.Filename))
                        {
                            File.Delete(param.Filename);
                        }

                        //1000 / listFrames[0].Delay
                        using (var aviWriter = new AviWriter(param.Filename, param.Framerate, image.PixelWidth, image.PixelHeight, param.VideoQuality))
                        {
                            var numImage = 0;
                            foreach (var frame in listFrames)
                            {
                                using (var outStream = new MemoryStream())
                                {
                                    var bitImage = frame.Path.SourceFrom();

                                    var enc = new BmpBitmapEncoder();
                                    enc.Frames.Add(BitmapFrame.Create(bitImage));
                                    enc.Save(outStream);

                                    outStream.Flush();

                                    using (var bitmap = new Bitmap(outStream))
                                        aviWriter.AddFrame(bitmap, param.FlipVideo);
                                }

                                Update(id, numImage, string.Format(processing, numImage));
                                numImage++;

                                #region Cancellation

                                if (tokenSource.Token.IsCancellationRequested)
                                {
                                    SetStatus(Status.Canceled, id);
                                    break;
                                }

                                #endregion
                            }
                        }

                        #endregion

                        break;

                    case VideoEncoderType.Ffmpg:

                        #region Video using FFmpeg

                        SetStatus(Status.Processing, id, null, true);

                        if (!Util.Other.IsFfmpegPresent())
                        {
                            throw new ApplicationException("FFmpeg not present.");
                        }

                        if (File.Exists(param.Filename))
                        {
                            File.Delete(param.Filename);
                        }

                        #region Generate concat

                        var concat = new StringBuilder();
                        foreach (var frame in listFrames)
                        {
                            concat.AppendLine("file '" + frame.Path + "'");
                            concat.AppendLine("duration " + (frame.Delay / 1000d).ToString(CultureInfo.InvariantCulture));
                        }

                        var concatPath = Path.GetDirectoryName(listFrames[0].Path) ?? Path.GetTempPath();
                        var concatFile = Path.Combine(concatPath, "concat.txt");

                        if (!Directory.Exists(concatPath))
                        {
                            Directory.CreateDirectory(concatPath);
                        }

                        if (File.Exists(concatFile))
                        {
                            File.Delete(concatFile);
                        }

                        File.WriteAllText(concatFile, concat.ToString());

                        #endregion

                        param.Command = string.Format(param.Command, concatFile, param.ExtraParameters.Replace("{H}", param.Height.ToString()).Replace("{W}", param.Width.ToString()), param.Filename);

                        var process = new ProcessStartInfo(UserSettings.All.FfmpegLocation)
                        {
                            Arguments             = param.Command,
                            CreateNoWindow        = true,
                            ErrorDialog           = false,
                            UseShellExecute       = false,
                            RedirectStandardError = true
                        };

                        var pro = Process.Start(process);

                        var str = pro.StandardError.ReadToEnd();

                        var fileInfo = new FileInfo(param.Filename);

                        if (!fileInfo.Exists || fileInfo.Length == 0)
                        {
                            throw new Exception("Error while encoding with FFmpeg.")
                                  {
                                      HelpLink = str
                                  }
                        }
                        ;

                        #endregion

                        break;

                    default:
                        throw new Exception("Undefined video encoder");
                    }

                    #endregion

                    break;

                default:
                    throw new ArgumentOutOfRangeException(nameof(param));
                }

                //If it was canceled, try deleting the file.
                if (tokenSource.Token.IsCancellationRequested)
                {
                    if (File.Exists(param.Filename))
                    {
                        File.Delete(param.Filename);
                    }

                    SetStatus(Status.Canceled, id);
                    return;
                }

                #region Upload

                if (param.Upload && File.Exists(param.Filename))
                {
                    InternalUpdate(id, "Encoder.Uploading", true, true);

                    try
                    {
                        ICloud cloud = CloudFactory.CreateCloud(param.UploadDestinationIndex);

                        var uploadedFile = await cloud.UploadFileAsync(param.Filename, CancellationToken.None);

                        InternalSetUpload(id, true, uploadedFile.Link, uploadedFile.DeleteLink);
                    }
                    catch (Exception e)
                    {
                        LogWriter.Log(e, "It was not possible to run the post encoding command.");
                        InternalSetUpload(id, false, null, null, e);
                    }
                }

                #endregion

                #region Copy to clipboard

                if (param.CopyToClipboard && File.Exists(param.Filename))
                {
                    Dispatcher.Invoke(() =>
                    {
                        try
                        {
                            var data = new DataObject();

                            switch (param.CopyType)
                            {
                            case CopyType.File:
                                if (param.Type != Export.Video)
                                {
                                    data.SetImage(param.Filename.SourceFrom());
                                }

                                data.SetText(param.Filename, TextDataFormat.Text);
                                data.SetFileDropList(new StringCollection {
                                    param.Filename
                                });
                                break;

                            case CopyType.FolderPath:
                                data.SetText(Path.GetDirectoryName(param.Filename) ?? param.Filename, TextDataFormat.Text);
                                break;

                            case CopyType.Link:
                                var link = InternalGetUpload(id);

                                data.SetText(string.IsNullOrEmpty(link) ? param.Filename : link, TextDataFormat.Text);
                                break;

                            default:
                                data.SetText(param.Filename, TextDataFormat.Text);
                                break;
                            }

                            //It tries to set the data to the clipboard 10 times before failing it to do so.
                            //This issue may happen if the clipboard is opened by any clipboard manager.
                            for (var i = 0; i < 10; i++)
                            {
                                try
                                {
                                    Clipboard.SetDataObject(data, true);
                                    break;
                                }
                                catch (COMException ex)
                                {
                                    if ((uint)ex.ErrorCode != 0x800401D0) //CLIPBRD_E_CANT_OPEN
                                    {
                                        throw;
                                    }
                                }

                                Thread.Sleep(100);
                            }

                            InternalSetCopy(id, true);
                        }
                        catch (Exception e)
                        {
                            LogWriter.Log(e, "It was not possible to copy the file.");
                            InternalSetCopy(id, false, e);
                        }
                    });
                }

                #endregion

                #region Execute commands

                if (param.ExecuteCommands && !string.IsNullOrWhiteSpace(param.PostCommands))
                {
                    InternalUpdate(id, "Encoder.Executing", true, true);

                    var command = param.PostCommands.Replace("{p}", "\"" + param.Filename + "\"").Replace("{f}", "\"" + Path.GetDirectoryName(param.Filename) + "\"");
                    var output  = "";

                    try
                    {
                        foreach (var com in command.Split(new[] { '\n' }, StringSplitOptions.RemoveEmptyEntries))
                        {
                            var procStartInfo = new ProcessStartInfo("cmd", "/c " + com)
                            {
                                RedirectStandardOutput = true,
                                RedirectStandardError  = true,
                                UseShellExecute        = false,
                                CreateNoWindow         = true
                            };

                            using (var process = new Process())
                            {
                                process.StartInfo = procStartInfo;
                                process.Start();

                                var message = process.StandardOutput.ReadToEnd();
                                var error   = process.StandardError.ReadToEnd();

                                if (!string.IsNullOrWhiteSpace(message))
                                {
                                    output += message + Environment.NewLine;
                                }

                                if (!string.IsNullOrWhiteSpace(message))
                                {
                                    output += message + Environment.NewLine;
                                }

                                if (!string.IsNullOrWhiteSpace(error))
                                {
                                    throw new Exception(error);
                                }

                                process.WaitForExit(1000);
                            }
                        }

                        InternalSetCommand(id, true, command, output);
                    }
                    catch (Exception e)
                    {
                        LogWriter.Log(e, "It was not possible to run the post encoding command.");
                        InternalSetCommand(id, false, command, output, e);
                    }
                }

                #endregion

                if (!tokenSource.Token.IsCancellationRequested)
                {
                    SetStatus(Status.Completed, id, param.Filename);
                }
            }
            catch (Exception ex)
            {
                LogWriter.Log(ex, "Encode");

                SetStatus(Status.Error, id, null, false, ex);
            }
            finally
            {
                #region Delete Encoder Folder

                try
                {
                    var encoderFolder = Path.GetDirectoryName(listFrames[0].Path);

                    if (!string.IsNullOrEmpty(encoderFolder))
                    {
                        if (Directory.Exists(encoderFolder))
                        {
                            Directory.Delete(encoderFolder, true);
                        }
                    }
                }
                catch (Exception ex)
                {
                    LogWriter.Log(ex, "Cleaning the Encode folder");
                }

                #endregion

                GC.Collect();
            }
        }
Exemple #17
0
        public CloudViewModel(
            CloudState state,
            CreateFolderViewModelFactory createFolderFactory,
            RenameFileViewModelFactory renameFactory,
            FileViewModelFactory fileFactory,
            FolderViewModelFactory folderFactory,
            IAuthViewModel auth,
            IFileManager files,
            ICloud cloud)
        {
            _cloud = cloud;
            Folder = createFolderFactory(this);
            Rename = renameFactory(this);
            Auth   = auth;

            var canInteract = this
                              .WhenAnyValue(
                x => x.Folder.IsVisible,
                x => x.Rename.IsVisible,
                (folder, rename) => !folder && !rename);

            _canInteract = canInteract
                           .ToProperty(this, x => x.CanInteract);

            var canRefresh = this
                             .WhenAnyValue(
                x => x.Folder.IsVisible,
                x => x.Rename.IsVisible,
                x => x.Auth.IsAuthenticated,
                (folder, rename, authenticated) => !folder && !rename && authenticated);

            Refresh = ReactiveCommand.CreateFromTask(
                () => cloud.GetFiles(CurrentPath),
                canRefresh);

            _files = Refresh
                     .Select(
                items => items
                .Select(file => fileFactory(file, this))
                .OrderByDescending(file => file.IsFolder)
                .ThenBy(file => file.Name)
                .ToList())
                     .Where(items => Files == null || !items.SequenceEqual(Files))
                     .ToProperty(this, x => x.Files);

            _isLoading = Refresh
                         .IsExecuting
                         .ToProperty(this, x => x.IsLoading);

            _isReady = Refresh
                       .IsExecuting
                       .Skip(1)
                       .Select(executing => !executing)
                       .ToProperty(this, x => x.IsReady);

            var canOpenCurrentPath = this
                                     .WhenAnyValue(x => x.SelectedFile)
                                     .Select(file => file != null && file.IsFolder)
                                     .CombineLatest(Refresh.IsExecuting, canInteract, (folder, busy, ci) => folder && ci && !busy);

            Open = ReactiveCommand.Create(
                () => Path.Combine(CurrentPath, SelectedFile.Name),
                canOpenCurrentPath);

            var canCurrentPathGoBack = this
                                       .WhenAnyValue(x => x.CurrentPath)
                                       .Where(path => path != null)
                                       .Select(path => path.Length > cloud.InitialPath.Length)
                                       .CombineLatest(Refresh.IsExecuting, canInteract, (valid, busy, ci) => valid && ci && !busy);

            Back = ReactiveCommand.Create(
                () => Path.GetDirectoryName(CurrentPath),
                canCurrentPathGoBack);

            SetPath = ReactiveCommand.Create <string, string>(path => path);

            _currentPath = Open
                           .Merge(Back)
                           .Merge(SetPath)
                           .Select(path => path ?? cloud.InitialPath)
                           .DistinctUntilChanged()
                           .Log(this, $"Current path changed in {cloud.Name}")
                           .ToProperty(this, x => x.CurrentPath, state.CurrentPath ?? cloud.InitialPath);

            var getBreadCrumbs = ReactiveCommand.CreateFromTask(
                () => cloud.GetBreadCrumbs(CurrentPath));

            _breadCrumbs = getBreadCrumbs
                           .Where(items => items != null && items.Any())
                           .Select(items => items.Select(folder => folderFactory(folder, this)))
                           .ToProperty(this, x => x.BreadCrumbs);

            _showBreadCrumbs = getBreadCrumbs
                               .ThrownExceptions
                               .Select(exception => false)
                               .Merge(getBreadCrumbs.Select(items => items != null && items.Any()))
                               .ObserveOn(RxApp.MainThreadScheduler)
                               .ToProperty(this, x => x.ShowBreadCrumbs);

            _hideBreadCrumbs = this
                               .WhenAnyValue(x => x.ShowBreadCrumbs)
                               .Select(show => !show)
                               .ToProperty(this, x => x.HideBreadCrumbs);

            this.WhenAnyValue(x => x.CurrentPath, x => x.IsReady)
            .Where(x => x.Item1 != null && x.Item2)
            .Select(_ => Unit.Default)
            .InvokeCommand(getBreadCrumbs);

            this.WhenAnyValue(x => x.CurrentPath)
            .Skip(1)
            .Select(_ => Unit.Default)
            .InvokeCommand(Refresh);

            this.WhenAnyValue(x => x.CurrentPath)
            .Subscribe(_ => SelectedFile = null);

            _isCurrentPathEmpty = this
                                  .WhenAnyValue(x => x.Files)
                                  .Skip(1)
                                  .Where(items => items != null)
                                  .Select(items => !items.Any())
                                  .ToProperty(this, x => x.IsCurrentPathEmpty);

            _hasErrorMessage = Refresh
                               .ThrownExceptions
                               .Select(exception => true)
                               .ObserveOn(RxApp.MainThreadScheduler)
                               .Merge(Refresh.Select(x => false))
                               .ToProperty(this, x => x.HasErrorMessage);

            var canUploadToCurrentPath = this
                                         .WhenAnyValue(x => x.CurrentPath)
                                         .Select(path => path != null)
                                         .CombineLatest(Refresh.IsExecuting, canInteract, (up, loading, can) => up && can && !loading);

            UploadToCurrentPath = ReactiveCommand.CreateFromObservable(
                () => Observable
                .FromAsync(files.OpenRead)
                .Where(response => response.Name != null && response.Stream != null)
                .Select(args => _cloud.UploadFile(CurrentPath, args.Stream, args.Name))
                .SelectMany(task => task.ToObservable()),
                canUploadToCurrentPath);

            UploadToCurrentPath.InvokeCommand(Refresh);

            var canDownloadSelectedFile = this
                                          .WhenAnyValue(x => x.SelectedFile)
                                          .Select(file => file != null && !file.IsFolder)
                                          .CombineLatest(Refresh.IsExecuting, canInteract, (down, loading, can) => down && !loading && can);

            DownloadSelectedFile = ReactiveCommand.CreateFromObservable(
                () => Observable
                .FromAsync(() => files.OpenWrite(SelectedFile.Name))
                .Where(stream => stream != null)
                .Select(stream => _cloud.DownloadFile(SelectedFile.Path, stream))
                .SelectMany(task => task.ToObservable()),
                canDownloadSelectedFile);

            var canLogout = cloud
                            .IsAuthorized
                            .DistinctUntilChanged()
                            .Select(loggedIn => loggedIn && (
                                        cloud.SupportsDirectAuth ||
                                        cloud.SupportsOAuth ||
                                        cloud.SupportsHostAuth))
                            .CombineLatest(canInteract, (logout, interact) => logout && interact)
                            .ObserveOn(RxApp.MainThreadScheduler);

            Logout = ReactiveCommand.CreateFromTask(cloud.Logout, canLogout);

            _canLogout = canLogout
                         .ToProperty(this, x => x.CanLogout);

            var canDeleteSelection = this
                                     .WhenAnyValue(x => x.SelectedFile)
                                     .Select(file => file != null && !file.IsFolder)
                                     .CombineLatest(Refresh.IsExecuting, canInteract, (del, loading, ci) => del && !loading && ci);

            DeleteSelectedFile = ReactiveCommand.CreateFromTask(
                () => cloud.Delete(SelectedFile.Path, SelectedFile.IsFolder),
                canDeleteSelection);

            DeleteSelectedFile.InvokeCommand(Refresh);

            var canUnselectFile = this
                                  .WhenAnyValue(x => x.SelectedFile)
                                  .Select(selection => selection != null)
                                  .CombineLatest(Refresh.IsExecuting, canInteract, (sel, loading, ci) => sel && !loading && ci);

            UnselectFile = ReactiveCommand.Create(
                () => { SelectedFile = null; },
                canUnselectFile);

            UploadToCurrentPath.ThrownExceptions
            .Merge(DeleteSelectedFile.ThrownExceptions)
            .Merge(DownloadSelectedFile.ThrownExceptions)
            .Merge(Refresh.ThrownExceptions)
            .Merge(getBreadCrumbs.ThrownExceptions)
            .Log(this, $"Exception occured in provider {cloud.Name}")
            .Subscribe();

            this.WhenAnyValue(x => x.CurrentPath)
            .Subscribe(path => state.CurrentPath = path);

            this.WhenAnyValue(x => x.Auth.IsAuthenticated)
            .Select(authenticated => authenticated ? _cloud.Parameters?.Token : null)
            .Subscribe(token => state.Token = token);

            this.WhenAnyValue(x => x.Auth.IsAuthenticated)
            .Select(authenticated => authenticated ? _cloud.Parameters?.User : null)
            .Subscribe(user => state.User = user);

            this.WhenActivated(ActivateAutoRefresh);
        }
        public CreateFolderViewModel(CreateFolderState state, ICloudViewModel owner, ICloud provider)
        {
            _path = owner
                    .WhenAnyValue(x => x.CurrentPath)
                    .ToProperty(this, x => x.Path);

            this.ValidationRule(
                x => x.Name,
                name => !string.IsNullOrWhiteSpace(name),
                "Folder name shouldn't be empty.");

            var pathRule = this.ValidationRule(
                x => x.Path,
                path => !string.IsNullOrWhiteSpace(path),
                "Path shouldn't be empty");

            Create = ReactiveCommand.CreateFromTask(
                () => provider.CreateFolder(Path, Name),
                this.IsValid());

            _isLoading = Create.IsExecuting
                         .ToProperty(this, x => x.IsLoading);

            var canInteract = owner
                              .WhenAnyValue(x => x.CanInteract)
                              .Skip(1)
                              .StartWith(true);

            var canOpen = this
                          .WhenAnyValue(x => x.IsVisible)
                          .Select(visible => !visible)
                          .CombineLatest(
                canInteract,
                pathRule.WhenAnyValue(x => x.IsValid),
                (visible, interact, path) => visible && provider.CanCreateFolder && interact && path);

            var canClose = this
                           .WhenAnyValue(x => x.IsVisible)
                           .Select(visible => visible);

            Open  = ReactiveCommand.Create(() => { }, canOpen);
            Close = ReactiveCommand.Create(() => { }, canClose);

            Open.Select(unit => true)
            .Merge(Close.Select(unit => false))
            .Subscribe(visible => IsVisible = visible);

            Close.Subscribe(x => Name = string.Empty);
            Create.InvokeCommand(Close);

            _hasErrorMessage = Create
                               .ThrownExceptions
                               .Select(exception => true)
                               .Merge(Close.Select(unit => false))
                               .ToProperty(this, x => x.HasErrorMessage);

            _errorMessage = Create
                            .ThrownExceptions
                            .Select(exception => exception.Message)
                            .Log(this, $"Create folder error occured in {provider.Name}")
                            .Merge(Close.Select(unit => string.Empty))
                            .ToProperty(this, x => x.ErrorMessage);

            Name      = state.Name;
            IsVisible = state.IsVisible;

            this.WhenAnyValue(x => x.Name)
            .Subscribe(name => state.Name = name);
            this.WhenAnyValue(x => x.IsVisible)
            .Subscribe(visible => state.IsVisible = visible);
        }
        public EcosApplication(ILicense licenseProvider, IConnection connectionProvider, IStorage storageProvider, ICloud cloudProvider)
        {
            if (connectionProvider == null)
                throw new ArgumentNullException("connectionProvider");
            if (storageProvider == null)
                throw new ArgumentNullException("storageProvider");
            if (licenseProvider == null)
                throw new ArgumentNullException("licenseProvider");
            if (cloudProvider == null)
                throw new ArgumentNullException("cloudProvider");

            Current = this;
            License = licenseProvider;
            storage = storageProvider;
            cloud = cloudProvider;

            connection = connectionProvider;
            connection.Disconnected += connection_Disconnected;
            connection.ServerDisconnected += connection_ServerDisconnected;
            connection.Received += connection_DataReceived;

            IsConnected = connection.IsConnected;

            var profiles = storage.GetData(nameof(Profiles), new ObservableCollection<EcosProfile>());
            profiles.All(profile => {
                RegisterProfileNotifications(profile);
                Profiles.Add(profile);
                return true;
            });

            Profiles.CollectionChanged += (s, e) =>
            {
                if (e.NewItems != null)
                    foreach (EcosProfile profile in e.NewItems)
                        RegisterProfileNotifications(profile);

                NotifyProfilesChanged();
            };
        }
Exemple #20
0
 public CloudVisualization(ICloud cloud, IPaletteDictionaryFactory paletteDictionaryFactory)
 {
     PaletteDictionary = paletteDictionaryFactory.GetPaletteDictioanry();
     this.cloud = cloud;
 }
Exemple #21
0
    private void OnGUI()
    {
        GUILayout.Label(status);
        GUILayout.Label(achievementStatus);
        GUILayout.Label(hasLicense.ToString());
        GUILayout.Label(SteamInterface.AppID.ToString());

        if (GUILayout.Button("Unlock Achivement!"))
        {
            if (SteamInterface.Stats.SetAchievement("Your-Achievement-Name"))
            {
                achievementStatus = "Achievement Status: Successfully got an achievement!";
            }
        }

        if (GUILayout.Button("Clear Achivement!"))
        {
            if (SteamInterface.Stats.ClearAchievement("Your-Achievement-Name"))
            {
                achievementStatus = "Achievement Status: Successfully cleared an achievement!";
            }
        }

        if (GUILayout.Button("Get Achievement!"))
        {
            StatsGetAchievementResult result = SteamInterface.Stats.GetAchievement("Your-Achievement-Name");
            if (result.result)
            {
                if (result.sender)
                {
                    achievementStatus = "Achievement Status: achievement is unlocked!";
                }
                else
                {
                    achievementStatus = "Achievement Status: achievement is locked!";
                }
            }
        }

        GUILayout.Space(24);

        if (GUILayout.Button("Write File"))
        {
            byte[]   buffer       = System.Text.Encoding.ASCII.GetBytes("Hello World again!!!");
            GCHandle bufferHandle = GCHandle.Alloc(buffer, GCHandleType.Pinned);

            try
            {
                System.IntPtr bufferPtr = Marshal.UnsafeAddrOfPinnedArrayElement(buffer, 0);
                SteamInterface.Cloud.Write("test123.dat", bufferPtr, 128);
            }
            finally
            {
                bufferHandle.Free();
            }
        }
        if (GUILayout.Button("Check Number of Files"))
        {
            ICloud cloud = SteamInterface.Cloud;
            Debug.Log("test123.dat Exists? " + cloud.Exists("test123.dat"));
        }
        if (GUILayout.Button("Read File"))
        {
            ICloud cloud     = Steamworks.SteamInterface.Cloud;
            string _filename = "test123.dat";
            int    filesize  = cloud.GetSize(_filename);
            Debug.Log("File Size: " + filesize);

            IntPtr hLocalRead = Marshal.AllocHGlobal(filesize);              // I am guessing this could be a problem line
            int    amountRead = cloud.Read(_filename, hLocalRead, filesize); // I am guessing this could be a problem line.
            Debug.Log("Amount Read: " + amountRead);

            String returnedString = Marshal.PtrToStringAnsi(hLocalRead);
            Debug.Log("Our Read Data is: " + returnedString);

            Marshal.FreeHGlobal(hLocalRead);
        }
        if (GUILayout.Button("Delete File"))
        {
            ICloud cloud = SteamInterface.Cloud;
            cloud.Delete("test123.dat");
            cloud.Forget("test123.dat");
        }

        GUILayout.Space(24);

        // NOTE!
        // Overlays might not work in the Unity editor, see the documentation for more information
        if (GUILayout.Button("Show overlay"))
        {
            // Will show the game overlay and show the Friends dialog.
            SteamInterface.Friends.ActivateGameOverlay(OverlayDialog.Friends);
        }
        if (GUILayout.Button("Show overlay (webpage)"))
        {
            // Will show the game overlay and open a web page.
            SteamInterface.Friends.ActivateGameOverlayToWebPage("http://ludosity.com");
        }
    }
Exemple #22
0
 public static EPPZ.Cloud.Plugin.Cloud NativePluginInstance(ICloud cloudObject)
 {
     EPPZ.Cloud.Plugin.Cloud cloud = !Application.isEditor ? ((EPPZ.Cloud.Plugin.Cloud) new Cloud_Android()) : ((EPPZ.Cloud.Plugin.Cloud) new Cloud_Editor());
     cloud.cloudObject = cloudObject;
     return(cloud);
 }
Exemple #23
0
 /**
  * Set the delegate implementation.
  *
  * @param _delegate The delegate implementing platform specific functions.
  */
 public void SetDelegate(ICloud _delegate)
 {
     this._delegate = _delegate;
 }
Exemple #24
0
 /**
  * Constructor with delegate.
  *
  * @param _delegate The delegate implementing platform specific functions.
  */
 public CloudBridge(ICloud _delegate) : base()
 {
     this._delegate = _delegate;
 }
        public RenameFileViewModel(RenameFileState state, ICloudViewModel owner, ICloud provider)
        {
            _oldName = owner
                       .WhenAnyValue(x => x.SelectedFile.Name)
                       .ToProperty(this, x => x.OldName);

            this.ValidationRule(
                x => x.NewName,
                name => !string.IsNullOrWhiteSpace(name),
                "New name shouldn't be empty.");

            var oldRule = this.ValidationRule(
                x => x.OldName,
                name => !string.IsNullOrWhiteSpace(name),
                "Old name shouldn't be empty.");

            Rename = ReactiveCommand.CreateFromTask(
                () => provider.RenameFile(owner.SelectedFile.Path, NewName),
                this.IsValid());

            _isLoading = Rename
                         .IsExecuting
                         .ToProperty(this, x => x.IsLoading);

            var canInteract = owner
                              .WhenAnyValue(x => x.CanInteract)
                              .Skip(1)
                              .StartWith(true);

            var canOpen = this
                          .WhenAnyValue(x => x.IsVisible)
                          .Select(visible => !visible)
                          .CombineLatest(
                canInteract,
                oldRule.WhenAnyValue(x => x.IsValid),
                (visible, interact, old) => visible && old && interact);

            var canClose = this
                           .WhenAnyValue(x => x.IsVisible)
                           .Select(visible => visible);

            Open  = ReactiveCommand.Create(() => { }, canOpen);
            Close = ReactiveCommand.Create(() => { }, canClose);

            Open.Select(unit => true)
            .Merge(Close.Select(unit => false))
            .Subscribe(visible => IsVisible = visible);

            Close.Subscribe(x => NewName = string.Empty);
            Rename.InvokeCommand(Close);

            _hasErrorMessage = Rename
                               .ThrownExceptions
                               .Select(exception => true)
                               .Merge(Close.Select(x => false))
                               .ToProperty(this, x => x.HasErrorMessage);

            _errorMessage = Rename
                            .ThrownExceptions
                            .Select(exception => exception.Message)
                            .Log(this, $"Rename file error occured in {provider.Name} for {OldName}")
                            .Merge(Close.Select(x => string.Empty))
                            .ToProperty(this, x => x.ErrorMessage);

            NewName = state.NewName;
            this.WhenAnyValue(x => x.NewName)
            .Subscribe(name => state.NewName = name);
        }
 /// <summary>
 /// Creates a secret manager with a connection string and cloud
 /// </summary>
 /// <param name="connectionString">The connection string</param>
 /// <param name="cloud">The cloud</param>
 public SecretManager(string connectionString, ICloud cloud)
 {
     _connectionString = connectionString;
     _cloud = cloud;
 }
Exemple #27
0
 public MusicController(DataBaseContext db, IConfiguration config, ICloud cloud)
 {
     this.db     = db;
     this.config = config;
     this.cloud  = cloud;
 }