示例#1
0
        CompilerResults CompileLine(string codeStr, CHash type, string assemblyName, string className)
        {
            CompilerParameters cp = new CompilerParameters();

            if (type == CHash.Function)
            {
                cp.OutputAssembly = assemblyName;
            }
            else
            {
                cp.GenerateInMemory = true;
            }

            foreach (string r in referenceList)
            {
#if DEBUG
                if (!System.Diagnostics.Debugger.IsAttached)
                {
                    Utils.Print(r);
                }
#endif
                cp.ReferencedAssemblies.Add(r);
            }

            string exprStr = codeStr;
            returnsValue = false;
            if (type == CHash.Expression)
            {
                if (codeStr[0] != '{' && !word_within(firstToken(codeStr), keywords))
                {
                    returnsValue = true;
                    exprStr      = "V[\"_\"] = " + codeStr;
                }
            }
            CompilerResults cr = CompileTemplate(cp, exprStr, type, className);
            if (cr.Errors.HasErrors)
            {
                if (returnsValue)
                {
                    // we assumed that this expression did return a value; we were wrong.
                    // Try it again, without assignment to $_
                    returnsValue      = false;
                    cp.OutputAssembly = null;  // Reset value, which is needed for Mono to work
                    cr = CompileTemplate(cp, codeStr, CHash.Expression, "");
                    if (!cr.Errors.HasErrors)
                    {
                        return(cr);
                    }
                }
                ShowErrors(cr, codeStr);
                return(null);
            }
            else
            {
                return(cr);
            }
        }
示例#2
0
文件: UserService.cs 项目: tdav/Quote
        public async Task <viUser> AuthenticateAsync(viAuthenticateModel model)
        {
            var res = await db.tbUsers
                      .AsNoTracking()
                      .Where(x => x.Email == model.Email)
                      .FirstOrDefaultAsync();

            if (res == null || CHash.EncryptMD5(model.Password) != res.Password)
            {
                return(null);
            }

            return(GetToken(res));
        }
示例#3
0
    void ExecuteLine(string codeStr)
    {
        // at this point we either have a line to be immediately compiled and evaluated,
        // or a function definition.
        CHash  type = CHash.Expression;
        string className = null, assemblyName = null, funName = null;
        Match  funMatch = funDef.Match(codeStr);

        if (funMatch != Match.Empty)
        {
            type = CHash.Function;
        }
        if (type == CHash.Function)
        {
            funName = funMatch.Groups[1].ToString();
            macro.RemoveMacro(funName);
            className    = "Csi" + nextAssembly++;
            assemblyName = className + ".dll";
            codeStr      = codeStr.Insert(funMatch.Groups[1].Index, "_");
        }
        codeStr = macro.ProcessLine(codeStr);
        if (codeStr == "")  // may have been a prepro statement!
        {
            return;
        }
        bool wasAssignment;

        codeStr = MassageInput(codeStr, out wasAssignment);
        if (wasAssignment)
        {
            type = CHash.Assignment;
        }
        CompilerResults cr = CompileLine(codeStr.TrimStart(), type, assemblyName, className);

        if (cr != null)
        {
            Assembly ass = cr.CompiledAssembly;
            if (type != CHash.Function)
            {
                CodeChunk.Instantiate(ass, this);
            }
            else
            {
                CsiFunctionContext.Instantiate(ass, varTable, className, funName);
                string prefix = mustDeclare ? "" : "$";
                macro.AddMacro(funName, prefix + className + "._" + funName, null);
                AddReference(Path.GetFullPath(assemblyName));
            }
        }
    }
示例#4
0
    CompilerResults CompileTemplate(CompilerParameters cp, string codeStr, CHash type, string className)
    {
        if (showCode)
        {
            Utils.Print("code:", codeStr);
        }
        string finalSource = CodeChunk.Template;

        if (type == CHash.Function)
        {
            finalSource = CsiFunctionContext.Template;
        }
        finalSource = finalSource.Replace("$USES$", namespaceString);
        finalSource = finalSource.Replace("$BODY$", codeStr);
        if (type == CHash.Function)
        {
            finalSource = finalSource.Replace("$CLASS$", className);
        }
        return(compiler.CompileAssemblyFromSource(cp, finalSource));
    }
