text:
#region COPYRIGHT (c) 2017 by Peters Sharp (MIT License)
//  Permission is hereby granted, free of charge, to any person obtaining a copy
//  of this software and associated documentation files (the "Software"), to deal
//  in the Software without restriction, including without limitation the rights
//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//  copies of the Software, and to permit persons to whom the Software is
//  furnished to do so, subject to the following conditions:
//
//  The above copyright notice and this permission notice shall be included in all
//  copies or substantial portions of the Software.
//
//  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
//  SOFTWARE.
#endregion

// #define NOT_SHOW_VERSION

using System;
using System.Windows.Forms;
using System.IO;
using stCoreUI;
using System.Reflection;
using System.Diagnostics;
using System.Globalization;
using System.Threading.Tasks;

namespace stRevizor
{
    public partial class Manager : Form
    {
        bool __isRaisingEvents = false;
        long __TimerDropMin = 0;
        object __isLockStat = new object();
        object __isLockBallon = new object();
        object __isLockProccess = new object();
        stRevizor.Engine stRv = null;

        public bool __isMinimized
        {
            get { return this.NotifyMain.Visible; }
        }

        enum __ButtonState : int
        {
            Start,
            Stop,
            Setup,
            Desabled,
        }

        public Manager()
        {
            InitializeComponent();
            this.flatRadioButton_SetDefault();
            this.flatRadioButton_SetChange();
            this.flatButtonTimerDrop.Text = Properties.Resources.ButtonTimerDrop;
            this.labelVerion.Text = "v:" + System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString();

            // overwrite, stupid constructor (always set default value)
            this.flatContextMenuLog.ShowImageMargin = true;
            this.flatContextMenuSendServer.ShowImageMargin = true;
            this.fileSystemWatch.EnableRaisingEvents = false;
            this.NotifyMain.Visible = false;
            __Set_NotifyIcon(false);
            // end overwrite

#if NOT_SHOW_VERSION
            this.flatTabControlMain.TabPages.RemoveAt(3);
#endif

            if (!__SetupFolder_Check(true))
            {
                __SetupFolder_Text(__ButtonState.Setup);
            }
            else
            {
                __SetupFolder_Text(__ButtonState.Start);
            }

            if (Properties.Settings.Default.SetupServerType)
            {
                this.flatRadioButtonFTP.Checked = true;
                this.flatRadioButtonTFTP.Checked = false;
            }
            else
            {
                this.flatRadioButtonTFTP.Checked = true;
                this.flatRadioButtonFTP.Checked = false;
            }

            __Set_LogMsg(
                string.Format(
                    "{0} {1} - {2}",
                    Properties.Resources.ButtonStart,
                    this.formSkinMain.Text,
                    this.labelVerion.Text
                )
            );

            stRv = new Engine(
                stCore.IOBaseAssembly.BaseDataDir(),
                Properties.Settings.Default.SetupServerType,
                Properties.Settings.Default.SetupServer,
                Properties.Settings.Default.SetupServerFTPLogin,
                Properties.Settings.Default.SetupServerFTPPass
            );
            stRv.OnProcessError += (o, e) =>
            {
                string msg = string.Format("{0} : {1}", e.ex.GetType().Name, e.ex.Message);
                __Set_AlertMsg(FlatAlertBox._Kind.Error, msg);
                __Set_LogMsg(msg);

            };
            stRv.OnProcessLog += (o, e) =>
            {
                string msg = string.Format("{0} : {1}", e.ex.GetType().Name, e.ex.Message);
                __Set_LogMsg(msg);
            };

            /* disable in Engine dll
                  // stRv.ProgressBar = __Set_ProgressBar;
             */

            this.timerSrvInfo_Tick(this, null);
            this.timerSrvInfo.Enabled = true;
        }

        private void timerSrvInfo_Tick(object sender, EventArgs e)
        {
            lock (__isLockStat)
            {
                flatThreadSafe.Run(this, (Action)(() =>
                    this.ServerInfoBindingSource.Clear()
                ));

                Task<ServerInfo.SiRoot> t1 = stRv.ReceiveAutoconfigT();
                t1.ContinueWith((o) =>
                {
                    ServerInfo.SiRoot sio;
                    if ((sio = o.Result) != null)
                    {
                        flatThreadSafe.Run(this, (Action)(() =>
                            this.ServerInfoBindingSource.Add(sio)
                        ));
                    }
                    o.Dispose();
                }, TaskContinuationOptions.NotOnFaulted | TaskContinuationOptions.NotOnCanceled);
                t1.ContinueWith((o) =>
                {
                    string.Format(
                        Properties.Resources.LogTaskError,
                        o.Status.ToString(),
                        ((o.Exception != null) ? o.Exception.Message : "-")
                    );
                    o.Dispose();
                }, TaskContinuationOptions.OnlyOnFaulted);
            }
        }

        private void flatButtonReload_Click(object sender, EventArgs e)
        {
            this.timerSrvInfo_Tick(sender, e);
        }

        #region Private SET value

        private void __Set_StatusBar(string msg)
        {
            flatThreadSafe.Run(this, (Action)(() =>
                this.flatStatusBarInfo.Text = Properties.Resources.StatusString1 + msg
            ));
        }

        private void __Set_LogMsg(string msg)
        {
            if (Properties.Settings.Default.SetupLogEnable)
            {
                flatThreadSafe.Run(this, (Action)(() =>
                    this.ListBoxLog.Items.Add(
                        string.Format("{0:dd/MM/yy HH:mm:ss} - {1}", DateTime.Now, msg)
                    )
                ));
            }
            if (__isMinimized)
            {
                __Set_NotifyBallon(msg, null, ToolTipIcon.None, 10000);
            }
            else
            {
                __Set_StatusBar(msg);
            }
        }

        private void __Set_AlertMsg(FlatAlertBox._Kind type, string msg)
        {
            if (__isMinimized)
            {
                __Set_NotifyBallon(msg, null, ToolTipIcon.Info, 10000);
            }
            else
            {
                flatThreadSafe.Run(this, (Action)(() =>
                    this.flatAlertBoxInfo.ShowControl(
                        type,
                        msg,
                        ((type == FlatAlertBox._Kind.Error) ? 20000 : 10000)
                    )
                ));
            }
        }

        /* disable in Engine dll
        private void __Set_ProgressBar(Int32 cnt)
        {
            flatThreadSafe.Run(this, (Action)(() =>
                this.FPBMain.Value =
                    ((cnt >= 0) ? ((cnt > 100) ? 100 : cnt) : 0)
            ));
        }
        */

        private void __Set_ErrorProvider(object ctrl, int pad, string txterr, ErrorIconAlignment align = ErrorIconAlignment.MiddleRight)
        {
            if (ctrl == null)
            {
                return;
            }
            flatThreadSafe.Run(this, (Action)(() => this.EPMain.SetIconAlignment(((FlatTextBox)ctrl), align)));
            flatThreadSafe.Run(this, (Action)(() => this.EPMain.SetIconPadding(((FlatTextBox)ctrl), pad)));
            flatThreadSafe.Run(this, (Action)(() => this.EPMain.SetError(((FlatTextBox)ctrl), txterr)));
        }

        private void __Set_NotifyIcon(bool isRun)
        {
            flatThreadSafe.Run(this, (Action)(() =>
                this.NotifyMain.Icon =
                    ((isRun) ?
                        Properties.Resources.security_firewall_on : Properties.Resources.security_firewall_off
                    )
            ));
        }

        private void __Set_NotifyBallon(string msg, string title = null, ToolTipIcon ti = ToolTipIcon.None, int tm = 0)
        {
            if (__isMinimized)
            {
                lock (__isLockBallon)
                {
                    flatThreadSafe.Run(this, (Action)(() => this.NotifyMain.BalloonTipIcon = ti));
                    flatThreadSafe.Run(this, (Action)(() => this.NotifyMain.BalloonTipTitle = ((string.IsNullOrEmpty(title)) ? "" : title)));
                    flatThreadSafe.Run(this, (Action)(() => this.NotifyMain.BalloonTipText = ((string.IsNullOrEmpty(msg)) ? "" : msg)));
                    flatThreadSafe.Run(this, (Action)(() => this.NotifyMain.ShowBalloonTip((tm > 0) ? tm : 1000)));
                }
            }
        }

        #endregion

        #region SetupFolder SET/OPEN

        private void __SetupFolder_Text(__ButtonState state)
        {
            switch (state)
            {
                case __ButtonState.Start:
                    {
                        flatThreadSafe.Run(this, (Action)(() =>
                            this.flatButtonStartStop.Text = Properties.Resources.ButtonStart
                        ));
                        break;
                    }
                case __ButtonState.Stop:
                    {
                        flatThreadSafe.Run(this, (Action)(() =>
                            this.flatButtonStartStop.Text = Properties.Resources.ButtonStop
                        ));
                        break;
                    }
                case __ButtonState.Setup:
                    {
                        flatThreadSafe.Run(this, (Action)(() =>
                            this.flatButtonStartStop.Text = Properties.Resources.ButtonSetup
                        ));
                        break;
                    }
                case __ButtonState.Desabled:
                    {
                        flatThreadSafe.Run(this, (Action)(() =>
                            this.flatButtonStartStop.Text = Properties.Resources.ButtonDisabled
                        ));
                        break;
                    }
                default:
                    {
                        break;
                    }
            }
            flatThreadSafe.Run(this, (Action)(() =>
                this.flatButtonStartStop.Refresh()
            ));
        }

        private bool __SetupFolder_Check(bool isCheck = false)
        {
            if ((!this.fileSystemWatch.EnableRaisingEvents) || (isCheck))
            {
                if (string.IsNullOrWhiteSpace(Properties.Settings.Default.SetupFolder))
                {
                    __Set_AlertMsg(FlatAlertBox._Kind.Error, Properties.Resources.AlertDirEmpty);
                    return false;
                }
                if (!Directory.Exists(Properties.Settings.Default.SetupFolder))
                {
                    __Set_AlertMsg(FlatAlertBox._Kind.Error, Properties.Resources.AlertDirNotFound);
                    return false;
                }
            }
            return true;
        }

        private void pictureBoxFolder_Click(object sender, EventArgs e)
        {
            try
            {
                if (this.OFDMain.ShowDialog() == DialogResult.OK)
                {
                    flatThreadSafe.Run(this, (Action)(() =>
                        Properties.Settings.Default.SetupFolder = this.OFDMain.SelectedPath + Path.DirectorySeparatorChar
                    ));
                }
                __Set_StatusBar(
                    Properties.Resources.FolderPath + Properties.Settings.Default.SetupFolder
                );
            }
            catch (Exception ex)
            {
                __Set_LogMsg(ex.Message);
            }
        }

