Пример #1
0
        private void addTicket_Load(object sender, EventArgs e)
        {
            this.Text += " - " + Program.TicketDB.CurrentUser.Nome;
            this.Update();

            List <Area> Areas = Program.TicketDB.ProcuraAreas();

            foreach (Area Area in Areas)
            {
                cbxTAvaria.Items.Add(Area.ToString());
            }
            Program.TicketDB.ProcuraPerfis();

            List <Prioridade> Prioridades = Program.TicketDB.ProcuraPrioridade();

            foreach (Prioridade Prio in Prioridades)
            {
                cbxPrioridade.Items.Add(Prio.ToString());
            }
            Program.TicketDB.ProcuraPerfis();

            List <Equipamento> Equipamentos = Program.TicketDB.ProcuraEquipamentos();

            foreach (Equipamento Equip in Equipamentos)
            {
                cbxEquipamento.Items.Add(Equip.ToString());
            }
            Program.TicketDB.ProcuraPerfis();
        }
Пример #2
0
 public int CompareTo(object obj)
 {
     if (obj == null)
     {
         return(1);
     }
     return(Prio.CompareTo(((Skill)obj).Prio));
 }
Пример #3
0
        public static void Log(Topic topic, Prio prio, ulong contentId, string content)
        {
            switch (prio)
            {
            case Prio.Fehler:
            case Prio.Warnung:
                MainWindow.ErrorCount++;
                break;
            }

            Sql sql = new Sql();

            sql.CreateLogEntry(topic, prio, contentId, content);
        }
Пример #4
0
        public static void Log(String sMsg, Prio ePriorite, Orig eOrigine, bool bMsgBox)
        {
            DateTime dt    = DateTime.Now;
            String   sLine = dt.Year.ToString() + "/" + dt.Month.ToString().PadLeft(2, '0') + "/" + dt.Day.ToString().PadLeft(2, '0')
                             + "\t" + dt.Hour.ToString().PadLeft(2, '0') + ":" + dt.Minute.ToString().PadLeft(2, '0') + ":" + dt.Second.ToString().PadLeft(2, '0')
                             + "\t" + eOrigine.ToString()
                             + "\t" + ePriorite.ToString()
                             + "\t" + sMsg;

            if (m_sLogFileDefined)
            {
                m_sw.WriteLine(sLine);
                m_sw.Flush();
            }
            // TODO : vérifier que le destructeur de StreamWriter ferme le fichier
        }
Пример #5
0
        public static void Log(Topic topic, Prio prio, ulong contentId, string content)
        {
            switch (prio)
            {
            case Prio.Fehler:
                ++StatusClass.ErrorCount;
                break;

            case Prio.Warnung:
                ++StatusClass.WarningCount;
                break;
            }
            Sql Sql = new Sql();

            Sql.CreateLogEntry(topic, prio, contentId, content);
        }
Пример #6
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (Name.Length != 0)
            {
                hash ^= Name.GetHashCode();
            }
            if (Prio != 0)
            {
                hash ^= Prio.GetHashCode();
            }
            if (GroupName.Length != 0)
            {
                hash ^= GroupName.GetHashCode();
            }
            return(hash);
        }
Пример #7
0
        /// <summary>
        /// Schreibt in eine Log-Datei wenn DebugBitPos in DegbuByte gesetzt ist oder errorNo < 0
        /// </summary>
        /// <param name="DebugBitPos">Bit-Position in DebugByte</param>
        /// <param name="errorNo">Eindeutige Fehlernummer</param>
        /// <param name="logMessage">Text</param>
        public static void Write(Cat DebugBitPos, Prio prio, int errorNo, string logMessage) //Fehlernummern siehe Log.cs 0701ZZ
        {
            if (Tools.IsBitSet(DebugWord, (int)DebugBitPos) || prio != Prio.Info)
            {
                LogWrite(string.Format("{0:00} {1} {2:D6}", (int)DebugBitPos, prio.ToString().Substring(0, 1), errorNo), logMessage);
            }

            if (DebugBitPos == (int)Log.Cat.Info && Tools.IsBitSet(DebugWord, (int)Log.Cat.Info))
            {
                Console.WriteLine(logMessage);
            }

            if (prio == Prio.Error)
            {
                Program.AppErrorOccured = true;

                if (Program.AppErrorNumber < 0)       //nur, wenn AppErrorCategory noch nicht gesetzt ist
                {
                    Program.AppErrorNumber = errorNo; //(int)DebugBitPos;
                }
            }
        }
 public LCDScreen(string name, Prio prio, int dur)
 {
     this.name = name;
     this.prio = prio;
     this.dur = dur;
 }