示例#5
0
文件: UserService.cs 项目: tdav/Quote
        public async Task <viUser> CreateUserAsync(viUserRegister value)
        {
            tbUser res = await db.tbUsers.AsNoTracking()
                         .FirstOrDefaultAsync(x => x.Email == value.Email);

            if (res == null)
            {
                res = new tbUser
                {
                    LastName   = value.LastName,
                    Name       = value.Name,
                    Patronymic = value.Patronymic,
                    Email      = value.Email,
                    Password   = CHash.EncryptMD5(value.Password),
                    Phone      = value.Phone,
                    CreateDate = DateTime.UtcNow,
                    CreateUser = 1,
                    Status     = 1,
                    RoleId     = 1
                };

                await db.tbUsers.AddAsync(res);

                await db.SaveChangesAsync();
            }
            else
            {
                if (res.Password != value.Password)
                {
                    return new viUser()
                           {
                               Status = 0, StatusMessage = "User already exists"
                           }
                }
                ;
            }

            return(GetToken(res));
        }
        private void Update_Output_Hashes( CHash hash )
        {
            bool modified_existing = false;
            foreach ( var manifest_entry in COutputManifest.Instance.Outputs )
            {
                if ( manifest_entry.OutputTag == Config.Tag )
                {
                    manifest_entry.Hash = hash;
                    modified_existing = true;
                    break;
                }
            }

            if ( !modified_existing )
            {
                COutputManifest.Instance.Outputs.Add( new COutputManifestEntry( Config.Tag, hash ) );
            }

            Config.Hash = hash;
        }