        #endregion

        #region File System Watch function

        private bool __FileWatcher_Run(bool isRun)
        {
            try
            {
                this.fileSystemWatch.EnableRaisingEvents = isRun;
                __Set_LogMsg(
                    string.Format(
                        "{0}: {1}",
                        ((isRun) ? Properties.Resources.LogManagerStart : Properties.Resources.LogManagerStop),
                        ((string.IsNullOrWhiteSpace(this.fileSystemWatch.Path)) ? "---" : this.fileSystemWatch.Path)
                    )
                );
                __Set_NotifyIcon(isRun);
                return true;
            }
            catch (Exception ex)
            {
                __Set_AlertMsg(FlatAlertBox._Kind.Error, ex.Message);
                __Set_NotifyIcon(false);
                return false;
            }
        }

        private void fileSystemWatch_Processed(object sender, System.IO.FileSystemEventArgs e)
        {
            Task t1 = Task.Factory.StartNew(() =>
            {
                stRv.WatchFileList.ForEach(o =>
                {
                    if (o.Equals(e.Name))
                    {
                        if (__SourceProcessed(e.FullPath, e.Name))
                        {
                            return;
                        }
                    }
                });
            });
            t1.ContinueWith((o) =>
            {
                o.Dispose();
            }, TaskContinuationOptions.NotOnFaulted | TaskContinuationOptions.NotOnCanceled);
            t1.ContinueWith((o) =>
            {
                string.Format(
                    Properties.Resources.LogTaskError,
                    o.Status.ToString(),
                    ((o.Exception != null) ? o.Exception.Message : "-")
                );
                o.Dispose();
            }, TaskContinuationOptions.OnlyOnFaulted);
        }

        private void pictureBoxLoadWait_Click(object sender, EventArgs e)
        {
            if (!this.flatContextMenuSendServer.Visible)
            {
                System.Drawing.Size msz = this.flatContextMenuSendServer.Size;
                System.Drawing.Point gpos = this.Location,
                                     wpos = this.pictureBoxLoadWait.Location;
                int x = ((gpos.X + wpos.X) - msz.Width),
                    y = ((gpos.Y + wpos.Y) + 54);

                this.flatContextMenuSendServer.Show(x, y);
            }
        }

        private void toolStripMenuItem3_Click(object sender, EventArgs e)
        {
            if (this.timerSendServer.Enabled)
            {
                this.timerSendServer.Enabled = false;
            }
            if (this.pictureBoxLoadWait.Image != null)
            {
                this.pictureBoxLoadWait.Image.Dispose();
                this.pictureBoxLoadWait.Image = null;
            }
            this.pictureBoxLoadWait.Click -= new System.EventHandler(this.pictureBoxLoadWait_Click);
            this.pictureBoxLoadWait.Cursor = Cursors.Default;
            stRv.LastFileSorage = null;
        }

        private void timerSendServer_Tick(object sender, EventArgs e)
        {
            __Set_LogMsg(
                Properties.Resources.LogResend
            );
            Task t1 = Task.Factory.StartNew(() =>
            {
                InputSorage fs = stRv.LastFileSorage;
                if ((fs == null) || (__SourceProcessed(fs.fPath, fs.fName)))
                {
                    flatThreadSafe.Run(this, (Action)(() =>
                        this.toolStripMenuItem3_Click(sender, e)
                    ));
                }
            });
            t1.ContinueWith((o) =>
            {
                o.Dispose();
            }, TaskContinuationOptions.NotOnFaulted | TaskContinuationOptions.NotOnCanceled);
            t1.ContinueWith((o) =>
            {
                __Set_LogMsg(
                    string.Format(
                        Properties.Resources.LogTaskError,
                        o.Status.ToString(),
                        ((o.Exception != null) ? o.Exception.Message : "-")
                    )
                );
                o.Dispose();
            }, TaskContinuationOptions.OnlyOnFaulted);
        }

        private bool __SourceProcessed(string fPath, string fName)
        {
            lock (__isLockProccess)
            {
                try
                {
                    string msg = stRevizor.stXFTPUtil.GetLocalFileSize(fPath);
                    msg = string.Format(
                        Properties.Resources.LogWatchFileFound,
                        fName,
                        ((string.IsNullOrWhiteSpace(msg)) ? "-" : msg)
                    );
                    __Set_LogMsg(msg);
                    __Set_AlertMsg(FlatAlertBox._Kind.Info, msg);
                }
                catch(Exception e)
                {
                    __Set_AlertMsg(
                        FlatAlertBox._Kind.Error,
                        string.Format(Properties.Resources.AlertFileStatError, fName, e.Message)
                    );
                    return false;
                }

                Engine.State st;

                switch ((st = stRv.BeginSource(fPath, fName)))
                {
                    case Engine.State.ListSuccess:
                        {
                            flatThreadSafe.Run(this, (Action)(() =>
                                Properties.Settings.Default.DateUpServer = DateTime.Now.ToString()
                            ));
                            if (!string.IsNullOrWhiteSpace(stRv.UpdateTime))
                            {
                                try
                                {
                                    DateTime dtUp = DateTime.Parse(stRv.UpdateTime);
                                    flatThreadSafe.Run(this, (Action)(() =>
                                        Properties.Settings.Default.DateUpList = dtUp.ToString()
                                    ));
                                }
                                catch
                                {
                                    flatThreadSafe.Run(this, (Action)(() =>
                                        Properties.Settings.Default.DateUpList = "???"
                                    ));
                                }
                            }

                            Properties.Settings.Default.Save();
                            string nPath = string.Format("{0}.old", fPath);

                            try
                            {
                                File.Delete(nPath);
                            }
                            catch { }
                            try
                            {
                                File.Move(fPath, nPath);
                            }
                            catch { }
                            __Set_AlertMsg(
                                FlatAlertBox._Kind.Success,
                                Properties.Resources.AlertSendSuccess
                            );
                            return true;
                        }
                    case Engine.State.ServerBusy:
                        {
                            __Set_AlertMsg(
                                FlatAlertBox._Kind.Error,
                                Properties.Resources.AlertSendBusy
                            );
                            stRv.AddToFileSorage(fPath, fName);
                            if (!this.timerSendServer.Enabled)
                            {
                                this.timerSendServer.Enabled = true;
                                this.pictureBoxLoadWait.Cursor = Cursors.Hand;
                                this.pictureBoxLoadWait.Image = Properties.Resources.ajax_loader3;
                                this.pictureBoxLoadWait.Click += new System.EventHandler(this.pictureBoxLoadWait_Click);
                            }
                            break;
                        }
                    case Engine.State.ServerError:
                        {
                            __Set_AlertMsg(
                                FlatAlertBox._Kind.Error,
                                Properties.Resources.AlertErrorServer
                            );
                            break;
                        }
                    case Engine.State.ListError:
                        {
                            __Set_AlertMsg(
                                FlatAlertBox._Kind.Error,
                                Properties.Resources.AlertErrorLocal
                            );
                            break;
                        }
                    default:
                        {
                            __Set_AlertMsg(
                                FlatAlertBox._Kind.Error,
                                string.Format(
                                    Properties.Resources.AlertOtherError,
                                    st.ToString()
                                )
                            );
                            break;
                        }
                }
            }
            return false;
        }

        #endregion

        #region flatRadioButton SET value

        private void flatRadioButton_SetDefault()
        {
            if (Properties.Settings.Default.SetupServerType)
            {
                this.flatRadioButtonTFTP.Checked = false;
                this.flatRadioButtonFTP.Checked = true;
            }
            else
            {
                this.flatRadioButtonTFTP.Checked = true;
                this.flatRadioButtonFTP.Checked = false;
            }
            this.flatRadioButtonFTP.Refresh();
            this.flatRadioButtonTFTP.Refresh();
        }

        private void flatRadioButton_SetChange()
        {
            if (Properties.Settings.Default.SetupServerType)
            {
                this.flatTextBoxServerFTPLogin.Enabled = true;
                this.flatTextBoxServerFTPPass.Enabled = true;
            }
            else
            {
                this.flatTextBoxServerFTPLogin.Enabled = false;
                this.flatTextBoxServerFTPPass.Enabled = false;
            }
            this.flatTextBoxServerFTPLogin.Refresh();
            this.flatTextBoxServerFTPPass.Refresh();
        }

        private void flatRadioButtonTFTP_CheckedChanged(object sender, EventArgs e)
        {
            flatThreadSafe.Run(this, (Action)(() => Properties.Settings.Default.SetupServerType =
                ((this.flatRadioButtonTFTP.Checked) ? false : true)
            ));
            flatThreadSafe.Run(this, (Action)(() => this.flatStatusBarInfo.Text = "set: " + Properties.Settings.Default.SetupServerType));
            flatRadioButton_SetChange();
            __Set_StatusBar(
                ((this.flatRadioButtonTFTP.Checked) ? Properties.Resources.ServerTypeTFTP : Properties.Resources.ServerTypeFTP)
            );
        }

        private void flatRadioButtonFTP_CheckedChanged(object sender, EventArgs e)
        {
            flatThreadSafe.Run(this, (Action)(() => Properties.Settings.Default.SetupServerType =
                ((this.flatRadioButtonFTP.Checked) ? true : false)
            ));
            flatRadioButton_SetChange();
            __Set_StatusBar(
                ((this.flatRadioButtonFTP.Checked) ? Properties.Resources.ServerTypeFTP : Properties.Resources.ServerTypeTFTP)
            );
        }

        #endregion

        #region Log Context menu

        private void toolStripMenuItem1_Click(object sender, EventArgs e)
        {
            try
            {
                if (this.SFDMain.ShowDialog() == DialogResult.OK)
                {
                    using (FileStream fp = File.Open(this.SFDMain.FileName, FileMode.CreateNew))
                    {
                        using (StreamWriter sw = new StreamWriter(fp))
                        {
                            foreach (var str in this.ListBoxLog.Items)
                            {
                                sw.WriteLine(str.ToString());
                            }
                        }
                    }
                    __Set_StatusBar(
                        string.Format(Properties.Resources.StatusSaveLog, this.SFDMain.FileName)
                    );
                }
            }
            catch (Exception ex)
            {
                __Set_LogMsg(ex.Message);
            }
        }

        private void toolStripMenuItem2_Click(object sender, EventArgs e)
        {
            this.ListBoxLog.Items.Clear();
        }

        #endregion

