Пример #1
0
 public bool ContainsValue(TValue value)
 {
     mutex.WaitOne();
     try
     {
         return(dictionary.ContainsValue(value));
     }
     finally
     {
         mutex.ReleaseMutex();
     }
 }
Пример #2
0
 public static bool containsValue <K, V>(System.Collections.Generic.Dictionary <K, V> data, V val)
 {
     if (!(data != null))
     {
         return(false);
     }
     if (!(val != null))
     {
         return(false);
     }
     return(data.ContainsValue(val));
 }
Пример #3
0
        static public void AddDeclareParameterToCommandArgument(System.Collections.Generic.List <string> arguments,
                                                                Framework.ITaskItem item,
                                                                string valueQuote,
                                                                System.Collections.Generic.Dictionary <string, string> lookupDictionary)
        {
            if (arguments != null && item != null && lookupDictionary != null)
            {
                // special for the name
                arguments.Clear();
                System.Collections.Generic.List <string> idenities = new System.Collections.Generic.List <string>(6);

                string name = item.ItemSpec;
                if (!string.IsNullOrEmpty(name))
                {
                    string element = item.GetMetadata(MsDeploy.ExistingParameterValiationMetadata.Element.ToString());
                    if (string.IsNullOrEmpty(element))
                    {
                        element = "parameterEntry";
                    }
                    if (string.Compare(element, "parameterEntry", System.StringComparison.OrdinalIgnoreCase) == 0)
                    {
                        idenities.Add(name);
                        foreach (string dPIdentity in System.Enum.GetNames(typeof(MsDeploy.ExistingDeclareParameterMetadata)))
                        {
                            idenities.Add(item.GetMetadata(dPIdentity));
                        }

                        string identity = string.Join(",", idenities.ToArray());
                        if (!lookupDictionary.ContainsKey(identity))
                        {
                            string nameValue = MsDeploy.Utility.PutValueInQuote(name, valueQuote);
                            arguments.Add(string.Concat("name=", nameValue));
                            System.Type enumType = lookupDictionary.ContainsValue(name) ? typeof(MsDeploy.ExistingDeclareParameterMetadata) : typeof(MsDeploy.DeclareParameterMetadata);
                            // the rest, build on the Enum Name
                            MsDeploy.Utility.BuildArgumentsBaseOnEnumTypeName(item, arguments, enumType, valueQuote);
                            lookupDictionary.Add(identity, name);
                        }
                    }
                    else if (string.Compare(element, "parameterValidation", System.StringComparison.OrdinalIgnoreCase) == 0)
                    {
                        System.Diagnostics.Debug.Assert(false, "msdeploy.exe doesn't support parameterValidation entry in the command line for declareParameter yet.");
                    }
                }
            }
        }
Пример #4
0
 /*
  * ▒██████▒▒████████▒████████
  * ██▒▒▒▒▒▒▒██▒▒▒▒▒▒▒▒▒▒██▒▒▒
  * ▒██████▒▒████████▒▒▒▒██▒▒▒
  * ▒▒▒▒▒▒██▒██▒▒▒▒▒▒▒▒▒▒██▒▒▒
  * ▒██████▒▒████████▒▒▒▒██▒▒▒
  */
 public bool SetKey(string keyName, UnityEngine.KeyCode button)
 {
     /* If duplicate, then flip */
     if (Key.ContainsValue(button))
     {
         Key[Value[button]]        = Key[keyName];
         Key[keyName]              = button;
         Value[Key[Value[button]]] = Value[button];
         Value[button]             = keyName;
     }
     else
     {
         Value.Remove(Key[keyName]);
         Value.Add(button, keyName);
         Key[keyName] = button;
     }
     return(UnityEngine.Input.GetKeyDown(button));
 }
        static StackObject *ContainsValue_9(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject *ptr_of_this_method;
            StackObject *__ret = ILIntepreter.Minus(__esp, 2);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            System.Int32 @value = ptr_of_this_method->Value;

            ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
            System.Collections.Generic.Dictionary <System.String, System.Int32> instance_of_this_method = (System.Collections.Generic.Dictionary <System.String, System.Int32>) typeof(System.Collections.Generic.Dictionary <System.String, System.Int32>).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);

            var result_of_this_method = instance_of_this_method.ContainsValue(@value);

            __ret->ObjectType = ObjectTypes.Integer;
            __ret->Value      = result_of_this_method ? 1 : 0;
            return(__ret + 1);
        }
        static StackObject *ContainsValue_5(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject *ptr_of_this_method;
            StackObject *__ret = ILIntepreter.Minus(__esp, 2);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            System.String @value = (System.String) typeof(System.String).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags) 0);
            __intp.Free(ptr_of_this_method);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
            System.Collections.Generic.Dictionary <UnityEngine.GameObject, System.String> instance_of_this_method = (System.Collections.Generic.Dictionary <UnityEngine.GameObject, System.String>) typeof(System.Collections.Generic.Dictionary <UnityEngine.GameObject, System.String>).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags) 0);
            __intp.Free(ptr_of_this_method);

            var result_of_this_method = instance_of_this_method.ContainsValue(@value);

            __ret->ObjectType = ObjectTypes.Integer;
            __ret->Value      = result_of_this_method ? 1 : 0;
            return(__ret + 1);
        }