示例#7
0
        private void m_ThreadCompleteFile()
        {
            CHash m_EdonkeyHash;
            byte[] m_Hash;
            m_EdonkeyHash	= new CHash();

            //lock the file for read/write
            while ((m_isReadingFile) ||(m_isWritingFile))
            {
                //Debug.WriteLine("[File] Intentando entrar a ESCRIBIR BLOQUE: " + start.ToString() + "-" + end.ToString() + ". " + m_FileName);
                Thread.Sleep(500);
            }
            m_isWritingFile=true;

            m_Hash=m_EdonkeyHash.DoFileHash(m_MyFile);

            //unlock the file
            m_isWritingFile	= false;

            if (!(CKernel.SameHash(ref (byte[])m_Hash, ref (byte[])FileHash)))
            {
                FileStatus=Protocol.FileState.Ready;
                if (m_MyFile.Length>0) m_CheckCompleteChunk(0,m_FileSize-1,false,m_EdonkeyHash.HashSet);
                if (m_Gaps.Count==0)
                {
                    m_Gaps.Add((uint)0,m_FileSize-1);
                    //inicializo el hashset... para volverlo a pedir (por si ha llegado corrupto)

                    m_NumChunks=0;
                    m_ChunksStatus=new Byte[m_NumChunks];
                    for (int i=0;i!=m_ChunksStatus.Length;i++)
                    {
                        m_ChunksStatus[i]=(byte)Protocol.ChunkState.Empty;
                    }

                    m_HashSet=new ArrayList(m_NumChunks);

                    CLog.Log(Constants.Log.Notify, "Corrupted file: " + m_FileName + ". Returning to download the complete file.");
                }
                else
                {
                    CLog.Log(Constants.Log.Notify, "Corrupted file: " + m_FileName + ". Returning to download the corrupted chunks.");
                }
            }
            else
            {
                if (m_CloseFileWrite())
                {
                    //mover el fichero
                    m_FileFolder=CKernel.Preferences.GetStringArray("SharedFolders")[0]; //cojo el 1er directorio de los compartidos
                    if (!Directory.Exists(m_FileFolder))
                    {
                        Directory.CreateDirectory(m_FileFolder);
                    }

                    string filenametodisk;

                    filenametodisk = m_FileName;

                    filenametodisk = filenametodisk.Replace("|","");
                    filenametodisk = filenametodisk.Replace("\\","");
                    filenametodisk = filenametodisk.Replace("/","");
                    filenametodisk = filenametodisk.Replace(":","");
                    filenametodisk = filenametodisk.Replace("*","");
                    filenametodisk = filenametodisk.Replace("?","");
                    filenametodisk = filenametodisk.Replace("<","");
                    filenametodisk = filenametodisk.Replace(">","");

                    //
                    Regex r = new Regex(@"^con$|^prn$|(^lpt[0-9]$)|(^com[0-9]$)|(^con\.)|(^prn\.)|(^lpt[0-9]\.)|(^com[0-9]\.)",RegexOptions.IgnoreCase);
                    // Find a match in the file name.
                    Match m = r.Match(filenametodisk);
                    if (m.Success)
                    {
                        filenametodisk = "_" + filenametodisk;
                    }

                    //comprobar que la longitud de la ruta de acceso no es superior a 260 caracteres
                    if ((m_FileFolder.Length + filenametodisk.Length) >= 260)
                    {
                        int long_max = 260 - (m_FileFolder.Length +1);
                        int index = filenametodisk.LastIndexOf(".");
                        if (index > ((uint)filenametodisk.Length-(uint)long_max))
                        {
                            filenametodisk = filenametodisk.Substring(0,(int)(((uint)index-1) - ((uint)filenametodisk.Length-(uint)long_max))) + filenametodisk.Substring(index, (filenametodisk.Length-index));
                        }
                        else
                        {
                            filenametodisk=filenametodisk.Substring(0,long_max-1);
                        }
                    }

                    string newCompleteName=Path.Combine(m_FileFolder, filenametodisk);
                    int i=0;
                    while (File.Exists(newCompleteName))
                    {
                        filenametodisk=string.Concat("["+i+"] " , filenametodisk);
                        //comprobar que la longitud de la ruta de acceso no es superior a 260 caracteres
                        if ((m_FileFolder.Length + filenametodisk.Length) >= 260)
                        {
                            int long_max = 260 - (m_FileFolder.Length +1);
                            int index = filenametodisk.LastIndexOf(".");
                            if (index > ((uint)filenametodisk.Length-(uint)long_max))
                            {
                                filenametodisk = filenametodisk.Substring(0,(int)(((uint)index-1) - ((uint)filenametodisk.Length-(uint)long_max))) + filenametodisk.Substring(index, (filenametodisk.Length-index));
                            }
                            else
                            {
                                filenametodisk=filenametodisk.Substring(0,long_max-1);
                            }
                        }
                        newCompleteName=Path.Combine(m_FileFolder, filenametodisk);
                        i++;
                    }
                    FileName=filenametodisk;

                    try
                    {
                        File.Move(m_CompleteName,newCompleteName);
                        m_Completed=true;
                        m_CompleteName=newCompleteName;
                        m_FileDetails.DiskFileName=m_CompleteName;

                        m_FileDate=File.GetLastWriteTime(m_CompleteName).ToUniversalTime();

                        //llamar a la funcin de grabar el know.met (despues de poner m_Completed=true
                        CKernel.FilesList.SaveList("");

                        CKernel.FilesList.CompleteFile(CKernel.HashToString(FileHash));

                        //borrar .met
                        File.Delete(m_CompleteNameMet);
                        File.Delete(m_CompleteNameMet + ".backup");

                        //							if (File.Exists(m_CompleteNameMet))
                        //							{
                        //								Debug.WriteLine("****[File]***** CAN NOT DELETE .met: " + m_CompleteNameMet);
                        //							}
                    }
                    catch
                    {
                        CLog.Log(Constants.Log.Notify,"ERR1_COMPLETED",m_FileName);
                    }
                }
                else
                {
                    //error al cerrar el fichero
                }
            }
        }
        CompilerResults CompileLine(string codeStr, CHash type, string assemblyName, string className)
        {
            CompilerParameters cp = new CompilerParameters();
            if (type == CHash.Function)
                cp.OutputAssembly = assemblyName;
            else
                cp.GenerateInMemory = true;

            foreach (string r in referenceList)
            {
            #if DEBUG
                if (!System.Diagnostics.Debugger.IsAttached)
                    Utils.Print(r);
            #endif
                cp.ReferencedAssemblies.Add(r);
            }

            string exprStr = codeStr;
            returnsValue = false;
            if (type == CHash.Expression)
            {
                if (codeStr[0] != '{' && !word_within(firstToken(codeStr), keywords))
                {
                    returnsValue = true;
                    exprStr = "V[\"_\"] = " + codeStr;
                }
            }
            CompilerResults cr = CompileTemplate(cp, exprStr, type, className);
            if (cr.Errors.HasErrors)
            {
                if (returnsValue)
                {
                    // we assumed that this expression did return a value; we were wrong.
                    // Try it again, without assignment to $_
                    returnsValue = false;
                    cp.OutputAssembly = null;  // Reset value, which is needed for Mono to work
                    CompilerResults cr2 = CompileTemplate(cp, codeStr, CHash.Expression, "");
                    if (!cr2.Errors.HasErrors)
                        return cr2;
                    try
                    {
                        bool firstErrorIsTypeConversion = false;
                        foreach (CompilerError err in cr.Errors)
                        {
                            // Check for "Cannot implicitly convert type `void' to `object'"
                            if (string.Equals("CS0029", err.ErrorNumber, StringComparison.OrdinalIgnoreCase)
                                && (!string.IsNullOrEmpty(err.ErrorText))
                                && (err.ErrorText.IndexOf("void", 0, StringComparison.OrdinalIgnoreCase) >= 0))
                            {
                                firstErrorIsTypeConversion = true;
                                break;
                            }
                        }

                        bool secondErrorIsTooCommon = false;
                        foreach (CompilerError err in cr2.Errors)
                        {
                            // Check for "Only assignment, call, increment, decrement, and new object expressions can be used as a statement"
                            if (string.Equals("CS0201", err.ErrorNumber, StringComparison.OrdinalIgnoreCase))
                            {
                                secondErrorIsTooCommon = true;
                                break;
                            }
                        }

                        // Usually show the second error, unless it is not very
                        // informative and the first error is unlikely to have
                        // been caused by our editing of the expression string
                        if ((!secondErrorIsTooCommon) || (firstErrorIsTypeConversion))
                        {
                            cr = cr2;
                        }
                    }
                    catch
                    {
                        // Assume that most recent error is mostly appropriate
                        cr = cr2;
                    }
                }
                ShowErrors(cr, codeStr);
                return null;
            }
            else
                return cr;
        }
 private void On_Post_Load( StreamingContext context )
 {
     Hash = new CHash( RawHash );
 }
 public void Clear_Hash()
 {
     RawHash = null;
     Hash = new CHash();
 }