        private void flatButtonSave_Click(object sender, EventArgs e)
        {
            this.EPMain.Clear();

            if (string.IsNullOrWhiteSpace(this.flatTextBoxFolder.Text))
            {
                __Set_ErrorProvider(this.flatTextBoxFolder, 4, Properties.Resources.ErrPrvTextEmpty);
                return;
            }

            if (!string.IsNullOrWhiteSpace(this.flatTextBoxServer.Text))
            {
                flatThreadSafe.Run(this, (Action)(() => Properties.Settings.Default.SetupServer =
                    this.flatTextBoxServer.Text
                ));
            }
            else
            {
                __Set_ErrorProvider(this.flatTextBoxServer, 4, Properties.Resources.ErrPrvTextEmpty);
                return;
            }

            if (Properties.Settings.Default.SetupServerType)
            {
                if (!string.IsNullOrWhiteSpace(this.flatTextBoxServerFTPLogin.Text))
                {
                    flatThreadSafe.Run(this, (Action)(() => Properties.Settings.Default.SetupServerFTPLogin =
                        this.flatTextBoxServerFTPLogin.Text
                    ));
                }
                else
                {
                    __Set_ErrorProvider(this.flatTextBoxServerFTPLogin, 4, Properties.Resources.ErrPrvTextEmpty);
                    return;
                }

                if (!string.IsNullOrWhiteSpace(this.flatTextBoxServerFTPPass.Text))
                {
                    flatThreadSafe.Run(this, (Action)(() => Properties.Settings.Default.SetupServerFTPPass =
                        this.flatTextBoxServerFTPPass.Text
                    ));
                }
                else
                {
                    __Set_ErrorProvider(this.flatTextBoxServerFTPPass, 4, Properties.Resources.ErrPrvTextEmpty);
                    return;
                }
            }
            __Set_StatusBar(Properties.Resources.SetupSave);
            Properties.Settings.Default.Save();
            stRv.EngineSet(
                Properties.Settings.Default.SetupServerType,
                Properties.Settings.Default.SetupServer,
                Properties.Settings.Default.SetupServerFTPLogin,
                Properties.Settings.Default.SetupServerFTPPass
            );
            this.timerSrvInfo_Tick(sender, e);
        }

        private void flatButtonStartStop_Click(object sender, EventArgs e)
        {
            if (!__SetupFolder_Check())
            {
                __SetupFolder_Text(__ButtonState.Setup);
                this.flatTabControlMain.SelectTab(1);
                this.pictureBoxFolder.Focus();
                return;
            }
            if (this.fileSystemWatch.EnableRaisingEvents)
            {
                __Set_AlertMsg(FlatAlertBox._Kind.Success, Properties.Resources.LogManagerStop);
                __SetupFolder_Text(__ButtonState.Start);
                flatThreadSafe.Run(this, (Action)(() => __isRaisingEvents = false));
            }
            else
            {
                __Set_AlertMsg(FlatAlertBox._Kind.Success, Properties.Resources.LogManagerStart);
                __SetupFolder_Text(__ButtonState.Stop);
                flatThreadSafe.Run(this, (Action)(() =>
                    this.fileSystemWatch.Path = Path.GetDirectoryName(Properties.Settings.Default.SetupFolder)
                ));
                flatThreadSafe.Run(this, (Action)(() =>
                    this.fileSystemWatch.NotifyFilter = NotifyFilters.FileName
                ));
                __isRaisingEvents = true;
            }
            __FileWatcher_Run(__isRaisingEvents);
        }

        #region Timer Drop function

        private void flatButtonTimerDrop_Click(object sender, EventArgs e)
        {
            if (this.timerDrop.Enabled)
            {
                return;
            }
            if ((__TimerDropMin = this.flatNumericTimerDrop.Value) <= 0)
            {
                __Set_AlertMsg(FlatAlertBox._Kind.Error, Properties.Resources.AlertDropError1);
                return;
            }

            Task<Engine.State> t1 = stRv.BeginBlockTimerT(__TimerDropMin);
            t1.ContinueWith((o) =>
            {
                Engine.State st = o.Result;
                switch (st)
                {
                    case Engine.State.ListSuccess:
                        {
                            __Set_AlertMsg(
                                FlatAlertBox._Kind.Success,
                                Properties.Resources.AlertDropError3
                            );
                            break;
                        }
                    case Engine.State.ServerBusy:
                        {
                            __Set_AlertMsg(
                                FlatAlertBox._Kind.Error,
                                Properties.Resources.AlertDropError2
                            );
                            return;
                        }
                    case Engine.State.ServerError:
                        {
                            __Set_AlertMsg(
                                FlatAlertBox._Kind.Error,
                                Properties.Resources.AlertErrorServer
                            );
                            return;
                        }
                    case Engine.State.ListError:
                        {
                            __Set_AlertMsg(
                                FlatAlertBox._Kind.Error,
                                Properties.Resources.AlertErrorLocal
                            );
                            return;
                        }
                    default:
                        {
                            __Set_AlertMsg(
                                FlatAlertBox._Kind.Error,
                                string.Format(
                                    Properties.Resources.AlertOtherError,
                                    st.ToString()
                                )
                            );
                            return;
                        }
                }
                __SetupFolder_Text(__ButtonState.Desabled);
                flatThreadSafe.Run(this, (Action)(() => __isRaisingEvents = this.fileSystemWatch.EnableRaisingEvents));
                __Set_LogMsg(string.Format(Properties.Resources.fmtStatusDropStart, __TimerDropMin));
                flatThreadSafe.Run(this, (Action)(() => __TimerDropMin = (__TimerDropMin * 60)));
                flatThreadSafe.Run(this, (Action)(() => this.timerDrop.Enabled = true));
                flatThreadSafe.Run(this, (Action)(() => this.flatButtonTimerDrop.Enabled = false));
                flatThreadSafe.Run(this, (Action)(() => this.flatButtonStartStop.Enabled = false));
                __FileWatcher_Run(false);
                o.Dispose();
            }, TaskContinuationOptions.NotOnFaulted | TaskContinuationOptions.NotOnCanceled);
            t1.ContinueWith((o) =>
            {
                __Set_LogMsg(
                    string.Format(
                        Properties.Resources.LogTaskError,
                        o.Status.ToString()
                    )
                );
                o.Dispose();
            }, TaskContinuationOptions.OnlyOnFaulted);
        }

        private void timerDrop_Tick(object sender, EventArgs e)
        {
            if (__TimerDropMin <= 0)
            {
                flatThreadSafe.Run(this, (Action)(() => this.timerDrop.Enabled = false));
                flatThreadSafe.Run(this, (Action)(() => this.flatButtonStartStop.Enabled = true));
                flatThreadSafe.Run(this, (Action)(() => this.flatButtonTimerDrop.Text = Properties.Resources.ButtonTimerDrop));
                flatThreadSafe.Run(this, (Action)(() => this.flatButtonTimerDrop.Enabled = true));
                this.flatButtonTimerDrop.Refresh();

                if (!__SetupFolder_Check())
                {
                    __SetupFolder_Text(__ButtonState.Setup);
                }
                else
                {
                    __SetupFolder_Text(
                        ((__isRaisingEvents) ? __ButtonState.Stop : __ButtonState.Start)
                    );
                    __FileWatcher_Run(__isRaisingEvents);
                }
                return;
            }
            TimeSpan t = TimeSpan.FromSeconds(__TimerDropMin);
            flatThreadSafe.Run(this, (Action)(() =>
                this.flatButtonTimerDrop.Text = string.Format("{0:D2}:{1:D2}:{2:D2}", t.Hours, t.Minutes, t.Seconds)
            ));
            this.flatButtonTimerDrop.Refresh();
            __TimerDropMin--;
        }

        #endregion

        #region NotifyIcon function

        private void flatMinimize_Click(object sender, EventArgs e)
        {
            flatThreadSafe.Run(this, (Action)(() => this.Hide()));
            flatThreadSafe.Run(this, (Action)(() => this.ShowInTaskbar = false));
            flatThreadSafe.Run(this, (Action)(() => this.NotifyMain.Visible = true));
            flatThreadSafe.Run(this, (Action)(() =>
                this.NotifyMain.Text = string.Format(
                    "{0} - {1}", this.formSkinMain.Text, DateTime.Now.ToShortTimeString()
                )
            ));
        }

        private void Manager_FormClosing(object sender, FormClosingEventArgs e)
        {
            flatThreadSafe.Run(this, (Action)(() => this.NotifyMain.Visible = false));
        }

        private void NotifyMain_Click(object sender, EventArgs e)
        {
            flatThreadSafe.Run(this, (Action)(() => this.WindowState = FormWindowState.Normal));
            flatThreadSafe.Run(this, (Action)(() => this.MaximizeBox = false));
            flatThreadSafe.Run(this, (Action)(() => this.ShowInTaskbar = true));
            flatThreadSafe.Run(this, (Action)(() => this.NotifyMain.Visible = false));
            flatThreadSafe.Run(this, (Action)(() => this.Show()));
            // this.Refresh();
        }

        #endregion

        #region Link Url launcher

        private void __LinkUrlClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            ProcessStartInfo pi;

            if (e.Link.LinkData != null)
            {
                pi = new ProcessStartInfo(e.Link.LinkData.ToString());
            }
            else
            {
                LinkLabel ll = sender as LinkLabel;
                pi = new ProcessStartInfo(ll.Text.Substring(e.Link.Start, e.Link.Length));
                ll.LinkVisited = false;
            }
            try
            {
                Process.Start(pi);
            }
            catch (Exception ex)
            {
                __Set_StatusBar(ex.Message);
            }
        }

        #endregion
    }
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<!--
  Copyright (C) FuseSource, Inc.
  http://fusesource.com

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

     http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
  -->
<assembly>
    <id>fuse-esb</id>

    <formats>
        <format>zip</format>
    </formats>

    <componentDescriptors>
        <componentDescriptor>target/shared/common-bin.xml</componentDescriptor>
        <componentDescriptor>target/shared/common-windows-bin.xml</componentDescriptor>
        <componentDescriptor>target/shared/examples-windows-bin.xml</componentDescriptor>
    </componentDescriptors>

    <files>
        <file>
            <source>${basedir}/target/classes/features.xml</source>
            <outputDirectory>system/org/apache/servicemix/${artifactId}/${version}</outputDirectory>
            <destName>${artifactId}-${version}-features.xml</destName>
            <fileMode>0644</fileMode>
            <lineEnding>dos</lineEnding>
        </file>
    </files>

</assembly>

redpajama_set_name: RedPajamaGithub


