예제 #1
0
        private static async Task ProcessContactsFile(CallInvoker invoker)
        {
            try
            {
                if (string.IsNullOrEmpty(_contactsFilename))
                {
                    return;
                }

                await using var file = File.OpenRead(_contactsFilename);
                var    stream = new StreamReader(file);
                string line;
                if ((line = stream.ReadLine()) != null)
                {
                    ZMIParser.TryParseAttributeLine(line, out var attribute, out var value);

                    if (attribute.Name == "contacts" && value.AttributeType.IsCompatible(ContactSetAttribute))
                    {
                        await SetContacts(invoker, (ValueSet)value);
                    }
                }
            }
            catch (Exception e)
            {
                Logger.LogException(e);
            }
        }
예제 #2
0
        private static async Task ProcessFile(CallInvoker invoker, string pathName, string fileName)
        {
            var commandOut = $"./fetch.sh > {fileName}".Bash();

            await using var file = File.OpenRead(fileName);
            var    stream = new StreamReader(file);
            string line;

            while ((line = stream.ReadLine()) != null)
            {
                if (line.StartsWith("/"))
                {
                    continue;
                }

                ZMIParser.TryParseAttributeLine(line, out var attribute, out var value);
                await SetAttribute(invoker, pathName, attribute, value);
            }
        }