Exemplo n.º 1
0
        static void Main(string[] args)
        {
            using(var fr = new FlowRuntime())
            {
                var frc = new FlowRuntimeConfiguration();

                var pageBufferContainer = new DataContainer<PageBuffer>();

                var frontend = new Frontend();

                frc.AddFlow(new Main(new Formatter(),
                                    frontend));
                frc.AddFlow(new Features(new CommandlineParser(pageBufferContainer),
                                        new TextFileAdapter(),
                                        new LineBuffer(pageBufferContainer),
                                        new Pager(pageBufferContainer)));
                fr.Configure(frc);

                frontend.displayFirstPage += fr.CreateEventProcessor(".displayFirstPage");
                frontend.displayLastPage += fr.CreateEventProcessor(".displayLastPage");
                frontend.displayNextPage += fr.CreateEventProcessor(".displayNextPage");
                frontend.displayPrevPage += fr.CreateEventProcessor(".displayPrevPage");

                //fr.Message += Console.WriteLine;

                fr.Process(new Message(".run", new[]{"test1.txt"}));

                fr.WaitForResult();
            }
        }
Exemplo n.º 2
0
 private async void Events_OnRosterItemSelected(object sender, Frontend.ContactSelectedEventArgs e)
 {
     try
     {
         await Frontend.RunAsync(() =>
         {
             if (e.Contact != null)
                 this.DataContext = e.Contact;
         });
     }
     catch (Exception uiEx) { Frontend.UIError(uiEx); }
 }
Exemplo n.º 3
0
Arquivo: Column.cs Projeto: vebin/BD2
        public Column(Frontend frontend,
		               byte[] chunkID,
		               string name, Type type, bool allowNull, long length)
            : base(frontend, chunkID)
        {
            if (name == null)
                throw new ArgumentNullException ("name");
            if (type == null)
                throw new ArgumentNullException ("type");
            this.name = name;
            this.type = type;
            this.allowNull = allowNull;
            this.length = length;
        }
Exemplo n.º 4
0
        public void Initialize()
        {
            ConfigureFromCanConfigurables();
            InitializeCulture();

            var initializers = new Action[] {
                () => Serialization.Initialize(Container),
                () => Commands.Initialize(Container),
                () => Container.Get <IEventsConfiguration>().Initialize(Container),
                () => Tasks.Initialize(Container),
                () => Views.Initialize(Container),
                () => Frontend.Initialize(Container),
                () => CallContext.Initialize(Container),
                () => ExecutionContext.Initialize(Container),
                () => Security.Initialize(Container),
                () => Tenancy.Initialize(Container),
                () => DefaultStorage.Initialize(Container)
            };

            Parallel.ForEach(initializers, initializator => initializator());
            ConfigurationDone();
        }
Exemplo n.º 5
0
        public override CGSize CellSizeForBounds(CGRect bounds)
        {
            if (!visible)
            {
                return(CGSize.Empty);
            }
            var size = new CGSize();

            Frontend.ApplicationContext.InvokeUserCode(delegate {
                var s = Frontend.GetRequiredSize();
                size  = new CGSize((nfloat)s.Width, (nfloat)s.Height);
            });
            if (size.Width > bounds.Width)
            {
                size.Width = bounds.Width;
            }
            if (size.Height > bounds.Height)
            {
                size.Height = bounds.Height;
            }
            return(size);
        }
Exemplo n.º 6
0
        private async void SendMessage()
        {
            try
            {
                await Frontend.RunAsync(() =>
                {
                    if (CurrentConversation != null && !string.IsNullOrEmpty(SendText.Text))
                    {
                        var account = Frontend.Accounts[CurrentConversation.Self];
                        if (account == null)
                        {
                            return;
                        }

                        if (account.persistantState == AccountState.Enabled)
                        {
                            var self  = GetSelf();
                            var other = GetOther();
                            if (self != null && other != null)
                            {
                                if (!string.IsNullOrEmpty(self.jid) && !string.IsNullOrEmpty(other.CurrentJID))
                                {
                                    var message = XMPPHelper.SendMessage(self.jid, other.CurrentJID, SendText.Text);
                                    if (message != null)
                                    {
                                        message.from = message.Account;
                                        CurrentConversation.AddMessage(message);
                                    }

                                    SendText.Text = string.Empty;
                                }
                            }
                        }
                    }
                });
            }
            catch (Exception uiEx) { Frontend.UIError(uiEx); }
        }