示例#11
0
        public static void Seed(this ModelBuilder modelBuilder)
        {
            modelBuilder.Entity <spRole>().HasData(
                new spRole
            {
                Id         = 1,
                Name       = "admin",
                UserAccess = "1,2,3",
                Status     = 1,
                CreateDate = DateTime.UtcNow,
                CreateUser = 1
            },
                new spRole
            {
                Id         = 2,
                Name       = "user",
                UserAccess = "4",
                Status     = 1,
                CreateDate = DateTime.UtcNow,
                CreateUser = 1
            });

            modelBuilder.Entity <tbUser>().HasData(
                new tbUser
            {
                Id         = 1,
                LastName   = "LastName",
                Name       = "Name",
                Patronymic = "Patronymic",
                Email      = "*****@*****.**",
                Password   = CHash.EncryptMD5("1"),
                RoleId     = 1,
                Status     = 1,
                CreateDate = DateTime.UtcNow,
                CreateUser = 1
            },
                new tbUser
            {
                Id         = 2,
                LastName   = "LastName",
                Name       = "Name",
                Patronymic = "Patronymic",
                Email      = "*****@*****.**",
                Password   = CHash.EncryptMD5("1"),
                RoleId     = 2,
                Status     = 1,
                CreateDate = DateTime.UtcNow,
                CreateUser = 1
            });

            modelBuilder.Entity <spSender>().HasData(
                new spSender
            {
                Id         = 1,
                Name       = "email",
                Status     = 1,
                CreateDate = DateTime.UtcNow,
                CreateUser = 1
            },
                new spSender
            {
                Id         = 2,
                Name       = "sms",
                Status     = 1,
                CreateDate = DateTime.UtcNow,
                CreateUser = 1
            });

            modelBuilder.Entity <spCategory>().HasData(
                new spCategory
            {
                Id         = 1,
                Name       = "Category 1",
                Status     = 1,
                CreateDate = DateTime.UtcNow,
                CreateUser = 1
            },
                new spCategory
            {
                Id         = 2,
                Name       = "Category 2",
                Status     = 1,
                CreateDate = DateTime.UtcNow,
                CreateUser = 1
            });

            modelBuilder.Entity <spAccessList>().HasData(
                new spAccessList
            {
                Id         = 1,
                Name       = "Create",
                Status     = 1,
                CreateDate = DateTime.UtcNow,
                CreateUser = 1
            },
                new spAccessList
            {
                Id         = 2,
                Name       = "Delete",
                Status     = 1,
                CreateDate = DateTime.UtcNow,
                CreateUser = 1
            },
                new spAccessList
            {
                Id         = 3,
                Name       = "Update",
                Status     = 1,
                CreateDate = DateTime.UtcNow,
                CreateUser = 1
            },
                new spAccessList
            {
                Id         = 4,
                Name       = "View",
                Status     = 1,
                CreateDate = DateTime.UtcNow,
                CreateUser = 1
            });

            modelBuilder.Entity <tbAuthor>().HasData(
                new tbAuthor
            {
                Id         = 1,
                LastName   = "Alimov",
                Name       = "Rustam",
                Patronymic = "Rustam",
                Status     = 1,
                CreateDate = DateTime.UtcNow,
                CreateUser = 1
            },
                new tbAuthor
            {
                Id         = 2,
                LastName   = "Sherali",
                Name       = "Juray",
                Patronymic = "Ozod",
                Status     = 1,
                CreateDate = DateTime.UtcNow,
                CreateUser = 1
            });

            modelBuilder.Entity <tbQuote>().HasData(
                new tbQuote
            {
                Id         = 1,
                Text       = "Text 1",
                AuthorId   = 1,
                CategoryId = 1,
                Status     = 1,
                CreateDate = DateTime.UtcNow,
                CreateUser = 1
            },
                new tbQuote
            {
                Id         = 2,
                Text       = "Text 2",
                AuthorId   = 2,
                CategoryId = 2,
                Status     = 1,
                CreateDate = DateTime.UtcNow,
                CreateUser = 1
            },
                new tbQuote
            {
                Id         = 3,
                Text       = "Text 3",
                AuthorId   = 1,
                CategoryId = 2,
                Status     = 1,
                CreateDate = DateTime.UtcNow,
                CreateUser = 1
            },
                new tbQuote
            {
                Id         = 4,
                Text       = "Text 4",
                AuthorId   = 2,
                CategoryId = 1,
                Status     = 1,
                CreateDate = DateTime.UtcNow,
                CreateUser = 1
            });

            modelBuilder.Entity <tbSubscribe>().HasData(
                new tbSubscribe
            {
                Id = 1,
                SubscribeUserId = 1,
                SenderId        = 1,
                Status          = 1,
                CreateDate      = DateTime.UtcNow,
                CreateUser      = 1
            },
                new tbSubscribe
            {
                Id = 2,
                SubscribeUserId = 2,
                SenderId        = 2,
                Status          = 1,
                CreateDate      = DateTime.UtcNow,
                CreateUser      = 1
            });
        }