Пример #7
0
 public virtual bool containsValue(object value)
 {
     if (hasNullKey)
     {
         if (value == null)
         {
             if (valueForNullKey == null)
             {
                 return(true);
             }
         }
         else
         {
             if (value.Equals(valueForNullKey))
             {
                 return(true);
             }
         }
     }
     return(data.ContainsValue(value));
 }
Пример #8
0
        static int _m_ContainsValue(RealStatePtr L)
        {
            ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);


            System.Collections.Generic.Dictionary <ulong, xc.GoodsEquip> __cl_gen_to_be_invoked = (System.Collections.Generic.Dictionary <ulong, xc.GoodsEquip>)translator.FastGetCSObj(L, 1);


            try {
                {
                    xc.GoodsEquip value = (xc.GoodsEquip)translator.GetObject(L, 2, typeof(xc.GoodsEquip));

                    bool __cl_gen_ret = __cl_gen_to_be_invoked.ContainsValue(value);
                    LuaAPI.lua_pushboolean(L, __cl_gen_ret);



                    return(1);
                }
            } catch (System.Exception __gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + __gen_e));
            }
        }
Пример #9
0
        static int _m_ContainsValue(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);


                System.Collections.Generic.Dictionary <string, UnityEngine.GameObject> gen_to_be_invoked = (System.Collections.Generic.Dictionary <string, UnityEngine.GameObject>)translator.FastGetCSObj(L, 1);



                {
                    UnityEngine.GameObject _value = (UnityEngine.GameObject)translator.GetObject(L, 2, typeof(UnityEngine.GameObject));

                    var gen_ret = gen_to_be_invoked.ContainsValue(_value);
                    LuaAPI.lua_pushboolean(L, gen_ret);



                    return(1);
                }
            } catch (System.Exception gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + gen_e));
            }
        }
        static int _m_ContainsValue(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);


                System.Collections.Generic.Dictionary <string, Framework.Event.Action <string> > gen_to_be_invoked = (System.Collections.Generic.Dictionary <string, Framework.Event.Action <string> >)translator.FastGetCSObj(L, 1);



                {
                    Framework.Event.Action <string> _value = translator.GetDelegate <Framework.Event.Action <string> >(L, 2);

                    bool gen_ret = gen_to_be_invoked.ContainsValue(_value);
                    LuaAPI.lua_pushboolean(L, gen_ret);



                    return(1);
                }
            } catch (System.Exception gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + gen_e));
            }
        }