Exemplo n.º 7
0
        private void CommandsRequest(SettingsPane sender, SettingsPaneCommandsRequestedEventArgs args)
        {
            try
            {
                if (aboutCommand == null)
                {
                    aboutCommand = new SettingsCommand("about", Helper.Translate("FlyoutTypeAbout"), (x) => OnAbout(true));
                }

                if (privacyCommand == null)
                {
                    privacyCommand = new SettingsCommand("privacy", Helper.Translate("PrivacyPolicyTitle"), (x) => OnPrivacy());
                }

                if (settingsCommand == null)
                {
                    settingsCommand = new SettingsCommand("settings", Helper.Translate("FlyoutTypeSettingsEdit"), (x) => OnSettings(true));
                }

                if (themeCommand == null)
                {
                    themeCommand = new SettingsCommand("theme", Helper.Translate("FlyoutTypeThemeEdit"), (x) => OnTheme(true));
                }

                if (accountsCommand == null)
                {
                    accountsCommand = new SettingsCommand("accounts", Helper.Translate("FlyoutTypeAccountListEdit"), (x) => OnAccounts(true));
                }

                args.Request.ApplicationCommands.Clear();
                args.Request.ApplicationCommands.Add(privacyCommand);
                args.Request.ApplicationCommands.Add(aboutCommand);
                args.Request.ApplicationCommands.Add(settingsCommand);
                args.Request.ApplicationCommands.Add(themeCommand);
                args.Request.ApplicationCommands.Add(accountsCommand);
            }
            catch (Exception uiEx) { Frontend.UIError(uiEx); }
        }
Exemplo n.º 8
0
        private bool CleanPaneState()
        {
            try
            {
                if (CurrentFlyout != null)
                {
                    CurrentFlyout.Hide();
                }

                AppBar.IsOpen = false;

                if (ApplicationView.Value == ApplicationViewState.Snapped)
                {
                    ApplicationView.TryUnsnap();
                    return(false);
                }

                return(true);
            }
            catch (Exception uiEx) { Frontend.UIError(uiEx); }

            return(false);
        }
Exemplo n.º 9
0
        public Main()
        {
            try
            {
                this.InitializeComponent();

                // Assign data to IsLoading ( Progress Indicator )
                IsLoading.DataContext = Frontend.Status;

                // Assign data to Notificationsbutton
                NotificationButton.DataContext = Frontend.Notifications;

                // Assign settings for inverting interface
                MainGrid.DataContext = Frontend.Settings;

                // Add Charms Handler
                SettingsPane.GetForCurrentView().CommandsRequested += CommandsRequest;

                // Size changed and roster
                SizeChanged += WindowSizeChanged;
                Frontend.Events.OnRosterContactSelected       += Events_OnRosterItemSelected;
                Frontend.Events.OnSubscriptionContactSelected += Events_OnSubscriptionContactSelected;

                // Background access
                Frontend.OnRequestBackgroundAccess += Frontend_OnRequestBackgroundAccess;

                Frontend.Events.OnMessageReceived    += Events_OnMessageReceived;
                Frontend.Events.OnAccountListChanged += Events_OnAccountListChange;
                Frontend.Notifications.NotificationList.CollectionChanged += NotificationList_CollectionChanged;

                // Reset control state on focus
                Frontend.CoreWindow.Activated += (s, e) => { _isCtrlKeyPressed = false; };

                RecreateLayout();
            }
            catch (Exception uiEx) { Frontend.UIError(uiEx); }
        }
Exemplo n.º 10
0
        public ConversationHeader()
        {
            try
            {
                this.InitializeComponent();
                if (Windows.ApplicationModel.DesignMode.DesignModeEnabled)
                {
                    return;
                }

                this.DataContext = null;

                Frontend.Events.OnRosterContactSelected += Events_OnRosterItemSelected;

                Frontend.AppColors.PropertyChanged += (s, e) =>
                {
                    if (e.PropertyName == "FrameForeground" || e.PropertyName == "HighlightImportant")
                    {
                        Notify = Notify;
                    }
                };
            }
            catch (Exception uiEx) { Frontend.UIError(uiEx); }
        }
Exemplo n.º 11
0
Arquivo: Column.cs Projeto: vebin/BD2
 public static Column Deserialize(Frontend fb, byte[] chunkID, byte[] buffer)
 {
     using (System.IO.MemoryStream MS = new System.IO.MemoryStream (buffer)) {
         using (System.IO.BinaryReader BR = new System.IO.BinaryReader (MS)) {
             return new Column (fb, chunkID, BR.ReadString (), fb.ValueSerializer.IDToType (BR.ReadByte ()), BR.ReadBoolean (), BR.ReadInt64 ());
         }
     }
 }
 public IActionResult UpdateFrontend([FromBody] Frontend entity)
 {
     _frontendService.Update(entity);
     return(Ok());
 }
Exemplo n.º 13
0
 public void Update(Frontend entity)
 {
     _frontendDal.Update(entity);
 }
Exemplo n.º 14
0
 public Main(Formatter formatter, Frontend frontend)
 {
     _formatter = formatter;
     _frontend  = frontend;
 }
Exemplo n.º 15
0
 public void OnTouchBack()
 {
     Frontend.OnMenuOpen("ui/menus");
 }
Exemplo n.º 16
0
 /// <summary>
 /// Instantiate a new <see cref="CommandConsole"/> instance.
 /// </summary>
 /// <param name="frontend">The frontend to use for this console.</param>
 /// <param name="filesRootPath">The root folder for commands like exec.</param>
 /// <param name="config">The console configuration.</param>
 public CommandConsole(Frontend frontend, string filesRootPath, ObjectProviderDelegate objectProvider = null, ConsoleConfiguration config = null)
     : this(frontend, new DefaultValueConverter(), new SystemIOFilesystem(filesRootPath), objectProvider, config)
 {
 }
