Exemple #1
0
        public static string GetStringValue(WorkType Val)
        {
            string str = null;

            StringValue[] customAttributes = Val.GetType().GetField(Val.ToString()).GetCustomAttributes(typeof(StringValue), false) as StringValue[];
            if (customAttributes.Length > 0)
            {
                str = customAttributes[0].GetStr();
            }
            return(str);
        }
Exemple #2
0
        /// <summary>
        /// Creates work instance with parameters
        /// </summary>
        /// <param name="name"></param>
        /// <param name="type"></param>
        /// <param name="retryCount"></param>
        /// <param name="minutesWaitBeforeSendUpdates"></param>
        public Work(WorkType type, int retryCount = 1, int minutesWaitBeforeSendUpdates = 0, string?name = null)
        {
            var now = DateTime.UtcNow;

            StartAfterMinutes          = minutesWaitBeforeSendUpdates;
            WorkType                   = type;
            CancelAfterProcessingCount = retryCount;
            Name = name ?? type.ToString();
            IsDeleteAfterSuccessfulCompleted = true;
            CreatedAt   = now;
            ProcessedAt = now;
        }
Exemple #3
0
        private void WriteWorkerStartedMessages(WorkType t)
        {
            WriteStatus("BackgroundWorker Started with worktype: " + t.ToString());

            WriteStatus("Total Feeds: " + this.feedList.Count);
            foreach (var feed in this.feedList)
            {
                if (feed.FeedVideos == null)
                {
                    WriteStatus("Feed: " + feed.FeedName + " has zero videos");
                }
                else
                {
                    WriteStatus("Feed: " + feed.FeedName + " has " + feed.FeedVideos.Count + " video(s)");
                }
            }
        }
Exemple #4
0
 public static void SetWorkType(WorkType workType)
 {
     Windows.WinRegistry.SetValue(Registry.Users, NTMinerRegistrySubKey, NTKeyword.WorkTypeRegistryKey, workType.ToString());
 }
 public static void Manager_WorkPerformed(int hours,
                                          WorkType workType)
 {
     Console.WriteLine("WorkPerformed event fired.  Hours: {0}  WorkType: {1}",
                       hours.ToString(), workType.ToString());
 }
Exemple #6
0
 static void Work2(int v, WorkType t)
 {
     Console.WriteLine("At {0} - {1}", v + 1, t.ToString());
 }
Exemple #7
0
 public override string ToString()
 {
     return("Work - Type: " + type.ToString() + ", Position: " + position);
 }
 public override string ToString()
 {
     return(string.Format("{0} - {1} - {2}", Start.ToShortTimeString(), End.ToShortTimeString(), WorkType.ToString()));
 }
 // handlers --- the method that actually does the work.
 static int DoTheWork(string greeting, WorkType wt)
 {
     Console.WriteLine($"1) Do work one way: {greeting}. Here is your worktype: {wt.ToString()}");
     return(1);
 }
Exemple #10
0
 static void InformDownstream(int hours, WorkType type)
 {
     Console.WriteLine("Informing Downstream");
     Console.WriteLine(string.Format("Hours - {0}; Type - {1}", hours, type.ToString()));
 }
Exemple #11
0
 static void NotifyUser(int hours, WorkType type)
 {
     Console.WriteLine("Notifying User");
     Console.WriteLine(string.Format("Hours - {0}; Type - {1}", hours, type.ToString()));
 }
Exemple #12
0
 static void LogEvent(int hours, WorkType type)
 {
     Console.WriteLine("Logging Data");
     Console.WriteLine(string.Format("Hours - {0}; Type - {1}", hours, type.ToString()));
 }
Exemple #13
0
        public void LoadCommands()
        {
            Commands.Clear(); Main_Form.mainForm.command.workList = new Dictionary <string, List <Work> >();
            try
            {
                using (FileStream f = new FileStream(Main_Form.mainForm.command.fileName, FileMode.Open))
                    using (StreamReader sr = new StreamReader(f, System.Text.Encoding.Default))
                    {
                        string currentCmd = string.Empty;
                        while (sr.Peek() > -1)
                        {
                            string line = sr.ReadLine();
                            if (line.StartsWith("?"))
                            {
                                currentCmd = line.Split('?')[1];
                            }
                            else
                            {
                                WorkType type = (WorkType)System.Enum.Parse(typeof(WorkType), line);
                                Work     work;
                                switch (type)
                                {
                                case WorkType.OPEN:
                                {
                                    string[] l = sr.ReadLine().Split('?');
                                    work = new WORK_OPEN(l[0], l[1]);
                                    AddWork(currentCmd, work);
                                    break;
                                }

                                case WorkType.CLOSE:
                                {
                                    work = new WORK_CLOSE();
                                    AddWork(currentCmd, work);
                                    break;
                                }

                                case WorkType.SENDKEY:
                                {
                                    work = new WORK_SENDKEY(sr.ReadLine());
                                    AddWork(currentCmd, work);
                                    break;
                                }

                                case WorkType.START:
                                {
                                    work = new WORK_START();
                                    AddWork(currentCmd, work);
                                    break;
                                }

                                case WorkType.STOP:
                                {
                                    work = new WORK_STOP();
                                    AddWork(currentCmd, work);
                                    break;
                                }

                                case WorkType.SAY:
                                {
                                    work = new WORK_SAY(sr.ReadLine());
                                    AddWork(currentCmd, work);
                                    break;
                                }

                                default:
                                {
#if DEBUGING
                                    System.Windows.Forms.MessageBox.Show("Commands.cs 에서 파일 로드중 인식치 못한 WorkType : " + type.ToString(), "디버그!!");
#endif
                                    break;
                                }
                                }
                            }
                        }
                    }
            }
            catch (FileNotFoundException)
            {
                SaveCommands();
                LoadCommands();
            }
        }