Esempio n. 1
0
        // NOTIFY delivery path HTTP/1.1

        void IWriterMethod.WriteMethod(byte[] aMethod, byte[] aUri, EVersion aVersion)
        {
            if (ASCIIEncoding.UTF8.GetString(aMethod, 0, aMethod.Length) == Upnp.kUpnpMethodNotify)
            {
                iMethodReceived = true;
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Convert from string to version.
        /// </summary>
        /// <param name="SplitString"></param>
        /// <returns></returns>
        public static EVersion ToVersion(this String SplitString)
        {
            try
            {
                string[] _1 = SplitString.Split('.');

                // If we don't have 3 versions then error out
                if (_1.Length != 4)
                {
                    MessageBox.Show($"Error converting string to version - must be 4 version components supplied", "Emerald Game Engine Error 60", MessageBoxButton.OK, MessageBoxImage.Error);
                    return(null);
                }

                EVersion Version = new EVersion();

                // set the version information
                Version.Major    = Convert.ToInt32(_1[0]);
                Version.Minor    = Convert.ToInt32(_1[1]);
                Version.Build    = Convert.ToInt32(_1[2]);
                Version.Revision = Convert.ToInt32(_1[3]);

                return(Version);
            }
            catch (FormatException err)
            {
                MessageBox.Show($"Error converting string to version - invalid version component supplied!\n\n{err}", "Emerald Game Engine Error 61", MessageBoxButton.OK, MessageBoxImage.Error);
                return(null);
            }
        }
Esempio n. 3
0
        public void Read()
        {
            iReader.ReadFlush();

            uint count = 0;

            while (true)
            {
                byte[] line;

                line = Ascii.Ascii.Trim(iReader.ReadUntil(Ascii.Ascii.kAsciiLf));

                int bytes = line.Length;

                if (bytes == 0)
                {
                    if (count == 0)
                    {
                        continue; // a blank line before first header - ignore (RFC 2616 section 4.1)
                    }
                    iWriter.WriteFlush();
                    return;
                }

                if (Ascii.Ascii.IsWhitespace(line[0]))
                {
                    continue; // a line starting with spaces is a continuation line
                }

                Parser parser = new Parser(line);

                if (count == 0)   // status
                {
                    EVersion version = Http.Version(parser.Next());

                    uint code;

                    try {
                        code = Ascii.Ascii.Uint(parser.Next());
                    }
                    catch (Ascii.AsciiError) {
                        throw (new HttpError());
                    }

                    byte[] temp   = Ascii.Ascii.Trim(parser.Remaining());
                    string reason = ASCIIEncoding.UTF8.GetString(temp, 0, temp.Length);
                    Status status = new Status(code, reason);

                    iWriter.WriteStatus(status, version);
                }
                else   // header
                {
                    byte[] field = parser.Next(Ascii.Ascii.kAsciiColon);
                    byte[] value = Ascii.Ascii.Trim(parser.Remaining());
                    iWriter.WriteHeader(field, value);
                }
                count++;
            }
        }
Esempio n. 4
0
        private void Connect(Uri endpoint)
        {
            _authenticationProvider.ApplyConfiguration(endpoint, _handler);

            _serviceImpl = new Kubernetes(endpoint, _handler, new JsonDelegatingHandler());

            _version = GetVersion(_serviceImpl);
        }
Esempio n. 5
0
 public void WriteStatus(Status aStatus, EVersion aVersion)
 {
     iWriter.Write(Http.ByteArray(Http.Version(aVersion)));
     iWriter.WriteSpace();
     iWriter.WriteUint(aStatus.Code());
     iWriter.WriteSpace();
     iWriter.Write(Http.ByteArray(aStatus.Reason()));
     iWriter.WriteNewline();
 }
Esempio n. 6
0
 public void WriteMethod(byte[] aMethod, byte[] aUri, EVersion aVersion)
 {
     iWriter.Write(aMethod);
     iWriter.WriteSpace();
     iWriter.Write(aUri);
     iWriter.WriteSpace();
     iWriter.Write(Http.ByteArray(Http.Version(aVersion)));
     iWriter.WriteNewline();
 }
Esempio n. 7
0
        public static string Version(EVersion aVersion)
        {
            switch (aVersion)
            {
            case EVersion.eHttp09: return(kHttpVersion09);

            case EVersion.eHttp10: return(kHttpVersion10);

            case EVersion.eHttp11: return(kHttpVersion11);

            default: break;
            }
            Assert.Check(false);
            return("");
        }
Esempio n. 8
0
File: Http.cs Progetto: weeble/ohos
 public void WriteStatus(Status aStatus, EVersion aVersion)
 {
     iWriter.Write(Http.ByteArray(Http.Version(aVersion)));
     iWriter.WriteSpace();
     iWriter.WriteUint(aStatus.Code);
     iWriter.WriteSpace();
     iWriter.Write(Http.ByteArray(aStatus.Reason));
     iWriter.WriteNewline();
 }
Esempio n. 9
0
File: Http.cs Progetto: weeble/ohos
 public void WriteMethod(byte[] aMethod, byte[] aUri, EVersion aVersion)
 {
     iWriter.Write(aMethod);
     iWriter.WriteSpace();
     iWriter.Write(aUri);
     iWriter.WriteSpace();
     iWriter.Write(Http.ByteArray(Http.Version(aVersion)));
     iWriter.WriteNewline();
 }
Esempio n. 10
0
File: Http.cs Progetto: weeble/ohos
        private void ProcessStatus(byte[] aVersion, byte[] aCode, byte[] aDescription)
        {
            Version = Http.Version(aVersion);
            try
            {
                Code = Ascii.Uint(aCode);
            }
            catch (AsciiError)
            {
                throw new HttpError();
            }

            Description = aDescription;
        }
Esempio n. 11
0
File: Http.cs Progetto: weeble/ohos
 public static string Version(EVersion aVersion)
 {
     switch (aVersion) {
         case EVersion.Http09: return kHttpVersion09;
         case EVersion.Http10: return kHttpVersion10;
         case EVersion.Http11: return kHttpVersion11;
         default: break;
     }
     throw new HttpError();
 }
Esempio n. 12
0
        // Parses the changes file
        private Hashtable ParseSelectionFile(string filename, ref EVersion eVersion)
        {
            Hashtable htSelection = new Hashtable();
            FileStream fileStream = null;
            StreamReader streamReader = null;
            uint uLineNumber = 1;
            string sVersion = "";

            try
            {
                LogFile.TheLogFile.WriteLine(LogFile.DT_APP, LogFile.EDebugLevel.Note, String.Format("opening changes file {0}", filename));

                fileStream = new FileStream(filename, FileMode.Open, FileAccess.Read);
                streamReader = new StreamReader(fileStream, System.Text.Encoding.ASCII);

                string sLine;
                sLine = streamReader.ReadLine();
                // First gedcomLine should be version number
                if (sLine.Length >= 8 && sLine.Substring(0, 11) == "// GEDmill ")
                {
                    sVersion = sLine.Substring(11);
                }
                if (sVersion.Length < 5 || m_sSoftwareVersion.Length < 5)
                {
                    eVersion = EVersion.pre1p8;
                }
                else
                {
                    switch (sVersion.Substring(0, 6))
                    {
                        case "1.10.0":
                        case "1.10.1":
                        case "1.10.2":
                        case "1.10.3":
                        case "1.10.4":
                        case "1.11.0":
                            eVersion = EVersion.v1p10;
                            break;
                        default:
                            switch (sVersion.Substring(0, 5))
                            {
                                case "1.8.0":
                                case "1.8.1":
                                case "1.8.2":
                                case "1.8.3":
                                case "1.8.4":
                                case "1.8.5":
                                case "1.8.6":
                                case "1.8.7":
                                case "1.8.8":
                                case "1.8.9":
                                    eVersion = EVersion.v1p8;
                                    break;
                                case "1.9.0":
                                case "1.9.1":
                                case "1.9.2":
                                    eVersion = EVersion.v1p9;
                                    break;
                            }
                            break;
                    }
                }
                if (eVersion == EVersion.pre1p8)
                {
                    if (sLine.IndexOf("GEDmill") == -1)
                    {
                        DialogResult dialogResult = MessageBocx.Show(this, "The file you have selected is not a valid GEDmill file.", "Invalid File",
                            MessageBoxButtons.OK, MessageBoxIcon.Exclamation, false);
                        return null;
                    }
                    sVersion = "pre 1.8.0";
                }
                LogFile.TheLogFile.WriteLine(LogFile.DT_APP, LogFile.EDebugLevel.Note, String.Format("version is {0}:{1}", sVersion, sLine));

                CISRecordChanges isrc = null;
                while ((sLine = streamReader.ReadLine()) != null)
                {
                    string xref = "";
                    string sSecondary = "";
                    // Parse characters in gedcomLine until whitespace or // found
                    int n = 0;
                    bool bSecondary = false;
                    while (n < sLine.Length)
                    {
                        char c = sLine[n];
                        if (char.IsWhiteSpace(c))
                        {
                            if (xref.Length == 0)
                            {
                                // Must be a secondary data gedcomLine
                                bSecondary = true;
                            }
                            else
                            {
                                // Whitespace at end of xref gedcomLine
                                break;
                            }
                        }
                        if ((c == '#'))
                        {
                            // # is the new comment starter. (Used to be // but that screwed up //machine/file/path/filenames )
                            break;
                        }
                        if (bSecondary)
                        {
                            sSecondary += c;
                        }
                        else
                        {
                            xref += c;
                        }
                        n++;
                    }
                    if (xref.Length > 0)
                    {
                        isrc = new CISRecordChanges(true);
                        htSelection[xref] = isrc;
                    }
                    if (sSecondary.Length > 0)
                    {
                        ParseSecondary(ref isrc, sSecondary);
                    }
                    uLineNumber++;
                }
            }
            catch (Exception e)
            {
                LogFile.TheLogFile.WriteLine(LogFile.DT_APP, LogFile.EDebugLevel.Error, String.Format("A problem was encountered while reading the file : {0} line {1}", e.ToString(), uLineNumber));
            }
            finally
            {
                if (streamReader != null)
                {
                    streamReader.Close();
                }

                if (fileStream != null)
                {
                    fileStream.Close();
                }
            }
            return htSelection;
        }
Esempio n. 13
0
File: Env.cs Progetto: leiwcq/E
        static Env()
        {
            if (PclExport.Instance == null)
            {
                throw new ArgumentException("PclExport.Instance needs to be initialized");
            }

            var platformName = PclExport.Instance.PlatformName;

            if (platformName != PclExport.Platforms.Uwp)
            {
                IsMono = AssemblyUtils.FindType("Mono.Runtime") != null;

                IsIOS = AssemblyUtils.FindType("MonoTouch.Foundation.NSObject") != null ||
                        AssemblyUtils.FindType("Foundation.NSObject") != null;

                IsAndroid = AssemblyUtils.FindType("Android.Manifest") != null;

                try
                {
                    IsOSX = AssemblyUtils.FindType("Mono.AppKit") != null;
#if NET45
                    IsWindows = !string.IsNullOrEmpty(Environment.GetEnvironmentVariable("windir"));
                    if (File.Exists(@"/System/Library/CoreServices/SystemVersion.plist"))
                    {
                        IsOSX = true;
                    }
                    string osType = File.Exists(@"/proc/sys/kernel/ostype") ? File.ReadAllText(@"/proc/sys/kernel/ostype") : null;
                    IsLinux = osType?.IndexOf("Linux", StringComparison.OrdinalIgnoreCase) >= 0;
#endif
                }
                catch (Exception) {}
            }
            else
            {
                IsUWP = true;
            }

#if NETSTANDARD2_0
            IsNetStandard = true;
            try
            {
                IsLinux   = System.Runtime.InteropServices.RuntimeInformation.IsOSPlatform(System.Runtime.InteropServices.OSPlatform.Linux);
                IsWindows = System.Runtime.InteropServices.RuntimeInformation.IsOSPlatform(System.Runtime.InteropServices.OSPlatform.Windows);
                IsOSX     = System.Runtime.InteropServices.RuntimeInformation.IsOSPlatform(System.Runtime.InteropServices.OSPlatform.OSX);
            }
            catch (Exception) {} //throws PlatformNotSupportedException in AWS lambda
            IsUnix = IsOSX || IsLinux;
            HasMultiplePlatformTargets = true;
#elif NET45
            IsNetFramework = true;
            var platform = (int)Environment.OSVersion.Platform;
            IsUnix  = platform == 4 || platform == 6 || platform == 128;
            IsLinux = IsUnix;
            if (Environment.GetEnvironmentVariable("OS")?.IndexOf("Windows", StringComparison.OrdinalIgnoreCase) >= 0)
            {
                IsWindows = true;
            }
#endif
            SupportsExpressions = true;
            SupportsEmit        = !IsIOS;

            ServerUserAgent = "E/" +
                              EVersion + " "
                              + platformName
                              + (IsMono ? "/Mono" : "/.NET");

            VersionString = EVersion.ToString(CultureInfo.InvariantCulture);

            __releaseDate = new DateTime(2001, 01, 01);
        }
Esempio n. 14
0
 protected Version(EVersion _Version)
 {
     SDKVersion = _Version;
 }
Esempio n. 15
0
        public static int Write(DataSet dataSet, string filePath, EVersion eVersion)
        {
            string connectionString = GetConnectionString(filePath, eVersion);

            using (OleDbConnection conn = new OleDbConnection(connectionString))
            {
                conn.Open();
                OleDbCommand cmd = new OleDbCommand();
                cmd.Connection = conn;
            
                foreach (DataTable table in dataSet.Tables)
                {
                    string colIdCollection = string.Empty;
                    string colValueCollection = string.Empty;
                    char[] trimChar = {'$'};
                    string tableName = table.TableName.Trim(trimChar);

                    for (int col = 0; col < table.Columns.Count; col++)
                    {
                        colIdCollection += "[" + table.Columns[col].ColumnName + "]";

                        string sqlDataType = GetSQLDataType(table.Columns[col].DataType);

                        colValueCollection += "[" + table.Columns[col].ColumnName + "]" + " " + sqlDataType;

                        if (col + 1 < table.Columns.Count)
                        { 
                            colIdCollection += ",";
                            colValueCollection += ",";
                        }
                    }

                    //cmd.CommandText = "CREATE TABLE [table1] (id INT, name VARCHAR, datecol DATE );";
                    cmd.CommandText = "CREATE TABLE [" + tableName + "] (" + colValueCollection + ");";
                    cmd.ExecuteNonQuery();

                    //CREATE TABLE [fieldinfo] ([No#] INT,[Field Name] VARCHAR,[Left] INT,[Top] INT,[Right] INT,[Bottom] INT,[Unit] VARCHAR,[Alignment] VARCHAR,[Field Type] VARCHAR,[Font Name] VARCHAR,[Font Size] INT,[Color] VARCHAR,[Red] INT,[Green] INT,[Blue] INT,[Cyan] INT,[Magenta] INT,[Yellow] INT,[Black] INT,[Gray] INT,[Bold	] VARCHAR,[Italic] VARCHAR,[Underline] VARCHAR,[Auto Fit] VARCHAR);

                    for (int row = 0; row < table.Rows.Count; row++)
                    {
                        string rowValueCollection = string.Empty;


                        for (int col = 0; col < table.Columns.Count; col++)
                        {
                            string val;
                            if (table.Columns[col].DataType == typeof(int))
                            {
                                val = table.Rows[row][col].ToString();
                            }
                            else
                            {
                                val = "'" + table.Rows[row][col].ToString() + "'";
                            }


                            rowValueCollection += val;

                            if (col + 1 < table.Columns.Count)
                            {
                                rowValueCollection += ",";
                            }

                        }

                        //cmd.CommandText = "INSERT INTO [table1](id,name,datecol) VALUES(1,'AAAA','2014-01-01');";
                        cmd.CommandText = "INSERT INTO [" + tableName + "](" + colIdCollection + ") VALUES(" + rowValueCollection + ");";
                        cmd.ExecuteNonQuery();

                    }
                }


                conn.Close();
            }


            return 0;
        }
Esempio n. 16
0
        private static string GetConnectionString(string filePath, EVersion eVersion)
        {
            Dictionary<string, string> props = new Dictionary<string, string>();

            if (eVersion == EVersion.eXLS)
            {
                // XLS - Excel 2003 and Older
                props["Provider"] = "Microsoft.Jet.OLEDB.4.0";
                props["Extended Properties"] = "Excel 8.0";
                props["Data Source"] = filePath;
            }
            else
            {
                // XLSX - Excel 2007, 2010, 2012, 2013
                props["Provider"] = "Microsoft.ACE.OLEDB.12.0;";
                props["Extended Properties"] = "Excel 12.0 XML";
                props["Data Source"] = filePath;
            }

            StringBuilder sb = new StringBuilder();

            foreach (KeyValuePair<string, string> prop in props)
            {
                sb.Append(prop.Key);
                sb.Append('=');
                sb.Append(prop.Value);
                sb.Append(';');
            }

            return sb.ToString();
        }