Exemplo n.º 17
0
 public void SwitchFrontend(Frontend frontend)
 {
     LConsole.Frontend.Stop();
     LConsole.Frontend = frontend;
 }
Exemplo n.º 18
0
    TreeView CreateTreeView()
    {
        TreeView frontendView = new TreeView ();
        frontendView.KeyPressEvent += IgnoreKeyPress;
        Gtk.TreeViewColumn hostnameCol = new Gtk.TreeViewColumn ();
        Gtk.CellRendererText hostnameCell = new Gtk.CellRendererText ();
        hostnameCol.Title = "Host";
        hostnameCol.PackStart (hostnameCell, true);
        hostnameCol.SetCellDataFunc (hostnameCell, new Gtk.TreeCellDataFunc (RenderHostname));

        TreeViewColumn statusCol = new TreeViewColumn ();
        CellRenderer statusCell = new CellRendererText ();
        statusCol.Title = "";
        statusCol.PackStart (statusCell, true);
        statusCol.SetCellDataFunc (statusCell, new TreeCellDataFunc (RenderStatus));

        Gtk.ListStore allFrontends = new Gtk.ListStore (typeof(Frontend));
        foreach (KeyValuePair<string, int> host in m_DB.GetFrontendHostnames ()) {
            Frontend foo = new Frontend (host.Key, host.Value);
            allFrontends.AppendValues (foo);
            ThreadPool.QueueUserWorkItem (foo.Connect);
            //foo.Connect (new object ());
        }

        frontendView.Model = allFrontends;
        frontendView.AppendColumn (hostnameCol);
        frontendView.AppendColumn (statusCol);
        return frontendView;
    }
Exemplo n.º 19
0
 public void OnTouchController2P()
 {
     Frontend.OnMenuController(2);
 }
Exemplo n.º 20
0
 protected override void OnExit()
 {
     Frontend.NotifyTargetEvent(new TargetEventArgs(TargetEventType.TargetExited));
     StopDebugger();
 }
Exemplo n.º 21
0
 private async void Events_OnRosterItemSelected(object sender, Frontend.ContactSelectedEventArgs e)
 {
     try
     {
         await Frontend.RunAsync(() =>
         {
             SelectedContact = e.Contact;
             RecreateLayout();
         });
     }
     catch (Exception uiEx) { Frontend.UIError(uiEx); }
 }
Exemplo n.º 22
0
 private async void Events_OnSubscriptionContactSelected(object sender, Frontend.ContactSelectedEventArgs e)
 {
     try
     {
         await Frontend.RunAsync(() =>
         {
             if (CleanPaneState())
                 CurrentFlyout = new Flyout.Flyout(FlyoutType.Subscription, e.Contact);
         });
     }
     catch (Exception uiEx) { Frontend.UIError(uiEx); }
 }
 public IActionResult AddFrontend([FromBody] Frontend entity)
 {
     _frontendService.Add(entity);
     return(Ok());
 }
Exemplo n.º 24
0
        public DataContext(Frontend frontend, byte[] id, DatabasePath path)
            : base(frontend)
        {
            Log.WriteLine ("DataContext-{0}..ctor(frontend={1}, id={2}, path={3})", id.ToHexadecimal (), frontend.ToString (), id.ToHexadecimal (), path);
            this.id = id;
            this.path = path;
            KeyValueStorageConfiguration kvscPrecomputedQueries = new KeyValueStorageConfiguration ("PrecomputedQueries", "Sqlite");
            KeyValueStorageConfiguration kvscMeta = new KeyValueStorageConfiguration ("Meta", "Sqlite");
            KeyValueStorageConfiguration kvscTemporary = new KeyValueStorageConfiguration ("Temporary", "Sqlite");
            precomputedQueries = kvscPrecomputedQueries.OpenStorage<byte[]> (path);
            meta = kvscMeta.OpenStorage<byte[]> (path);
            temporary = kvscTemporary.OpenStorage<byte[]> (path);
            try {
                byte[] cid = meta.Get ("ID".SHA256 ());
                if (cid == null) {
                    meta.Put ("ID".SHA256 (), id);
                    meta.Put ("Solid".SHA256 (), new byte[] { 0 });
                } else {
                    if (ByteSequenceComparer.Shared.Compare (cid, id) != 0)
                        throw new InvalidDataException ("Wrong ID");//should i even do this?
                }
            } catch {
                meta.Put ("ID".SHA256 (), id);
                meta.Put ("Solid".SHA256 (), new byte[] { 0 });
            }
            foreach (var t in frontend.GetTables ())
                perTableRows.Add (t, new SortedDictionary<byte[], Row> (ByteSequenceComparer.Shared));
            foreach (var kvp in temporary) {
                byte[] objectID = kvp.Key;
                //BaseDataObject bdo = new BaseDataObject (this.Frontend, objectID);
                System.IO.MemoryStream ms = new MemoryStream (kvp.Value, 16, kvp.Value.Length - 16);
                byte[] GuidBytes = new byte[16];
                System.Buffer.BlockCopy (kvp.Value, 0, GuidBytes, 0, 16);
                BaseDataObjectVersion bdov = BaseDataObjectTypeIdAttribute.GetAttribFor (new Guid (GuidBytes)).Deserialize (this.Frontend, null, ms.ToArray ());
                var row = bdov as Row;
                if (!references.ContainsKey (bdov.ID)) {
                    if (row != null) {
                        perTableRows [row.Table].Add (bdov.ID, row);
                    }
                    objects.Add (bdov.ID, row);
                }
                foreach (var r in bdov.ReplacingIDs) {
                    if (!references.ContainsKey (r)) {
                        references.Add (r, new SortedSet<byte[]> (ByteSequenceComparer.Shared));
                    }
                    references [r].Add (bdov.ID);
                }

            }
            //this.frontendInstanceBase = (FrontendInstance)frontendInstanceBase;
        }