text:
<!DOCTYPE html>

    <link rel="stylesheet" href="../styles/docfx.vendor.css">
    <link rel="stylesheet" href="../styles/default.css">
    <link rel="stylesheet" href="../styles/main.css">

Class Dacs7ContentException

Inheritance

System.Object

System.Exception

Dacs7ContentException

Implements

System.Runtime.Serialization.ISerializable

Inherited Members

      System.Exception.GetBaseException()

      System.Exception.GetObjectData(System.Runtime.Serialization.SerializationInfo, System.Runtime.Serialization.StreamingContext)

      System.Exception.GetType()

      System.Exception.ToString()

      System.Exception.Data

      System.Exception.HelpLink

      System.Exception.HResult

      System.Exception.InnerException

      System.Exception.Message

      System.Exception.Source

      System.Exception.StackTrace

      System.Exception.TargetSite

      System.Exception.SerializeObjectState

      System.Object.Equals(System.Object)

      System.Object.Equals(System.Object, System.Object)

      System.Object.GetHashCode()

      System.Object.MemberwiseClone()

      System.Object.ReferenceEquals(System.Object, System.Object)

Namespace: Dacs7

Assembly: Dacs7.dll

Syntax

public class Dacs7ContentException : Exception, ISerializable

Constructors

Dacs7ContentException()

Declaration

public Dacs7ContentException()

Dacs7ContentException(Byte, Int32)

Declaration

public Dacs7ContentException(byte errorCode, int itemIndex)

Parameters

        Type
        Name
        Description

        System.Byte
        errorCode

        System.Int32
        itemIndex

Dacs7ContentException(String)

Declaration

public Dacs7ContentException(string message)

Parameters

        Type
        Name
        Description

        System.String
        message

Dacs7ContentException(String, Exception)

Declaration

public Dacs7ContentException(string message, Exception innerException)

Parameters

        Type
        Name
        Description

        System.String
        message

        System.Exception
        innerException

Properties

ErrorCode

Declaration

public ItemResponseRetValue ErrorCode { get; }

Property Value

        Type
        Description

        ItemResponseRetValue

ErrorIndex

Declaration

public int ErrorIndex { get; }

Property Value

        Type
        Description

        System.Int32

Implements

      System.Runtime.Serialization.ISerializable

Extension Methods

      Converter.SetSwap<T>(T, IFormatProvider)

      Converter.SetNoSwap<T>(T)

      Converter.ToByteArray<T>(T, Int32)


text:
export interface User {
  id: number;
  name: string;
  username: string;
  email: string;
  address: Address;
  phone: string;
  website: string;
  company: Company;
}

export interface Company {
  name: string;
  catchPhrase: string;
  bs: string;
}

export interface Address {
  street: string;
  suite: string;
  city: string;
  zipcode: string;
  geo: Geo;
}

export interface Geo {
  lat: string;
  lng: string;
}


text:
<!DOCTYPE html>

    <meta charset="UTF-8">
    <title>Neighborhood Map by Manish Bisht</title>
    <link href="css/bootstrap.min.css" rel="stylesheet">
    <link href="css/style.css" rel="stylesheet">
    <link rel="icon" type="image/png" href="images/logo.png">
    <meta name="viewport" content="width=device-width,initial-scale=1">

    <input id="search-field" class="search-field" type="text" placeholder="Filter" data-bind="textInput: query">


text:
(function() {
// 'strict mode' is invoked for this scope.

//<include src="combobutton.js"/>
//<include src="commandbutton.js"/>
//
//<include src="path_util.js"/>
//<include src="util.js"/>
//<include src="breadcrumbs_controller.js"/>
//<include src="butter_bar.js"/>
//<include src="directory_contents.js">
//<include src="directory_model.js"/>
//<include src="file_copy_manager_wrapper.js"/>
//<include src="drive_banners.js" />
//<include src="file_grid.js"/>
//<include src="file_manager.js"/>
//<include src="file_manager_pyauto.js"/>
//<include src="file_selection.js"/>
//<include src="file_table.js"/>
//<include src="file_tasks.js"/>
//<include src="file_transfer_controller.js"/>
//<include src="file_type.js"/>
//<include src="sidebar.js"/>
//<include src="volume_manager.js"/>
//<include src="media/media_util.js"/>
//<include src="metadata/metadata_cache.js"/>
//<include src="default_action_dialog.js"/>
//<include src="file_manager_commands.js"/>
// // For accurate load performance tracking place main.js should be
// // the last include to include.
//<include src="main.js"/>

// Exports
window.util = util;
window.FileCopyManagerWrapper = FileCopyManagerWrapper;

// Exports
window.util = util;

})();


text:
package com.taobao.api.internal.toplink.embedded.websocket.frame.rfc6455;

import com.taobao.api.internal.toplink.embedded.websocket.frame.FrameHeader;
import com.taobao.api.internal.toplink.embedded.websocket.frame.rfc6455.FrameBuilderRfc6455.Opcode;

/**
 * The Class PongFrame.
 *
 * @author Takahiro Hashimoto
 */
public class PongFrame extends FrameRfc6455 {

	/**
	 * Instantiates a new pong frame.
	 *
	 * @param header the header
	 * @param bodyData the contents data
	 */
	public PongFrame(FrameHeader header, byte[] bodyData) {
		super(header, bodyData);
	}

	/**
	 * Instantiates a new pong frame.
	 */
	public PongFrame(){
		FrameHeader header = FrameBuilderRfc6455.createFrameHeader(null, false, Opcode.PONG);
		setHeader(header);
	}
}


text:
package com.javarush.task.task19.task1921;

import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;

/*
Хуан Хуанович

В метод main первым параметром приходит имя файла.
В этом файле каждая строка имеет следующий вид:
имя день месяц год
где [имя] — может состоять из нескольких слов, разделенных пробелами, и имеет тип String.
[день] — int, [месяц] — int, [год] — int
данные разделены пробелами.

Заполнить список PEOPLE используя данные из файла.
Закрыть потоки.

Пример входного файла:
Иванов Иван Иванович 31 12 1987
Вася 15 5 2013

Требования:
1. Класс Solution должен содержать публичную константу PEOPLE типа List, которая должна быть сразу проинициализирована.
2. Программа НЕ должна считывать данные с консоли.
3. Программа должна считывать содержимое файла (используй FileReader).
4. Поток чтения из файла (FileReader) должен быть закрыт.
5. Программа должна заполнить список PEOPLE данными из файла.
*/

public class Solution {
    public static final List<Person> PEOPLE = new ArrayList<Person>();

    public static void main(String[] args) throws IOException{
        String fileName = args[0];

        try (BufferedReader fileReader = new BufferedReader(new FileReader(fileName))) {
            while (fileReader.ready()) {
                String line = fileReader.readLine();
                String nameStr = line.replaceAll("[\\w]", "").trim();
                String[] digitalParts = line.substring(nameStr.length()).trim().split(" ");
                int day = Integer.parseInt(digitalParts[0]);
                int month = Integer.parseInt(digitalParts[1]);
                int year = Integer.parseInt(digitalParts[2]);
                Date date = new GregorianCalendar(year, month-1, day).getTime();

                PEOPLE.add(new Person(nameStr, date));
            }
        }

        //Show me
//        for (Person p :PEOPLE)
//            System.out.println(p.getName()+" "+p.getBirthday());
    }
}


text:
import axios from 'axios';
import qs from 'qs';
require('promise.prototype.finally').shim();

axios.defaults.timeout = 10000;                        // 响应时间
axios.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded';    // 配置请求头
// axios.defaults.baseURL = 配置接口地址';            // 配置接口地址

axios.interceptors.request.use(config => {
    if (config.method === 'post') {
        config.data = qs.stringify(config.data);
    }
    return config;
}, error => Promise.reject(error));

// axios.interceptors.response.use(res => {
//     if (!res.data.success) {
//         return Promise.reject(res);
//     }
//     return res;
// }, error => Promise.reject(error));

export default axios;


text:
namespace ArgentPonyWarcraftClient;

/// <summary>
/// A reference to an item.
/// </summary>
public record ItemReferenceWithoutName
{
    /// <summary>
    /// Gets the key for the item.
    /// </summary>
    [JsonPropertyName("key")]
    public Self Key { get; init; }

    /// <summary>
    /// Gets the ID of the item.
    /// </summary>
    [JsonPropertyName("id")]
    public int Id { get; init; }
}


text:
var _ = require('lodash');
var os = require("os");
var fs = require('fs-extra');
var path = require('path');
var launch = require('open');

var portscanner = require('portscanner');

module.exports = function(directory, silent, open, callback) {
    var self = this;

    var connect = this.connect;

    if (silent !== undefined) self.log.silent(silent);
    self.log.header('ready!');

    /* This section is all thanks to forced logs by gulp-connect */
    // Replace console log
    if(silent !== 'force') console.log = console.warn = console.error = function() {
        self.log.addLog.apply(self.log, arguments)
    };
    else {
        // This will prevent gulp-connect logs for Mocha
        console.log = function() {
            if (/\[.*?\]/.exec(arguments[0])) return false;
            else console.warn.apply(null, arguments);
        };
    }
    // --------------------------------------------------------- //

    if (!directory) directory = self.directory || process.cwd();

    // Checks if .blanc file exists
    if(!fs.existsSync(path.resolve(directory, '.blanc'))) {
        self.log.error('.blanc');
        return herb.error('.blanc file does not exists! Run', herb.magenta('blanc fix or blanc init'));
    }

    try {
        self.config = JSON.parse(fs.readFileSync(path.resolve(directory, '.blanc'), 'utf8')) || self.config;
        self.dest = path.resolve(directory, self.config.dest || '');
        self.directory = directory;
    }catch(e) {
        callback('.blanc issue')
        self.log.error('.blanc');
        return herb.error('.blanc file seems to be corrupted! Run', herb.magenta('blanc fix'));
    }

    portscanner.findAPortNotInUse(8080, 9000, '127.0.0.1', function(error, port) {
        if (error) throw error;
        self.port = port;
        // Update footer
        self.setFooter();
        connect.server({
            root: [self.dest || ''],
            livereload: true,
            port: port
        });
        if(open) launch('http://localhost:'+port);
        // Callback after port is determined
        if(callback) callback(null, self.port);
    })

    self.setFooter();
    // Log time spent
    setInterval(function(){
        // Defines a minimum 5 min save time to stop the counter
        if((parseInt(self.idle) === NaN) || (parseInt(self.idle) <= 5)) {
            self.idle += 1;
            self.config.timeSpent += 1;
            self.setFooter();
            // Ignore errors
            fs.writeFile(path.resolve(self.directory, '.blanc'), JSON.stringify(self.config, null, 2), function(error) { });
        }
    }, 60000);

    self.autoOverwatch();
}


