Beispiel #1
0
 internal void LoadConfigFromJSON(string filename)
 {
     this.filename = filename;
     PromptHelper.ShowPromptInfo("");
     PromptHelper.ShowPromptHighlight($"Not implemented yet.");
     PromptHelper.ShowPromptInfo("");
 }
Beispiel #2
0
 internal void LoadConfigFromJSON(string filename)
 {
     this.filename = filename;
     PromptHelper.ShowPromptInfo("");
     PromptHelper.ShowPromptHighlight($"Please use ConsolePrintNet.exe included in your PrintServer with command line.");
     PromptHelper.ShowPromptHighlight($"Example: ");
     PromptHelper.ShowPromptHighlight($"ConsolePrintNet.exe -configurationfile:\"{filename}\"");
     PromptHelper.ShowPromptInfo("");
 }
Beispiel #3
0
        internal void LoadConfigFromJSONAsync(string filename)
        {
            this.filename = filename;
            MongoConfig config = JsonConvert.DeserializeObject <MongoConfig>(File.ReadAllText(filename));

            PromptHelper.ShowPromptInfo($"Server: {config.ServerUrl}");
            PromptHelper.ShowPromptInfo(config.FieldName);
            PromptHelper.ShowPromptInfo(config.SearchType);

            MongoServer   = config.ServerUrl;
            MongoDatabase = config.Database;

            PromptHelper.ShowPromptInfo($"Last {LastItems} files: ");
            InitGridAsync(config.FieldName, config.SearchType, "").GetAwaiter().GetResult();

            ShowMenu();

            string fileToDownload = PromptHelper.EnterValue($"Enter: ");
        }
Beispiel #4
0
        private async Task InitGridAsync(string fieldName, string cbSearchType, string tbTextToSearch)
        {
            EdiHelper h = new EdiHelper(MongoServer, MongoDatabase);

            List <GridFSFileInfo> result = await h.SearchAsync(fieldName, cbSearchType, tbTextToSearch, LastItems);

            foreach (var item in result)
            {
                string filename = string.Empty;
                try
                {
                    filename = item.Metadata != null ? item.Metadata["fileName"]?.AsString : "";
                }
                catch (Exception)
                {
                    // nothing to do
                }
                PromptHelper.ShowPromptInfo($"{item.Filename} {filename } \t {item.ContentType} \t {item.Length} \t {item.UploadDateTime}");
            }
        }