Exemplo n.º 25
0
            public static void DoWork(object data)
            {
                var sw = new Stopwatch();

                sw.Start();

                var w = (ParseWorker)data;

                string self_bin_file = w.self_file;

                int i = w.start;

                int cache_hit  = 0;
                int cache_miss = 0;

                try
                {
                    for (int cnt = 0; i < (w.start + w.count); ++i, ++cnt)
                    {
                        //too verbose?
                        //if(cnt > 0 && cnt % 1000 == 0)
                        //{
                        //  var elapsed = Math.Round(sw.ElapsedMilliseconds/1000.0f,2);
                        //  Console.WriteLine("BHL Parser " + w.id + " " + cnt + "/" + w.count + ", " + elapsed + " sec");
                        //}

                        var file = w.files[i];
                        using (var sfs = File.OpenRead(file))
                        {
                            var deps = new List <string>();

                            if (w.check_deps)
                            {
                                var imports = w.ParseImports(file, sfs);
                                deps = imports.files;
                            }
                            deps.Add(file);

                            //NOTE: adding self binary as a dep
                            if (self_bin_file.Length > 0)
                            {
                                deps.Add(self_bin_file);
                            }

                            var cache_file = GetCompiledCacheFile(w.cache_dir, file);

                            var interim = new InterimResult();

                            if (!w.use_cache || BuildUtil.NeedToRegen(cache_file, deps))
                            {
                                var parser = Frontend.Stream2Parser(file, sfs);
                                var parsed = new ANTLR_Result(parser.TokenStream, parser.program());

                                interim.parsed = parsed;

                                ++cache_miss;
                                //Console.WriteLine("PARSE " + file + " " + cache_file);
                            }
                            else
                            {
                                interim.use_file_cache = true;

                                ++cache_hit;
                            }

                            w.file2interim[file] = interim;
                        }
                    }
                }
                catch (Exception e)
                {
                    if (e is IError)
                    {
                        w.error = e;
                    }
                    else
                    {
                        //let's log unexpected exceptions immediately
                        Console.Error.WriteLine(e.Message + " " + e.StackTrace);
                        w.error = new BuildError(w.files[i], e);
                    }
                }

                sw.Stop();
                Console.WriteLine("BHL parser {0} done(hit/miss:{2}/{3}, {1} sec)", w.id, Math.Round(sw.ElapsedMilliseconds / 1000.0f, 2), cache_hit, cache_miss);
            }
Exemplo n.º 26
0
 public Func(ref ptr <Config> Config = default, ref ptr <Cache> Cache = default, Frontend fe = default, ref ptr <pass> pass = default, @string Name = default, ref ptr <types.Type> Type = default, slice <ptr <Block> > Blocks = default, ref ptr <Block> Entry = default, ref ptr <Value> LastDeferExit = default, idAlloc bid = default, idAlloc vid = default, map <@string, writeSyncer> logfiles = default, ref ptr <HTMLWriter> HTMLWriter = default, bool DebugTest = default, bool PrintOrHtmlSSA = default, map <@string, long> ruleMatches = default, bool scheduled = default, bool laidout = default, bool NoSplit = default, slice <Location> RegAlloc = default, map <LocalSlot, slice <ptr <Value> > > NamedValues = default, slice <LocalSlot> Names = default, slice <ptr <Block> > WBLoads = default, ref ptr <Value> freeValues = default, ref ptr <Block> freeBlocks = default, slice <ptr <Block> > cachedPostorder = default, slice <ptr <Block> > cachedIdom = default, SparseTree cachedSdom = default, ref ptr <loopnest> cachedLoopnest = default, ref ptr <xposmap> cachedLineStarts = default, auxmap auxmap = default, map <long, slice <ptr <Value> > > constants = default)
 {
     this.Config           = Config;
     this.Cache            = Cache;
     this.fe               = fe;
     this.pass             = pass;
     this.Name             = Name;
     this.Type             = Type;
     this.Blocks           = Blocks;
     this.Entry            = Entry;
     this.LastDeferExit    = LastDeferExit;
     this.bid              = bid;
     this.vid              = vid;
     this.logfiles         = logfiles;
     this.HTMLWriter       = HTMLWriter;
     this.DebugTest        = DebugTest;
     this.PrintOrHtmlSSA   = PrintOrHtmlSSA;
     this.ruleMatches      = ruleMatches;
     this.scheduled        = scheduled;
     this.laidout          = laidout;
     this.NoSplit          = NoSplit;
     this.RegAlloc         = RegAlloc;
     this.NamedValues      = NamedValues;
     this.Names            = Names;
     this.WBLoads          = WBLoads;
     this.freeValues       = freeValues;
     this.freeBlocks       = freeBlocks;
     this.cachedPostorder  = cachedPostorder;
     this.cachedIdom       = cachedIdom;
     this.cachedSdom       = cachedSdom;
     this.cachedLoopnest   = cachedLoopnest;
     this.cachedLineStarts = cachedLineStarts;
     this.auxmap           = auxmap;
     this.constants        = constants;
 }
