Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

This is discontinued. #66

Open
SuperJMN opened this issue Oct 4, 2017 · 22 comments
Open

This is discontinued. #66

SuperJMN opened this issue Oct 4, 2017 · 22 comments

Comments

@SuperJMN
Copy link

SuperJMN commented Oct 4, 2017

You just have to take a look to see that this project isn't even maintained.

@Szymaniuk
Copy link

Is there any other really good alternative for this plugin?

@SuperJMN
Copy link
Author

I don't really know. If someone can answer, please, do!

@Szymaniuk
Copy link

I really didn't have much issues with this plugin, except this one #14
but I'm worry about the future, and if something won't break in next XF/Android/iOS releases.

Anyone :P?

@xavier-rigau
Copy link

We had a lot of issues with PCLStorage and we submitted a few. The API is quite limited but workable.

Here is another one #61

I would be interested in a replacement too.

@Binnette
Copy link

Binnette commented Nov 6, 2017

I also think that this plugin is discontinued. This is a very bad news 😢
This plugin is still referenced as 'the' xamarin storage plugin in this page :
https://github.com/xamarin/XamarinComponents

@antonioseric opened an issue here xamarin/XamarinComponents#27
He recommands this alternative plugin : https://github.com/PCLExt/PCLExt.FileStorage

@Binnette
Copy link

Hi, i fill a bug report to Xamarin. You can view and comment it here : https://bugzilla.xamarin.com/show_bug.cgi?id=60749

@Binnette
Copy link

Hi, if you want a .NET Standard Storage plugin, please vote here 👍 👍 👍
https://xamarin.uservoice.com/forums/144858-xamarin-platform-suggestions/suggestions/32307739-create-a-net-standard-storage-plugin-for-xamarin

@xavier-rigau
Copy link

Replace or update this plug in please. We desperately need one that is up-to-date and more convenient. Daniel @dsplaisted is no longer actively working on this one. It is workable but it has a few open issues and the interface is limited. I agree with @Binnette

@LanceMcCarthy
Copy link

LanceMcCarthy commented Jan 18, 2018

Use System.IO, it's available on Android, iOS and UWP.

@charlesroddie
Copy link

@binette System.IO is in .Net Standard 2.0.

@robintschroeder
Copy link

@charlesroddie
Copy link

@robintschroeder That may be useful for projects that are on .Net Standard 1.x (e.g. needing to support Windows 8 store apps) but not needed for projects that can target .Net Standard 2.0. I migrated from PCLStorage to System.IO and while PCLStorage was an essential solution to a major problem at the time, it's much nicer to use System.IO.

@Szymaniuk
Copy link

Szymaniuk commented Mar 7, 2018

I also completely get rid of PCLStorage and moved to pure System.IO with .NETStandard 2.0.

@ghuntley
Copy link
Collaborator

ghuntley commented Apr 4, 2018

Howdy @robintschroeder I managed to get some 1:1 time with the maintainer whilst at mvpsummit. I now have admin privs on this github repo and admin privs on nuget to push new versions. Do you want to take over as maintainer (or at min raise a PR from your fork into this repo so that folks have a smoother upgrade path?)

@dsplaisted
Copy link
Owner

@ghuntley I think you still need to accept the invite to be a collaborator on the repo so I can mark you as an admin

@charlesroddie
Copy link

Is there any reason to keep this project going? What features does it add that are not in .Net Standard?

@Bobisback
Copy link

Bobisback commented Apr 17, 2018

@charlesroddie or @Szymaniuk Are there any samples or examples of using System.IO in xamarin forms. Or any docs that explain migrating from PLC Storage to Ssytem.IO?

@LanceMcCarthy
Copy link

LanceMcCarthy commented Apr 17, 2018

@Bobisback System.IO has a File object, which has a ton of helpful methods. I recommend reading this documentation, it's a great place to start.

image

Here's a simple example that will save text to a file, then reopen the file to verify that it was properly saved:

<Grid>
    <Grid.RowDefinitions>
        <RowDefinition />
        <RowDefinition Height="Auto" />
    </Grid.RowDefinitions>

    <Label x:Name="OutputLabel"
           LineBreakMode="CharacterWrap" />

    <Button Text="Save File"
            Clicked="Button_OnClicked"
            Grid.Row="1" />
</Grid>

UPDATED

private int writeNumber = 0;

private void Button_OnClicked(object sender, EventArgs e)
{
    try
    {
        var currentFolder = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);

        var fileName = "notes.txt";
        var filePath = Path.Combine(currentFolder, fileName);

        using (var fileStream = File.OpenWrite(filePath))
        using (var streamWriter = new StreamWriter(fileStream))
        {
            streamWriter.WriteLine($"Text writing {++writeNumber}");
        }

        using (var streamReader = File.OpenText(filePath))
        {
            OutputLabel.Text = streamReader.ReadToEnd();
        }
    }
    catch (Exception ex)
    {
        Debug.WriteLine($"Exception: {ex}");
    }
}

@Bobisback
Copy link

So Directory.GetCurrentDirectory() will reliably get the local storage directory of iOS and Android?

I guess this was probably my biggest concern, Is making sure that the files are being saved in a place that is considered legal by ios and android standards.

@LanceMcCarthy
Copy link

LanceMcCarthy commented Apr 17, 2018

No, even though my above example works on iOS, it won't on UWP because the app doesn't have permissions to write to that folder (you'll get a System.UnauthorizedAccessException).

You would want to get the safe folder for each platform and use that. You can do this with a DependencyService, see Working With Files doc. You'll see that each platform is able to provide a folder that files get saved to.

@charlesroddie
Copy link

charlesroddie commented Apr 18, 2018

@Bobisback I am using Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData)

@LanceMcCarthy Also it's best to use Path.Combine since slashes go in different directions on different platforms.

@LanceMcCarthy
Copy link

LanceMcCarthy commented Apr 18, 2018

Thanks @charlesroddie,

@Bobisback I updated my snippet.

Side Notes:

Environment.GetFolderPath and Environment.SpecialFolder are only available in .NET Standard 2.0. If you're using 1.4, you'll need to change project settings Target Framework version.

If you have a UWP project:
To support .NET Standard 2.0, make sure your Min and TargetSDK version are at least Fall Creators Update (16299):

image

and your UWP project's Microsoft.NetCore.UniversalWindowsPlatform NuGet package is at least 6.0:

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants