Example #1
0
        public Step5(Global g)
        {
            this.Opacity = 0.0f;
            this.g = g;
             //   this.BackgroundImage = g.getTheme("bg");
            InitializeComponent();
            initTheme();

            System.Timers.Timer aTimer = new System.Timers.Timer();
            aTimer.Elapsed += new ElapsedEventHandler(OnTimedEvent);
            aTimer.Interval = 500;
            aTimer.Enabled = true;

            DateTime t1 = DateTime.Now;
            string H = t1.Hour.ToString();
            if (H.Length == 1) H = "0" + H;

            string M = t1.Minute.ToString();
            if (M.Length == 1) M = "0" + M;

            if (t1.Second % 2 == 0)
                SetTime(H + ":" + M);
            else
                SetTime(H + " " + M);

            this.textBox1.Text = g.user_id;
            g.printUser();
            g.saveUser();

            g.playVoice("16");
        }
Example #2
0
        public StepWeb(Global g,string url)
        {
            this.url = url;
            _inactiveTimeRetriever = new InactiveTimeRetriever();

            this.Opacity = 0.0f;
            this.g = g;
            InitializeComponent();

            webBrowser1.Navigate(url);

            initTheme();

            System.Timers.Timer aTimer = new System.Timers.Timer();
            aTimer.Elapsed += new ElapsedEventHandler(OnTimedEvent);
            aTimer.Interval = 500;
            aTimer.Enabled = true;
            DateTime t1 = DateTime.Now;
            string H = t1.Hour.ToString();
            if (H.Length == 1) H = "0" + H;

            string M = t1.Minute.ToString();
            if (M.Length == 1) M = "0" + M;

            if (t1.Second % 2 == 0)
                SetTime(H + ":" + M);
            else
                SetTime(H + " " + M);

            noFocus.Select();

            this.Update();
        }
Example #3
0
 // Use this for initialization
 void Start()
 {
     if (instance == null)
         instance = this;
     else
         DestroyObject (this);
 }
Example #4
0
 public Form1()
 {
     InitializeComponent();
     this.g = new Global();
     msgWindow = new MyMessageWindow(g);
     loadU();
 }
Example #5
0
 public Node(int id, NodeType type)
 {
     this.Id = id;
     this.type = type;
     this.packetSeq = 0;
     this.global = Global.getInstance();
 }
Example #6
0
 // Use this for initialization
 void Start()
 {
     GameObject g = GameObject.Find ("GlobalObject");
     globalObj = g.GetComponent< Global >();
     //lastScore = 0;
     scoreText = gameObject.GetComponent<GUIText>();
 }
Example #7
0
        public GlobalClass(Global parent, XmlNode xml, XmlNamespaceManager nsm)
            : this(parent)
        {
            if (xml == null)
                throw new ArgumentNullException();
            if (nsm == null)
                throw new ArgumentNullException();

            XmlAttribute attr = xml.SelectSingleNode("@superclass", nsm) as XmlAttribute;
            if (attr != null)
                this.Superclass = attr.Value;
            attr = xml.SelectSingleNode("@instaneState", nsm) as XmlAttribute;
            if (attr != null)
            {
                if (attr.Value == "byte")
                    this.InstanceState = InstanceStateEnum.Byte;
                else if (attr.Value == "object")
                    this.InstanceState = InstanceStateEnum.Object;
                else
                    this.InstanceState = InstanceStateEnum.None;
            }

            foreach (XmlAttribute node in xml.SelectNodes("sd:InstanceVariable/@name", nsm))
                this.InstanceVariables.Add(node.Value);
            foreach (XmlAttribute node in xml.SelectNodes("sd:ClassVariable/@name", nsm))
                this.ClassVariables.Add(node.Value);
            foreach (XmlAttribute node in xml.SelectNodes("sd:ClassInstanceVariable/@name", nsm))
                this.ClassInstanceVariables.Add(node.Value);
            foreach (XmlAttribute node in xml.SelectNodes("sd:ImportedPool/@name", nsm))
                this.ImportedPools.Add(node.Value);
        }
 public LogicalPathReader(int id, int org)
     : base(id, org)
 {
     this.global = Global.getInstance();
     this.reversePathCache = new Dictionary<string, ReversePath>();
     Event.AddEvent(new Event(scheduler.currentTime, EventType.CHK_REV_PATH_CACHE, this, null));
 }
Example #9
0
        public void findWays(List<miniWayList> mwl,Global g)
        {
            fintRoutes.Clear();
            citys.Clear();

            foreach (miniWayList ww in mwl)
            {
                if (barcodes.Contains(ww.barcode))
                {
                    foreach (string str in ww.citys)
                        citys.Add(str);
                }
            }

            foreach (Route rr in g.dataRoutes)
            {
                bool trigger = true;
                foreach (string str in citys)
                {
                    if (!rr.dataAllCitys.Contains(str))
                    {
                        trigger = false;
                    }
                }
                if (trigger)
                {
                    this.fintRoutes.Add(rr);
                }
            }
        }
 protected void Application_Start(object sender, EventArgs e)
 {
     GlobalConfiguration.Configure(WebApiConfig.Register);
     Instance = this;
     Tracer.Create("EVServices");
     Tracer.Debug("Application_Start.");
 }
Example #11
0
		public void SetUIFromSettings(Global.RefreshMode mode)
		{
			chkIdentity.Checked = Global.DBSetting.IdentityInsert;
			chkDelete.Checked = Global.DBSetting.DeleteBeforeInsert;
			this.chkScriptToFile.Checked = Global.DBSetting.ScriptToFile;
			this.txtFile.Text = Global.DBSetting.FileNameResult;
		}
Example #12
0
        /// <summary>
        /// Loads the changes from the given stream and applies them to the given object.
        /// </summary>
        public void Load(Global Global, ref object Object, Stream Stream)
        {
            Lua.lua_State state = Global.Default.Instantiate();
            this.Push(state, Object);
            Lua.lua_setglobal(state, this.Name);

            string code;
            using (TextReader txt = new StreamReader(Stream))
            {
                code = txt.ReadToEnd();
            }

            int compileerr = Lua.luaL_loadstring(state, code);
            if (compileerr != 0)
            {
                string error = Lua.lua_tostring(state, -1).ToString();
                throw new Exception(error);
            }

            int runerr = Lua.lua_pcall(state, 0, 0, 0);
            if (runerr != 0)
            {
                string error = Lua.lua_tostring(state, -1).ToString();
                throw new Exception(error);
            }

            Lua.lua_getglobal(state, this.Name);
            Object = this.To(state, -1);
        }
Example #13
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="series"></param>
        /// <param name="episode"></param>
        /// <param name="quality"></param>
        /// <returns></returns>
        public override SearchResult FindTorrent(Series series,
                                                 Episode episode,
                                                 Global.EpisodeQuality quality)
        {
            var rssFeed = from r in _rssShows where r.Item2.ToLower() == series.Name.ToLower() select r;
            if (rssFeed.Any() == false)
            {
                // Log
                return null;
            }

            List<RssResult> rssResults = GetShowRssResults(rssFeed.First().Item1, series.Id);

            var result = from r in rssResults
                         where
                             r.SeasonNumber == episode.SeasonNumber & r.EpisodeNumber == episode.EpisodeNumber &
                             r.Quality == quality
                         select r;

            // Need a fall back option on the quality
            if (result.Any() == false)
            {
                return null;
            }

            SearchResult searchResult = new SearchResult();
            searchResult.Url = result.First().Url;
            searchResult.Quality = result.First().Quality;

            return searchResult;
        }
Example #14
0
        public void Awake()
        {
            if (Instance != null) return;

            Instance = this;
            DontDestroyOnLoad(this);

            foreach (UrlDir.UrlConfig url in GameDatabase.Instance.GetConfigs("THE_WRITE_STUFF"))
            {
                int debugLevel = 0;
                if (url.config.HasValue("debugLevel"))
                {
                    debugLevel = int.Parse(url.config.GetValue("debugLevel"));
                    if (debugLevel >= 1) Debug1 = true;
                    if (debugLevel >= 2) Debug2 = true;
                    if (debugLevel >= 3) Debug3 = true;
                    Utils.Log("Debug level {0}", debugLevel);
                }

                if (url.config.HasValue("cacheSize")) FileCacheSize = int.Parse(url.config.GetValue("cacheSize"));
            }

            WhiteBackground = new Texture2D(1, 1, TextureFormat.ARGB32, false);
            WhiteBackground.SetPixel(1, 1, Color.white);
            WhiteBackground.Apply();

            Black32 = new Color32(0, 0, 0, 255);
            White32 = new Color32(255, 255, 255, 255);
            Gray32 = new Color32(127, 127, 127, 255);

            SelectedColor = new Color(1.0f, 1.0f, 1.0f);
            NotSelectedColor = new Color(0.7f, 0.7f, 0.7f);
            BackgroundColor = new Color(0.5f, 0.5f, 0.5f);
        }
Example #15
0
        public Step3(Global g,string t )
        {
            this.Opacity = 0.0f;
            this.g = g;

            this.SelectedInput = t;
               // this.BackgroundImage = g.getTheme("bg");
            InitializeComponent();
            initTheme();

            System.Timers.Timer aTimer = new System.Timers.Timer();
            aTimer.Elapsed += new ElapsedEventHandler(OnTimedEvent);
            aTimer.Interval = 500;
            aTimer.Enabled = true;
            DateTime t1 = DateTime.Now;
            string H = t1.Hour.ToString();
            if (H.Length == 1) H = "0" + H;

            string M = t1.Minute.ToString();
            if (M.Length == 1) M = "0" + M;

            if (t1.Second % 2 == 0)
                SetTime(H + ":" + M);
            else
                SetTime(H + " " + M);

            bmp = new Bitmap(Path.Combine(Application.StartupPath + @"\img", "a.gif"));
            ImageAnimator.Animate(bmp, new EventHandler(this.OnFrameChanged));
            this.Paint += new System.Windows.Forms.PaintEventHandler(this.Step3_Paint);

            g.playVoice("10");
        }
Example #16
0
 public regPay(Global g, double sum)
 {
     this.sum = sum;
     this.g = g;
     InitializeComponent();
     UpdatePrice();
 }
Example #17
0
        public bool Move(Global.Directions direction)
        {
            Direction = direction;

              if(Moving) {
            return false;
              }

              Vector2 NewTilePosition = new Vector2();
              switch(direction) {
            case Global.Directions.Up:
              NewTilePosition = new Vector2((int)TilePosition.X, (int)TilePosition.Y - 1);
              break;
            case Global.Directions.Down:
              NewTilePosition = new Vector2((int)TilePosition.X, (int)TilePosition.Y + 1);
              break;
            case Global.Directions.Left:
              NewTilePosition = new Vector2((int)TilePosition.X - 1, (int)TilePosition.Y);
              break;
            case Global.Directions.Right:
              NewTilePosition = new Vector2((int)TilePosition.X + 1, (int)TilePosition.Y);
              break;
              }

              bool moveResult = Engine.Level.CheckMove((int)NewTilePosition.X, (int)NewTilePosition.Y);

              if(moveResult) {
            OldPosition = Position;
            TilePosition = NewTilePosition;
            TargetPosition = new Vector2(TilePosition.X * Engine.Level.TileWidth, TilePosition.Y * Engine.Level.TileHeight);
              }

              Moving = moveResult;
              return moveResult;
        }
Example #18
0
        // Called before the action in the inherited controller is executed, allowing certain members to be set
        protected override void OnActionExecuting(ActionExecutingContext ctx)
        {
            base.OnActionExecuting(ctx);

            this.db = HengeApplication.DataProvider;
            this.globals = HengeApplication.Globals;

            // If the user has logged in then add their name to the view data
            if (this.User.Identity.IsAuthenticated)
            {
                this.user					= this.db.Get<User>(x => x.Name == this.User.Identity.Name);
                this.avatar					= Session["Avatar"] as Avatar;
                if(this.avatar != null && this.avatar.User != this.user) {
                    this.avatar = null;
                }
                this.cache					= Session["Cache"] as Cache;

                this.ViewData["User"] 		= this.User.Identity.Name;
                this.ViewData["Character"]	= (this.avatar != null) ? string.Format("{0} of {1}", this.avatar.Name, this.user.Clan) : null;
            }
            else
            {
                this.user 	= null;
                this.avatar	= null;
            }
        }
Example #19
0
 public Clients(Global g)
 {
     this.g = g;
     InitializeComponent();
     SetDoubleBuffered(dataG, true);
     loadit();
 }
Example #20
0
        public regCount(Global g,itemBook it)
        {
            this.g = g;
            this.it = it;
            InitializeComponent();
            it.Compare();
            string[] buffCount =   it.count.Split('.');

            try
            {
                this.textBox1.Text = buffCount[0];
            }
            catch (Exception) { }

            if (it.mes == "1")
            {
                label5.Text = "(Весовой)";
                textBox2.Enabled = true;

                try
                {
                    this.textBox2.Text = buffCount[1];
                }
                catch (Exception) { }
            }
            else
            {
                label5.Text = "(Штучный)";
                textBox2.Enabled = false;
            }

            label4.Text = it.title;
        }
Example #21
0
        /// <summary>
        /// Constructs an animation from information about the spritesheet.
        /// </summary>
        /// <param name="engine">The game engine reference.</param>
        /// <param name="spriteSheetFilePath">The spritesheet filepath.</param>
        /// <param name="frameWidth">The width of a frame in the spritesheet.</param>
        /// <param name="frameHeight">The height of a frame in the spritesheet.</param>
        /// <param name="rows">The number of rows in the spritesheet.</param>
        /// <param name="cols">The number of columns in the spritesheet.</param>
        /// <param name="frameCount">The number of frames to play in the spritesheet.</param>
        /// <param name="framesPerSecond">The number of frames to display per second.</param>
        /// <param name="type">The type of animation (repeat, play once, etc.).</param>
        public Animation(Engine engine, string spriteSheetFilePath, int frameWidth, int frameHeight,
                         int rows, int cols, int frameCount, int framesPerSecond, Global.Animations type)
            : base(engine)
        {
            this.filePath = spriteSheetFilePath;
            this.frameWidth = frameWidth;
            this.frameHeight = frameHeight;
            this.rows = rows;
            this.columns = cols;
            this.frameCount = frameCount;
            this.framesPerSecond = framesPerSecond;
            this.type = type;

            timePerFrame = 1.0f / framesPerSecond;
            spriteOrigin = new Vector2(frameWidth / 2, frameHeight / 2);

            frames = new List<Rectangle>();

            this.Scale = 1.0f;
            this.Speed = 1.0f;
            SpriteEffect = SpriteEffects.None;

            // defaults to not playing
            Playing = false;

            engine.AddComponent(this);
        }
Example #22
0
 protected Server()
     : base(0)
 {
     this.global = Global.getInstance();
     this.type = NodeType.SERVER;
     this.objectLocations = new Dictionary<int, ObjectLocation>();
 }
Example #23
0
        public Form1()
        {
            XX = MousePosition.X;
            YY = MousePosition.Y;
            TT = GetTime();
            InitializeComponent();

            g = new Global();
            g.loadTheme();

            this.TIME = Convert.ToInt32(g.TT);
             //   this.TIME = Convert.ToInt32(1);
            initTheme();

              // g.playVoice("2");

            if (File.Exists(Application.StartupPath + @"\video\1.mp4"))
            {
                aTimer = new System.Timers.Timer();
                aTimer.Elapsed += new ElapsedEventHandler(OnTimedEvent2);

                aTimer.Interval = 100;
                aTimer.Enabled = true;

            }

            if ( ! g.STYLE.Equals("1"))
            {
                button1.Location = new Point(button1.Location.X, 450);

                button3.Hide();
                button4.Hide();
                button5.Hide();
            }
        }
Example #24
0
        protected override void OnStartup(StartupEventArgs e)
        {
            Global global = new Global();
            Window startupWindow = global.StartupWindow;

            startupWindow.Show();
        }
        public void should_return_all_repositories_services_and_controllers(Type type)
        {
            var kernel = new Global(Consts.TEST_APP_DATA).GetKernel();

            kernel.Get(type)
                .Should().NotBeNull();
        }
Example #26
0
    //init
    void Start() { 
        //get game objects from scene
        globalObj = GameObject.FindWithTag(TAG_GLOBAL); //global game object
        globalScript = globalObj.GetComponent<Global>(); //global script
        setupObj = GameObject.FindWithTag(TAG_SETUP); //setup game object
        connectScript = setupObj.GetComponent<Connect>(); //connect script
        activateScript = setupObj.GetComponent<Activate>(); //activate script

        //disable scripts to start
        //note: disable/uncheck scripts in the Unity interface
        connectScript.enabled = false;
        activateScript.enabled = false;

        //state manager
        //transition into scene
        //initialize since this is the first scene
        if (StateManager.Instance != null) {
            //set the transition effects for the state manager
            StateManager.Instance.gameObject.GetComponent<TransitionFade>().isFadingIn = true;
            StateManager.Instance.gameObject.GetComponent<TransitionFade>().isHoldFade = false;
        }

        //audio manager
        //initialize since this is the first scene
        if (AudioManager.Instance != null) {
            //set the transition effects for the audio manager
            //bgm
            AudioManager.Instance.switchBgmAfterDelay(AudioManager.Instance.bgmMenu, 0.0f);
            AudioManager.Instance.bgmIsFadingIn = true;
            AudioManager.Instance.bgmIsHoldFade = false;
        }

    } //end function
        public Inventory(Global g,bool preload)
        {
            this.g = g;
            InitializeComponent();

            SetDoubleBuffered(this.dataGrid1, true);

            if (g.conf7 == "1")
            {
                SetupTableStylesFull();
            }
            else
            {
                SetupTableStyles();
            }
            SetupDataTable("");

            if (preload)
            {
                this.Close(); return;
            }
            Clipboard.SetDataObject(" ");

            if (g.conf10 == "1")
            {
                this.dataGrid1.Visible = false;
                this.textBox1.Visible = false;

                this.label1.Visible = true;
                this.label2.Visible = true;
            }
        }
Example #28
0
        public Conf(Global g)
        {
            this.g = g;
            InitializeComponent();
            comboBox1.SelectedIndex = 0;

            textBox1.Text = g.conf1;

            comboBox1.SelectedIndex = Convert.ToInt32(g.conf2);

            textBox2.Text = g.conf3;
            textBox3.Text = g.conf4;

            if (g.conf5 == "1") checkBox1.Checked = true;

            if (g.conf10 == "1") checkBox3.Checked = true;

            textBox4.Text = g.conf6;

            if (g.conf7 == "1") checkBox2.Checked = true;

            textBox5.Text = g.conf8;

            textBox6.Text = g.conf9;
        }
Example #29
0
        public Step2(Global g)
        {
            this.Opacity = 0.0f;
            this.g = g;

               // this.BackgroundImage = g.getTheme("bg");
            InitializeComponent();
            initTheme();
            noFocus.Select();

            System.Timers.Timer aTimer = new System.Timers.Timer();
            aTimer.Elapsed += new ElapsedEventHandler(OnTimedEvent);
            aTimer.Interval = 500;
            aTimer.Enabled = true;
            DateTime t1 = DateTime.Now;
            string H = t1.Hour.ToString();
            if (H.Length == 1) H = "0" + H;

            string M = t1.Minute.ToString();
            if (M.Length == 1) M = "0" + M;

            if (t1.Second % 2 == 0)
                SetTime(H + ":" + M);
            else
                SetTime(H + " " + M);

            //pbs.Add("1", pictureBox1);
               // pbs.Add("2", pictureBox2);
               // pbs.Add("3", pictureBox3);
               // pbs.Add("4", pictureBox4);

            loadMENU0();

            g.playVoice("5");
        }
Example #30
0
        public MedView(Global g, string uin)
        {
            this.uin = uin;
            this.g = g;
            InitializeComponent();

            SetDoubleBuffered(this.dataGrid1, true);

            if (g.conf7 == "1")
            {
                SetupTableStylesFull();
            }
            else
            {
                SetupTableStyles();
            }
            SetupDataTable("");

            Clipboard.SetDataObject(" ");

            if (g.conf10 == "1")
            {
                this.dataGrid1.Visible = false;
                this.textBox1.Visible = false;

                this.label1.Visible = true;
                this.label2.Visible = true;
            }
        }
Example #31
0
        void DoRefresh()
        {
            this.m_lock.AcquireWriterLock(m_nLockTimeout);
            this.m_nInRefresh++;
            this.toolStripButton_refresh.Enabled = false;
            // this.EnableControls(false);
            try
            {
                string strError = "";

                stop.OnStop += new StopEventHandler(this.DoStop);
                stop.Initial("正在获取任务 '" + MonitorTaskName + "' 的最新信息 ...");
                stop.BeginLoop();

                try
                {

                    for (int i = 0; i < 10; i++)  // 最多循环获取10次
                    {
                        Application.DoEvents();
                        if (stop != null && stop.State != 0)
                        {
                            strError = "用户中断";
                            goto ERROR1;
                        }

                        BatchTaskInfo param = new BatchTaskInfo();
                        BatchTaskInfo resultInfo = null;

                        if ((this.MessageStyle & MessageStyle.Result) == 0)
                        {
                            param.MaxResultBytes = 0;
                        }
                        else
                        {
                            param.MaxResultBytes = 4096;
                            if (i >= 5)  // 如果发现尚未来得及获取的内容太多,就及时扩大“窗口”尺寸
                                param.MaxResultBytes = 100 * 1024;
                        }

                        param.ResultOffset = this.CurResultOffs;

                        stop.SetMessage("正在获取任务 '" + MonitorTaskName + "' 的最新信息 (第 " + (i + 1).ToString() + " 批 共10批)...");

                        long lRet = Channel.BatchTask(
                            stop,
                            MonitorTaskName,
                            "getinfo",
                            param,
                            out resultInfo,
                            out strError);
                        if (lRet == -1)
                            goto ERROR1;

                        Global.WriteHtml(this.webBrowser_info,
                            GetResultText(resultInfo.ResultText));
                        ScrollToEnd();

                        // DateTime now = DateTime.Now;

                        if ((this.MessageStyle & MessageStyle.Progress) != 0)
                        {
                            this.label_progress.Text = // now.ToLongTimeString() + " -- " + 
                                resultInfo.ProgressText;
                        }

                        if ((this.MessageStyle & MessageStyle.Result) == 0)
                        {
                            // 没有必要显示累积
                            break;
                        }

                        if (this.CurResultOffs == 0)
                            this.CurResultVersion = resultInfo.ResultVersion;
                        else if (this.CurResultVersion != resultInfo.ResultVersion)
                        {
                            // 说明服务器端result文件其实已经更换
                            this.CurResultOffs = 0; // rewind
                            Global.WriteHtml(this.webBrowser_info,
                                "***新内容 version=" + resultInfo.ResultVersion.ToString() + " ***\r\n");
                            ScrollToEnd();
                            goto COINTINU1;
                        }

                        if (resultInfo.ResultTotalLength < param.ResultOffset)
                        {
                            // 说明服务器端result文件其实已经更换
                            this.CurResultOffs = 0; // rewind
                            Global.WriteHtml(this.webBrowser_info,
                                "***新内容***\r\n");
                            ScrollToEnd();
                            goto COINTINU1;
                        }
                        else
                        {
                            // 存储用以下次
                            this.CurResultOffs = resultInfo.ResultOffset;
                        }

                    COINTINU1:
                        // 如果本次并没有“触底”,需要立即循环获取新的信息。但是循环有一个最大次数,以应对服务器疯狂发生信息的情形。
                        if (resultInfo.ResultOffset >= resultInfo.ResultTotalLength)
                            break;
                    }
                }
                finally
                {
                    this.toolStripButton_refresh.Enabled = true;
                    // this.EnableControls(true);
                    this.m_nInRefresh--;
                    stop.EndLoop();
                    stop.OnStop -= new StopEventHandler(this.DoStop);
                    stop.Initial("");
                }

                return;
            ERROR1:
                this.label_progress.Text = strError;
            }
            finally
            {
                this.m_lock.ReleaseWriterLock();
            }
        }
Example #32
0
        // 暂停批处理任务
        int PauseAllBatchTask(out string strError)
        {
            strError = "";

            BatchTaskStartInfo startinfo = new BatchTaskStartInfo();

            this.m_lock.AcquireWriterLock(m_nLockTimeout);
            try
            {
                EnableControls(false);

                stop.OnStop += new StopEventHandler(this.DoStop);
                stop.Initial("正在暂停全部批处理任务 ...");
                stop.BeginLoop();

                this.Update();
                Program.MainForm.Update();

                try
                {
                    BatchTaskInfo param = new BatchTaskInfo();
                    param.StartInfo = startinfo;

                    BatchTaskInfo resultInfo = null;

                    long lRet = Channel.BatchTask(
                        stop,
                        "",
                        "pause",
                        param,
                        out resultInfo,
                        out strError);
                    if (lRet == -1)
                        goto ERROR1;

                    if (resultInfo != null)
                    {
                        Global.WriteHtml(this.webBrowser_info,
                            GetResultText(resultInfo.ResultText));
                        ScrollToEnd();

                        this.label_progress.Text = resultInfo.ProgressText;
                    }
                }
                finally
                {
                    stop.EndLoop();
                    stop.OnStop -= new StopEventHandler(this.DoStop);
                    stop.Initial("");

                    EnableControls(true);
                }

                return 1;
            ERROR1:
                return -1;
            }
            finally
            {
                this.m_lock.ReleaseWriterLock();
            }
        }
Example #33
0
        // 停止批处理任务
        // parameters:
        //      strAction   "stop"或者"abort"
        int StopBatchTask(string strTaskName,
            string strAction,
            out string strError)
        {
            strError = "";

            if (string.IsNullOrEmpty(strAction))
                strAction = "stop";

            Debug.Assert(strAction == "stop" || strAction == "abort", "");

            this.m_lock.AcquireWriterLock(m_nLockTimeout);

            try
            {

                EnableControls(false);

                stop.OnStop += new StopEventHandler(this.DoStop);
                stop.Initial("正在"
                    + "停止"
                    + "任务 '" + strTaskName + "' ...");
                stop.BeginLoop();

                this.Update();
                Program.MainForm.Update();

                try
                {
                    BatchTaskInfo param = new BatchTaskInfo();
                    BatchTaskInfo resultInfo = null;

                    long lRet = Channel.BatchTask(
                        stop,
                        strTaskName,
                        strAction,  // "stop",
                        param,
                        out resultInfo,
                        out strError);
                    if (lRet == -1)
                        goto ERROR1;

                    Global.WriteHtml(this.webBrowser_info,
                        GetResultText(resultInfo.ResultText));
                    ScrollToEnd();

                    this.label_progress.Text = resultInfo.ProgressText;
                }
                finally
                {
                    stop.EndLoop();
                    stop.OnStop -= new StopEventHandler(this.DoStop);
                    stop.Initial("");

                    EnableControls(true);
                }

                return 1;
            ERROR1:
                return -1;
            }
            finally
            {
                this.m_lock.ReleaseWriterLock();
            }
        }
Example #34
0
        // 启动批处理任务
        // parameters:
        // return:
        //      -1  出错
        //      1   成功。strError 里面有提示成功的内容
        int StartBatchTask(string strTaskName,
            out string strError)
        {
            strError = "";

            BatchTaskStartInfo startinfo = new BatchTaskStartInfo();
            if (strTaskName == "日志恢复")
            {
                StartLogRecoverDlg dlg = new StartLogRecoverDlg();
                MainForm.SetControlFont(dlg, this.Font, false);
                dlg.StartInfo = startinfo;
                dlg.ShowDialog(this);
                if (dlg.DialogResult != DialogResult.OK)
                {
                    strError = "用户放弃启动";
                    return -1;
                }
            }
            else if (strTaskName == "dp2Library 同步")
            {
                StartReplicationDlg dlg = new StartReplicationDlg();
                MainForm.SetControlFont(dlg, this.Font, false);
                dlg.StartInfo = startinfo;
                dlg.ShowDialog(this);
                if (dlg.DialogResult != DialogResult.OK)
                {
                    strError = "用户放弃启动";
                    return -1;
                }
            }
            else if (strTaskName == "重建检索点")
            {
                StartRebuildKeysDlg dlg = new StartRebuildKeysDlg();
                MainForm.SetControlFont(dlg, this.Font, false);
                dlg.StartInfo = startinfo;
                dlg.ShowDialog(this);
                if (dlg.DialogResult != DialogResult.OK)
                {
                    strError = "用户放弃启动";
                    return -1;
                }
            }
            else if (strTaskName == "预约到书管理")
            {
                StartArriveMonitorDlg dlg = new StartArriveMonitorDlg();
                MainForm.SetControlFont(dlg, this.Font, false);
                dlg.StartInfo = startinfo;
                dlg.ShowDialog(this);
                if (dlg.DialogResult != DialogResult.OK)
                {
                    strError = "用户放弃启动";
                    return -1;
                }
            }
            /*
        else if (strTaskName == "跟踪DTLP数据库")
        {
            StartTraceDtlpDlg dlg = new StartTraceDtlpDlg();
        MainForm.SetControlFont(dlg, this.Font, false);
            dlg.StartInfo = startinfo;
            dlg.ShowDialog(this);
            if (dlg.DialogResult != DialogResult.OK)
            {
                strError = "用户放弃启动";
                return -1;
            }
        }
             * */
                /*
            else if (strTaskName == "正元一卡通读者信息同步")
            {
                StartZhengyuanReplicationDlg dlg = new StartZhengyuanReplicationDlg();
                MainForm.SetControlFont(dlg, this.Font, false);
                dlg.StartInfo = startinfo;
                dlg.ShowDialog(this);
                if (dlg.DialogResult != DialogResult.OK)
                {
                    strError = "用户放弃启动";
                    return -1;
                }
            }
            else if (strTaskName == "迪科远望一卡通读者信息同步")
            {
                StartDkywReplicationDlg dlg = new StartDkywReplicationDlg();
                MainForm.SetControlFont(dlg, this.Font, false);
                startinfo.Start = "!breakpoint";    // 一开始就有适当的缺省值,避免从头开始跟踪
                dlg.StartInfo = startinfo;
                dlg.ShowDialog(this);
                if (dlg.DialogResult != DialogResult.OK)
                {
                    strError = "用户放弃启动";
                    return -1;
                }
            }
                 * */
            else if (strTaskName == "读者信息同步")
            {
#if NO
                StartPatronReplicationDlg dlg = new StartPatronReplicationDlg();
                MainForm.SetControlFont(dlg, this.Font, false);
                startinfo.Start = "!breakpoint";    // 一开始就有适当的缺省值,避免从头开始跟踪
                dlg.StartInfo = startinfo;
                dlg.ShowDialog(this);
                if (dlg.DialogResult != DialogResult.OK)
                {
                    strError = "用户放弃启动";
                    return -1;
                }
#endif
                startinfo.Start = "activate";   // 表示立即启动,忽略服务器原有定时启动参数
            }
            else if (strTaskName == "超期通知")
            {
                startinfo.Start = "activate";   // 表示立即启动,忽略服务器原有定时启动参数
            }
            else if (strTaskName == "创建 MongoDB 日志库")
            {
                StartLogRecoverDlg dlg = new StartLogRecoverDlg();
                MainForm.SetControlFont(dlg, this.Font, false);
                dlg.Text = "启动 创建 MongoDB 日志库 任务";
                dlg.TaskName = "创建 MongoDB 日志库";
                dlg.StartInfo = startinfo;
                dlg.ShowDialog(this);
                if (dlg.DialogResult != DialogResult.OK)
                {
                    strError = "用户放弃启动";
                    return -1;
                }
            }
            else if (strTaskName == "服务器同步")
            {
                StartServerReplicationDlg dlg = new StartServerReplicationDlg();
                MainForm.SetControlFont(dlg, this.Font, false);
                dlg.Text = "启动 服务器同步 任务";
                dlg.TaskName = "服务器同步";
                dlg.StartInfo = startinfo;
                dlg.ShowDialog(this);
                if (dlg.DialogResult != DialogResult.OK)
                {
                    strError = "用户放弃启动";
                    return -1;
                }
            }
            else if (strTaskName == "大备份")
            {
                if (StringUtil.CompareVersion(Program.MainForm.ServerVersion, "2.117") < 0)
                {
                    strError = "dp2library 应在 2.117 版以上才能使用“大备份”任务相关的功能";
                    return -1;
                }

                StartBackupDialog dlg = new StartBackupDialog();
                MainForm.SetControlFont(dlg, this.Font, false);
                dlg.StartInfo = startinfo;
                dlg.ShowDialog(this);
                if (dlg.DialogResult == System.Windows.Forms.DialogResult.Abort)
                {
                    if (StopBatchTask(strTaskName,
            "abort",
            out strError) == -1)
                        return -1;
                    strError = "任务 '" + strTaskName + "' 已被撤销";
                    return 1;
                }
                if (dlg.DialogResult != DialogResult.OK)
                {
                    strError = "用户放弃启动";
                    return -1;
                }

                // 2017/9/30
                if (dlg.DownloadFiles)
                {
                    if (StringUtil.IsInList("download", MainForm._currentUserRights) == false)
                    {
                        strError = "启动“大备份”任务被拒绝。当前用户并不具备 download 权限,所以无法在大备份同时下载文件。请先为当前用户添加这个权限,再重新启动大备份任务";
                        return -1;
                    }
                }
            }
            else if (strTaskName == "<日志备份>")
            {
                string strOutputFolder = "";

                // 备份日志文件。即,把日志文件从服务器拷贝到本地目录。要处理好增量复制的问题。
                // return:
                //      -1  出错
                //      0   放弃下载,或者没有必要下载。提示信息在 strError 中
                //      1   成功启动了下载
                int nRet = Program.MainForm.BackupOperLogFiles(ref strOutputFolder,
            out strError);
                if (nRet != 1)
                {
                    if (nRet == 0 && string.IsNullOrEmpty(strError))
                        strError = "用户放弃启动";
                    return -1;
                }
                strError = "本地任务 '<日志备份> 成功启动'";
                return 1;
            }

            this.m_lock.AcquireWriterLock(m_nLockTimeout);
            try
            {
                EnableControls(false);

                stop.OnStop += new StopEventHandler(this.DoStop);
                stop.Initial("正在"
                    + "启动"
                    + "任务 '" + strTaskName + "' ...");
                stop.BeginLoop();

                this.Update();
                Program.MainForm.Update();

                try
                {
                    BatchTaskInfo param = new BatchTaskInfo();
                    param.StartInfo = startinfo;

                    BatchTaskInfo resultInfo = null;

                    // return:
                    //      -1  出错
                    //      0   启动成功
                    //      1   调用前任务已经处于执行状态,本次调用激活了这个任务
                    long lRet = Channel.BatchTask(
                        stop,
                        strTaskName,
                        "start",
                        param,
                        out resultInfo,
                        out strError);
                    if (lRet == -1 || lRet == 1)
                        goto ERROR1;

                    if (resultInfo != null)
                    {
                        Global.WriteHtml(this.webBrowser_info,
                            GetResultText(resultInfo.ResultText));
                        ScrollToEnd();
                    }

                    this.label_progress.Text = resultInfo.ProgressText;

                    if (strTaskName == "大备份"
                        && resultInfo.StartInfo != null)
                    {
                        string strOutputFolder = "";
                        List<string> paths = StringUtil.SplitList(resultInfo.StartInfo.OutputParam);

                        StringUtil.RemoveBlank(ref paths);

                        List<dp2Circulation.MainForm.DownloadFileInfo> infos = MainForm.BuildDownloadInfoList(paths);

                        // 询问是否覆盖已有的目标下载文件。整体询问
                        // return:
                        //      -1  出错
                        //      0   放弃下载
                        //      1   同意启动下载
                        int nRet = Program.MainForm.AskOverwriteFiles(infos,    // paths,
            ref strOutputFolder,
            out bool bAppend,
            out strError);
                        if (nRet == -1)
                            return -1;
                        if (nRet == 1)
                        {
                            paths = MainForm.GetFileNames(infos, (info) =>
                            {
                                return info.ServerPath;
                            });
                            foreach (string path in paths)
                            {
                                if (string.IsNullOrEmpty(path) == false)
                                {
                                    // parameters:
                                    //      strOutputFolder 输出目录。
                                    //                      [in] 如果为 null,表示要弹出对话框询问目录。如果不为 null,则直接使用这个目录路径
                                    //                      [out] 实际使用的目录
                                    // return:
                                    //      -1  出错
                                    //      0   放弃下载
                                    //      1   成功启动了下载
                                    nRet = Program.MainForm.BeginDownloadFile(path,
                                        bAppend ? "append" : "overwrite",
                                        ref strOutputFolder,
                                        out strError);
                                    if (nRet == -1)
                                        return -1;
                                    if (nRet == 0)
                                        break;
                                }
                            }
                        }
                    }
                }
                finally
                {
                    stop.EndLoop();
                    stop.OnStop -= new StopEventHandler(this.DoStop);
                    stop.Initial("");

                    EnableControls(true);
                }

                strError = "任务 '" + strTaskName + "' 已成功启动";
                return 1;
            ERROR1:
                return -1;
            }
            finally
            {
                this.m_lock.ReleaseWriterLock();
            }
        }
Example #35
0
 void webBrowser_info_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
 {
     Global.ScrollToEnd(this.webBrowser_info);
 }
Example #36
0
 /// <summary>
 /// 保存配置文件并通知配置改变
 /// </summary>
 public void SaveAndNotifyChanged()
 {
     Global.SaveConfig();
     Application.Current.Dispatcher?.InvokeAsync(() => { ConfigChanged?.Invoke(this, new EventArgs()); });
 }
Example #37
0
 private void OnEnable()
 {
     this.AddObserver(OnValidateAttack, Global.ValidateNotification <AttackAction>());
 }
Example #38
0
        private static void ExecMarkFileAsNew(AsyncTaskData obj)
        {
            CoreContext.TenantManager.SetCurrentTenant(Convert.ToInt32(obj.TenantID));

            using (var folderDao = Global.DaoFactory.GetFolderDao())
            {
                object parentFolderId;

                if (obj.FileEntry is File)
                {
                    parentFolderId = ((File)obj.FileEntry).FolderID;
                }
                else
                {
                    parentFolderId = obj.FileEntry.ID;
                }
                var parentFolders = folderDao.GetParentFolders(parentFolderId);
                parentFolders.Reverse();

                var userIDs = obj.UserIDs;

                var userEntriesData = new Dictionary <Guid, List <FileEntry> >();

                if (obj.FileEntry.RootFolderType == FolderType.BUNCH)
                {
                    if (!userIDs.Any())
                    {
                        return;
                    }

                    parentFolders.Add(folderDao.GetFolder(Global.FolderProjects));

                    var entries = new List <FileEntry> {
                        obj.FileEntry
                    };
                    entries = entries.Concat(parentFolders).ToList();

                    userIDs.ForEach(userID =>
                    {
                        if (userEntriesData.ContainsKey(userID))
                        {
                            userEntriesData[userID].AddRange(entries);
                        }
                        else
                        {
                            userEntriesData.Add(userID, entries);
                        }

                        RemoveFromCahce(Global.FolderProjects, userID);
                    });
                }
                else
                {
                    var filesSecurity = Global.GetFilesSecurity();

                    if (!userIDs.Any())
                    {
                        userIDs = filesSecurity.WhoCanRead(obj.FileEntry).Where(x => x != obj.CurrentAccountId).ToList();
                    }
                    if (obj.FileEntry.ProviderEntry)
                    {
                        userIDs = userIDs.Where(u => !CoreContext.UserManager.GetUsers(u).IsVisitor()).ToList();
                    }

                    parentFolders.ForEach(parentFolder =>
                                          filesSecurity
                                          .WhoCanRead(parentFolder)
                                          .Where(userID => userIDs.Contains(userID) && userID != obj.CurrentAccountId)
                                          .ToList()
                                          .ForEach(userID =>
                    {
                        if (userEntriesData.ContainsKey(userID))
                        {
                            userEntriesData[userID].Add(parentFolder);
                        }
                        else
                        {
                            userEntriesData.Add(userID, new List <FileEntry> {
                                parentFolder
                            });
                        }
                    })
                                          );



                    if (obj.FileEntry.RootFolderType == FolderType.USER)
                    {
                        var folderShare = folderDao.GetFolder(Global.FolderShare);

                        foreach (var userID in userIDs)
                        {
                            var userFolderId = folderDao.GetFolderIDUser(false, userID);

                            Folder rootFolder = null;
                            if (obj.FileEntry.ProviderEntry)
                            {
                                rootFolder = obj.FileEntry.RootFolderCreator == userID
                                                 ? folderDao.GetFolder(userFolderId)
                                                 : folderShare;
                            }
                            else if (!Equals(obj.FileEntry.RootFolderId, userFolderId))
                            {
                                rootFolder = folderShare;
                            }
                            else
                            {
                                RemoveFromCahce(userFolderId, userID);
                            }

                            if (rootFolder == null)
                            {
                                continue;
                            }

                            if (userEntriesData.ContainsKey(userID))
                            {
                                userEntriesData[userID].Add(rootFolder);
                            }
                            else
                            {
                                userEntriesData.Add(userID, new List <FileEntry> {
                                    rootFolder
                                });
                            }

                            RemoveFromCahce(rootFolder.ID, userID);
                        }
                    }

                    if (obj.FileEntry.RootFolderType == FolderType.COMMON)
                    {
                        userIDs.ForEach(userID => RemoveFromCahce(Global.FolderCommon, userID));

                        if (obj.FileEntry.ProviderEntry)
                        {
                            var commonFolder = folderDao.GetFolder(Global.FolderCommon);
                            userIDs.ForEach(userID =>
                            {
                                if (userEntriesData.ContainsKey(userID))
                                {
                                    userEntriesData[userID].Add(commonFolder);
                                }
                                else
                                {
                                    userEntriesData.Add(userID, new List <FileEntry> {
                                        commonFolder
                                    });
                                }

                                RemoveFromCahce(Global.FolderCommon, userID);
                            });
                        }
                    }

                    userIDs.ForEach(userID =>
                    {
                        if (userEntriesData.ContainsKey(userID))
                        {
                            userEntriesData[userID].Add(obj.FileEntry);
                        }
                        else
                        {
                            userEntriesData.Add(userID, new List <FileEntry> {
                                obj.FileEntry
                            });
                        }
                    });
                }

                using (var tagDao = Global.DaoFactory.GetTagDao())
                {
                    var newTags    = new List <Tag>();
                    var updateTags = new List <Tag>();

                    foreach (var userID in userEntriesData.Keys)
                    {
                        if (tagDao.GetNewTags(userID, obj.FileEntry).Any())
                        {
                            continue;
                        }

                        var entries = userEntriesData[userID].Distinct().ToList();

                        var exist  = tagDao.GetNewTags(userID, entries.ToArray()).ToList();
                        var update = exist.Where(t => t.EntryType == FileEntryType.Folder).ToList();
                        update.ForEach(t => t.Count++);
                        updateTags.AddRange(update);

                        entries.ForEach(entry =>
                        {
                            if (entry != null && exist.All(tag => tag != null && !tag.EntryId.Equals(entry.ID)))
                            {
                                newTags.Add(Tag.New(userID, entry));
                            }
                        });
                    }

                    if (updateTags.Any())
                    {
                        tagDao.UpdateNewTags(updateTags.ToArray());
                    }
                    if (newTags.Any())
                    {
                        tagDao.SaveTags(newTags.ToArray());
                    }
                }
            }
        }
Example #39
0
        public static IEnumerable <FileEntry> SetTagsNew(IFolderDao folderDao, Folder parent, IEnumerable <FileEntry> entries)
        {
            using (var tagDao = Global.DaoFactory.GetTagDao())
            {
                var totalTags = tagDao.GetNewTags(SecurityContext.CurrentAccount.ID, parent, false).ToList();

                if (totalTags.Any())
                {
                    var parentFolderTag = Equals(Global.FolderShare, parent.ID)
                                              ? tagDao.GetNewTags(SecurityContext.CurrentAccount.ID, folderDao.GetFolder(Global.FolderShare)).FirstOrDefault()
                                              : totalTags.FirstOrDefault(tag => tag.EntryType == FileEntryType.Folder && Equals(tag.EntryId, parent.ID));

                    totalTags.Remove(parentFolderTag);
                    var countSubNew = 0;
                    totalTags.ForEach(tag => countSubNew += tag.Count);

                    if (parentFolderTag == null)
                    {
                        parentFolderTag    = Tag.New(SecurityContext.CurrentAccount.ID, parent, 0);
                        parentFolderTag.Id = -1;
                    }

                    if (parentFolderTag.Count != countSubNew)
                    {
                        if (countSubNew > 0)
                        {
                            var diff = parentFolderTag.Count - countSubNew;

                            parentFolderTag.Count -= diff;
                            if (parentFolderTag.Id == -1)
                            {
                                tagDao.SaveTags(parentFolderTag);
                            }
                            else
                            {
                                tagDao.UpdateNewTags(parentFolderTag);
                            }

                            object cacheFolderId = parent.ID;
                            var    parentsList   = folderDao.GetParentFolders(parent.ID);
                            parentsList.Reverse();
                            parentsList.Remove(parent);

                            if (parentsList.Any())
                            {
                                var    rootFolder   = parentsList.Last();
                                object rootFolderId = null;
                                cacheFolderId = rootFolder.ID;
                                if (rootFolder.RootFolderType == FolderType.BUNCH)
                                {
                                    cacheFolderId = rootFolderId = Global.FolderProjects;
                                }
                                else if (rootFolder.RootFolderType == FolderType.USER && !Equals(rootFolder.RootFolderId, Global.FolderMy))
                                {
                                    cacheFolderId = rootFolderId = Global.FolderShare;
                                }

                                if (rootFolderId != null)
                                {
                                    parentsList.Add(folderDao.GetFolder(rootFolderId));
                                }

                                var fileSecurity = Global.GetFilesSecurity();

                                foreach (var folderFromList in parentsList)
                                {
                                    var parentTreeTag = tagDao.GetNewTags(SecurityContext.CurrentAccount.ID, new FileEntry[] { folderFromList }).FirstOrDefault();

                                    if (parentTreeTag == null)
                                    {
                                        if (fileSecurity.CanRead(folderFromList))
                                        {
                                            tagDao.SaveTags(Tag.New(SecurityContext.CurrentAccount.ID, folderFromList, -diff));
                                        }
                                    }
                                    else
                                    {
                                        parentTreeTag.Count -= diff;
                                        tagDao.UpdateNewTags(parentTreeTag);
                                    }
                                }
                            }

                            if (cacheFolderId != null)
                            {
                                RemoveFromCahce(cacheFolderId);
                            }
                        }
                        else
                        {
                            RemoveMarkAsNew(parent);
                        }
                    }

                    entries.ToList().ForEach(
                        entry =>
                    {
                        var folder = entry as Folder;
                        if (folder != null)
                        {
                            var curTag = totalTags.FirstOrDefault(tag => tag.EntryType == FileEntryType.Folder && tag.EntryId.Equals(folder.ID));

                            folder.NewForMe = curTag != null ? curTag.Count : 0;
                        }
                    });
                }
            }

            return(entries);
        }
Example #40
0
        public static List <FileEntry> MarkedItems(Folder folder)
        {
            if (folder == null)
            {
                throw new ArgumentNullException("folder", FilesCommonResource.ErrorMassage_FolderNotFound);
            }
            if (!Global.GetFilesSecurity().CanRead(folder))
            {
                throw new SecurityException(FilesCommonResource.ErrorMassage_SecurityException_ViewFolder);
            }
            if (folder.RootFolderType == FolderType.TRASH && !Equals(folder.ID, Global.FolderTrash))
            {
                throw new SecurityException(FilesCommonResource.ErrorMassage_ViewTrashItem);
            }

            Dictionary <FileEntry, Tag> entryTags;

            using (var tagDao = Global.DaoFactory.GetTagDao())
                using (var fileDao = Global.DaoFactory.GetFileDao())
                    using (var folderDao = Global.DaoFactory.GetFolderDao())
                    {
                        var tags = (tagDao.GetNewTags(SecurityContext.CurrentAccount.ID, folder, true) ?? new List <Tag>()).ToList();

                        if (!tags.Any())
                        {
                            return(new List <FileEntry>());
                        }

                        if (Equals(folder.ID, Global.FolderMy) || Equals(folder.ID, Global.FolderCommon) || Equals(folder.ID, Global.FolderShare))
                        {
                            var folderTags = tags.Where(tag => tag.EntryType == FileEntryType.Folder);

                            var providerFolderTags = folderTags.Select(tag => new KeyValuePair <Tag, Folder>(tag, folderDao.GetFolder(tag.EntryId)))
                                                     .Where(pair => pair.Value.ProviderEntry).ToList();
                            providerFolderTags.Reverse();

                            foreach (var providerFolderTag in providerFolderTags)
                            {
                                tags.AddRange(tagDao.GetNewTags(SecurityContext.CurrentAccount.ID, providerFolderTag.Value, true));
                            }
                        }

                        tags = tags.Distinct().ToList();
                        tags.RemoveAll(tag => Equals(tag.EntryId, folder.ID));
                        tags = tags.Where(t => t.EntryType == FileEntryType.Folder)
                               .Concat(tags.Where(t => t.EntryType == FileEntryType.File)).ToList();

                        entryTags = tags.ToDictionary(
                            tag =>
                            tag.EntryType == FileEntryType.File
                        ? (FileEntry)fileDao.GetFile(tag.EntryId)
                        : (FileEntry)folderDao.GetFolder(tag.EntryId));
                    }

            foreach (var entryTag in entryTags)
            {
                var entry    = entryTag.Key;
                var parentId =
                    entryTag.Key is File
                        ? ((File)entry).FolderID
                        : ((Folder)entry).ParentFolderID;

                var parentEntry = entryTags.Keys.FirstOrDefault(entryCountTag => Equals(entryCountTag.ID, parentId));
                if (parentEntry != null)
                {
                    entryTags[parentEntry].Count -= entryTag.Value.Count;
                }
            }

            var result = new List <FileEntry>();

            foreach (var entryTag in entryTags)
            {
                if (!string.IsNullOrEmpty(entryTag.Key.Error))
                {
                    RemoveMarkAsNew(entryTag.Key);
                    continue;
                }

                if (entryTag.Value.Count > 0)
                {
                    result.Add(entryTag.Key);
                }
            }
            return(result);
        }
Example #41
0
 private static bool DefaultFilter(TModel model) => Global.CanDisplay(model.Value);
Example #42
0
 public static string Parse(string key)
 {
     return(Signature.Read <string>(key ?? String.Empty, Global.GetDocDbKey()));
 }
 private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
 {
     Global.SerializeToFile(Global.gszItems, Global.gszItemsFile);
     _timerThread.Stop();
     _updateCAMThread.Stop();
 }
Example #44
0
 protected void FvDesignationMaster_ItemUpdating(object sender, FormViewUpdateEventArgs e)
 {
     Global.SetFormViewParameters(e.NewValues, Employee.GetDesignationRow());
 }
Example #45
0
 private void OnDisable()
 {
     this.RemoveObserver(OnValidateAttack, Global.ValidateNotification <AttackAction>());
 }
Example #46
0
    void Start()
    {
        var go  = Resources.Load("Prefabs/UI/Dialog") as GameObject;
        var go1 = Resources.Load("Prefabs/UI/DialogBackground") as GameObject;

        try
        {
            StartCoroutine(XMLManager.LoadAsync <SceneDialog>(Application.streamingAssetsPath + "/XML/Core/SceneDialog/sceneDialog_Battle_" + Global.GetInstance().IndexToString(Global.GetInstance().BattleIndex) + ".xml", result => sceneDialog = result));
        }
        catch
        {
            Debug.Log("本场景无对话内容。");
        }

        dialogBackground = Instantiate(go1, GameObject.Find("Canvas").transform);
        dialogBackground.SetActive(false);

        GameController.GetInstance().Invoke(() =>
        {
            Units = UnitManager.GetInstance().units;
            foreach (var unit in Units.FindAll(u => ((CharacterStatus)u).characterIdentity == CharacterStatus.CharacterIdentity.noumenon))
            {
                var dialogUI = Instantiate(go, dialogBackground.transform);
                dialogUI.SetActive(false);
                var unitPosition = unit.GetComponent <CharacterStatus>().arrowPosition + unit.transform.position;
                unitsUIDic.Add(unit, dialogUI.transform);
                dialogUIDic.Add(dialogUI.transform, unitPosition);
            }
        }, 0.1f);

        //var multi = new MultiConversation("Shikamaru", speakers, contents);

        //var single = new Conversation("Neji", "测试文本!");

        //var turn = new TurnDialog();
        //turn.conversations.Add(multi);
        //turn.conversations.Add(single);
        //var round = new RoundDialog();
        //round.turnDialogList.Add(turn);
        //sceneDialog.roundDialogList.Add(round);

        //SaveDialog();
    }
Example #47
0
        /// <summary>
        /// A*寻路移动
        /// useLinearFinder 使用直线寻路,对于夺宝奇兵类型的怪物,使用直线寻路,寻找近的点
        /// </summary>
        private bool AStarMove(Monster sprite, Point p, int action)
        {
            //首先置空路径
            //sprite.PathString = "";

            Point srcPoint = sprite.Coordinate;

            //*****************************************
            //srcPoint = new Point(710, 3450);
            //p = new Point(619, 2191);
            //****************************************

            //进行单元格缩小
            Point start = new Point()
            {
                X = srcPoint.X / 20,
                Y = srcPoint.Y / 20
            },
                  end = new Point()
            {
                X = p.X / 20,
                Y = p.Y / 20
            };

            //如果起止一样,就不移动
            if (start.X == end.X && start.Y == end.Y)
            {
                return(true);
            }

            GameMap gameMap = GameManager.MapMgr.DictMaps[sprite.MonsterZoneNode.MapCode];

            //System.Diagnostics.Debug.WriteLine(
            //string.Format("开始AStar怪物寻路, ExtenstionID={0}, Start=({1},{2}), End=({3},{4}), fixedObstruction=({5},{6}), MapCode={7}",
            //            sprite.MonsterInfo.ExtensionID, (int)start.X, (int)start.Y, (int)end.X, (int)end.Y, gameMap.MyNodeGrid.numCols, gameMap.MyNodeGrid.numRows,
            //            sprite.MonsterZoneNode.MapCode)
            //            );

            if (start != end)
            {
                List <ANode> path = null;

                gameMap.MyNodeGrid.setStartNode((int)start.X, (int)start.Y);
                gameMap.MyNodeGrid.setEndNode((int)end.X, (int)end.Y);

                try
                {
                    path = gameMap.MyAStarFinder.find(gameMap.MyNodeGrid);
                }
                catch (Exception)
                {
                    sprite.DestPoint = new Point(-1, -1);
                    LogManager.WriteLog(LogTypes.Error, string.Format("AStar怪物寻路失败, ExtenstionID={0}, Start=({1},{2}), End=({3},{4}), fixedObstruction=({5},{6})",
                                                                      sprite.MonsterInfo.ExtensionID, (int)start.X, (int)start.Y, (int)end.X, (int)end.Y, gameMap.MyNodeGrid.numCols, gameMap.MyNodeGrid.numRows));
                    return(false);
                }

                if (path == null || path.Count <= 1)
                {
                    // 寻找一个直线的两点间的从开始点出发的最大无障碍点
                    Point maxPoint;
                    if (FindLinearNoObsMaxPoint(gameMap, sprite, p, out maxPoint))
                    {
                        path = null;
                        end  = new Point()
                        {
                            X = maxPoint.X / gameMap.MapGridWidth,
                            Y = maxPoint.Y / gameMap.MapGridHeight,
                        };

                        p = maxPoint;

                        gameMap.MyNodeGrid.setStartNode((int)start.X, (int)start.Y);
                        gameMap.MyNodeGrid.setEndNode((int)end.X, (int)end.Y);

                        path = gameMap.MyAStarFinder.find(gameMap.MyNodeGrid);
                    }
                }

                if (path == null || path.Count <= 1)
                {
                    //路径不存在
                    //sprite.MoveToPos = new Point(-1, -1); //防止重入
                    sprite.DestPoint = new Point(-1, -1);
                    sprite.Action    = GActions.Stand; //不需要通知,统一会执行的动作
                    Global.RemoveStoryboard(sprite.Name);
                    return(false);
                }
                else
                {
                    //找到路径 设置路径
                    //sprite.PathString = Global.TransPathToString(path);

                    //System.Diagnostics.Debug.WriteLine(String.Format("monster_{0} 路径:{1} ", sprite.RoleID, sprite.PathString));
                    //System.Diagnostics.Debug.WriteLine(String.Format("start:{0}, {1}  end {2}, {3}", start.X, start.Y, end.X, end.Y));
                    //System.Diagnostics.Debug.WriteLine(String.Format("srcPoint:{0}, {1}  P {2}, {3}", srcPoint.X, srcPoint.Y, p.X, p.Y));

                    sprite.Destination = p;
                    double UnitCost = 0;
                    //if (action == (int)GActions.Walk)
                    //{
                    //    UnitCost = Data.WalkUnitCost;
                    //}
                    //else if (action == (int)GActions.Run)
                    //{
                    //    UnitCost = Data.RunUnitCost;
                    //}
                    UnitCost = Data.RunUnitCost; //怪物使用跑步的移动速度
                    UnitCost = UnitCost / sprite.MoveSpeed;

                    UnitCost = 20.0 / UnitCost * Global.MovingFrameRate;
                    UnitCost = UnitCost * 0.5;

                    StoryBoardEx.RemoveStoryBoard(sprite.Name);

                    StoryBoardEx sb = new StoryBoardEx(sprite.Name);
                    sb.Completed = Move_Completed;

                    //path.Reverse();
                    Point firstPoint = new Point(path[0].x * gameMap.MapGridWidth, path[0].y * gameMap.MapGridHeight);
                    sprite.Direction = this.CalcDirection(sprite.Coordinate, firstPoint);
                    sprite.Action    = (GActions)action;

                    sb.Binding();

                    sprite.FirstStoryMove = true;
                    sb.Start(sprite, path, UnitCost, 20);
                }
            }

            return(true);
        }
Example #48
0
        /// <summary>
        /// Wykonuje się w momencie zaakceptowania oferty.
        /// </summary>
        /// <param name="offerId"></param>
        /// <param name="payType"></param>
        private static void OnOfferAccept(int offerId, OfferPayType payType)
        {
            Offer offerData = GetOfferData(offerId);

            if (offerData == null)
            {
                return;
            }

            if (!offerData.SystemOffer && !NAPI.Entity.DoesEntityExist(offerData.Player) ||
                !NAPI.Entity.DoesEntityExist(offerData.Target))
            {
                offerData.Destroy("Jeden z graczy nie jest zalogowany.");
                return;
            }

            Character charData   = Account.GetPlayerData(offerData.Player);
            Character targetData = Account.GetPlayerData(offerData.Target);

            if (!offerData.SystemOffer && charData == null || targetData == null)
            {
                offerData.Destroy("Jeden z graczy nie jest zalogowany.");
                return;
            }

            if (payType == OfferPayType.Cash && targetData.Cash < offerData.Price)
            {
                offerData.Destroy("Kupujący nie ma odpowiedniej ilości gotówki przy sobie.");
                return;
            }

            if (payType == OfferPayType.Card && targetData.AccountBalance < offerData.Price)
            {
                offerData.Destroy("Kupujący nie ma na koncie bankowym odpowiedniej ilości gotówki.");
                return;
            }

            // Akcje ofert

            if (offerData.Type == OfferType.SellItem)
            {
                if (Global.GetDistanceBetweenPositions(offerData.Player.Position, offerData.Target.Position) > 3.0 ||
                    offerData.Player.Dimension != offerData.Target.Dimension)
                {
                    offerData.Destroy("Zbyt daleko od celu.");
                    return;
                }

                ItemEntity itemData = ItemsManager.Items.FirstOrDefault(t => t.Id == (int)offerData.Data["Id"]);

                if (itemData == null)
                {
                    offerData.Destroy("Przedmiot nie został znaleziony.");
                    return;
                }

                if (itemData.Used)
                {
                    offerData.Destroy("Przedmiot nie może być używany.");
                    return;
                }

                if (offerData.Price == 0 || PayForOffer(charData, targetData, payType, (int)offerData.Price))
                {
                    itemData.SetOwner(OwnerType.Player, targetData.Id);

                    Chat.Library.SendPlayerMeMessage(charData,
                                                     $"podaje przedmiot \"{itemData.Name}\" graczowi {Player.GetPlayerIcName(targetData)}", true);
                    offerData.Success();
                    return;
                }
            }
            else if (offerData.Type == OfferType.Rp)
            {
                if (offerData.Price == 0 || PayForOffer(charData, targetData, payType, (int)offerData.Price))
                {
                    offerData.Success();
                    return;
                }
            }
            else if (offerData.Type == OfferType.RegisterVehicle)
            {
                Vehicle vehData = Vehicles.Library.GetVehicleData((int)offerData.Data["Id"]);
                if (vehData == null)
                {
                    offerData.Destroy("Wystąpił błąd w trakcie pobierania danych pojazdu.");
                    return;
                }

                if (offerData.Price == 0 || PayForOffer(charData, targetData, payType, (int)offerData.Price))
                {
                    vehData.NumberPlate = Vehicles.Library.GeneratePlate();
                    vehData.Save();
                    if (vehData.Spawned && NAPI.Entity.DoesEntityExist(vehData.VehicleHandle))
                    {
                        vehData.VehicleHandle.NumberPlate = vehData.NumberPlate;
                    }
                    // TODO: akcje z botem

                    offerData.Success();
                    return;
                }
            }
            else if (offerData.Type == OfferType.SellCar)
            {
                Vehicle vehData = Vehicles.Library.GetVehicleData((int)offerData.Data["Id"]);
                if (vehData == null)
                {
                    offerData.Destroy("Pojazd nie został odnaleziony.");
                    return;
                }

                if (offerData.Price == 0 || PayForOffer(charData, targetData, payType, (int)offerData.Price))
                {
                    vehData.OwnerType = Vehicles.OwnerType.Player;
                    vehData.Owner     = targetData.Id;
                    vehData.Save();
                    Chat.Library.SendPlayerMeMessage(charData,
                                                     $"podaje klucze do pojazdu graczowi {Player.GetPlayerIcName(targetData)}.", true);

                    offerData.Success();
                    return;
                }
            }
            else if (offerData.Type == OfferType.Heal)
            {
                if (offerData.Price == 0 || PayForOffer(charData, targetData, payType, (int)offerData.Price))
                {
                    targetData.Health = 100;
                    targetData.PlayerHandle.Health = 100;

                    offerData.Success();
                    return;
                }
            }
            else if (offerData.Type == OfferType.PdFine)
            {
                // todo
            }
            else if (offerData.Type == OfferType.Fuel)
            {
                // todo
            }
            else if (offerData.Type == OfferType.GroupGive)
            {
                using (Database.Database db = new Database.Database())
                {
                    // todo
                }
            }
            else if (offerData.Type == OfferType.BincoCloth)
            {
                if (offerData.Price == 0 || PayForOffer(null, targetData, payType, (int)offerData.Price))
                {
                    using (Database.Database db = new Database.Database())
                    {
                        db.ClothSets.Add((ClothSet)offerData.Data["clothSet"]);
                        db.SaveChanges();

                        Player.SendFormattedChatMessage(targetData.PlayerHandle,
                                                        "Ubranie zostało zapisane. Możesz je zmienić używając komendy /przebierz.",
                                                        Constants.ColorPictonBlue);

                        offerData.Success();
                    }
                }
            }
            else if (offerData.Type == OfferType.GasStation)
            {
                Vehicle vehData = Vehicles.Library.GetVehicleData((GTANetworkAPI.Vehicle)offerData.Data["vehicle"]);
                if (vehData != null)
                {
                    if (offerData.Price == 0 || PayForOffer(null, targetData, payType, (int)offerData.Price))
                    {
                        vehData.Fuel += Command.GetNumberFromString(offerData.Data["fuel"].ToString());
                        vehData.Save();

                        Chat.Library.SendPlayerMeMessage(targetData,
                                                         $"wkłada wąż do baku i tankuje auto \"{vehData.Name}\".", true);

                        offerData.Success();
                    }
                }
            }
            else if (offerData.Type == OfferType.Repair)
            {
                Vehicle vehData = (Vehicle)offerData.Data["vehData"];
                if (vehData != null)
                {
                    if (charData != null && Progress.Library.DoesPlayerHasActiveProgress(charData) ||
                        targetData != null && Progress.Library.DoesPlayerHasActiveProgress(targetData))
                    {
                        offerData.Destroy("Jeden z graczy posiada już aktywne zadanie.");
                        return;
                    }

                    Dictionary <string, object> data = new Dictionary <string, object>
                    {
                        { "veh", vehData },
                        { "price", offerData.Price },
                        { "type", payType }
                    };
                    Progress.Library.CreateProgress("Naprawa pojazdu", targetData, charData, ProgressType.FixVehicle,
                                                    60, data);
                    offerData.Success(true);
                }
            }
            else if (offerData.Type == OfferType.TattooCreate)
            {
                if (charData != null && Progress.Library.DoesPlayerHasActiveProgress(charData) ||
                    targetData != null && Progress.Library.DoesPlayerHasActiveProgress(targetData))
                {
                    offerData.Destroy("Jeden z graczy posiada już aktywne zadanie.");
                    return;
                }

                Dictionary <string, object> data = new Dictionary <string, object>
                {
                    { "tattooId", (int)offerData.Data["tattooId"] },
                    { "price", offerData.Price },
                    { "type", payType }
                };
                Progress.Library.CreateProgress("Nakładanie tatuażu", targetData, charData, ProgressType.TattooCreate,
                                                20, data);
                offerData.Success(true);
            }

            offerData.Destroy();
        }
Example #49
0
 /// <summary>
 /// 计算精灵的朝向
 /// </summary>
 /// <param name="sprite"></param>
 /// <param name="p"></param>
 /// <returns></returns>
 public double CalcDirection(Monster sprite, Point p)
 {
     return(Global.GetDirectionByTan(p.X, p.Y, sprite.Coordinate.X, sprite.Coordinate.Y));
 }
Example #50
0
 protected double CalcDirection(Point op, Point ep)
 {
     return(Global.GetDirectionByTan(ep.X, ep.Y, op.X, op.Y));
 }
Example #51
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                string Number = Request.QueryString["Data"];
                if (Number != "")
                {
                    CreamBell_DMS_WebApps.App_Code.Global obj = new Global();
                    conn = obj.GetConnection();

                    adp1 = new SqlDataAdapter("SELECT * FROM ax.inventtable where ITEMID = '" + Number + "'", conn);
                    //adp1.SelectCommand.CommandTimeout = 0;
                    ds1.Clear();

                    adp1.Fill(ds1, "dtl");

                    if (ds1.Tables["dtl"].Rows.Count != 0)
                    {
                        for (int i = 0; i < ds1.Tables["dtl"].Rows.Count; i++)
                        {
                            txMaterialCode.Text      = string.Copy(ds1.Tables["dtl"].Rows[i]["ITEMID"].ToString());
                            txtProductName.Text      = string.Copy(ds1.Tables["dtl"].Rows[i]["PRODUCT_NAME"].ToString());
                            txtMaterialGroup.Text    = string.Copy(ds1.Tables["dtl"].Rows[i]["PRODUCT_GROUP"].ToString());
                            txtMaterialNickName.Text = string.Copy(ds1.Tables["dtl"].Rows[i]["PRODUCT_NICKNAME"].ToString());
                            txtMaterialMRP.Text      = (Math.Round(Convert.ToDecimal((ds1.Tables["dtl"].Rows[i]["PRODUCT_MRP"].ToString())), 2)).ToString();
                            txtMaterialPackSize.Text = (Math.Round(Convert.ToDecimal((ds1.Tables["dtl"].Rows[i]["PRODUCT_PACKSIZE"].ToString())), 2)).ToString();
                            //txtMaterialPackSize.Text = string.Copy(ds1.Tables["dtl"].Rows[i][9].ToString());
                            txtMaterialCratePackSize.Text = (Math.Round(Convert.ToDecimal((ds1.Tables["dtl"].Rows[i]["PRODUCT_CRATE_PACKSIZE"].ToString())), 2)).ToString();
                            //txtMaterialCratePackSize.Text = string.Copy(ds1.Tables["dtl"].Rows[i][10].ToString());
                            txtUOM.Text = string.Copy(ds1.Tables["dtl"].Rows[i]["UOM"].ToString());
                            txtLTR.Text = (Math.Round(Convert.ToDecimal((ds1.Tables["dtl"].Rows[i]["LTR"].ToString())), 2)).ToString();
                            //txtLTR.Text = string.Copy(ds1.Tables["dtl"].Rows[i][12].ToString());
                            //txtGrossWt.Text = string.Copy(ds1.Tables["dtl"].Rows[i][13].ToString());
                            txtGrossWt.Text = (Math.Round(Convert.ToDecimal((ds1.Tables["dtl"].Rows[i]["GROSSWEIGHTINGM"].ToString())), 2)).ToString();
                            //txtNetWt.Text = string.Copy(ds1.Tables["dtl"].Rows[i][14].ToString());
                            txtNetWt.Text              = (Math.Round(Convert.ToDecimal((ds1.Tables["dtl"].Rows[i]["NETWEIGHTPCS"].ToString())), 2)).ToString();
                            txtBarcodeNumber.Text      = string.Copy(ds1.Tables["dtl"].Rows[i]["BARCODE"].ToString());
                            DefaultWarehouse.Text      = string.Copy(ds1.Tables["dtl"].Rows[i]["WAREHOUSE"].ToString());
                            txtMaterialCategory.Text   = string.Copy(ds1.Tables["dtl"].Rows[i]["PRODUCT_GROUP"].ToString());
                            txtproductNature.Text      = string.Copy(ds1.Tables["dtl"].Rows[i]["PRODUCT_NATURE"].ToString());
                            txtMaterialSubCatoery.Text = string.Copy(ds1.Tables["dtl"].Rows[i]["PRODUCT_SUBCATEGORY"].ToString());
                            txtFlavor.Text             = string.Copy(ds1.Tables["dtl"].Rows[i]["FLAVOUR"].ToString());

                            decimal volume, vol, vol1, vol2;

                            vol1 = (Convert.ToDecimal((ds1.Tables["dtl"].Rows[i]["PRODUCT_PACKSIZE"].ToString())));

                            vol2 = (Convert.ToDecimal((ds1.Tables["dtl"].Rows[i]["LTR"].ToString())));

                            vol = vol1 * vol2 / 1000;

                            volume = (Math.Round(vol, 2));

                            //vol = ((Math.Round(Convert.ToDecimal((ds1.Tables["dtl"].Rows[i][9].ToString())), 2)) * (Math.Round(Convert.ToDecimal((ds1.Tables["dtl"].Rows[i][12].ToString())), 2)))/1000;

                            txtVolume.Text = volume.ToString();
                        }
                    }
                }
            }
            catch (Exception ex) { ErrorSignal.FromCurrentContext().Raise(ex); }
            finally
            {
                conn.Close();
                conn.Dispose();
            }
        }