Exemplo n.º 27
0
        private void RenderFrontEnd(StringBuilder sb, Frontend f)
        {
            sb.AppendLine(string.Format("frontend\t{0}", f.Name).TrimEnd());

            foreach (var bind in f.Bind)
            {
                sb.AppendLine(string.Format("    bind\t{0}\t{1}", bind.Host, (bind.Options is bool? "" : string.Join(" ", ((JArray)bind.Options).ToList()))));
            }
            sb.AppendLine();

            if (!string.IsNullOrWhiteSpace(f.Mode))
            {
                sb.AppendLine(string.Format("    mode\t{0}", f.Mode).TrimEnd());
            }

            if (f.MaxConn.HasValue)
            {
                sb.AppendLine(string.Format("    maxconn\t{0}", f.MaxConn).TrimEnd());
            }

            if (f.Compression != null)
            {
                if (f.Compression.Algorithms?.Count > 0)
                {
                    sb.AppendLine("    compression algo " + string.Join(" ", f.Compression.Algorithms));
                }
                if (f.Compression.Types?.Count > 0)
                {
                    sb.AppendLine("    compression type " + string.Join(" ", f.Compression.Types));
                }
                if (f.Compression.Offload)
                {
                    sb.AppendLine("    compression offload");
                }
            }
            sb.AppendLine();

            foreach (var a in f.ACL)
            {
                sb.AppendLine(string.Format("    acl\t{0}\t{1}", a.Name, string.Join(" ", a.Conditions)).TrimEnd());
            }
            sb.AppendLine();

            if (f.Capture != null)
            {
                foreach (JArray cr in f.Capture.Request)
                {
                    sb.AppendLine(string.Format("    capture\trequest\theader\t{0}\tlen\t{1}", cr.First, cr.Last));
                }
                sb.AppendLine();

                foreach (JArray cr in f.Capture.Response)
                {
                    sb.AppendLine(string.Format("    capture\tresponse\theader\t{0}\tlen\t{1}", cr.First, cr.Last));
                }
            }
            sb.AppendLine();

            foreach (var kv in f.Option)
            {
                var vd = kv.Value as JObject;
                if (!(kv.Value is bool))
                {
                    foreach (var vk in vd)
                    {
                        sb.AppendLine(string.Format("    option\t{0}.{1}\t{2}", kv.Key, vk.Key, vk.Value).TrimEnd());
                    }
                }
                else
                {
                    sb.AppendLine(string.Format("    option\t{0}", kv.Key).TrimEnd());
                }
            }
            sb.AppendLine();

            if (f.HttpRequest != null)
            {
                foreach (var sh in f.HttpRequest.SetHeader)
                {
                    sb.AppendLine(string.Format("    http-request\tset-header\t{0}\t{1}\t{2}", sh.Header, sh.Value, string.Join(" ", sh.Conditions)));
                }
                sb.AppendLine();

                foreach (var sh in f.HttpRequest.ReplaceHeader)
                {
                    sb.AppendLine(string.Format("    http-request\treplace-header\t{0}\t{1}\t{2}\t{3}", sh.Header, sh.Match, sh.Replace, string.Join(" ", sh.Conditions)));
                }
                sb.AppendLine();

                foreach (var sh in f.HttpRequest.Redirect)
                {
                    sb.AppendLine(string.Format("    http-request\tredirect\t{0}\t{1}\t{2}", (sh.Code.HasValue ? "code " + sh.Code + "\tlocation" : "location"), sh.Url, string.Join(" ", sh.Conditions)));
                }

                sb.AppendLine();

                foreach (var sh in f.HttpRequest.DeleteHeader)
                {
                    sb.AppendLine(string.Format("    http-request\tdel-header\t{0}\t{1}", sh.Header, string.Join(" ", sh.Conditions)));
                }
                sb.AppendLine();

                if (f.HttpRequest.Deny.Count > 0)
                {
                    sb.AppendLine(string.Format("    http-request\tdeny\tif\t{0}", string.Join(" ", f.HttpRequest.Deny)));
                }

                sb.AppendLine();

                if (f.HttpRequest.SilentDrop.Count > 0)
                {
                    sb.AppendLine(string.Format("    http-request\tsilent-drop\tif\t{0}", string.Join(" ", f.HttpRequest.SilentDrop)));
                }

                sb.AppendLine();

                foreach (var sh in f.HttpRequest.SetVar)
                {
                    sb.AppendLine(string.Format("    http-request\tset-var({0})\t{1}", sh.Name, sh.Variable));
                }
                sb.AppendLine();
            }

            if (f.HttpResponse != null)
            {
                foreach (var sh in f.HttpResponse.SetHeader)
                {
                    sb.AppendLine(string.Format("    http-response\tset-header\t{0}\t{1}\t{2}", sh.Header, sh.Value, string.Join(" ", sh.Conditions)));
                }
                sb.AppendLine();

                foreach (var sh in f.HttpResponse.ReplaceHeader)
                {
                    sb.AppendLine(string.Format("    http-response\treplace-header\t{0}\t{1}\t{2}\t{3}", sh.Header, sh.Match, sh.Replace, string.Join(" ", sh.Conditions)));
                }
                sb.AppendLine();

                foreach (var sh in f.HttpResponse.DeleteHeader)
                {
                    sb.AppendLine(string.Format("    http-response\tdel-header\t{0}\t{1}", sh.Header, string.Join(" ", sh.Conditions)));
                }
                sb.AppendLine();
            }

            foreach (var rs in f.RspIDel)
            {
                sb.AppendLine(string.Format("    rspidel\t{0}", rs));
            }
            sb.AppendLine();

            foreach (var reqirep in f.ReqIRep)
            {
                sb.AppendLine(string.Format("    reqirep\t{0}\t{1}\t{2}", reqirep.Match, reqirep.Replace, string.Join(" ", reqirep.Conditions)));
            }
            sb.AppendLine();

            if (f.Redirect != null)
            {
                foreach (var sch in f.Redirect.Scheme)
                {
                    sb.AppendLine(string.Format("    redirect\tscheme\t{0}\t{1}\t{2}\t{3}", sch.Protocol, (sch.Code.HasValue ? "code " + sch.Code : ""), string.Join(" ", sch.Option), string.Join(" ", sch.Conditions)));
                }
                sb.AppendLine();
            }

            foreach (var ub in f.BackEnds)
            {
                sb.AppendLine(string.Format("    use_backend\t{0}\t{1}", ub.Backend, (ub.Conditions is bool? "" : string.Join(" ", ((JArray)ub.Conditions).ToList()))));
            }

            sb.AppendLine();

            if (!string.IsNullOrWhiteSpace(f.DefaultBackend))
            {
                sb.AppendLine(string.Format("    default_backend\t{0}", f.DefaultBackend).TrimEnd());
            }

            sb.AppendLine();
            sb.AppendLine();
        }