text:
package eu.hansolo.tilesfx.addons;

import eu.hansolo.tilesfx.Tile;
import eu.hansolo.tilesfx.fonts.Fonts;
import eu.hansolo.tilesfx.tools.Helper;
import javafx.beans.property.BooleanProperty;
import javafx.beans.property.BooleanPropertyBase;
import javafx.beans.property.DoubleProperty;
import javafx.beans.property.DoublePropertyBase;
import javafx.beans.property.ObjectProperty;
import javafx.beans.property.ObjectPropertyBase;
import javafx.geometry.VPos;
import javafx.scene.canvas.Canvas;
import javafx.scene.canvas.GraphicsContext;
import javafx.scene.layout.Region;
import javafx.scene.paint.Color;
import javafx.scene.shape.ArcType;
import javafx.scene.shape.StrokeLineCap;
import javafx.scene.text.Text;
import javafx.scene.text.TextAlignment;

import java.util.Locale;

public class HappinessIndicator extends Region {
    public enum Happiness {
        UNHAPPY, NEUTRAL, HAPPY;
    }

    private static final double                    PREFERRED_WIDTH  = 64;
    private static final double                    PREFERRED_HEIGHT = 64;
    private static final double                    MINIMUM_WIDTH    = 16;
    private static final double                    MINIMUM_HEIGHT   = 16;
    private static final double                    MAXIMUM_WIDTH    = 1024;
    private static final double                    MAXIMUM_HEIGHT   = 1024;
    private              double                    size;
    private              double                    width;
    private              double                    height;
    private              Text                      text;
    private              Canvas                    canvas;
    private              GraphicsContext           ctx;
    private              ObjectProperty<Happiness> happiness;
    private              DoubleProperty            value;
    private              ObjectProperty<Color>     barBackgroundColor;
    private              ObjectProperty<Color>     textColor;
    private              BooleanProperty           textVisible;
    private              ObjectProperty<Color>     happyColor;
    private              ObjectProperty<Color>     neutralColor;
    private              ObjectProperty<Color>     unhappyColor;

    // ******************** Constructors **************************************
    public HappinessIndicator() {
        this(Happiness.HAPPY, 0);
    }
    public HappinessIndicator(final Happiness HAPPINESS) {
        this(HAPPINESS, 0);
    }
    public HappinessIndicator(final Happiness HAPPINESS, final double VALUE) {
        happiness          = new ObjectPropertyBase<>(HAPPINESS) {
            @Override protected void invalidated() { redraw(); }
            @Override public Object getBean() { return HappinessIndicator.this; }
            @Override public String getName() { return "happiness"; }
        };
        value              = new DoublePropertyBase(VALUE) {
            @Override protected void invalidated() {
                double value = Helper.clamp(0, 1, get());
                set(value);
                text.setText(String.format(Locale.US, "%.0f%%", value * 100.0));
                redraw();
            }
            @Override public Object getBean() { return HappinessIndicator.this; }
            @Override public String getName() { return "value"; }
        };
        barBackgroundColor = new ObjectPropertyBase<>(Tile.BACKGROUND.brighter()) {
            @Override protected void invalidated() { redraw(); }
            @Override public Object getBean() { return HappinessIndicator.this; }
            @Override public String getName() { return "barBackgroundColor"; }
        };
        textColor          = new ObjectPropertyBase<>(Tile.FOREGROUND) {
            @Override protected void invalidated() { text.setFill(get()); }
            @Override public Object getBean() { return HappinessIndicator.this; }
            @Override public String getName() { return "textColor"; }
        };
        textVisible        = new BooleanPropertyBase(true) {
            @Override protected void invalidated() {
                Helper.enableNode(text, get());
                redraw();
            }
            @Override public Object getBean() { return HappinessIndicator.this; }
            @Override public String getName() { return "textVisible"; }
        };
        happyColor         = new ObjectPropertyBase<>(Tile.GREEN) {
            @Override protected void invalidated() { redraw(); }
            @Override public Object getBean() { return HappinessIndicator.this; }
            @Override public String getName() { return "happyColor"; }
        };
        neutralColor       = new ObjectPropertyBase<>(Tile.YELLOW_ORANGE) {
            @Override protected void invalidated() { redraw(); }
            @Override public Object getBean() { return HappinessIndicator.this; }
            @Override public String getName() { return "neutralColor"; }
        };
        unhappyColor       = new ObjectPropertyBase<>(Tile.RED) {
            @Override protected void invalidated() { redraw(); }
            @Override public Object getBean() { return HappinessIndicator.this; }
            @Override public String getName() { return "unhappyColor"; }
        };
        initGraphics();
        registerListeners();
    }

    // ******************** Initialization ************************************
    private void initGraphics() {
        if (Double.compare(getPrefWidth(), 0.0) <= 0 || Double.compare(getPrefHeight(), 0.0) <= 0 || Double.compare(getWidth(), 0.0) <= 0 ||
            Double.compare(getHeight(), 0.0) <= 0) {
            if (getPrefWidth() > 0 && getPrefHeight() > 0) {
                setPrefSize(getPrefWidth(), getPrefHeight());
            } else {
                setPrefSize(PREFERRED_WIDTH, PREFERRED_HEIGHT);
            }
        }

        canvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT);
        ctx    = canvas.getGraphicsContext2D();

        text   = new Text(String.format(Locale.US, "%.0f%%", getValue() * 100.0));
        text.setTextAlignment(TextAlignment.CENTER);
        text.setTextOrigin(VPos.TOP);
        text.setFill(getTextColor());
        Helper.enableNode(text, getTextVisible());

        getChildren().setAll(canvas, text);
    }

    private void registerListeners() {
        widthProperty().addListener(o -> resize());
        heightProperty().addListener(o -> resize());
    }

    public double getValue() { return value.get(); }
    public void setValue(final double VALUE) { value.set(VALUE); }
    public DoubleProperty valueProperty() { return value; }

    public Color getBarBackgroundColor() { return barBackgroundColor.get(); }
    public void setBarBackgroundColor(final Color COLOR) { barBackgroundColor.set(COLOR); }
    public ObjectProperty<Color> barBackgroundColorProperty() { return barBackgroundColor; }

    public Color getTextColor() { return textColor.get(); }
    public void setTextColor(final Color COLOR) { textColor.set(COLOR); }
    public ObjectProperty<Color> textColorProperty() { return textColor; }

    public boolean getTextVisible() { return textVisible.get(); }
    public void setTextVisible(final boolean VISIBLE) { textVisible.set(VISIBLE); }
    public BooleanProperty textVisibleProperty() { return textVisible; }

    public Happiness getHappiness() { return happiness.get(); }
    public void setHappiness(final Happiness HAPPINESS) { happiness.set(HAPPINESS); }
    public ObjectProperty<Happiness> happinessProperty() { return happiness; }

    public Color getHappyColor() { return happyColor.get(); }
    public void setHappyColor(final Color COLOR) { happyColor.set(COLOR); }
    public ObjectProperty<Color> happyColorProperty() { return happyColor; }

    public Color getNeutralColor() { return neutralColor.get(); }
    public void setNeutralColor(final Color COLOR) { neutralColor.set(COLOR); }
    public ObjectProperty<Color> neutralColorProperty() { return neutralColor; }

    public Color getUnhappyColor() { return unhappyColor.get(); }
    public void setUnhappyColor(final Color COLOR) { unhappyColor.set(COLOR); }
    public ObjectProperty<Color> unhappyColorProperty() { return unhappyColor; }

    // ******************** Methods *******************************************
    @Override protected double computeMinWidth(final double HEIGHT) { return MINIMUM_WIDTH; }
    @Override protected double computeMinHeight(final double WIDTH) { return MINIMUM_HEIGHT; }
    @Override protected double computePrefWidth(final double HEIGHT) { return super.computePrefWidth(HEIGHT); }
    @Override protected double computePrefHeight(final double WIDTH) { return super.computePrefHeight(WIDTH); }
    @Override protected double computeMaxWidth(final double HEIGHT) { return MAXIMUM_WIDTH; }
    @Override protected double computeMaxHeight(final double WIDTH) { return MAXIMUM_HEIGHT; }

    // ******************** Resizing ******************************************
    private void resize() {
        width  = getWidth() - getInsets().getLeft() - getInsets().getRight();
        height = getHeight() - getInsets().getTop() - getInsets().getBottom();
        size   = width < height ? width : height;

        if (width > 0 && height > 0) {
            canvas.setWidth(size);
            canvas.setHeight(size);
            canvas.relocate((getWidth() - size) * 0.5, (getHeight() - size) * 0.5);

            text.setFont(Fonts.latoBold(size * 0.25));
            text.relocate((getWidth() - text.getLayoutBounds().getWidth()) * 0.5, height * 0.5 - size * 0.54);

            redraw();
        }
    }

    private void redraw() {
        double scaling = getTextVisible() ? 0.7 : 1.0;
        double offsetY = getTextVisible() ? size * 0.15 : 0;

        double circleSize   = size * 0.9 * scaling;
        double circleOffset = (size - circleSize) / 2;

        ctx.clearRect(0, 0, width, height);
        ctx.setLineCap(StrokeLineCap.ROUND);

        ctx.setStroke(getBarBackgroundColor());
        ctx.setLineWidth(size * 0.08823529 * scaling);
        ctx.strokeOval(circleOffset, circleOffset + offsetY, circleSize, circleSize);

        Color currentColor = Color.TRANSPARENT;

        ctx.save();
        ctx.translate(offsetY, offsetY + offsetY);

        ctx.setLineWidth(size * 0.05882353 * scaling);
        switch(getHappiness()) {
            case HAPPY:
                currentColor = getHappyColor();
                ctx.setStroke(currentColor);
                ctx.beginPath();
                ctx.moveTo(size * 0.26470588 * scaling, size * 0.59411765 * scaling);
                ctx.bezierCurveTo(size * 0.26470588 * scaling, size * 0.59411765 * scaling, size * 0.33047353 * scaling,size * 0.73529412 * scaling, size * 0.5 * scaling,size * 0.73529412 * scaling );
                ctx.bezierCurveTo(size * 0.67506176 * scaling,size * 0.73529412 * scaling, size * 0.73529412 * scaling,size * 0.59411765 * scaling, size * 0.73529412 * scaling,size * 0.59411765 * scaling);
                ctx.stroke();
                break;
            case NEUTRAL:
                currentColor = getNeutralColor();
                ctx.setStroke(currentColor);
                ctx.strokeLine(size * 0.26470588 * scaling,size * 0.65294118 * scaling, size * 0.73529412 * scaling,size * 0.65294118 * scaling);
                break;
            case UNHAPPY:
                currentColor = getUnhappyColor();
                ctx.setStroke(currentColor);
                ctx.beginPath();
                ctx.moveTo(size * 0.26470588 * scaling, size * 0.70588235 * scaling);
                ctx.bezierCurveTo(size * 0.26470588 * scaling, size * 0.70588235 * scaling, size * 0.33047353 * scaling,size * 0.56803529 * scaling, size * 0.5 * scaling,size * 0.56803529 * scaling);
                ctx.bezierCurveTo(size * 0.67506176 * scaling,size * 0.56803529 * scaling, size * 0.73529412 * scaling,size * 0.70588235 * scaling, size * 0.73529412 * scaling,size * 0.70588235 * scaling);
                ctx.stroke();
                break;
        }
        ctx.setFill(currentColor);
        ctx.fillOval(size * 0.26470588 * scaling, size * 0.3 * scaling, size * 0.14705882 * scaling, size * 0.14705882 * scaling);
        ctx.fillOval(size * 0.58823529 * scaling, size * 0.3 * scaling, size * 0.14705882 * scaling, size * 0.14705882 * scaling);

        ctx.restore();

        ctx.setStroke(currentColor);
        ctx.setLineWidth(size * 0.08823529 * scaling);
        ctx.strokeArc(circleOffset, circleOffset + offsetY, circleSize, circleSize, 90, -(getValue() * 360.0), ArcType.OPEN);
    }
}


