OpenTl / OpenTl.ClientApi

The Api client library that implements the MtProto 2.0. To connect to servers, such as Telegram
MIT License
80 stars 22 forks source link

Rename 'session.dat' File #25

Closed dehqan closed 6 years ago

dehqan commented 6 years ago

Hi, How to rename 'session.dat' file from library? Is it possible?

Thanks.

KoalaBear84 commented 6 years ago

Yes, I guess that is possible by implementing your own SessionStore with the ISessionStore interface: https://github.com/OpenTl/OpenTl.ClientApi/blob/master/src/OpenTl.ClientApi/ISessionStore.cs and supply it to: https://github.com/OpenTl/OpenTl.ClientApi/blob/master/src/OpenTl.ClientApi/FactorySettings.cs

You probably already have a sample app, anyway here is the SampleApp part in the repository, and add extra SessionStore parameter: https://github.com/OpenTl/OpenTl.ClientApi/blob/master/samples/OpenTl.ClientApi.SampeApp/Program.cs

I haven't checked or tested any of this!

dehqan commented 6 years ago

I used SessionTag property but it didin't work.

dehqan commented 6 years ago

@KoalaBear84 Could you please give a sample how to use SessionStore and change the session file name?

KoalaBear84 commented 6 years ago

Hmm. SesstionTag already works as expected.

Code: image

Result: image

dehqan commented 6 years ago

Yes it works. my mistake. Thanks!

KoalaBear84 commented 6 years ago

OK, good. Closing!