Exemplo n.º 28
0
 /// <summary>
 /// Instantiate a new <see cref="CommandConsole"/> instance.
 /// </summary>
 /// <param name="frontend">The frontend to use for this console.</param>
 /// <param name="valueConverter">The value converter to use for command arguments.</param>
 /// <param name="fileSystem">The file system for commands like exec.</param>
 /// <param name="objectProvider">The object provider for injecting dependencies into methods.</param>
 /// <param name="config">The console configuration.</param>
 public CommandConsole(Frontend frontend, IValueConverter valueConverter, IFileSystem fileSystem, ObjectProviderDelegate objectProvider, ConsoleConfiguration config = null)
     : this(frontend, valueConverter, fileSystem, null, new CommandRegistry(), new CommandExecutor(objectProvider), config ?? new ConsoleConfiguration())
 {
 }
Exemplo n.º 29
0
 public Main(Formatter formatter, Frontend frontend)
 {
     _formatter = formatter;
     _frontend = frontend;
 }
Exemplo n.º 30
0
 /// <summary>
 /// Instantiate a new <see cref="CommandConsole"/> instance.
 /// </summary>
 /// <param name="frontend">The frontend to use for this console.</param>
 /// <param name="config">The console configuration.</param>
 public CommandConsole(Frontend frontend, ObjectProviderDelegate objectProvider = null, ConsoleConfiguration config = null)
     : this(frontend, new DefaultValueConverter(), null, objectProvider, config)
 {
 }
Exemplo n.º 31
0
        public override void Initialize(Frontend frontend)
        {
            base.Initialize(frontend);

            m_Button.onClick.AddListener(OnButtonClick);
        }