Пример #11
0
        public override SmtpResponse DataEnd(ISmtpSessionInfo sessionInfo)
        {
            var fileName = GetFileNameFromSessionInfo(sessionInfo);

            using (var stream = File.OpenWrite(fileName)) {
                FS.WriteTo(stream);
                stream.Flush();
                stream.Close();
            }
            var size           = FS.Length;
            var successMessage = String.Format("{0} bytes received", size);
            var response       = SmtpResponse.OK.CloneAndChange(successMessage);

            FeuerwehrCloud.Helper.Logger.WriteLine("|  < [SMTPServer] *** Finished receiving eMail");
            System.Threading.Thread NWorker = new System.Threading.Thread(new System.Threading.ParameterizedThreadStart(delegate(object obj) {
                try {
                    FeuerwehrCloud.Helper.Logger.WriteLine("|  < [SMTPServer] *** Pass Message to MimeLoader");
                    FS.Seek(0, SeekOrigin.Begin);
                    FeuerwehrCloud.Mime.Message M = FeuerwehrCloud.Mime.Message.Load(FS);                      //new FileInfo((string)obj));
                    System.Collections.Generic.List <FeuerwehrCloud.Mime.MessagePart> attachments = M.FindAllAttachments();
                    FeuerwehrCloud.Helper.Logger.WriteLine("|  < [SMTPServer] ***** Loop trough Parts");
                    foreach (FeuerwehrCloud.Mime.MessagePart attachment in attachments)
                    {
                        // Only extract Text if from ILS!
                        // Has PDF-Attachment?
                        FeuerwehrCloud.Helper.Logger.WriteLine("|  < [SMTPServer] ****** Has PDF-Attachment?");
                        if (attachment.FileName.EndsWith(".pdf", StringComparison.InvariantCultureIgnoreCase))
                        {
                            try {
                                // Extract PDF to /tmp/
                                FeuerwehrCloud.Helper.Logger.WriteLine("|  < [SMTPServer] ******* Safe PDF to " + "/tmp/" + attachment.FileName);
                                attachment.Save(new FileInfo("/tmp/" + attachment.FileName));
                                try {
                                    System.IO.File.Copy("/tmp/" + attachment.FileName, "public/fax/" + attachment.FileName, true);
                                } catch (Exception ex) {
                                    FeuerwehrCloud.Helper.Logger.WriteLine(FeuerwehrCloud.Helper.Helper.GetExceptionDescription(ex));
                                }
                                int count = 0;

                                // Print PDF!
                                System.Diagnostics.Process P       = new System.Diagnostics.Process();
                                P.StartInfo.FileName               = FeuerwehrCloud.Input.SMTP.Properties.Settings.Default.lp_path;
                                P.StartInfo.WorkingDirectory       = "/tmp/";
                                P.StartInfo.Arguments              = " /tmp/" + attachment.FileName;
                                P.StartInfo.UseShellExecute        = false;
                                P.StartInfo.CreateNoWindow         = true;
                                P.StartInfo.RedirectStandardOutput = true;
                                P.Start();
                                P.StandardOutput.ReadToEnd();
                                P.WaitForExit();

                                string XSubject = M.Headers.Subject;
                                if (XSubject.StartsWith("=?UTF-8?B", StringComparison.InvariantCultureIgnoreCase))
                                {
                                    XSubject = System.Text.Encoding.Default.GetString(System.Convert.FromBase64String(XSubject.Substring(XSubject.IndexOf("?B?", StringComparison.InvariantCultureIgnoreCase) + 3).Replace("?=", "")));
                                }
                                if (XSubject.EndsWith(")", StringComparison.InvariantCultureIgnoreCase))
                                {
                                    XSubject = XSubject.Replace(" (", " ").Replace(")", "");
                                }

                                if (XSubject.StartsWith("Fax von"))
                                {
                                    XSubject = XSubject.Substring(XSubject.LastIndexOf(" ", StringComparison.InvariantCultureIgnoreCase) + 1).Trim();
                                    FeuerwehrCloud.Helper.Logger.WriteLine("|  < [SMTPServer] ***** Is FAX-Number of ILS? " + (XSubject == ""?"No number supplied...":XSubject));

                                    if (BOSConfig.ContainsValue(XSubject))
                                    {
                                        FeuerwehrCloud.Helper.Logger.WriteLine("|  < [SMTPServer] ******* ILS-Number detected!");
                                        // Notify running Display-Software!
                                        new System.Threading.Thread(delegate() {
                                            try {
                                                System.Net.Sockets.TcpClient TC = new TcpClient();
                                                TC.Connect("localhost", 27655);
                                                TC.GetStream().Write(System.Text.Encoding.Default.GetBytes("GET / HTTP/1.0\r\n\r\n"), 0, 18);
                                                TC.Close();
                                            } catch (Exception ex) {
                                            }
                                        }).Start();

                                        // Extract Image from PDF
                                        FeuerwehrCloud.Helper.Logger.WriteLine("|  < [SMTPServer] ********* Extract PNG from PDF!");
                                        P = new System.Diagnostics.Process();
                                        P.StartInfo.FileName               = FeuerwehrCloud.Input.SMTP.Properties.Settings.Default.mutool_path;
                                        P.StartInfo.WorkingDirectory       = "/tmp/";
                                        P.StartInfo.Arguments              = " extract /tmp/" + attachment.FileName;
                                        P.StartInfo.UseShellExecute        = false;
                                        P.StartInfo.CreateNoWindow         = true;
                                        P.StartInfo.RedirectStandardOutput = true;
                                        P.Start();
                                        string output = P.StandardOutput.ReadToEnd();
                                        P.WaitForExit();

                                        string[] Pages = output.Split(new [] { "\n" }, StringSplitOptions.RemoveEmptyEntries);
                                        for (int i = 0; i < Pages.Length; i++)
                                        {
                                            Pages[i] = Pages[i].Substring(Pages[i].IndexOf("image ", StringComparison.OrdinalIgnoreCase) + 6);
                                        }
                                        ParentPlugin.RaiseFinish("pictures", Pages);
                                    }
                                    else
                                    {
                                        FeuerwehrCloud.Helper.Logger.WriteLine("|  < [SMTPServer] ******* Does not look like a FAX from ILS...");
                                    }
                                }
                            } catch (Exception ex2) {
                                Console.ForegroundColor = ConsoleColor.Red;
                                FeuerwehrCloud.Helper.Logger.WriteLine(FeuerwehrCloud.Helper.Helper.GetExceptionDescription(ex2));
                                Console.ForegroundColor = ConsoleColor.Gray;
                            }
                        }
                    }

                    FS = new MemoryStream();
                } catch (Exception ex) {
                    Console.ForegroundColor = ConsoleColor.Red;
                    FeuerwehrCloud.Helper.Logger.WriteLine(FeuerwehrCloud.Helper.Helper.GetExceptionDescription(ex));
                    Console.ForegroundColor = ConsoleColor.Gray;
                }
                FeuerwehrCloud.Helper.Logger.WriteLine("|  < [SMTPServer] *** Done!");
            }));
            NWorker.Start(fileName);
            return(response);
        }