text:
let store = {};

function computeAndStore(key, block, context) {
  let value = block.call(context);
  store[key] = value;
  return value;
}

module.exports = {
  get(key, block, context) {
    return store[key] || computeAndStore(key, block, context);
  }
};


text:
using System.Collections.Generic;
using Azure.Core;

namespace Azure.Maps.Routing.Models
{
    /// <summary> Contains guidance related elements. This field is present only when guidance was requested and is available. </summary>
    public partial class RouteGuidance
    {
        /// <summary> Initializes a new instance of RouteGuidance. </summary>
        internal RouteGuidance()
        {
            Instructions = new ChangeTrackingList<RouteInstruction>();
            InstructionGroups = new ChangeTrackingList<RouteInstructionGroup>();
        }

        /// <summary> Initializes a new instance of RouteGuidance. </summary>
        /// <param name="instructions"> A list of instructions describing maneuvers. </param>
        /// <param name="instructionGroups"> Groups a sequence of instruction elements which are related to each other. </param>
        internal RouteGuidance(IReadOnlyList<RouteInstruction> instructions, IReadOnlyList<RouteInstructionGroup> instructionGroups)
        {
            Instructions = instructions;
            InstructionGroups = instructionGroups;
        }

        /// <summary> A list of instructions describing maneuvers. </summary>
        public IReadOnlyList<RouteInstruction> Instructions { get; }
        /// <summary> Groups a sequence of instruction elements which are related to each other. </summary>
        public IReadOnlyList<RouteInstructionGroup> InstructionGroups { get; }
    }
}


text:
var path          = require('path');
var fs            = require('fs');
var assert        = require('assert');
var baseTransform = require('../index');
var classVisitors = require('jstransform/visitors/es6-class-visitors').visitorList;

function transform(code, options) {
  return baseTransform(code, options, classVisitors);
}

describe('es6-module-jstransform', function() {

  beforeEach(function() {
    baseTransform.__resetModuleState();
  });

  fs.readdirSync(path.join(__dirname, 'cases')).forEach(function(p) {
    if (/\.result\.js$/.exec(p))
      return;

    p = path.join(__dirname, 'cases', p);

    it('transform ' + path.basename(p), function() {

      var code = fs.readFileSync(p, 'utf8');
      var result = fs.readFileSync(p.replace(/\.js$/, '.result.js'), 'utf8');
      assert.equal(result.trim(), transform(code).code.trim());
    });
  });
});


text:
=begin

Copyright 2012-2013 inBloom, Inc. and its affiliates.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

=end

require 'logger'

require_relative '../Shared/data_utility.rb'
require_relative '../Shared/EntityClasses/enum/ClassroomPositionType.rb'
require_relative '../Shared/EntityClasses/section.rb'
require_relative '../Shared/EntityClasses/staff_ed_org_assignment_association.rb'
require_relative '../Shared/EntityClasses/teacher.rb'
require_relative '../Shared/EntityClasses/teacher_school_association.rb'
require_relative '../Shared/EntityClasses/teacher_section_association.rb'
require_relative 'gradebook_entry_factory.rb'

