Example #1
0
        public void Preprocess(LibraryHelpers g)
        {
            //g.SetNameOfEnumWithMatchingItem("SDL_LOG_CATEGORY_CUSTOM", "LogCategory");

            // Clean up types
            g.FindClass("CXString").IsOpaque = true;
            g.FindClass("CXSourceLocation").IsOpaque = true;
            g.FindClass("CXSourceRange").IsOpaque = true;
            g.FindClass("CXCursor").IsOpaque = true;
            g.FindClass("CXType").IsOpaque = true;
            g.FindClass("CXToken").IsOpaque = true;
            g.FindClass("CXIdxLoc").IsOpaque = true;
            g.FindClass("CXTranslationUnitImpl").IsOpaque = true;
        }
Example #2
0
 public void Postprocess(LibraryHelpers g)
 {
     g.FindEnum("CompletionContext").SetFlags();
     g.FindClass("String").Name = "CXString";
     //gen.SetNameOfEnumWithName("LOG_CATEGORY", "LogCategory");
 }
Example #3
0
        /// <summary>
        /// Create an instance and get the current version of Esent.
        /// </summary>
        /// <returns>The current version of Esent.</returns>
        private uint GetVersionFromEsent()
        {
#if MANAGEDESENT_ON_WSA
            // JetGetVersion isn't available in new Windows user interface, so we'll pretend it's always Win8:
            return(8250 << 8);
#else
            // Create a unique name so that multiple threads can call this simultaneously.
            // This can happen if there are multiple AppDomains.
            string       instanceName = string.Format(CultureInfo.InvariantCulture, "GettingEsentVersion{0}", LibraryHelpers.GetCurrentManagedThreadId());
            JET_INSTANCE instance     = JET_INSTANCE.Nil;
            RuntimeHelpers.PrepareConstrainedRegions();
            try
            {
                this.JetCreateInstance(out instance, instanceName);
                this.JetSetSystemParameter(instance, JET_SESID.Nil, JET_param.Recovery, new IntPtr(0), "off");
                this.JetSetSystemParameter(instance, JET_SESID.Nil, JET_param.NoInformationEvent, new IntPtr(1), null);
                this.JetSetSystemParameter(instance, JET_SESID.Nil, JET_param.MaxTemporaryTables, new IntPtr(0), null);
                this.JetSetSystemParameter(instance, JET_SESID.Nil, JET_param.MaxCursors, new IntPtr(16), null);
                this.JetSetSystemParameter(instance, JET_SESID.Nil, JET_param.MaxOpenTables, new IntPtr(16), null);
                this.JetSetSystemParameter(instance, JET_SESID.Nil, JET_param.MaxVerPages, new IntPtr(4), null);
                this.JetSetSystemParameter(instance, JET_SESID.Nil, JET_param.MaxSessions, new IntPtr(1), null);
                this.JetInit(ref instance);

                JET_SESID sesid;
                this.JetBeginSession(instance, out sesid, string.Empty, string.Empty);
                try
                {
                    uint version;
                    this.JetGetVersion(sesid, out version);
                    return(version);
                }
                finally
                {
                    this.JetEndSession(sesid, EndSessionGrbit.None);
                }
            }
            finally
            {
                if (JET_INSTANCE.Nil != instance)
                {
                    this.JetTerm(instance);
                }
            }
#endif
        }
Example #4
0
 public void Postprocess(LibraryHelpers g)
 {
     g.FindEnum("CompletionContext").SetFlags();
     g.FindClass("String").Name = "CXString";
     //gen.SetNameOfEnumWithName("LOG_CATEGORY", "LogCategory");
 }
Example #5
0
 public override void Preprocess(Driver driver, ASTContext ctx)
 {
     LibraryHelpers.SetMethodParameterUsage(ctx, "TestMappedTypeNonConstRefParamConsumer",
                                            "ChangePassedMappedTypeNonConstRefParam", 1, ParameterUsage.InOut);
 }
Example #6
0
        protected void UploadFile(FileUpload fuBulkUpload, string _filename)
        {
            // Delay for Progress Bar
            Thread.Sleep(5000);

            #region Add Item Programmatically
            DirectoryInfo dir = null;
            string        extension, fileName = string.Empty;
            string        path      = string.Empty;
            string        tableName = string.Empty;
            string        getError  = string.Empty;
            DataSet       dataSet   = new DataSet();
            try
            {
                if (fuBulkUpload.HasFile)
                {
                    string folderName = Guid.NewGuid().ToString();

                    string        folderpath        = Server.MapPath("~/sitecore/admin/template/" + folderName + "/");
                    string[]      templatePathFiles = Directory.GetFiles(Server.MapPath("~/sitecore/admin/template/"), "*.xml", SearchOption.TopDirectoryOnly);
                    List <string> templateFiles     = new List <string>();
                    foreach (string template in templatePathFiles)
                    {
                        templateFiles.Add(Path.GetFileName(template).Substring(0, Path.GetFileName(template).LastIndexOf(".")));
                    }
                    ServerMapPath = folderpath;
                    dir           = Directory.CreateDirectory(folderpath);
                    extension     = Path.GetExtension(fuBulkUpload.FileName);
                    fileName      = fuBulkUpload.FileName.Substring(0, fuBulkUpload.FileName.LastIndexOf('.'));
                    //if (fuBulkUpload.PostedFile.ContentLength > (maxFile * 1024))
                    //    throw new Exception(string.Format("File size more than {0}MB, please upload file less than {1}MB.", maxFile, maxFile));
                    if (extension != ".csv")
                    {
                        throw new FormatException("Wrong File Format.");
                    }
                    if (_filename != fileName)
                    {
                        throw new Exception("Wrong File Upload. File Upload using filename " + _filename + ".csv or Try another File Upload..");
                    }
                    if (!templateFiles.Contains(fileName))
                    {
                        throw new Exception("Wrong File Name. No template name equals with this file name");
                    }
                    path = folderpath + fuBulkUpload.FileName;
                    fuBulkUpload.SaveAs(path);

                    Data = LibraryHelpers.ConvertCSVToTable(path);
                    UploadHelpers.MappedDataToDB(Data, folderpath.Replace(folderName, "") + "/" + fileName + ".xml", fileName);
                    getError = UploadHelpers.GetErrorMessage();

                    if (getError == "ERROR")
                    {
                        litWarningError.Text = "Database is not Updated. Please make sure the Data is Valid.";
                        Page.ClientScript.RegisterStartupScript(GetType(), "loadAlertWarning", "AlertWarningBottom()", true);
                    }
                    else
                    {
                        fuBulkUpload.Dispose();
                        Page.ClientScript.RegisterStartupScript(GetType(), "loadAlertSuccess", "AlertSuccessBottom()", true);
                    }

                    File.Delete(path);
                }
            }
            catch (FormatException fx)
            {
                litAlertError.Text = fx.Message;
                Page.ClientScript.RegisterStartupScript(GetType(), "loadAlertFailed", "AlertFailedBottom()", true);
            }
            catch (Exception ex)
            {
                litAlertError.Text = " " + ex.Message;
                Page.ClientScript.RegisterStartupScript(GetType(), "loadAlertFailed", "AlertFailedBottom()", true);
            }
            finally
            {
                if (!string.IsNullOrEmpty(path))
                {
                    File.Delete(path);
                }
                dir.Delete();
            }
            #endregion
        }