Пример #12
0
        void HandleAsyncCallback(IAsyncResult ar)
        {
            Socket socket = ar.AsyncState as Socket;

            dataRecieved = socket.EndReceive(ar);
            (new System.Threading.Thread(delegate() {
                string output = Encoding.ASCII.GetString(buffer);
                buffer = new byte[DEFAULT_SIZE];
                FeuerwehrCloud.Helper.Logger.WriteLine("|  < [FAX] *** Received FAX from Hylafax");
                string[] Pages = output.Split(new [] { "|" }, StringSplitOptions.RemoveEmptyEntries);
                if (Pages == null)
                {
                }
                else
                {
                    FeuerwehrCloud.Helper.Logger.WriteLine("|  < [FAX] ***** Is FAX-Number from ILS? " + (Pages[0] == ""?"No number supplied...":Pages[0]));
                }
                if (Pages == null || FAXConfig.ContainsValue(Pages [0]))
                {
                    FeuerwehrCloud.Helper.Logger.WriteLine("|  < [FAX] ******* ILS-Number detected!");
                    if (Pages [1].IndexOf("\\") > -1)
                    {
                        Pages [1] = Pages [1].Substring(0, Pages [1].IndexOf("\\"));
                    }
                    if (Pages [1].IndexOf("\n") > -1)
                    {
                        Pages [1] = Pages [1].Substring(0, Pages [1].IndexOf("\n"));
                    }
                    if (Pages [1].IndexOf("\r") > -1)
                    {
                        Pages [1] = Pages [1].Substring(0, Pages [1].IndexOf("\r"));
                    }
                    FeuerwehrCloud.Helper.Logger.WriteLine("|  < [FAX] ******* Printing " + CopiesConfig["count"] + " copies ");
                    string TF = System.IO.Path.GetTempFileName();
                    System.IO.File.WriteAllText(TF, "/usr/bin/tiff2ps -a -h 12 -w 7.7 " + "/var/spool/hylafax/" + Pages [1] + " | lpr  -o orientation-requested=3 -o position=top-left -#" + CopiesConfig["count"]);
                    FeuerwehrCloud.Helper.Helper.exec("/bin/bash", " " + TF);
                    System.IO.File.Delete(TF);
                    FeuerwehrCloud.Helper.Logger.WriteLine("|  < [FAX] ******* Safe TIFF to " + "/tmp/" + Pages [1].Replace("recvq/", ""));
                    System.IO.File.Copy("/var/spool/hylafax/" + Pages [1], "/tmp/" + Pages [1].Replace("recvq/", ""), true);
                    if (!System.IO.Directory.Exists("public/fax"))
                    {
                        System.IO.Directory.CreateDirectory("public/fax");
                    }
                    System.IO.File.Copy("/var/spool/hylafax/" + Pages [1], "public/fax/" + Pages [1].Replace("recvq/", ""), true);
                    string[] P = { Pages [1].Replace("recvq/", "") };
                    RaiseFinish("pictures", P);
                    FeuerwehrCloud.Helper.Logger.WriteLine("|  < [FAX] *** Done!");
                }
                else
                {
                    FeuerwehrCloud.Helper.Logger.WriteLine("|  < [FAX] ******* Does not look like a FAX from ILS...");
                    if (Pages [1].IndexOf("\\") > -1)
                    {
                        Pages [1] = Pages [1].Substring(0, Pages [1].IndexOf("\\"));
                    }
                    if (Pages [1].IndexOf("\n") > -1)
                    {
                        Pages [1] = Pages [1].Substring(0, Pages [1].IndexOf("\n"));
                    }
                    if (Pages [1].IndexOf("\r") > -1)
                    {
                        Pages [1] = Pages [1].Substring(0, Pages [1].IndexOf("\r"));
                    }
                    FeuerwehrCloud.Helper.Logger.WriteLine("|  < [FAX] ******* Printing 1 copy ");
                    string TF = System.IO.Path.GetTempFileName();
                    System.IO.File.WriteAllText(TF, "/usr/bin/tiff2ps -a -h 12 -w 7.7 " + "/var/spool/hylafax/" + Pages [1] + " | lpr  -o orientation-requested=3 -o position=top-left");
                    FeuerwehrCloud.Helper.Helper.exec("/bin/bash", " " + TF);
                    System.IO.File.Delete(TF);
                }
            })).Start();
            try {
                socket.Shutdown(SocketShutdown.Both);
                socket.Close();
            } catch (Exception ex) {
            }
        }