Exemplo n.º 32
0
        private async void OnRosterContactSelected(object sender, Frontend.ContactSelectedEventArgs e)
        {
            try
            {
                await Frontend.RunAsync(() =>
                {
                    if (e.Contact != null && !string.IsNullOrEmpty(e.Contact.jid))
                    {
                        var account = Frontend.Accounts[new XMPP.JID(e.Contact.account).Bare];
                        if (account == null || account.OwnContact == null)
                            return;

                        if (!account.CurrentConversations.Keys.Contains(e.Contact.jid))
                            account.CurrentConversations[e.Contact.jid] = new Backend.Data.Conversation(account.OwnContact.jid, e.Contact.jid);

                        // Remove old listerners
                        if (CurrentConversation != null)
                            CurrentConversation.Items.CollectionChanged -= OnCoversationItemCollectionChanged;

                        // Change to the new Conversation
                        CurrentConversation = account.CurrentConversations[e.Contact.jid];

                        UpdateOfflineWarnings();

                        // Remove old text
                        SendText.Text = string.Empty;

                        // Add new listener
                        CurrentConversation.Items.CollectionChanged += OnCoversationItemCollectionChanged;

                        ClearMessageCount();

                        ScrollToBottom();
                        
                        // Can be vary annoying
                        if (Frontend.Settings.focusTextInput)
                            this.SendText.Focus(FocusState.Programmatic);
                    }
                    else // No contact selected
                    {
                        if (CurrentConversation != null)
                        {
                            if (CurrentConversation.Items.Count > 0)
                            {
                                foreach (var item in CurrentConversation.Items)
                                    item.Messages.CollectionChanged -= OnConversationItemMessageCollectionChanged;
                            }

                            CurrentConversation.Items.CollectionChanged -= OnCoversationItemCollectionChanged;

                            AccountOfflineWarning.Visibility = Visibility.Collapsed;
                            ContactOfflineWarning.Visibility = Visibility.Collapsed;
                        }

                        CurrentConversation = null;
                    }
                });
            }
            catch (Exception uiEx) { Frontend.UIError(uiEx); }
        }
Exemplo n.º 33
0
 bool getSelectedFrontend(out TreeIter iter, out Frontend selectedFrontend)
 {
     TreeModel model;
     TreeSelection selection = m_TreeView.Selection;
     if (selection.GetSelected (out model, out iter)) {
         selectedFrontend = model.GetValue (iter, 0) as Frontend;
         if (selectedFrontend != null) {
             Console.WriteLine ("selected: " + selectedFrontend);
             return true;
         }
     }
     selectedFrontend = null;
     return false;
 }
Exemplo n.º 34
0
 public void Add(Frontend entity)
 {
     _frontendDal.Add(entity);
 }
Exemplo n.º 35
0
        public async void RecreateLayout()
        {
            try
            {
                await Frontend.RunAsync(() =>
                {
                    if (Frontend.Accounts == null)
                    {
                        return;
                    }

                    OnUserRelevantEvent();

                    // No accounts overlay
                    if (Frontend.Accounts.Count <= 0)
                    {
                        NoAccountsOverlay.Visibility = Visibility.Visible;
                    }
                    else
                    {
                        NoAccountsOverlay.Visibility = Visibility.Collapsed;
                    }

                    // Snapping
                    if (ApplicationView.Value == ApplicationViewState.Snapped) // Snapped
                    {
                        if (SelectedContact != null)                           // Contact Selected
                        {
                            this.LeftGridControl.Visibility           = Visibility.Collapsed;
                            this.RightGridControl.Visibility          = Visibility.Visible;
                            this.RosterControl.Visibility             = Visibility.Visible;
                            this.ConversationControl.Visibility       = Visibility.Visible;
                            this.StatusControl.Visibility             = Visibility.Visible;
                            this.ConversationHeaderControl.Visibility = Visibility.Visible;
                        }
                        else
                        {
                            this.LeftGridControl.Visibility           = Visibility.Visible;
                            this.RightGridControl.Visibility          = Visibility.Collapsed;
                            this.RosterControl.Visibility             = Visibility.Visible;
                            this.ConversationControl.Visibility       = Visibility.Visible;
                            this.StatusControl.Visibility             = Visibility.Visible;
                            this.ConversationHeaderControl.Visibility = Visibility.Visible;
                        }
                    }
                    else // Not snapped
                    {
                        this.LeftGridControl.Visibility           = Visibility.Visible;
                        this.RightGridControl.Visibility          = Visibility.Visible;
                        this.RosterControl.Visibility             = Visibility.Visible;
                        this.ConversationControl.Visibility       = Visibility.Visible;
                        this.StatusControl.Visibility             = Visibility.Visible;
                        this.ConversationHeaderControl.Visibility = Visibility.Collapsed;
                    }

                    // Appbar
                    if (SelectedContact != null)
                    {
                        RemoveContact.IsEnabled = true;
                        ContactInfo.IsEnabled   = true;
                    }
                    else
                    {
                        RemoveContact.IsEnabled = false;
                        ContactInfo.IsEnabled   = false;
                    }

                    if (Frontend.Accounts.Enabled.Count() > 0)
                    {
                        AddContact.IsEnabled = true;
                    }
                    else
                    {
                        AddContact.IsEnabled = false;
                    }
                });
            }
            catch (Exception uiEx) { Frontend.UIError(uiEx); }
        }
Exemplo n.º 36
0
 public void Delete(Frontend entity)
 {
     _frontendDal.Delete(entity);
 }
Exemplo n.º 37
0
 public void OnTouchFilters()
 {
     Frontend.OnMenuFilter();
 }