示例#12
0
 public CHashResponse( EHashWorkID id, CHash hash )
 {
     ID = id;
     Hash = hash;
 }
        public bool Verify_Download_Hash( CHash hash )
        {
            if ( !Hash.Is_Valid() )
            {
                Hash = hash;
                return true;
            }

            return Hash.Equals( hash );
        }
示例#14
0
        private bool m_LoadFilesFromFolder(string folder/*,bool refreshing*/)
        {
            if (!Directory.Exists(folder)) return false;
            string [] ficheros=Directory.GetFiles(folder);
            DateTime date;
            string name;
            if (m_EdonkeyHash==null) m_EdonkeyHash=new CHash();
            foreach (string file in ficheros)
            {
                // 0 Kb file are ignored, avoid a crash
                FileInfo filInfo = new FileInfo(file);
                if((filInfo.Length == 0)||
                    ((filInfo.Attributes&(FileAttributes.Hidden|FileAttributes.System))!=0)) continue;

                date=File.GetLastWriteTime(file).ToUniversalTime();
                name=Path.GetFileName(file);
                CKnownFileAttributes Atributos;
                if ((Atributos=m_IsKnown(name,date))!=null)
                {
                    //if (refreshing) continue;
                    if (!m_Contains(Atributos.FileHash))
                    {
                    CElement Element=new CElement();
                    Element.File=new CFile(Atributos.FileHash,Atributos.Date,folder,name,Atributos.Size, Atributos.Priority, Atributos.Permisions, Atributos.HashSet, Atributos.Comment, Atributos.Rating);
                    Element.SourcesList=null;
                    Element.Statistics=new CFileStatistics();
                    this.m_FileList.Add(Element);
                    CKernel.NewSharedFile(Element);
                    }
                    //if (!m_Contains(Atributos.FileHash))this.m_FileList.Add(Element);
                }
                else //new file
                {
                    m_EdonkeyHash.AddFile(file);
                }
            }
            return true;
        }