Пример #13
0
        private static async void ConnectAsTcpClient(object iHost)
        {
            try {
                System.Net.WebClient WC = new WebClient();
                string RESULT           = WC.DownloadString("http://" + FRITZCallMonitor.Gw.ToString());
                if (RESULT.IndexOf("FRITZ!Box", StringComparison.OrdinalIgnoreCase) > 0)
                {
                    FBC = new System.Net.Sockets.TcpClient();
                    FRITZCallMonitor iH = (FRITZCallMonitor)iHost;
                    using (var tcpClient = new TcpClient()) {
                        FeuerwehrCloud.Helper.Logger.WriteLine("|  < [FRITZCallMonitor] *** FRITZ!Box found at " + FRITZCallMonitor.Gw.ToString() + ", trying to attach to CallMonitor");
                        await tcpClient.ConnectAsync(FRITZCallMonitor.Gw, 1012);

                        FeuerwehrCloud.Helper.Logger.WriteLine("|  < [FRITZCallMonitor] *** CallMonitor attached, waiting for calls...");
                        using (var networkStream = tcpClient.GetStream()) {
                            do
                            {
                                var buffer    = new byte[4096];
                                var byteCount = await networkStream.ReadAsync(buffer, 0, buffer.Length);

                                var      response = Encoding.UTF8.GetString(buffer, 0, byteCount);
                                string[] rLine    = response.Split(new [] { ";" }, StringSplitOptions.None);
                                switch (rLine [1])
                                {
                                case "CALL":
                                    FeuerwehrCloud.Helper.Logger.WriteLine("|  < [FRITZCallMonitor] *** Outgoing call with " + rLine [3] + "/" + rLine [4] + " to: " + rLine [5]);
                                    iH.RaiseFinish("text", rLine);
                                    break;

                                case "RING":
                                    FeuerwehrCloud.Helper.Logger.WriteLine("|  < [FRITZCallMonitor] *** Incoming call from: " + rLine [3] + " on number " + rLine [4]);
                                    if (BOSConfig.ContainsValue(rLine [3]))
                                    {
                                        FeuerwehrCloud.Helper.Logger.WriteLine("|  < [FRITZCallMonitor] *** Incoming call FAX FROM ILS! Forcing printer tp warm up...");
                                        try {
                                            // There's a new Method wo wake up the printer -> FeuerwehrCloud.Generic.PrinterStatus
                                            //System.Diagnostics.Process.Start("/usr/bin/lp wakeup.txt");
                                        } catch (Exception ex) {
                                        }
                                    }
                                    break;
                                    iH.RaiseFinish("text", rLine);

                                case "CONNECT":
                                    FeuerwehrCloud.Helper.Logger.WriteLine("|  < [FRITZCallMonitor] *** Pickup call: " + rLine [4]);
                                    iH.RaiseFinish("text", rLine);
                                    break;

                                case "DISCONNECT":
                                    FeuerwehrCloud.Helper.Logger.WriteLine("|  < [FRITZCallMonitor] *** Hangup call after " + rLine [3]);
                                    iH.RaiseFinish("text", rLine);
                                    break;

                                default:
                                    FeuerwehrCloud.Helper.Logger.WriteLine("|  < [FRITZCallMonitor] *** response was {0}", response);
                                    break;
                                }
                            } while (Disposing == false);
                        }
                    }
                }
            } catch (Exception ex) {
            }
        }
Пример #14
0
 public static bool ContainsValue(LTexture texture)
 {
     return(lazyTextures.ContainsValue(texture));
 }