Пример #9
0
        public int dur; //duration in 1/8 seconds

        public LCDScreen(string name, Prio prio, int dur)
        {
            this.name = name;
            this.prio = prio;
            this.dur  = dur;
        }
Пример #10
0
 public static void Log(String sMsg, Prio ePriorite, Orig eOrigine)
 {
     Log(sMsg, ePriorite, eOrigine, false);
 }
Пример #11
0
 public bool Equals(Prio <D> that)
 {
     return(Priority == that.Priority);
 }
Пример #12
0
    /// <summary>
    /// (re)Run the scripts collected thus far
    /// </summary>
    public static Assembly CompileScripts()
    {
        // compile
        MonoScript.Unload(oldScripts);
        var scriptass = Script.Evaluator.StaticCompile(GetSources(), "s_");

        oldScripts = scriptass;
        Dictionary <string, List <MethodInfo> > broadcast = new Dictionary <string, List <MethodInfo> >();

        // populate the base dispatch list
        foreach (var t in typeof(ScriptEvents).GetMethods(BindingFlags.Public | BindingFlags.Instance))
        {
            if (!broadcast.ContainsKey(t.Name))
            {
                broadcast[t.Name] = new List <MethodInfo>();
            }
        }

        var dispatcher = new StringBuilder();

        dispatcher.AppendLine("using System.Collections.Generic;");
        dispatcher.AppendLine("public class ScriptDispatcher : ScriptEvents {");

        // collect the methods we'll broadcast to
        foreach (var t in scriptass.GetTypesSafe())
        {
            if (t.IsAbstract || t.IsInterface || (!t.IsPublic))
            {
                Debug.Log($"[SCRIPT] Skipping {t.Name} because it is abstract {t.IsAbstract} {t.IsInterface} {t.IsPublic} {t.BaseType?.Name ?? "no base"} {t?.BaseType?.BaseType?.Name ?? "no 2base"}");
                continue;
            }
            for (var bt = t.BaseType; bt != null && bt != typeof(Object); bt = bt.BaseType)
            {
                if (bt.Name == "ScriptEvents")
                {
                    goto good;
                }
            }
            continue;
good:
            foreach (var m in t.GetMethods(BindingFlags.Public | BindingFlags.Instance))
            {
                if (!broadcast.ContainsKey(m.Name))
                {
                    continue;
                }
                if (m.DeclaringType != t)
                {
                    continue;
                }
                broadcast[m.Name].Add(m);
            }
            // populate the instances while at it.
            dispatcher.AppendLine($"public {t.Name} {t.Name}_instance = new {t.Name}();");
        }

        // sort em according to broadcast priority
        foreach (var kv in broadcast)
        {
            kv.Value.Sort((a, b) =>
            {
                var attra = new Prio(0);
                var attrb = new Prio(0);
                a.GetAttr(ref attra);
                b.GetAttr(ref attrb);
                return(attrb.prio - attra.prio);
            });
        }

        // Now construct the dispatcher
        foreach (var kv in broadcast)
        {
            if (kv.Value.Count == 0)
            {
                continue;
            }
            var m = typeof(ScriptEvents).GetMethod(kv.Key);
            dispatcher.AppendLine("override " + m.GetSignature().Replace("&", "").Replace("+", "."));
            dispatcher.AppendLine("{");
            // early exit?
            // TODO: support enumerators
            var isexit = m.ReturnType == typeof(bool);
            if (isexit)
            {
                dispatcher.Append("return ");
            }
            // construct the call
            foreach (var fun in kv.Value)
            {
                dispatcher.Append(fun.DeclaringType.Name + "_instance." + fun.GetSignature(true).Replace("&", ""));
                if (isexit && kv.Value.Last() != fun)
                {
                    dispatcher.Append("||");
                }
                else
                {
                    dispatcher.AppendLine(";");
                }
            }
            dispatcher.AppendLine("}");
        }
        dispatcher.AppendLine("}");
        dispatcher.AppendLine("//" + scriptass.FullName);
        var dstr = dispatcher.ToString();

        Debug.Log("Compiled dispatch: " + dstr);
        // compile this mess and instantiate the dispatcher
        var dispAss = Script.Evaluator.StaticCompile(new object[] { /*scriptass, */ dstr.ToBytes() }, "d_");

        Script.On?.OnDestroy();
        Script.On = Activator.CreateInstance(dispAss.GetTypesSafe().First(x => x.Name == "ScriptDispatcher")) as ScriptEvents;
        // if there is a GO already in place, we'll have to simulate start and awake
        if (MBProxy.go != null)
        {
            Script.On.Awake();
            Script.On.Start();
        }
        var newlist = new Dictionary <MonoBehaviour, ScriptEvents>();

        foreach (var kv in SingletonList.singletons)
        {
            if (kv.Value != Script.On)
            {
                Script.On.OnSingleton(kv.Key, false);
            }
            newlist[kv.Key] = Script.On;
        }
        SingletonList.singletons = newlist;
        MonoScript.Unload(dispAss);
        return(scriptass);
    }
        public async void StartSubscriptionAsync(IRC5Session cs, string resource, T eventArgs)
        {
            Cs = cs;

            if (Cs.IsOmnicore)
            {
                Protocol          = "rws_subscription";
                TemplateSocketUrl = "wss://{0}/poll";
            }

            using HttpClientHandler handler = new HttpClientHandler { Credentials = new NetworkCredential(cs?.UAS.User, cs?.UAS.Password) };
            handler.Proxy    = null;
            handler.UseProxy = false;
            handler.ServerCertificateCustomValidationCallback = (sender, certificate, chain, sslPolicyErrors) => { return(true); };

            string prioAndResourcePath = Prio + "|" + resource.Replace(resource.Split('/').Last(), "");

            int resourceCount = 1;

            Cs.SubscriptionService.SubscriptionSessions.TryGetValue(prioAndResourcePath, out var outSubscData);
            resourceCount += outSubscData == null ? 0 : outSubscData.ResourceCount;

            Tuple <string, string>[] dataParameters =
            {
                Tuple.Create("resources",              resourceCount.ToString()),
                Tuple.Create(resourceCount.ToString(), resource),
                Tuple.Create(resourceCount + "-p",     Prio.ToString(CultureInfo.InvariantCulture))
            };


            string combinedParams = IRC5Session.BuildDataParameters(dataParameters);

            if (outSubscData != null)
            {
                outSubscData.CombinedParameters = (outSubscData.CombinedParameters.Contains(resource) ?
                                                   outSubscData.CombinedParameters : (outSubscData.CombinedParameters + "&" + combinedParams).TrimStart('&'));

                outSubscData.ResourceCount = resourceCount;
            }
            else
            {
                Cs.SubscriptionService.SubscriptionSessions.AddOrOverwrite(prioAndResourcePath, new OpenSubscriptionData()
                {
                    ResourceCount      = resourceCount,
                    CombinedParameters = combinedParams,
                    ResourcePath       = prioAndResourcePath.Split('|')[1],
                    GroupID            = "1",
                });
            }
            outSubscData = Cs.SubscriptionService.SubscriptionSessions[prioAndResourcePath];


            using HttpContent httpContent = new StringContent(outSubscData.CombinedParameters);
            httpContent.Headers.Remove("Content-Type");
            httpContent.Headers.Add("Content-Type", Cs.ContentTypeHeader);

            using HttpClient client = new HttpClient(handler);

            outSubscData.RequestQueue.Add(new Task(() => { StartSubscriptionAsync(Cs, resource, eventArgs); }));

            if (outSubscData.RequestQueue.Count == 1)
            {
                outSubscData.CombinedParameters = "";

                await SocketThreadAsync(client, httpContent, eventArgs, prioAndResourcePath);
            }
        }