Example #52
0
 /// <summary>
 /// 移动结束
 /// </summary>
 private void Move_Completed(object sender, EventArgs e)
 {
     //System.Diagnostics.Debug.Write("怪物移动: 故事板结束");
     Global.RemoveStoryboard((sender as StoryBoardEx).Name);
 }
Example #53
0
 static TextEffect()
 {
     _pixelShader.UriSource = Global.MakePackUri("ShaderSource/TextEffect.ps");
 }
Example #54
0
        protected override IEnumerable <KeyValuePair <string, object> > GetClientVariables(HttpContext context)
        {
            var imgs = new Dictionary <string, string>
            {
                { "empty_screen_filter", WebImageSupplier.GetAbsoluteWebPath("empty_screen_filter.png") },
                { "empty_screen_tasks", WebImageSupplier.GetAbsoluteWebPath("empty_screen_tasks.png", ProductEntryPoint.ID) },
                { "empty_screen_deals", WebImageSupplier.GetAbsoluteWebPath("empty_screen_deals.png", ProductEntryPoint.ID) },
                { "empty_screen_cases", WebImageSupplier.GetAbsoluteWebPath("empty_screen_cases.png", ProductEntryPoint.ID) },
                { "empty_screen_invoices", WebImageSupplier.GetAbsoluteWebPath("empty_screen_invoices.png", ProductEntryPoint.ID) },
                { "empty_screen_products_services", WebImageSupplier.GetAbsoluteWebPath("empty_screen_products_services.png", ProductEntryPoint.ID) },
                { "empty_screen_taxes", WebImageSupplier.GetAbsoluteWebPath("empty_screen_taxes.png", ProductEntryPoint.ID) },
                { "empty_screen_persons", WebImageSupplier.GetAbsoluteWebPath("empty_screen_persons.png", ProductEntryPoint.ID) },
                { "empty_people_logo_40_40", WebImageSupplier.GetAbsoluteWebPath("empty_people_logo_40_40.png", ProductEntryPoint.ID) },
                { "empty_screen_opportunity_participants", WebImageSupplier.GetAbsoluteWebPath("empty_screen_opportunity_participants.png", ProductEntryPoint.ID) },
                { "empty_screen_company_participants", WebImageSupplier.GetAbsoluteWebPath("empty_screen_company_participants.png", ProductEntryPoint.ID) },
                { "empty_screen_case_participants", WebImageSupplier.GetAbsoluteWebPath("empty_screen_case_participants.png", ProductEntryPoint.ID) },
                { "empty_screen_projects", WebImageSupplier.GetAbsoluteWebPath("empty_screen_projects.png", ProductEntryPoint.ID) },
                { "empty_screen_userfields", WebImageSupplier.GetAbsoluteWebPath("empty_screen_userfields.png", ProductEntryPoint.ID) },
                { "empty_screen_tags", WebImageSupplier.GetAbsoluteWebPath("empty_screen_tags.png", ProductEntryPoint.ID) },
                { "empty_screen_twitter", WebImageSupplier.GetAbsoluteWebPath("empty_screen_twitter.png", ProductEntryPoint.ID) }
            };

            return(new List <KeyValuePair <string, object> >(1)
            {
                RegisterObject(
                    new
                {
                    ProfileRemoved = Constants.LostUser.DisplayUserName(),
                    System.Threading.Thread.CurrentThread.CurrentCulture.NumberFormat.CurrencyDecimalSeparator,
                    KeyCodeCurrencyDecimalSeparator = (int)System.Threading.Thread.CurrentThread.CurrentCulture.NumberFormat.CurrencyDecimalSeparator[0],
                    Global.VisiblePageCount,
                    DefaultEntryCountOnPage = Global.EntryCountOnPage,
                    Global.DefaultCustomFieldSize,
                    Global.DefaultCustomFieldRows,
                    Global.DefaultCustomFieldCols,
                    Global.MaxCustomFieldSize,
                    Global.MaxCustomFieldRows,
                    Global.MaxCustomFieldCols,
                    Global.MaxHistoryEventCharacters,
                    IsCRMAdmin = CRMSecurity.IsAdmin,
                    EmptyScrImgs = imgs,

                    ContactSelectorTypeEnum =
                        new Dictionary <string, int>
                    {
                        { "All", (int)ContactSelectorTypeEnum.All },
                        { "Companies", (int)ContactSelectorTypeEnum.Companies },
                        { "CompaniesAndPersonsWithoutCompany", (int)ContactSelectorTypeEnum.CompaniesAndPersonsWithoutCompany },
                        { "Persons", (int)ContactSelectorTypeEnum.Persons },
                        { "PersonsWithoutCompany", (int)ContactSelectorTypeEnum.PersonsWithoutCompany }
                    },

                    HistoryCategorySystem =
                        new Dictionary <string, int>
                    {
                        { "TaskClosed", (int)HistoryCategorySystem.TaskClosed },
                        { "FilesUpload", (int)HistoryCategorySystem.FilesUpload },
                        { "MailMessage", (int)HistoryCategorySystem.MailMessage }
                    },

                    DefaultContactPhoto =
                        new Dictionary <string, string>
                    {
                        { "CompanyBigSizePhoto", ContactPhotoManager.GetBigSizePhoto(0, true) },
                        { "PersonBigSizePhoto", ContactPhotoManager.GetBigSizePhoto(0, false) },
                        { "CompanyMediumSizePhoto", ContactPhotoManager.GetMediumSizePhoto(0, true) },
                        { "PersonMediumSizePhoto", ContactPhotoManager.GetMediumSizePhoto(0, false) }
                    },

                    CookieKeyForPagination =
                        new Dictionary <string, string>
                    {
                        { "contacts", "contactPageNumber" },
                        { "tasks", "taskPageNumber" },
                        { "deals", "dealPageNumber" },
                        { "cases", "casesPageNumber" },
                        { "invoices", "invoicePageNumber" },
                        { "invoiceitems", "invoiceItemsPageNumber" }
                    },

                    CanCreateProjects = Global.CanCreateProjects()
                })
            });
        }
Example #55
0
        /// <summary>
        /// Write a decimal value to the file.
        /// </summary>
        /// <param name="number">The value to write.</param>
        /// <param name="length">The overall width of the column being written to.</param>
        /// <param name="decimalCount">The number of decimal places in the column.</param>
        public void Write(decimal number, int length, int decimalCount)
        {
            string outString = string.Empty;

            int wholeLength = length;

            if (decimalCount > 0)
            {
                wholeLength -= (decimalCount + 1);
            }

            // Force to use point as decimal separator
            string strNum       = Convert.ToString(number, Global.GetNfi());
            int    decimalIndex = strNum.IndexOf('.');

            if (decimalIndex < 0)
            {
                decimalIndex = strNum.Length;
            }

            if (decimalIndex > wholeLength)
            {
                // Too many digits to the left of the decimal. Use the left
                // most "wholeLength" number of digits. All values to the right
                // of the decimal will be '0'.
                StringBuilder sb = new StringBuilder();
                sb.Append(strNum.Substring(0, wholeLength));
                if (decimalCount > 0)
                {
                    sb.Append('.');
                    for (int i = 0; i < decimalCount; ++i)
                    {
                        sb.Append('0');
                    }
                }
                outString = sb.ToString();
            }
            else
            {
                // Chop extra digits to the right of the decimal.
                StringBuilder sb = new StringBuilder();
                sb.Append("{0:0");
                if (decimalCount > 0)
                {
                    sb.Append('.');
                    for (int i = 0; i < decimalCount; ++i)
                    {
                        sb.Append('0');
                    }
                }
                sb.Append('}');
                // Force to use point as decimal separator
                outString = String.Format(Global.GetNfi(), sb.ToString(), number);
            }

            for (int i = 0; i < length - outString.Length; i++)
            {
                _writer.Write((byte)0x20);
            }
            foreach (char c in outString)
            {
                _writer.Write(c);
            }
        }
Example #56
0
 /// <summary>
 /// 保存配置文件并重载
 /// </summary>
 private void SaveAndReload()
 {
     Global.SaveConfig();
     Reload();
 }
Example #57
0
 protected virtual void OnStateStarted(){ Global.Log(string.Format("{0} started '{1}' state", Slave.Name, GetType().Name)); }
 internal void SetLanguageForComponent()
 {
     Global.SetLanguageForComponent(this);
 }
Example #59
0
 public static string CreateKey(string fileId)
 {
     return(Signature.Create(fileId, Global.GetDocDbKey()));
 }
Example #60
0
 public void ToggleSelectAllowPreRelease(bool enabled)
 {
     Global.GuiConfig.IsPreRelease = enabled;
     Global.SaveConfig();
 }