Exemple #1
0
        static LispReader()
        {
            _macros['"'] = new StringReader();
            _macros[';'] = new CommentReader();
            _macros['\''] = new WrappingReader(QUOTE);
            _macros['@'] = new WrappingReader(DEREF);//new DerefReader();
            _macros['^'] = new MetaReader();
            _macros['`'] = new SyntaxQuoteReader();
            _macros['~'] = new UnquoteReader();
            _macros['('] = new ListReader();
            _macros[')'] = new UnmatchedDelimiterReader();
            _macros['['] = new VectorReader();
            _macros[']'] = new UnmatchedDelimiterReader();
            _macros['{'] = new MapReader();
            _macros['}'] = new UnmatchedDelimiterReader();
            ////	macros['|'] = new ArgVectorReader();
            _macros['\\'] = new CharacterReader();
            _macros['%'] = new ArgReader();
            _macros['#'] = new DispatchReader();

            _dispatchMacros['^'] = new MetaReader();
            _dispatchMacros['\''] = new VarReader();
            _dispatchMacros['"'] = new RegexReader();
            _dispatchMacros['('] = new FnReader();
            _dispatchMacros['{'] = new SetReader();
            _dispatchMacros['='] = new EvalReader();
            _dispatchMacros['!'] = new CommentReader();
            _dispatchMacros['<'] = new UnreadableReader();
            _dispatchMacros['_'] = new DiscardReader();
        }
Exemple #2
0
        static LispReader()
        {
            _macros['"']  = new StringReader();
            _macros[';']  = new CommentReader();
            _macros['\''] = new WrappingReader(QUOTE);
            _macros['@']  = new WrappingReader(DEREF);//new DerefReader();
            _macros['^']  = new WrappingReader(META);
            _macros['`']  = new SyntaxQuoteReader();
            _macros['~']  = new UnquoteReader();
            _macros['(']  = new ListReader();
            _macros[')']  = new UnmatchedDelimiterReader();
            _macros['[']  = new VectorReader();
            _macros[']']  = new UnmatchedDelimiterReader();
            _macros['{']  = new MapReader();
            _macros['}']  = new UnmatchedDelimiterReader();
            ////	macros['|'] = new ArgVectorReader();
            _macros['\\'] = new CharacterReader();
            _macros['%']  = new ArgReader();
            _macros['#']  = new DispatchReader();


            _dispatchMacros['^']  = new MetaReader();
            _dispatchMacros['\''] = new VarReader();
            _dispatchMacros['"']  = new RegexReader();
            _dispatchMacros['(']  = new FnReader();
            _dispatchMacros['{']  = new SetReader();
            _dispatchMacros['=']  = new EvalReader();
            _dispatchMacros['!']  = new CommentReader();
            _dispatchMacros['<']  = new UnreadableReader();
            _dispatchMacros['_']  = new DiscardReader();
        }
Exemple #3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="element"></param>
        /// <param name="fileName"></param>
        /// <returns></returns>
        private string GetConverterRequestUrl(Element element, string fileName)
        {
            string attachementUrl = MetaReader.GetMetaReader().GetMetaUrl(element.Class, element.Id, fileName);
            string contentUrl     = HttpUtility.UrlEncode(attachementUrl);
            Config config         = ConfigManager.GetConfigManager().ConnectorConfig;

            return(config.ConverterUrl + contentUrl);
        }
Exemple #4
0
        public void Run()
        {
            string inputFileName  = arguments[0];
            string outputFileName = inputFileName + ".xml";

            var reader   = new MetaReader();
            var meta     = reader.Read(inputFileName);
            var exporter = new MetaExporter();

            exporter.ExportToXml(meta, outputFileName);
        }