Пример #14
0
 public bool Equals(Prio <D> that)
 {
     return(this.priority == that.priority);
 }
Пример #15
0
 public int CompareTo(Prio <D> that)
 {
     return(this.priority.CompareTo(that.priority));
 }
Пример #16
0
        /// <summary>
        /// Returns true if Incident instances are equal
        /// </summary>
        /// <param name="other">Instance of Incident to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(Incident other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Incidentid == other.Incidentid ||
                     Incidentid != null &&
                     Incidentid.Equals(other.Incidentid)
                     ) &&
                 (
                     Description == other.Description ||
                     Description != null &&
                     Description.Equals(other.Description)
                 ) &&
                 (
                     Type == other.Type ||
                     Type != null &&
                     Type.Equals(other.Type)
                 ) &&
                 (
                     Position == other.Position ||
                     Position != null &&
                     Position.Equals(other.Position)
                 ) &&
                 (
                     Prio == other.Prio ||
                     Prio != null &&
                     Prio.Equals(other.Prio)
                 ) &&
                 (
                     Status == other.Status ||
                     Status != null &&
                     Status.Equals(other.Status)
                 ) &&
                 (
                     Probability == other.Probability ||
                     Probability != null &&
                     Probability.Equals(other.Probability)
                 ) &&
                 (
                     Interventionplan == other.Interventionplan ||
                     Interventionplan != null &&
                     Interventionplan.Equals(other.Interventionplan)
                 ) &&
                 (
                     Incidenttime == other.Incidenttime ||
                     Incidenttime != null &&
                     Incidenttime.Equals(other.Incidenttime)
                 ) &&
                 (
                     Wbid == other.Wbid ||
                     Wbid != null &&
                     Wbid.Equals(other.Wbid)
                 ) &&
                 (
                     Telephone == other.Telephone ||
                     Telephone != null &&
                     Telephone.Equals(other.Telephone)
                 ) &&
                 (
                     AdditionalMedia == other.AdditionalMedia ||
                     AdditionalMedia != null &&
                     AdditionalMedia.Equals(other.AdditionalMedia)
                 ) &&
                 (
                     MediaType == other.MediaType ||
                     MediaType != null &&
                     MediaType.Equals(other.MediaType)
                 ) &&
                 (
                     Area == other.Area ||
                     Area != null &&
                     MediaType.Equals(other.Area)
                 ));
        }