# factory for creating section work orders using the specified scenario (and corresponding world)
class SectionWorkOrderFactory

  def initialize(world, scenario, prng)
    $stdout.sync = true
    @log = Logger.new($stdout)
    @log.level = Logger::INFO

    @world = world
    @scenario = scenario
    @teachers = {}
    @prng = prng
    @cp_prng = Random.new(0)
    @teacher_unique_state_id = 0
    @start_index = 1
    @gradebook_entry_factory = GradebookEntryFactory.new(@scenario)
  end

  # uses the instantiated @world to generate sections (and corresponding teachers) for the specified education organization
  # -> expected behaviour: teachers will NOT come into existence until sections, populated with students, are available for them to teach.
  #    for small scenarios (less than 500 students), it is possible that pre-requisite teachers will not come into existence until later years
  def generate_sections_with_teachers(ed_org, ed_org_type, yielder = [])
    school_id    = DataUtility.get_school_id(ed_org['id'], ed_org_type.to_sym)
    ed_org_index = @world[ed_org_type].index(ed_org) if @world[ed_org_type].nil? == false and @world[ed_org_type].size > 0

    class_periods = @world[ed_org_type][ed_org_index]["class_periods"]

    @teachers[school_id] = [] if @teachers[school_id].nil?
    @world[ed_org_type][ed_org_index]['sections'] = {}
    ed_org_assigned = {}
    unless ed_org['students'].nil?
      ed_org['students'].each{|year, student_map|
        @world[ed_org_type][ed_org_index]['sections'][year] = {}
        unless ed_org['offerings'].nil?
          student_map.each{|grade, num|
            @world[ed_org_type][ed_org_index]['sections'][year][grade] = {}

            teachers_for_this_grade = ed_org['teachers'].select { |teacher| teacher['grades'].include? grade }
            if !teachers_for_this_grade.nil? and teachers_for_this_grade.size > 0
              teachers_for_this_grade.each do |teacher|
                teacher['num_sections'] = sections_for_this_teacher(ed_org_type)
                ed_org_assigned[teacher['id']] = false
              end
            end

            # take sections_from_edorg output and add teachers to sections
            # -> num_sections for each teacher is reset for each new year
            sections_with_teachers = add_teachers_to_sections(sections_from_edorg(ed_org, ed_org_type, year, grade), teachers_for_this_grade, ed_org_type)

            sections_with_teachers.each{ |offering, sections|
              @world[ed_org_type][ed_org_index]['sections'][year][grade][offering['id']] = []
              session = find_matching_session_for_school(school_id, offering, year)

              interval = session['interval']
              begin_date = interval.get_begin_date unless interval.nil?
              end_date   = interval.get_end_date unless interval.nil?
              sections.each{ |section|
                teacher_id = 0
                isFirstTeacherForSection = true
                section[:section_teachers].each { |section_teacher|
                  if teacher_does_not_exist_yet(section_teacher['id'])
                    year_of = Date.today.year - DataUtility.select_random_from_options(@prng, (25..65).to_a)
                    # keep :name => nil in work order --> Teacher entity class will lazily create name for teacher if its nil
                    yielder << {:type=>Teacher, :id=>section_teacher['id'], :year=>year_of, :name=>section_teacher['name']}
                  end
                  teacher_id = section_teacher['id']

                  # add staff -> education organization assignment association for current session (where teacher is associated to school)
                  # -> this will eventually allow us to migrate teachers (even pre-requisite teachers) across education organizations as part of
                  #    the current simulation
                  unless ed_org_assigned[teacher_id]
                    ed_org_associations = create_staff_ed_org_association_for_teacher(session, teacher_id, school_id, ed_org_type)
                    ed_org_associations.each { |order| yielder << order }
                    ed_org_assigned[teacher_id] = true
                  end

                  if !@teachers[school_id].include?(teacher_id)
                    @teachers[school_id] << teacher_id
                    yielder << {:type=>TeacherSchoolAssociation,
                      :id=>teacher_id,
                      :school=>school_id,
                      :assignment=>:REGULAR_EDUCATION,
                      :grades=>[grade],
                      :subjects=>section_teacher['subjects']
                    }

                    # add staff -> program associations (currently very random)
                    # future implementations should be based off of a program catalog, OR more intelligence in reacting to students during simulation
                    program_associations = create_staff_program_associations_for_teacher(session, teacher_id, ed_org["programs"])
                    program_associations.each { |order| yielder << order }
                  end

                  # A section can have multiple teachers, assign the first teacher to the section
                  if isFirstTeacherForSection
                    yielder << {:type=>TeacherSectionAssociation, :teacher=>teacher_id, :section=>section[:id], :school=>school_id, :position=>:TEACHER_OF_RECORD, :start_date=>begin_date, :end_date=>end_date}
                    isFirstTeacherForSection = false
                  end
                }

                # generate gradebook entries here
                # -> need session for interval (start date and end date of session)
                # use section[:id] and offering['ed_org_id'] for section
                # use offering['grade'] for current grade
                gradebook_entries = @gradebook_entry_factory.generate_entries(@prng, grade, session,
                  {:ed_org_id => offering['ed_org_id'], :unique_section_code => DataUtility.get_unique_section_id(section[:id])})

                # use unique section ids that map to each course offering --> stored in the @world
                # -> determine number of gradebook entries here, and store with section :id
                @world[ed_org_type][ed_org_index]['sections'][year][grade][offering['id']] << { :id => section[:id], :gbe => get_gradebook_entry_breakdown(grade, gradebook_entries) }

                gradebook_entries.each { |entry| yielder << entry }

                period_idx = @cp_prng.rand(class_periods.length)
                class_period_name = class_periods[period_idx][:name]

                yielder << {:type=>Section, :id=>section[:id], :edOrg=>school_id, :offering=>offering, :class_period_name => class_period_name}
                unless session.nil?
                  dates = session['interval']
                else
                  dates = DateInterval.new(Date.new, Date.new + 180, 180)
                end
                (@scenario['INCIDENTS_PER_SECTION'] or 0).times {|i|
                  yielder << DisciplineIncident.new(i, section[:id], school_id, teacher_id, dates, "Classroom")
                }
              }
            }
          }
        end
      }
    end
  end

  # gets the breakdown of gradebook entries created (performs lookup into @scenario for specified grade)
  def get_gradebook_entry_breakdown(grade, entries)
    breakdown = {}
    @scenario['GRADEBOOK_ENTRIES_BY_GRADE'][GradeLevelType.to_string(grade)].each do |type, guidelines|
      current_type = entries.select { |entry| entry[:gbe_type] == type }
      breakdown[type] = current_type.size
    end
    breakdown
  end

  # returns true if the teacher does NOT exist (and needs to be created), and false otherwise (teacher already exists)
  # -> used for determining whether or not to create a Teacher ed-fi entity for the incoming teacher
  # -> will check every school in the world to see if teacher exists anywhere
  def teacher_does_not_exist_yet(teacher_id)
    needs_to_be_created = true
    if !@teachers.nil? and @teachers.size > 0
      @teachers.each do |school, current_teachers|
        if current_teachers.include?(teacher_id)
          needs_to_be_created = false
          break
        end
      end
    end
    needs_to_be_created
  end

  def sections(id, type, year, grade)
    if (@world.nil? == false && @world[type].nil? == false)
      ed_org = @world[type].find{ |s| s['id'] == id }
      return ed_org['sections'][year][grade] unless ed_org.nil? or ed_org['sections'].nil? or ed_org['sections'][year].nil?
    end
    return nil
  end

  def sections_from_edorg(ed_org, ed_org_type, year, grade)
    section_map = {}
    if (ed_org['offerings'].nil? == false && ed_org['offerings'][year].nil? == false)
      offerings = ed_org['offerings'][year].select{|c| c['grade'] == grade}
      offerings.each{ |course|
        sections_range      = find_sections(ed_org, ed_org_type, year, grade, course, @start_index)
        @start_index        += sections_range.to_a.size
        section_map[course] = sections_range
      }
    end
    section_map
  end

  # take sections (map entries: {course offering --> range of sections}) and unroll range of sections to be an array
  # with elements that are {section=>section_id, teacher=>teacher_id}
  # -> teachers represents pre-requisite teachers that must have sections created first
  # -> grades that don't have pre-requisite teachers will create new of teachers
  # -> future implementations will update @world with newly created teachers
  def add_teachers_to_sections(sections, teachers, type)
    sections_with_teachers     = {}
    sections.each { |offering, section_range|
      # skip this offering if the section range is nil
      next if section_range.nil?

      sections_for_this_offering  = []

      section_range.each do |section|

        section_teachers = []
        teachers_per_section = DataUtility.rand_float_to_int(@prng, @scenario['TEACHERS_PER_SECTION'] || 1)
        for t in 1..teachers_per_section
          teacher = teachers.shift
          if teacher.nil?
            # need to create teacher
            # use course offering to create teacher school association
            @teacher_unique_state_id += 1
            ed_org_id                = offering['ed_org_id']
            teacher                  = create_teacher(type, DataUtility.get_teacher_unique_state_id(@teacher_unique_state_id), offering['grade'])
            added_teacher            = push_new_teacher_into_world(teacher, ed_org_id, type)
            @log.warn "Failed to push teacher with id: #{teacher['id']} into world" if !added_teacher
          end
          section_teachers << teacher
        end

        # decrement the number of sections available to the current teacher and push them back onto the @world
        # -> this operation will push the teacher onto the end of the 'teachers' queue for the given education organization,
        #    so sections will be spread evenly across teachers
        sections_for_this_offering << {:id=>section, :section_teachers=>section_teachers}
        if !teacher['num_sections'].nil?
          teacher['num_sections'] = teacher['num_sections'] - 1
          teachers << teacher if teacher['num_sections'] > 0
        end
      end
      sections_with_teachers[offering] = sections_for_this_offering
    }
    sections_with_teachers
  end

  private

  # performs the work of pushing the teacher onto the corresponding education organization (of specified 'type')
  # by iterating through @world[type] (such as @world["elementary"] --> all elementary schools) to match the specified
  # education organization id
  # -> returns true if the education organization was found (and teacher was pushed onto education organization)
  # -> returns false if the education organization was not found (teacher was not pushed)
  def push_new_teacher_into_world(teacher, ed_org_id, type)
    pushed_teacher = false
    return pushed_teacher if @world[type].nil?
    @world[type].each_index do |ed_org_index|
      ed_org = @world[type][ed_org_index]
      ed_org_str = DataUtility.get_school_id(ed_org['id'], type)
      if DataUtility.get_school_id(ed_org['id'], type) == ed_org_id
        pushed_teacher = true
        @world[type][ed_org_index]['teachers'] << teacher
        break
      end
    end
    pushed_teacher
  end

  # finds the school with the specified education organization id
  # -> returns the sessions stored on that school in the @world
  def find_matching_session_for_school(ed_org_id, course_offering, year)
    ed_org = find_school_with_id(ed_org_id, "elementary")
    ed_org = find_school_with_id(ed_org_id, "middle") if ed_org.nil?
    ed_org = find_school_with_id(ed_org_id, "high") if ed_org.nil?

    # 'ed_org' now contains the education organization matching ed_org_id (if it was found)
    session = ed_org['sessions'].detect{|session| session['name'] == course_offering['session']['name'] && session["year"] == year}
    session

    # ed_org['sessions'].each do |session|
    #   puts "finding matching session for school #{ed_org_id} for year #{year}"
    #   next if session["year"] != year
    #   unless ed_org.nil?
    #     puts "found a session match: #{session.inspect}" if session['name'] == course_offering['session']['name']
    #     return session if session['name'] == course_offering['session']['name']
    #   end
    # end
  end

  def find_school_with_id(id, type)
    return @world[type].detect {|school| school["id"] == id} if @world[type].nil? == false
    return nil
  end

  # creates staff -> education organization assignment association for the teacher at the specified school, in the specified session
  def create_staff_ed_org_association_for_teacher(session, teacher_id, ed_org_id, type)
    associations = []
    if !@scenario["HACK_NO_STAFF_EDORG_ASSOCIATIONS_EXCEPT_SEA"] && !session.nil?
      if ed_org_id.kind_of? Integer
        state_org_id = DataUtility.get_state_education_agency_id(ed_org_id) if type == "seas"
        state_org_id = DataUtility.get_local_education_agency_id(ed_org_id) if type == "leas"
        state_org_id = DataUtility.get_school_id(ed_org_id, type)
      else
        state_org_id = ed_org_id
      end

      classification = "Educator"
      title          = :TEACHER
      interval       = session["interval"]
      begin_date     = interval.get_begin_date
      end_date       = interval.get_end_date

      associations << {:type=>StaffEducationOrgAssignmentAssociation, :id=>teacher_id, :edOrg=>state_org_id,
                       :classification=>classification, :title=>title, :beginDate=>begin_date, :endDate=>end_date}
    end
    associations
  end

  # creates staff -> program association for the teacher in the specified session
  # -> randomly selects the number of programs the teacher is involved in (range is specified in scenario configuration)
  # -> assembles a subset of available programs and creates associations
  def create_staff_program_associations_for_teacher(session, teacher_id, programs)
    associations = []
    if !session.nil?
      staff_program_associations_per_teacher = DataUtility.rand_float_to_int(@prng, (@scenario["HACK_STAFF_PROGRAM_ASSOCIATIONS_FOR_TEACHER"] or 1))
      for a in 1..staff_program_associations_per_teacher
        min          = (@scenario["MINIMUM_NUM_PROGRAMS_PER_TEACHER"] or 1)
        max          = (@scenario["MAXIMUM_NUM_PROGRAMS_PER_TEACHER"] or 5)
        interval     = session["interval"]
        begin_date   = interval.get_begin_date
        end_date     = interval.get_end_date
        num_programs = DataUtility.select_random_from_options(@prng, (min..max).to_a)
        my_programs  = DataUtility.select_num_from_options(@prng, num_programs, programs)
        my_programs.each do |program|
          access = DataUtility.select_random_from_options(@prng, [true, false])
          program_id = DataUtility.get_program_id(program[:id])
          associations << {:type=>StaffProgramAssociation, :staff=>teacher_id, :program=>program_id, :access=>access, :begin_date=>begin_date, :end_date=>end_date}
        end
      end
    end
    associations
  end

  def find_sections(ed_org, ed_org_type, year, grade, course, start_index = 1)
    student_count = ed_org['students'][year][grade]
    section_count = (student_count.to_f / students_per_section(ed_org_type)).ceil
    return nil if section_count < 1
    start_index..(start_index + section_count - 1)
  end

  # creates a teacher specific to education organization of specified 'type' (elementary, middle, or high school)
  # -> type is used to determine academic subjects
  # -> id is used to create a teacher unique state id
  # -> grade is used to assign the teacher at the specified grade
  def create_teacher(type, id, grade)
    subjects = DataUtility.get_random_academic_subjects_for_type(@prng, type)
    # name is intentionally left nil here
    # -> signal for Teacher.new (when invoked via teacher work order) to randomly create name for this teacher
    {"id"=>id, "name"=>nil, "grades"=>[grade], "subjects"=>subjects, "num_sections"=>sections_for_this_teacher(type)}
  end

  def students_per_section(type)
    @scenario['STUDENTS_PER_SECTION'][type]
  end

  # return the maximum number of sections available for a teacher in the given type of school
  # -> eventually pass this into random number generator
  def sections_for_this_teacher(type)
    DataUtility.select_random_from_options(@prng, (1..@scenario['MAX_SECTIONS_PER_TEACHER'][type]).to_a)
  end

end


text:
ACCEPTED

#### According to
The Catalogue of Life, 3rd January 2011

#### Published in
Decades Mycologicae Italicae 1-3(nos 1-30): 16 (1879)

#### Original name
Nectria urceolus Speg., 1879

### Remarks
null


text:
default_target: all
.PHONY : default_target

# Allow only one "make -f Makefile2" at a time, but pass parallelism.
.NOTPARALLEL:
.PHONY : .NOTPARALLEL

#=============================================================================
# Special targets provided by cmake.

# Disable implicit rules so canonical targets will work.
.SUFFIXES:

# Remove some rules from gmake that .SUFFIXES does not remove.
SUFFIXES =

.SUFFIXES: .hpux_make_needs_suffix_list

# Suppress display of executed commands.
$(VERBOSE).SILENT:

# A target that is always out of date.
cmake_force:
.PHONY : cmake_force

#=============================================================================
# Set environment variables for the build.