示例#15
0
 CompilerResults CompileTemplate(CompilerParameters cp, string codeStr, CHash type, string className)
 {
     if (showCode)
         Utils.Print("code:", codeStr);
     string finalSource = CodeChunk.Template;
     if (type == CHash.Function)
         finalSource = CsiFunctionContext.Template;
     finalSource = finalSource.Replace("$USES$", namespaceString);
     finalSource = finalSource.Replace("$BODY$", codeStr);
     if (type == CHash.Function)
         finalSource = finalSource.Replace("$CLASS$", className);
     return prov.CompileAssemblyFromSource(cp, finalSource);
 }
示例#16
0
        CompilerResults CompileLine(string codeStr, CHash type, string assemblyName, string className)
        {
            CompilerParameters cp = new CompilerParameters();
            if (type == CHash.Function)
                cp.OutputAssembly = assemblyName;
            else
                cp.GenerateInMemory = true;

            foreach (string r in referenceList)
            {
#if DEBUG
                if (!System.Diagnostics.Debugger.IsAttached)
                    Utils.Print(r);
#endif
                cp.ReferencedAssemblies.Add(r);
            }

            string exprStr = codeStr;
            returnsValue = false;
            if (type == CHash.Expression)
            {
                if (codeStr[0] != '{' && !word_within(firstToken(codeStr), keywords))
                {
                    returnsValue = true;
                    exprStr = "V[\"_\"] = " + codeStr;
                }
            }
            CompilerResults cr = CompileTemplate(cp, exprStr, type, className);
            if (cr.Errors.HasErrors)
            {
                if (returnsValue)
                {
                    // we assumed that this expression did return a value; we were wrong.
                    // Try it again, without assignment to $_
                    returnsValue = false;
                    cp.OutputAssembly = null;  // Reset value, which is needed for Mono to work
                    cr = CompileTemplate(cp, codeStr, CHash.Expression, "");
                    if (!cr.Errors.HasErrors)
                        return cr;
                }
                ShowErrors(cr, codeStr);
                return null;
            }
            else
                return cr;
        }
        CompilerResults CompileLine(string codeStr, CHash type, string assemblyName, string className)
        {
            CompilerParameters cp = new CompilerParameters();

            if (type == CHash.Function)
            {
                cp.OutputAssembly = assemblyName;
            }
            else
            {
                cp.GenerateInMemory = true;
            }

            foreach (string r in referenceList)
            {
#if DEBUG
                if (!System.Diagnostics.Debugger.IsAttached)
                {
                    Utils.Print(r);
                }
#endif
                cp.ReferencedAssemblies.Add(r);
            }

            string exprStr = codeStr;
            returnsValue = false;
            if (type == CHash.Expression)
            {
                if (codeStr[0] != '{' && !word_within(firstToken(codeStr), keywords))
                {
                    returnsValue = true;
                    exprStr      = "V[\"_\"] = " + codeStr;
                }
            }
            CompilerResults cr = CompileTemplate(cp, exprStr, type, className);
            if (cr.Errors.HasErrors)
            {
                if (returnsValue)
                {
                    // we assumed that this expression did return a value; we were wrong.
                    // Try it again, without assignment to $_
                    returnsValue      = false;
                    cp.OutputAssembly = null;  // Reset value, which is needed for Mono to work
                    CompilerResults cr2 = CompileTemplate(cp, codeStr, CHash.Expression, "");
                    if (!cr2.Errors.HasErrors)
                    {
                        return(cr2);
                    }
                    try
                    {
                        bool firstErrorIsTypeConversion = false;
                        foreach (CompilerError err in cr.Errors)
                        {
                            // Check for "Cannot implicitly convert type `void' to `object'"
                            if (string.Equals("CS0029", err.ErrorNumber, StringComparison.OrdinalIgnoreCase) &&
                                (!string.IsNullOrEmpty(err.ErrorText)) &&
                                (err.ErrorText.IndexOf("void", 0, StringComparison.OrdinalIgnoreCase) >= 0))
                            {
                                firstErrorIsTypeConversion = true;
                                break;
                            }
                        }

                        bool secondErrorIsTooCommon = false;
                        foreach (CompilerError err in cr2.Errors)
                        {
                            // Check for "Only assignment, call, increment, decrement, and new object expressions can be used as a statement"
                            if (string.Equals("CS0201", err.ErrorNumber, StringComparison.OrdinalIgnoreCase))
                            {
                                secondErrorIsTooCommon = true;
                                break;
                            }
                        }

                        // Usually show the second error, unless it is not very
                        // informative and the first error is unlikely to have
                        // been caused by our editing of the expression string
                        if ((!secondErrorIsTooCommon) || (firstErrorIsTypeConversion))
                        {
                            cr = cr2;
                        }
                    }
                    catch
                    {
                        // Assume that most recent error is mostly appropriate
                        cr = cr2;
                    }
                }
                ShowErrors(cr, codeStr);
                return(null);
            }
            else
            {
                return(cr);
            }
        }
 public COutputManifestEntry( string output_tag, CHash hash )
 {
     OutputTag = output_tag;
     Clear_Hash();
     Hash = hash;
 }
 public CCopyAndHashWorker( string output_source, string output_destination )
 {
     CumulativeHash = new CHash();
     OutputSource = output_source;
     OutputDestination = output_destination;
 }