Пример #1
0
 /// <summary>
 /// Deletes a file.
 /// <see href="https://api.slack.com/methods/files.delete" />
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='token'>
 /// Authentication token. Requires scope: `files:write:user`
 /// </param>
 /// <param name='file'>
 /// ID of file to delete.
 /// </param>
 public static DeleteOKResponseModelModel Delete1(this IFiles operations, string token = default(string), string file = default(string))
 {
     return(operations.Delete1Async(token, file).GetAwaiter().GetResult());
 }
Пример #2
0
 /// <summary>
 /// Lists &amp; filters team files.
 /// <see href="https://api.slack.com/methods/files.list" />
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='count'>
 /// </param>
 /// <param name='channel'>
 /// Filter files appearing in a specific channel, indicated by its ID.
 /// </param>
 /// <param name='tsTo'>
 /// Filter files created before this timestamp (inclusive).
 /// </param>
 /// <param name='tsFrom'>
 /// Filter files created after this timestamp (inclusive).
 /// </param>
 /// <param name='token'>
 /// Authentication token. Requires scope: `files:read`
 /// </param>
 /// <param name='user'>
 /// Filter files created by a single user.
 /// </param>
 /// <param name='page'>
 /// </param>
 /// <param name='types'>
 /// Filter files by type:
 ///
 /// * `all` - All files
 /// * `spaces` - Posts
 /// * `snippets` - Snippets
 /// * `images` - Image files
 /// * `gdocs` - Google docs
 /// * `zips` - Zip files
 /// * `pdfs` - PDF files
 ///
 /// You can pass multiple values in the types argument, like
 /// `types=spaces,snippets`.The default value is `all`, which does not filter
 /// the list.
 /// </param>
 public static ListOKResponseModelModelModelModelModel List(this IFiles operations, string count = default(string), string channel = default(string), int?tsTo = default(int?), int?tsFrom = default(int?), string token = default(string), string user = default(string), string page = default(string), string types = default(string))
 {
     return(operations.ListAsync(count, channel, tsTo, tsFrom, token, user, page, types).GetAwaiter().GetResult());
 }
Пример #3
0
 public Driver()
 {
     _objects = new Objects();
     _users   = new Users();
     _files   = new Files();
 }
Пример #4
0
 public TumblrDownloader(IShellService shellService, IManagerService managerService, CancellationToken ct, PauseToken pt,
                         IProgress <DownloadProgress> progress, IPostQueue <TumblrPost> postQueue, FileDownloader fileDownloader,
                         ICrawlerService crawlerService, IBlog blog, IFiles files)
     : base(shellService, managerService, ct, pt, progress, postQueue, fileDownloader, crawlerService, blog, files)
 {
 }
Пример #5
0
 /// <summary>
 /// Get empty file
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 public static System.IO.Stream GetEmptyFile(this IFiles operations)
 {
     return(System.Threading.Tasks.Task.Factory.StartNew(s => ((IFiles)s).GetEmptyFileAsync(), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult());
 }
Пример #6
0
 public BlogService(IBlog blog, IFiles files)
 {
     this.blog  = blog;
     this.files = files;
 }
Пример #7
0
        private static async Task GetFile(HttpRequest request, HttpResponse response, RouteData routeData, IFiles files)
        {
            var file   = routeData.GetString("file");
            var source = await files.TryGetFileSource(file);

            if (source == null)
            {
                response.StatusCode = 404;
                return;
            }

            response.StatusCode = 200;
            if (source.Type == FileType.Text)
            {
                response.ContentType = "text/text";
                await response.SendFileAsync(source.FullPath);
            }
            else
            {
                response.ContentType = "application/binary";
                using (var stream = File.OpenRead(source.FullPath))
                {
                    await stream.CopyToAsync(response.Body);
                }
            }
        }
Пример #8
0
        /// <summary>
        /// Get empty file
        /// </summary>
        /// <param name='operations'>
        /// The operations group for this extension method.
        /// </param>
        /// <param name='cancellationToken'>
        /// The cancellation token.
        /// </param>
        public static async Task <System.IO.Stream> GetEmptyFileAsync(this IFiles operations, CancellationToken cancellationToken = default(CancellationToken))
        {
            var _result = await operations.GetEmptyFileWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false);

            return(_result.Body);
        }
 public void AddArchive(IFiles archiveDB) => throw new NotImplementedException();
Пример #10
0
 /// <summary>
 /// Instantiates an instance of <see cref="StepsForImprovement" />
 /// </summary>
 /// <param name="fileSystem">A file system wrapper</param>
 /// <param name="serializer"><see cref="ISerializer">Json Serializer</see></param>
 public StepsForImprovement(IFiles fileSystem, ISerializer serializer)
 {
     _fileSystem = fileSystem;
     _serializer = serializer;
 }