# The shell in which to execute make rules.
SHELL = /bin/sh

# The CMake executable.
CMAKE_COMMAND = /opt/cmake-3.0.2-Linux-i386/bin/cmake

# The command to remove a file.
RM = /opt/cmake-3.0.2-Linux-i386/bin/cmake -E remove -f

# Escaping for special characters.
EQUALS = =

# The top-level source directory on which CMake was run.
CMAKE_SOURCE_DIR = /home/trezitorul/gitProjects/Pull-Tester

# The top-level build directory on which CMake was run.
CMAKE_BINARY_DIR = /home/trezitorul/gitProjects/Pull-Tester

#=============================================================================
# Targets provided globally by CMake.

# Special rule for the target edit_cache
edit_cache:
	@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake cache editor..."
	/opt/cmake-3.0.2-Linux-i386/bin/ccmake -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR)
.PHONY : edit_cache

# Special rule for the target edit_cache
edit_cache/fast: edit_cache
.PHONY : edit_cache/fast

# Special rule for the target rebuild_cache
rebuild_cache:
	@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake to regenerate build system..."
	/opt/cmake-3.0.2-Linux-i386/bin/cmake -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR)
.PHONY : rebuild_cache

# Special rule for the target rebuild_cache
rebuild_cache/fast: rebuild_cache
.PHONY : rebuild_cache/fast

# The main all target
all: cmake_check_build_system
	$(CMAKE_COMMAND) -E cmake_progress_start /home/trezitorul/gitProjects/Pull-Tester/CMakeFiles /home/trezitorul/gitProjects/Pull-Tester/CMakeFiles/progress.marks
	$(MAKE) -f CMakeFiles/Makefile2 all
	$(CMAKE_COMMAND) -E cmake_progress_start /home/trezitorul/gitProjects/Pull-Tester/CMakeFiles 0
.PHONY : all

# The main clean target
clean:
	$(MAKE) -f CMakeFiles/Makefile2 clean
.PHONY : clean

# The main clean target
clean/fast: clean
.PHONY : clean/fast

# Prepare targets for installation.
preinstall: all
	$(MAKE) -f CMakeFiles/Makefile2 preinstall
.PHONY : preinstall

# Prepare targets for installation.
preinstall/fast:
	$(MAKE) -f CMakeFiles/Makefile2 preinstall
.PHONY : preinstall/fast

# clear depends
depend:
	$(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 1
.PHONY : depend

#=============================================================================
# Target rules for targets named PullTester

# Build rule for target.
PullTester: cmake_check_build_system
	$(MAKE) -f CMakeFiles/Makefile2 PullTester
.PHONY : PullTester

# fast build rule for target.
PullTester/fast:
	$(MAKE) -f CMakeFiles/PullTester.dir/build.make CMakeFiles/PullTester.dir/build
.PHONY : PullTester/fast

#=============================================================================
# Target rules for targets named debug

# Build rule for target.
debug: cmake_check_build_system
	$(MAKE) -f CMakeFiles/Makefile2 debug
.PHONY : debug

# fast build rule for target.
debug/fast:
	$(MAKE) -f CMakeFiles/debug.dir/build.make CMakeFiles/debug.dir/build
.PHONY : debug/fast

#=============================================================================
# Target rules for targets named run

# Build rule for target.
run: cmake_check_build_system
	$(MAKE) -f CMakeFiles/Makefile2 run
.PHONY : run

# fast build rule for target.
run/fast:
	$(MAKE) -f CMakeFiles/run.dir/build.make CMakeFiles/run.dir/build
.PHONY : run/fast

PullTester.obj: PullTester.cpp.obj
.PHONY : PullTester.obj

# target to build an object file
PullTester.cpp.obj:
	$(MAKE) -f CMakeFiles/PullTester.dir/build.make CMakeFiles/PullTester.dir/PullTester.cpp.obj
.PHONY : PullTester.cpp.obj

PullTester.i: PullTester.cpp.i
.PHONY : PullTester.i

# target to preprocess a source file
PullTester.cpp.i:
	$(MAKE) -f CMakeFiles/PullTester.dir/build.make CMakeFiles/PullTester.dir/PullTester.cpp.i
.PHONY : PullTester.cpp.i

PullTester.s: PullTester.cpp.s
.PHONY : PullTester.s

# target to generate assembly for a file
PullTester.cpp.s:
	$(MAKE) -f CMakeFiles/PullTester.dir/build.make CMakeFiles/PullTester.dir/PullTester.cpp.s
.PHONY : PullTester.cpp.s

# Help Target
help:
	@echo "The following are some of the valid targets for this Makefile:"
	@echo "... all (the default if no target is provided)"
	@echo "... clean"
	@echo "... depend"
	@echo "... PullTester"
	@echo "... debug"
	@echo "... edit_cache"
	@echo "... rebuild_cache"
	@echo "... run"
	@echo "... PullTester.obj"
	@echo "... PullTester.i"
	@echo "... PullTester.s"
.PHONY : help

#=============================================================================
# Special targets to cleanup operation of make.

# Special rule to run CMake to check the build system integrity.
# No rule that depends on this can have commands that come from listfiles
# because they might be regenerated.
cmake_check_build_system:
	$(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 0
.PHONY : cmake_check_build_system


text:
{
  const path = this.path;
  const prefix = `/${path.split("/")[1]}`;
  return !new RegExp(config.get("routerPrefix.api")).test(prefix)
    ? true
    : _.some(
        config.get("publicAPIs").map(o => pathToRegexp(o).test(this.path)),
        Boolean
      );
}


text:
<form (ngSubmit)="saveSchema()">

{{ 'schemas.rules.title' | sqxTranslate }}

                    {{ 'schemas.rules.empty' | sqxTranslate }}

                        <sqx-control-errors for="action"></sqx-control-errors>

                        <select class="form-select" formControlName="action">
                            <option *ngFor="let fieldAction of fieldActions" [ngValue]="fieldAction">{{fieldAction}}</option>
                        </select>

                        <sqx-control-errors for="field"></sqx-control-errors>

                        <select class="form-select" formControlName="field">
                            <option *ngFor="let field of fieldNames" [ngValue]="field">{{field}}</option>
                        </select>

{{ 'schemas.rules.when' | sqxTranslate }}

                        <sqx-control-errors for="condition"></sqx-control-errors>

                        <input type="text" class="form-control" formControlName="condition" placeholder="{{ 'schemas.rules.condition' | sqxTranslate }}">

                        <button type="button" class="btn btn-text-danger" [disabled]="!isEditable"
                            (sqxConfirmClick)="editForm.remove(i)"
                            confirmTitle="i18n:schemas.deleteRuleConfirmTitle"
                            confirmText="i18n:schemas.deleteRuleConfirmText"
                            confirmRememberKey="deleteFieldRule">

                        </button>

{{ 'schemas.rules.action' | sqxTranslate }}

{{ 'common.field' | sqxTranslate }}

{{ 'schemas.rules.when' | sqxTranslate }}

{{ 'schemas.rules.condition' | sqxTranslate }}

                        <button type="button" class="btn btn-success" (click)="add()">

                        </button>

            <button type="submit" class="float-end btn btn-primary">
                {{ 'common.save' | sqxTranslate }}
            </button>

</form>


text:
import { moduleForComponent, test } from 'ember-qunit';
import hbs from 'htmlbars-inline-precompile';

moduleForComponent('flip-clock', 'Integration | Component | flip clock', {
  integration: true
});

test('it renders', function(assert) {
  // Set any properties with this.set('myProperty', 'value');
  // Handle any actions with this.on('myAction', function(val) { ... });

  this.render(hbs`{{flip-clock}}`);

  assert.equal(this.$().text().trim(), '');

  // Template block usage:
  this.render(hbs`
    {{#flip-clock}}
      template block text
    {{/flip-clock}}
  `);

  assert.equal(this.$().text().trim(), 'template block text');
});


text:
#ifndef _WMX_SDK_SUP_CTRL_H
#define _WMX_SDK_SUP_CTRL_H

#include "CommonServices.h"		// @@@ : JSS : Replaced with correct file name
#include "WrappersCommon.h"

/// <summary>
/// This API initializes the Supplicant wrapper.
///
/// A call to this API should be preceded with a successful call to the iWmxSDK DLL's wmxSDK_Init() API.
/// This API should be called only once for all threads of a user application.
/// If the user wishes to "reset" the wrapper he should call the wmxSup_Finalize() API before calling wmxSup_Init() again.
/// </summary>
///
/// <returns>A wmx_Status_t value indicating the API call's success/error.</returns>
wmx_Status_t WMX_WRAPPER_API WMX_EXT_CALL_CONV wmxSup_Init();

/// <summary>
/// This API finalizes the Supplicant wrapper.
///
/// If the user wishes to finish working with the iWmxSDK DLL altogether, then a call to this API
/// should be followed with a call to the iWmxSDK DLL's wmxSDK_Finalize() API.
/// </summary>
void WMX_WRAPPER_API WMX_EXT_CALL_CONV wmxSup_Finalize();

#endif // _WMX_SDK_SUP_CTRL_H


text:
<?php
function uses_weakref() {
    $wr = WeakReference::create(new stdClass());
    try {
        $wr->disallow = "writes";
    } catch (Error $ex) {
        var_dump($ex->getMessage());
    }
    echo strlen($wr->get());  // should warn that this is an object
    echo strlen($wr->missingMethod());  // should warn
    // Phan should warn about wrong argument for create
    var_export(WeakReference::create(2));
    // Phan should warn about trying to construct WeakReference with a param
    $wrInvalid = new WeakReference(new stdClass());
}
uses_weakref();


text:
<?php

/**
 * Provides core functionality for Swift generated events for plugins
 * @package Swift_Events
 * @author Chris Corbyn <chris@w3style.co.uk>
 */
class Swift_Events /*abstract*/
{
  /**
   * An instance of Swift
   * @var Swift
   */
  var $swift = null;

  /**
   * Provide a reference to te currently running Swift this event was generated from
   * @param Swift
   */
  function setSwift(&$swift)
  {
    $this->swift =& $swift;
  }
  /**
   * Get the current instance of swift
   * @return Swift
   */
  function &getSwift()
  {
    return $this->swift;
  }
}


text:
'use strict';

// MODULES //

var setReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' );
var sdsapxsumpw = require( './sdsapxsumpw.native.js' );
var ndarray = require( './ndarray.native.js' );

// MAIN //

setReadOnly( sdsapxsumpw, 'ndarray', ndarray );

// EXPORTS //

module.exports = sdsapxsumpw;