Exemple #5
0
        private void ConvertResourceToXml()
        {
            string inputFileName  = arguments[0];
            string outputFileName = inputFileName + ".xml";

            var reader   = new MetaReader();
            var meta     = reader.Read(inputFileName);
            var exporter = new MetaXmlExporter();

            exporter.HashMapping = new Dictionary <int, string>();
            AddHashForStrings(exporter, "MetaTool.Lists.FileNames.txt");
            AddHashForStrings(exporter, "MetaTool.Lists.MetaNames.txt");
            exporter.Export(meta, outputFileName);
        }
Exemple #6
0
            public Object getResponse()
            {
                Message lm = request.GetMessage(requestor.Local);
                Message rm;

                if (!requestor.remoteProtocol.Messages.TryGetValue(request.GetMessage(requestor.Local).Name, out rm))
                {
                    throw new AvroRuntimeException
                              ("Not a remote message: " + request.GetMessage(requestor.Local).Name);
                }

                Transceiver t = requestor.Transceiver;

                if ((lm.Oneway.GetValueOrDefault() != rm.Oneway.GetValueOrDefault()) && t.IsConnected)
                {
                    throw new AvroRuntimeException
                              ("Not both one-way messages: " + request.GetMessage(requestor.Local));
                }

                if (lm.Oneway.GetValueOrDefault() && t.IsConnected)
                {
                    return(null);                                                // one-way w/ handshake
                }
                RpcContext context = request.Context;

                context.ResponseCallMeta = MetaReader.Read(null, input);

                if (!input.ReadBoolean())
                {
                    // no error
                    Object response = requestor.ReadResponse(rm.Response, lm.Response, input);
                    context.Response = response;

                    return(response);
                }

                Exception error = requestor.ReadError(rm.SupportedErrors, lm.SupportedErrors, input);

                context.Error = error;

                throw error;
            }
Exemple #7
0
        static EdnReader()
        {
            _macros['"'] = new StringReader();
            _macros[';'] = new CommentReader();
            _macros['^'] = new MetaReader();
            _macros['('] = new ListReader();
            _macros[')'] = new UnmatchedDelimiterReader();
            _macros['['] = new VectorReader();
            _macros[']'] = new UnmatchedDelimiterReader();
            _macros['{'] = new MapReader();
            _macros['}'] = new UnmatchedDelimiterReader();
            _macros['\\'] = new CharacterReader();
            _macros['#'] = new DispatchReader();

            _dispatchMacros['^'] = new MetaReader();
            //_dispatchMacros['"'] = new RegexReader();
            _dispatchMacros['{'] = new SetReader();
            _dispatchMacros['<'] = new UnreadableReader();
            _dispatchMacros['_'] = new DiscardReader();
        }