Пример #17
0
 /// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         var hashCode = 41;
         // Suitable nullity checks etc, of course :)
         if (Incidentid != null)
         {
             hashCode = hashCode * 59 + Incidentid.GetHashCode();
         }
         if (Description != null)
         {
             hashCode = hashCode * 59 + Description.GetHashCode();
         }
         if (Type != null)
         {
             hashCode = hashCode * 59 + Type.GetHashCode();
         }
         if (Position != null)
         {
             hashCode = hashCode * 59 + Position.GetHashCode();
         }
         if (Prio != null)
         {
             hashCode = hashCode * 59 + Prio.GetHashCode();
         }
         if (Status != null)
         {
             hashCode = hashCode * 59 + Status.GetHashCode();
         }
         if (Probability != null)
         {
             hashCode = hashCode * 59 + Probability.GetHashCode();
         }
         if (Interventionplan != null)
         {
             hashCode = hashCode * 59 + Interventionplan.GetHashCode();
         }
         if (Incidenttime != null)
         {
             hashCode = hashCode * 59 + Incidenttime.GetHashCode();
         }
         if (Wbid != null)
         {
             hashCode = hashCode * 59 + Wbid.GetHashCode();
         }
         if (Telephone != null)
         {
             hashCode = hashCode * 59 + Telephone.GetHashCode();
         }
         if (AdditionalMedia != null)
         {
             hashCode = hashCode * 59 + AdditionalMedia.GetHashCode();
         }
         if (MediaType != null)
         {
             hashCode = hashCode * 59 + MediaType.GetHashCode();
         }
         if (Area != null)
         {
             hashCode = hashCode * 59 + Area.GetHashCode();
         }
         return(hashCode);
     }
 }
Пример #18
0
 public static void Log(String sMsg, Prio ePriorite)
 {
     Log(sMsg, ePriorite, Orig.General, false);
 }