Exemplo n.º 38
0
            public static void DoWork(object data)
            {
                var sw = new Stopwatch();

                sw.Start();

                var w = (CompilerWorker)data;

                w.file2path.Clear();
                w.file2compiled.Clear();

                var imp = new Frontend.Importer();

                imp.SetParsedCache(w.cache);
                imp.AddToIncludePath(w.inc_dir);

                int i = w.start;

                int cache_hit  = 0;
                int cache_miss = 0;

                try
                {
                    for (int cnt = 0; i < (w.start + w.count); ++i, ++cnt)
                    {
                        var file = w.files[i];

                        var compiled_file = GetCompiledCacheFile(w.cache_dir, file);
                        var file_module   = new Module(w.ts.globs, imp.FilePath2ModuleName(file), file);

                        InterimResult interim;
                        if (w.cache.file2interim.TryGetValue(file, out interim) &&
                            interim.use_file_cache)
                        {
                            ++cache_hit;

                            w.file2path.Add(file, file_module.path);
                            //TODO: load from the cached file?
                            //w.file2symbols.Add(file, ...);
                        }
                        else
                        {
                            ++cache_miss;

                            Frontend.Result front_res = null;

                            if (interim.parsed != null)
                            {
                                front_res = Frontend.ProcessParsed(file_module, interim.parsed, w.ts, imp);
                            }
                            else
                            {
                                front_res = Frontend.ProcessFile(file, w.ts, imp);
                            }

                            front_res = w.postproc.Patch(front_res, file);

                            w.file2path.Add(file, file_module.path);
                            w.file2symbols.Add(file, front_res.module.symbols);

                            var c  = new Compiler(w.ts, front_res);
                            var cm = c.Compile();
                            CompiledModule.ToFile(cm, compiled_file);
                        }

                        w.file2compiled.Add(file, compiled_file);
                    }
                }
                catch (Exception e)
                {
                    if (e is IError)
                    {
                        w.error = e;
                    }
                    else
                    {
                        //let's log unexpected exceptions immediately
                        Console.Error.WriteLine(e.Message + " " + e.StackTrace);
                        w.error = new BuildError(w.files[i], e);
                    }
                }

                sw.Stop();
                Console.WriteLine("BHL compiler {0} done(hit/miss:{2}/{3}, {1} sec)", w.id, Math.Round(sw.ElapsedMilliseconds / 1000.0f, 2), cache_hit, cache_miss);
            }
Exemplo n.º 39
0
        private async void OnRosterContactSelected(object sender, Frontend.ContactSelectedEventArgs e)
        {
            try
            {
                await Frontend.RunAsync(() =>
                {
                    if (e.Contact != null && !string.IsNullOrEmpty(e.Contact.jid))
                    {
                        var account = Frontend.Accounts[new XMPP.JID(e.Contact.account).Bare];
                        if (account == null || account.OwnContact == null)
                        {
                            return;
                        }

                        if (!account.CurrentConversations.Keys.Contains(e.Contact.jid))
                        {
                            account.CurrentConversations[e.Contact.jid] = new Backend.Data.Conversation(account.OwnContact.jid, e.Contact.jid);
                        }

                        // Remove old listerners
                        if (CurrentConversation != null)
                        {
                            CurrentConversation.Items.CollectionChanged -= OnCoversationItemCollectionChanged;
                        }

                        // Change to the new Conversation
                        CurrentConversation = account.CurrentConversations[e.Contact.jid];

                        UpdateOfflineWarnings();

                        // Remove old text
                        SendText.Text = string.Empty;

                        // Add new listener
                        CurrentConversation.Items.CollectionChanged += OnCoversationItemCollectionChanged;

                        ClearMessageCount();

                        ScrollToBottom();

                        // Can be vary annoying
                        if (Frontend.Settings.focusTextInput)
                        {
                            this.SendText.Focus(FocusState.Programmatic);
                        }
                    }
                    else // No contact selected
                    {
                        if (CurrentConversation != null)
                        {
                            if (CurrentConversation.Items.Count > 0)
                            {
                                foreach (var item in CurrentConversation.Items)
                                {
                                    item.Messages.CollectionChanged -= OnConversationItemMessageCollectionChanged;
                                }
                            }

                            CurrentConversation.Items.CollectionChanged -= OnCoversationItemCollectionChanged;

                            AccountOfflineWarning.Visibility = Visibility.Collapsed;
                            ContactOfflineWarning.Visibility = Visibility.Collapsed;
                        }

                        CurrentConversation = null;
                    }
                });
            }
            catch (Exception uiEx) { Frontend.UIError(uiEx); }
        }
Exemplo n.º 40
0
 /// <summary cref="DisposeBase.Dispose(bool)"/>
 protected override void Dispose(bool disposing)
 {
     isFinished = true;
     Frontend.FinishCodeGeneration(this);
 }
Exemplo n.º 41
0
 /// <summary>
 /// Adds a new node of specified value to the effective 'Rear' of pseudoqueue
 /// ('Rear' is bottom of 'Backend' stack)
 /// </summary>
 /// <param name="value"> value of added node </param>
 public void Enqueue(T value)
 {
     Offload(Backend, Frontend);
     Frontend.Push(value);
 }