Exemple #8
0
        static EdnReader()
        {
            _macros['"']  = new StringReader();
            _macros[';']  = new CommentReader();
            _macros['^']  = new MetaReader();
            _macros['(']  = new ListReader();
            _macros[')']  = new UnmatchedDelimiterReader();
            _macros['[']  = new VectorReader();
            _macros[']']  = new UnmatchedDelimiterReader();
            _macros['{']  = new MapReader();
            _macros['}']  = new UnmatchedDelimiterReader();
            _macros['\\'] = new CharacterReader();
            _macros['#']  = new DispatchReader();

            _dispatchMacros['^'] = new MetaReader();
            //_dispatchMacros['"'] = new RegexReader();
            _dispatchMacros['{'] = new SetReader();
            _dispatchMacros['<'] = new UnreadableReader();
            _dispatchMacros['_'] = new DiscardReader();
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="element"></param>
        /// <param name="res"></param>
        /// <param name="fileName"></param>
        private void OverwriteAttachementValues(Element element, ConverterResult res, string fileName)
        {
            Config cfg = ConfigManager.GetConfigManager().ConnectorConfig;

            element.ReplaceValues($"{cfg.StringIdentifier}.{cfg.BodyFieldName}", res.Body);

            element.ReplaceValues($"{cfg.FacetIdentifier}.{cfg.ApplicationFieldName}", res.Application);
            element.ReplaceValues($"{cfg.StringIdentifier}.{cfg.ApplicationFieldName}", res.Application);

            element.ReplaceValues($"{cfg.FacetIdentifier}.{cfg.MimeTypeFieldName}", res.MimeType);
            element.ReplaceValues($"{cfg.StringIdentifier}.{cfg.MimeTypeFieldName}", res.MimeType);

            string attachementUrl = MetaReader.GetMetaReader().GetMetaUrl(element.Class, element.Id, fileName);

            element.ReplaceValues($"{cfg.StringIdentifier}.{cfg.UrlFieldName}", attachementUrl);

            string newId = $"{element.Id}_{fileName}";

            element.ReplaceValues($"{cfg.StringIdentifier}.{cfg.UidFieldName}", newId);
            element.Id = newId;
        }
Exemple #10
0
        public void RefreshEditor(MetaReader.LoadType type)
        {
            // Load Plugin Path
            string groupName = VariousFunctions.SterilizeTagGroupName(CharConstant.ToString(_tag.RawTag.Group.Magic)).Trim();

            _pluginPath = string.Format("{0}\\{1}\\{2}.xml", VariousFunctions.GetApplicationLocation() + @"Plugins",
                                        _buildInfo.Settings.GetSetting <string>("plugins"), groupName);

            if (!File.Exists(_pluginPath) && _buildInfo.Settings.PathExists("fallbackPlugins"))
            {
                _pluginPath = string.Format("{0}\\{1}\\{2}.xml", VariousFunctions.GetApplicationLocation() + @"Plugins",
                                            _buildInfo.Settings.GetSetting <string>("fallbackPlugins"), groupName);
            }

            if (_pluginPath == null || !File.Exists(_pluginPath))
            {
                UpdateMetaButtons(false);
                StatusUpdater.Update("Plugin doesn't exist. It can't be loaded for this tag.");
                return;
            }

            // Store the current search selection so it can be restored
            int searchSelectedItem = comboSearchResults.SelectedIndex;

            // Set the stream manager and base offset to use based upon the LoadType
            IStreamManager streamManager = null;
            long           baseOffset    = 0;

            switch (type)
            {
            case MetaReader.LoadType.File:
                streamManager = _fileManager;
                baseOffset    = (uint)_tag.RawTag.MetaLocation.AsOffset();
                break;

            case MetaReader.LoadType.Memory:
                if (_rteProvider == null)
                {
                    goto default;
                }

                if (_rteProvider.GetMetaStream(_cache) == null)
                {
                    ShowConnectionError();
                    return;
                }

                streamManager = new RTEStreamManager(_rteProvider, _cache);
                baseOffset    = _tag.RawTag.MetaLocation.AsPointer();
                break;

            default:
                MetroMessageBox.Show("Not Supported", "That feature is not supported for this game.");
                return;
            }

            // Load Plugin File
            using (XmlReader xml = XmlReader.Create(_pluginPath))
            {
                _pluginVisitor = new ThirdGenPluginVisitor(_tags, _stringIdTrie, _cache.MetaArea,
                                                           App.AssemblyStorage.AssemblySettings.PluginsShowInvisibles);
                AssemblyPluginLoader.LoadPlugin(xml, _pluginVisitor);
            }

            _changeTracker = new FieldChangeTracker();
            _fileChanges   = new FieldChangeSet();
            _memoryChanges = new FieldChangeSet();

            var metaReader = new MetaReader(streamManager, baseOffset, _cache, _buildInfo, type, _fileChanges);

            _flattener = new TagBlockFlattener(metaReader, _changeTracker, _fileChanges);
            _flattener.Flatten(_pluginVisitor.Values);
            metaReader.ReadFields(_pluginVisitor.Values);
            panelMetaComponents.ItemsSource = _pluginVisitor.Values;

            // Start monitoring fields for changes
            _changeTracker.RegisterChangeSet(_fileChanges);
            _changeTracker.RegisterChangeSet(_memoryChanges);
            _changeTracker.Attach(_pluginVisitor.Values);

            // Update Meta Toolbar
            UpdateMetaButtons(true);

            // Refresh search if needed
            if (searchSelectedItem != -1)
            {
                SearchTimer(null);
                if (searchSelectedItem <= (comboSearchResults.Items.Count - 1))
                {
                    comboSearchResults.SelectedIndex = searchSelectedItem;
                }
            }
        }
Exemple #11
0
 public void RefreshMeta()
 {
     _reader = new MetaReader(_streamManager, _cacheOffset, _cacheFile, _buildInfo, MetaReader.LoadType.File, null);
     _reader.ReadFields(_fields);
 }
        public void RefreshEditor(MetaReader.LoadType type)
        {
            if (!File.Exists(_pluginPath))
            {
                UpdateMetaButtons(false);
                StatusUpdater.Update("Plugin doesn't exist. It can't be loaded for this tag.");
                return;
            }

            // Store the current search selection so it can be restored
            int searchSelectedItem = comboSearchResults.SelectedIndex;

            // Set the stream manager and base offset to use based upon the LoadType
            IStreamManager streamManager = null;
            uint           baseOffset    = 0;
            uint           headerOffset  = 0;

            switch (type)
            {
            case MetaReader.LoadType.File:
                streamManager = _fileManager;
                baseOffset    = (uint)_tag.RawTag.MetaLocation.AsOffset();
                headerOffset  = _tag.RawTag.HeaderLocation == null ? 0 : (uint)_tag.RawTag.HeaderLocation.AsOffset();
                break;

            case MetaReader.LoadType.Memory:
                if (_rteProvider == null)
                {
                    goto default;
                }

                using (var testStream = _rteProvider.GetMetaStream(_cache, _tag.RawTag))
                {
                    if (testStream == null)
                    {
                        ShowConnectionError();
                        return;
                    }
                }

                streamManager = new RTEStreamManager(_rteProvider, _cache, _tag.RawTag);
                baseOffset    = _tag.RawTag.MetaLocation.AsPointer();
                break;

            default:
                MetroMessageBox.Show("Not Supported", "That feature is not supported for this game.");
                return;
            }

            // Load Plugin File
            using (XmlReader xml = XmlReader.Create(_pluginPath))
            {
                _pluginVisitor = new ThirdGenPluginVisitor(_tags, _stringIdTrie, _cache.MetaArea,
                                                           App.AssemblyStorage.AssemblySettings.PluginsShowInvisibles);
                AssemblyPluginLoader.LoadPlugin(xml, _pluginVisitor);
            }

            _changeTracker = new FieldChangeTracker();
            _fileChanges   = new FieldChangeSet();
            _memoryChanges = new FieldChangeSet();

            var metaReader = new MetaReader(streamManager, headerOffset, baseOffset, _cache, _buildInfo, type, _fileChanges);

            _flattener = new ReflexiveFlattener(metaReader, _changeTracker, _fileChanges);
            _flattener.Flatten(_pluginVisitor.Values);
            metaReader.ReadFields(_pluginVisitor.Values);
            panelMetaComponents.ItemsSource = _pluginVisitor.Values;

            // Start monitoring fields for changes
            _changeTracker.RegisterChangeSet(_fileChanges);
            _changeTracker.RegisterChangeSet(_memoryChanges);
            _changeTracker.Attach(_pluginVisitor.Values);

            // Update Meta Toolbar
            UpdateMetaButtons(true);

            // Refresh search if needed
            if (searchSelectedItem != -1)
            {
                SearchTimer(null);
                if (searchSelectedItem <= (comboSearchResults.Items.Count - 1))
                {
                    comboSearchResults.SelectedIndex = searchSelectedItem;
                }
            }
        }