{"id":20227710,"url":"https://github.com/andreabbondanza/dewxamarinfiles","last_synced_at":"2026-04-12T03:31:43.158Z","repository":{"id":96834435,"uuid":"119820480","full_name":"andreabbondanza/DewXamarinFiles","owner":"andreabbondanza","description":"A library for xamarin forms to manage files and local settings","archived":false,"fork":false,"pushed_at":"2018-05-03T14:09:21.000Z","size":12,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-02T17:40:39.997Z","etag":null,"topics":["dotnet-core","dotnetcore","dotnetstandard","xamarin","xamarin-forms"],"latest_commit_sha":null,"homepage":null,"language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/andreabbondanza.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-02-01T10:29:03.000Z","updated_at":"2018-08-16T17:59:26.000Z","dependencies_parsed_at":null,"dependency_job_id":"f774f69a-9219-4645-96cb-57ba3ac942ae","html_url":"https://github.com/andreabbondanza/DewXamarinFiles","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreabbondanza%2FDewXamarinFiles","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreabbondanza%2FDewXamarinFiles/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreabbondanza%2FDewXamarinFiles/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreabbondanza%2FDewXamarinFiles/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/andreabbondanza","download_url":"https://codeload.github.com/andreabbondanza/DewXamarinFiles/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241670154,"owners_count":20000327,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dotnet-core","dotnetcore","dotnetstandard","xamarin","xamarin-forms"],"created_at":"2024-11-14T07:26:12.339Z","updated_at":"2025-12-31T01:03:06.293Z","avatar_url":"https://github.com/andreabbondanza.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# DewXamarinFiles\nA library for xamarin forms to manage files and local settings.\n\n## How to use\n\nThis is a static class, so you can use the methods and attributes directly.\n\n### Files\n\nHere the methods/attributes that help you to manage files.\n\n#### Attributes\n\n- __BufferSize__: _int_ - Is the buffer size for read/write files\n\n#### Methods\n\n- __ReadLocalFileAsync__: (__path__: _string_ : _The path to the file_) : _return_ __byte[]__\n- __ReadLocalFileTextAsync__: (__path__: _string_ : _The path to the file_) : _return_ __string__\n- __WriteLocalFileAsync__: (_s_: _byte[]_ : The data to write, __name__: _string_ : _filename_, __path__: _string_ : _the path to the folder_)\n- __WriteLocalFileAsync__: (_s_: _string_ : The data to write, __name__: _string_ : _filename_, __path__: _string_ : _the path to the folder_)\n- __ApplicationPath__: _return_ __string__ : _the path to the local app folder with write permissions__\n- __CheckFileExists__: (__file__: _string_ : __file path__) : _return_ __bool__\n- __CheckDirectoryExists__: (__path__: _string_ : _directory path_) _return_ __bool__\n\n#### Example\n\n```csharp\nusing DewCore.Xamarin.Files;\nusing DewCore.Extensions.Strings;\npublic class Example\n{\n    public async Task CreateFileWithText(string toWrite)\n    {\n        var basePath = DewXamarinFiles.ApplicationPath();\n        if(!DewXamarinFiles.CheckFileExists(basePath+Path.DirectorySeparator+\"textfile.txt\"))\n            await DewXamarinFiles.WriteLocalFileTextAsync(towrite,\"textfile.txt\",basePath);\n        if(!DewXamarinFiles.CheckFileExists(basePath+Path.DirectorySeparator+\"bytefile\"))\n            await DewXamarinFiles.WriteLocalFileTextAsync(towrite.ToBytes(),\"bytefile\",basePath);\n        string text = await DewXamarinFiles.ReadLocalFileTextAsync(basePath+Path.DirectorySeparator+\"textfile.txt\");\n        byte[] bytes = await DewXamarinFiles.ReadLocalFileAsync(basePath+Path.DirectorySeparator+\"textfile.txt\");\n    }\n}\n```\n#### NOTE\nIn app environemnt, you need to pass always the _basePath_ because you don't have the permissions to write wherever you want. The methods supports absolute paths just for the future, in the eventually of MacOS, Linux, PC xamarin forms supports.\n\n### Local Settings\n\nHere the methods/attributes that help you to manage local settings.\n\n#### Attributes\n\n- __SettingsName__: _string_ - Is the local settings file name (without extension), default value is \"_\\_\\_dew\\_loc\\_set_\"\n\n#### Methods\n\n- __WriteLocalSettings__: (__string__: _key_ : _local setting key_, __string__: _option_ : _local setting value_)\n- __WriteLocalSettings\\\u003cT\\\u003e__: (__string__: _key_ : _local setting's key_, __T__: _option_ : _local setting value_) - T must implmenent a ToString method to serialize\n- __CheckLocalSettingExists__: (__string__: _key_ : _local setting's key_) : _return_ __bool__\n- __ReadLocalSetting__: (__string__: _key_ : _local setting's key_): _return_ __string__\n- __ReadLocalSetting\\\u003cT\\\u003e__: (__string__: _key_ : _local setting's key_): _return_ __T__\n- __SerializeObject\\\u003cT\\\u003e__: (__T__ toSerialize : _Object to serialize_): _return_ __string__\n- __DeserializeObject\\\u003cT\\\u003e__: (__string__ toDeserialize : _Object to deserialize_): _return_ __T__\n\n\n#### Example\n\n```csharp\nusing DewCore.Xamarin.Files;\nusing DewCore.Extensions.Strings;\npublic class Example\n{\n    public class User\n    {\n        public string Name {get;set;}\n        public string Surname {get;set;}\n    }\n//-----------------------------------------------------------------------\n    public async Task\u003cbool\u003e WriteToken()\n    {\n        if(!(await DewXamarinFiles.CheckLocalSettingExists(\"token\")))\n            return false;\n        var token = await DewXamarinFiles.ReadLocalSettings(\"token\");\n        if(token.Length \u003c 10)\n            while(token.Length \u003c 10)\n                token += \"0\";\n        await DewXamarinFiles.WriteLocalSetting(\"token\",token);\n        return true;\n    }\n//-----------------------------------------------------------------------\n    public async Task WriteUser(User u)\n    {\n        await DewXamarinFiles.WriteLocalSetting\u003cUser\u003e(\"user\",u);    \n    }\n//-----------------------------------------------------------------------\n    public async Task\u003cUser\u003e ReadUser()\n    {\n        if(!(await DewXamarinFiles.CheckLocalSettingExists(\"user\")))\n            return null;\n        return DewXamarinFiles.ReadLocalSetting\u003cUser\u003e(\"user\");\n    }\n//-----------------------------------------------------------------------\n}\n```\n\n### Note\n\n- Type __T__ must be serializable\n- When you try to read a local setting and the file doesn't exist, it will throw a __FileNotFoundException__, so Use _CheckLocalSettingExists_ before\n- When you call __CheckLocalSettings__, if the file doesn't exist it will be created with \"{}\" object into.\n- When you call a __Write__ function, if the file doesn't exist it will be created with \"{}\" object into.\n\n## About\n[Andrea Vincenzo Abbondanza](http://www.andrewdev.eu)\n\n## Donate\n[Help me to grow up, if you want](https://payPal.me/andreabbondanza)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandreabbondanza%2Fdewxamarinfiles","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandreabbondanza%2Fdewxamarinfiles","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandreabbondanza%2Fdewxamarinfiles/lists"}