Пример #11
0
 /// <summary>
 /// Get a large file
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 public static Stream GetFileLarge(this IFiles operations)
 {
     return(Task.Factory.StartNew(s => ((IFiles)s).GetFileLargeAsync(), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult());
 }
 public FilesController(IFiles files)
 {
     this.files = files;
 }
Пример #13
0
 public Api(string authToken, IFiles files, IFolders folders)
 {
     Files = files;
     Folders = folders;
     RefreshAuthToken(authToken);
 }
Пример #14
0
 /// <summary>
 /// Enables a file for public/external sharing.
 /// <see href="https://api.slack.com/methods/files.sharedPublicURL" />
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='token'>
 /// Authentication token. Requires scope: `files:write:user`
 /// </param>
 /// <param name='file'>
 /// File to share
 /// </param>
 public static SharedPublicURLOKResponse SharedPublicURL(this IFiles operations, string token = default(string), string file = default(string))
 {
     return(operations.SharedPublicURLAsync(token, file).GetAwaiter().GetResult());
 }
Пример #15
0
        private static async Task PutFile(HttpRequest request, HttpResponse response, RouteData routeData, IFiles files)
        {
            var file = routeData.GetString("file");
            var type = request.Query.GetEnumOrDefault("type", FileType.Binary);

            await files.WriteAsync(file, request.Body, type);

            response.StatusCode = 201;
        }
Пример #16
0
 public TumblrDownloader(IShellService shellService, IManagerService managerService, CancellationToken ct, PauseToken pt, IProgress <DownloadProgress> progress, BlockingCollection <TumblrPost> producerConsumerCollection, FileDownloader fileDownloader, ICrawlerService crawlerService, IBlog blog, IFiles files)
     : base(shellService, managerService, ct, pt, progress, producerConsumerCollection, fileDownloader, crawlerService, blog, files)
 {
 }
Пример #17
0
        private static Task DeleteFile(HttpRequest request, HttpResponse response, RouteData routeData, IFiles files)
        {
            var file = routeData.GetString("file");

            response.StatusCode = files.Delete(file) ? 200 : 404;

            return(Task.CompletedTask);
        }
Пример #18
0
        public DataGeneratorFactory(Logger logger, IFiles files, params Type[] typesToGenerate) :
            this(logger, new PathResolver(files), typesToGenerate)

        {
        }
Пример #19
0
 /// <summary>
 /// Instantiates an instance of <see cref="ImprovableManager" />
 /// </summary>
 /// <param name="fileSystem">A file system wrapper</param>
 /// <param name="serializer">A serializer</param>
 /// <param name="recipeManager">A recipe manager</param>
 public ImprovableManager(IFiles fileSystem, ISerializer serializer, IRecipeManager recipeManager)
 {
     _serializer    = serializer;
     _recipeManager = recipeManager;
     _fileSystem    = fileSystem;
 }
Пример #20
0
        /// <summary>
        /// Get empty file
        /// </summary>
        /// <param name='operations'>
        /// The operations group for this extension method.
        /// </param>
        /// <param name='cancellationToken'>
        /// The cancellation token.
        /// </param>
        public static async System.Threading.Tasks.Task <System.IO.Stream> GetEmptyFileAsync(this IFiles operations, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
        {
            var _result = await operations.GetEmptyFileWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false);

            _result.Request.Dispose();
            return(_result.Body);
        }
 /// <summary>
 /// Instantiates an instance of <see cref="ImprovementsForImprovable" />
 /// </summary>
 /// <param name="fileSystem">A file system wrapper</param>
 public ImprovementsForImprovable(IFiles fileSystem)
 {
     _fileSystem = fileSystem;
 }
Пример #22
0
 public void RemoveDatabase(IFiles database) => throw new NotImplementedException();
Пример #23
0
 private static IBlogService GetBlogService(IBlog blog, IFiles files)
 {
     return(new BlogService(blog, files));
 }
Пример #24
0
 protected AbstractDownloader(IShellService shellService, IManagerService managerService, CancellationToken ct, PauseToken pt, IProgress <DownloadProgress> progress, IPostQueue <TumblrPost> postQueue, FileDownloader fileDownloader, ICrawlerService crawlerService = null, IBlog blog = null, IFiles files = null)
 {
     this.shellService   = shellService;
     this.crawlerService = crawlerService;
     this.managerService = managerService;
     this.blog           = blog;
     this.files          = files;
     this.ct             = ct;
     this.pt             = pt;
     this.progress       = progress;
     this.postQueue      = postQueue;
     this.fileDownloader = fileDownloader;
 }
Пример #25
0
 private TumblrDownloader GetTumblrDownloader(CancellationToken ct, PauseToken pt, IProgress <DownloadProgress> progress,
                                              IBlog blog, IFiles files, IPostQueue <TumblrPost> postQueue)
 {
     return(new TumblrDownloader(shellService, managerService, pt, progress, postQueue, GetFileDownloader(ct),
                                 crawlerService, blog, files, ct));
 }
Пример #26
0
 /// <summary>
 /// Edit an existing file comment.
 /// <see href="https://api.slack.com/methods/files.comments.edit" />
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='token'>
 /// Authentication token. Requires scope: `files:write:user`
 /// </param>
 /// <param name='comment'>
 /// Text of the comment to edit.
 /// </param>
 /// <param name='id'>
 /// The comment to edit.
 /// </param>
 /// <param name='file'>
 /// File containing the comment to edit.
 /// </param>
 public static EditOKResponse Edit(this IFiles operations, string token = default(string), string comment = default(string), string id = default(string), string file = default(string))
 {
     return(operations.EditAsync(token, comment, id, file).GetAwaiter().GetResult());
 }
Пример #27
0
 public PathResolver(IFiles files)
 {
     Files = files;
 }
Пример #28
0
 /// <summary>
 /// Gets information about a team file.
 /// <see href="https://api.slack.com/methods/files.info" />
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='count'>
 /// </param>
 /// <param name='token'>
 /// Authentication token. Requires scope: `files:read`
 /// </param>
 /// <param name='file'>
 /// Specify a file by providing its ID.
 /// </param>
 /// <param name='page'>
 /// </param>
 public static InfoOKResponseModelModelModelModel Info(this IFiles operations, string count = default(string), string token = default(string), string file = default(string), string page = default(string))
 {
     return(operations.InfoAsync(count, token, file, page).GetAwaiter().GetResult());
 }
Пример #29
0
 /// <summary>
 /// Instantiates a new instance of <see cref="IFiles" />
 /// </summary>
 /// <param name="fileSystem">A file system wrapper</param>
 /// <param name="serializer">A serializer</param>
 public StepResultsForStep(IFiles fileSystem, ISerializer serializer)
 {
     _serializer = serializer;
     _fileSystem = fileSystem;
 }
Пример #30
0
 /// <summary>
 /// Add a comment to an existing file.
 /// <see href="https://api.slack.com/methods/files.comments.add" />
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='token'>
 /// Authentication token. Requires scope: `files:write:user`
 /// </param>
 /// <param name='comment'>
 /// Text of the comment to add.
 /// </param>
 /// <param name='file'>
 /// File to add a comment to.
 /// </param>
 public static AddOKResponse Add(this IFiles operations, string token = default(string), string comment = default(string), string file = default(string))
 {
     return(operations.AddAsync(token, comment, file).GetAwaiter().GetResult());
 }
Пример #31
0
 /// <summary>
 /// Instantiates an instance of <see cref="RawLogForStep" />
 /// </summary>
 /// <param name="fileSystem"></param>
 public RawLogForStep(IFiles fileSystem)
 {
     _fileSystem = fileSystem;
 }
Пример #32
0
		//public static bool FirstLoading = false;
		//public static bool FirstLoadingInProgress = false;
		//public static bool FirstLoadingError = false;

		public static async void DoInit ()
		{
			if (Files != null)
				return;
			Random = new Random (DateTime.Now.Millisecond);
			Files = DependencyService.Get<IFiles> ();
			Notificator = DependencyService.Get<IToastNotificator> ();
			Vibrator = CrossVibrate.Current;
			Helper.SettingsRead<string> ("UniqueAppId", string.Empty);
			if (UniqueAppId.Length == 0) {
				UniqueAppId = Helper.GenerateAppId;
				Helper.SettingsSave<string> ("UniqueAppId", UniqueAppId);
			}
			BeaconsTools = DependencyService.Get<IBeaconTools> ();
			ImageResizer = DependencyService.Get<IImageResizer> ();
			Tools.DoInit ();
			Menus = new MenuManager ();

			return;
			/*
			Translation.RefreshAllText ();

			Menus.Refresh ();

			if (!Translation.IsTextReady) {
				FirstLoading = true;
				FirstLoadingInProgress = true;
				System.Net.Http.HttpClient httpClient = new System.Net.Http.HttpClient ();
				httpClient.Timeout = new TimeSpan (0, 0, 0, 10, 500);
				httpClient.DefaultRequestHeaders.ExpectContinue = false;
				string url = string.Format("{0}Content/Languages/{1}.txt", Global.BaseUrl, Translation.Language);
				System.Diagnostics.Debug.WriteLine("Url: " + url);
				string ImmediateResult = string.Empty;
				try{
					ImmediateResult = await httpClient.GetStringAsync (url);
				} catch(Exception err) {
					System.Diagnostics.Debug.WriteLine ("Loading language error: " + err.Message);
					try {
						ImmediateResult = await httpClient.GetStringAsync (url);
					} catch (Exception err2) {
						System.Diagnostics.Debug.WriteLine ("Second Loading language error: " + err2.Message);
						FirstLoadingError = true;
					}
				}
				if (ImmediateResult.Length > 0) {
					//System.Diagnostics.Debug.WriteLine("Traduction: " + ImmediateResult);
					//await Tools.ImmediateDownloadLanguage (Translation.Language);
					Translation.NewTranslation (ImmediateResult);
					Menus.Refresh ();
				} else
					FirstLoadingError = true;
				FirstLoadingInProgress = false;
				if (FirstLoadingFinish != null)
					FirstLoadingFinish ();
			}

			IDataServer allLanguages = new IDataServer ("languages", true);
			allLanguages.DataRefresh += delegate(bool status, string result) {
				System.Diagnostics.Debug.WriteLine ("Status: " + allLanguages.FileName + "=" + status);
				if (!status)
					return;
				System.Diagnostics.Debug.WriteLine ("Result: " + Helper.Decrypt (result));
				SerializableDictionary<string, string> res = null;
				try {
					res =	Newtonsoft.Json.JsonConvert.DeserializeObject<SerializableDictionary<string, string>> (Helper.Decrypt (result));
				} catch (Exception error) {
					System.Diagnostics.Debug.WriteLine ("ERROR: " + error.Message);
				}
				try {
					Translation.AllLanguages.Clear ();
					foreach (KeyValuePair<string, string> kvp in res) {
						Translation.AllLanguages.Add (kvp.Key, kvp.Value);
					}
				} catch (Exception err) { 
					System.Diagnostics.Debug.WriteLine ("** ERROR: " + err.Message);
				}
			};
			DataServer.AddToDo (allLanguages);

			IDataServer xa = new IDataServer ("country", true);
			xa.DataRefresh +=  delegate(bool status, string result) {
				System.Diagnostics.Debug.WriteLine("Status: " + xa.FileName + "=" + status);
				if(!status)
					return;
				AllCountry.LoadFromJson(Helper.Decrypt(result));
			};
			DataServer.AddToDo (xa);

			IDataServer x = new IDataServer ("news", true);
			x.DataRefresh +=  delegate(bool status, string result) {
				System.Diagnostics.Debug.WriteLine("Status: " + x.FileName + "=" + status);
				if(!status)
					return;
				AllNews.LoadFromJson(Helper.Decrypt(result));
				AllNews.Refresh();
			};
			DataServer.AddToDo (x);

			IDataServer xx = new IDataServer ("builders", true);
			xx.DataRefresh +=  delegate(bool status, string result) {
				System.Diagnostics.Debug.WriteLine("Status: " + xx.FileName + "=" + status);
				if(!status)
					return;
				AllBuilders.LoadFromJson(Helper.Decrypt(result));
			};
			DataServer.AddToDo (xx);

			IDataServer xxx = new IDataServer ("clubs", true);
			xxx.DataRefresh +=  delegate(bool status, string result) {
				System.Diagnostics.Debug.WriteLine("Status: " + xxx.FileName + "=" + status);
				if(!status)
					return;
				AllClubs.LoadFromJson(Helper.Decrypt(result));
			};
			DataServer.AddToDo (xxx);

			IDataServer xxxx = new IDataServer ("exhibitions", true);
			xxxx.DataRefresh +=  delegate(bool status, string result) {
				System.Diagnostics.Debug.WriteLine("Status: " + xxxx.FileName + "=" + status);
				if(!status)
					return;
				AllExhibitions.LoadFromJson(Helper.Decrypt(result));
			};
			DataServer.AddToDo (xxxx);


			IDataServer xxxxx = new IDataServer ("cards", true);
			xxxxx.DataRefresh +=  delegate(bool status, string result) {
				System.Diagnostics.Debug.WriteLine("Status: " + xxxxx.FileName + "=" + status);
				if(!status)
					return;
				AllCards.LoadFromJson(Helper.Decrypt(result));
			};
			DataServer.AddToDo (xxxxx);

			DataServer.Launch ();
*/
			/*
			xa.ForceFreshData = true;
			DataServer.AddToDo (xa);
			x.ForceFreshData = true;
			DataServer.AddToDo (x);
			xx.ForceFreshData = true;
			DataServer.AddToDo (xx);
			xxx.ForceFreshData = true;
			DataServer.AddToDo (xxx);
			*/
		}
Пример #33
0
 public Driver()
 {
     _objects = new Objects();
     _users = new Users();
     _files = new Files();
 }